From patchwork Wed Jul 22 11:37:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Duvert X-Patchwork-Id: 1333845 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=duvert.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=duvert.net header.i=@duvert.net header.a=rsa-sha256 header.s=vinduvmail header.b=D/Bm0NiE; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BBYYR48JLz9sSy for ; Wed, 22 Jul 2020 21:45:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730661AbgGVLpN (ORCPT ); Wed, 22 Jul 2020 07:45:13 -0400 Received: from vinduvvm.duvert.net ([91.224.149.70]:44326 "EHLO vinduvvm.duvert.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbgGVLpM (ORCPT ); Wed, 22 Jul 2020 07:45:12 -0400 X-Greylist: delayed 410 seconds by postgrey-1.27 at vger.kernel.org; Wed, 22 Jul 2020 07:45:11 EDT Received: from home.duvert.net (152.60.68.91.rev.sfr.net [91.68.60.152]) by vinduvvm.duvert.net (Postfix) with ESMTPSA id DB11672FAD for ; Wed, 22 Jul 2020 13:38:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=duvert.net; s=vinduvmail; t=1595417899; bh=vkAb9Z8GrA+OxmouJVHm0egJVQWG/TaYqNa+WfCPY74=; h=From:To:Cc:Subject:Date:From; b=D/Bm0NiEsSYW4v76G6/2zfwtMp7FTigK7AXaxuACHPzYgn6oF4Ef/XRjUyhHsE7sr 93/4z+Zh8z2ibAvjv+hycaVhvydHtT2WrC2D7iEFymcqckhPkrF2VhupCehFNKbzTM xVd/GxXHZVm9/c/DxYon6m6ydARqzN1wpQ35AoU4= Received: from vincent (uid 1000) (envelope-from vincent@home.duvert.net) id 91e20 by home.duvert.net (DragonFly Mail Agent v0.11); Wed, 22 Jul 2020 13:38:19 +0200 From: Vincent Duvert To: netdev@vger.kernel.org Cc: Vincent Duvert Subject: [PATCH 1/2] appletalk: Fix atalk_proc_init return path Date: Wed, 22 Jul 2020 13:37:51 +0200 Message-Id: <20200722113752.1218-1-vincent.ldev@duvert.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add a missing return statement to atalk_proc_init so it doesn't return -ENOMEM when successful. This allows the appletalk module to load properly. Signed-off-by: Vincent Duvert --- net/appletalk/atalk_proc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index 550c6ca007cc..9c1241292d1d 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c @@ -229,6 +229,8 @@ int __init atalk_proc_init(void) sizeof(struct aarp_iter_state), NULL)) goto out; + return 0; + out: remove_proc_subtree("atalk", init_net.proc_net); return -ENOMEM; From patchwork Wed Jul 22 11:37:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Duvert X-Patchwork-Id: 1333844 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=duvert.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=duvert.net header.i=@duvert.net header.a=rsa-sha256 header.s=vinduvmail header.b=IJxUxS9m; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BBYYP4LNdz9sSn for ; Wed, 22 Jul 2020 21:45:13 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728642AbgGVLpL (ORCPT ); Wed, 22 Jul 2020 07:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726503AbgGVLpL (ORCPT ); Wed, 22 Jul 2020 07:45:11 -0400 X-Greylist: delayed 408 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 22 Jul 2020 04:45:11 PDT Received: from vinduvvm.duvert.net (vinduvvm.duvert.net [IPv6:2a03:7220:8081:4600::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50C69C0619DC for ; Wed, 22 Jul 2020 04:45:11 -0700 (PDT) Received: from home.duvert.net (152.60.68.91.rev.sfr.net [91.68.60.152]) by vinduvvm.duvert.net (Postfix) with ESMTPSA id EC50E76CDE for ; Wed, 22 Jul 2020 13:38:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=duvert.net; s=vinduvmail; t=1595417900; bh=YjLjrjqXm+3LF4qfaMTlT2v/xMZrLH+jzUJ4c13ZkYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJxUxS9m1iTt/BDOotKgMZVhBr2wjvD6Y11ubLuN6/ZDIA9ea2kHirtJQMayskdWL tKjWfeFrgJmkPsvSckSS6sFRnmeInaHNp9BJhwxoEEOuSZuDFwtFVaEfF3sqnhlsYV uPK32gk46i03Ib8A8RHX+cmFGT3DEwfSzDQ96yEY= Received: from vincent (uid 1000) (envelope-from vincent@home.duvert.net) id 91e23 by home.duvert.net (DragonFly Mail Agent v0.11); Wed, 22 Jul 2020 13:38:19 +0200 From: Vincent Duvert To: netdev@vger.kernel.org Cc: Vincent Duvert Subject: [PATCH 2/2] appletalk: Improve handling of broadcast packets Date: Wed, 22 Jul 2020 13:37:52 +0200 Message-Id: <20200722113752.1218-2-vincent.ldev@duvert.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200722113752.1218-1-vincent.ldev@duvert.net> References: <20200722113752.1218-1-vincent.ldev@duvert.net> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When a broadcast AppleTalk packet is received, prefer queuing it on the socket whose address matches the address of the interface that received the packet (and is listening on the correct port). Userspace applications that handle such packets will usually send a response on the same socket that received the packet; this fix allows the response to be sent on the correct interface. If a socket matching the interface's address is not found, an arbitrary socket listening on the correct port will be used, if any. This matches the implementation's previous behavior. Fixes atalkd's responses to network information requests when multiple network interfaces are configured to use AppleTalk. Signed-off-by: Vincent Duvert --- net/appletalk/ddp.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 15787e8c0629..9d19cd03076f 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -89,6 +89,7 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, struct atalk_iface *atif) { struct sock *s; + struct sock *def_socket = NULL; read_lock_bh(&atalk_sockets_lock); sk_for_each(s, &atalk_sockets) { @@ -98,8 +99,20 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, continue; if (to->sat_addr.s_net == ATADDR_ANYNET && - to->sat_addr.s_node == ATADDR_BCAST) - goto found; + to->sat_addr.s_node == ATADDR_BCAST) { + if (atif->address.s_node == at->src_node && + atif->address.s_net == at->src_net) { + /* This socket's address matches the address of the interface + * that received the packet -- use it + */ + goto found; + } + + /* Continue searching for a socket matching the interface address, + * but use this socket by default if no other one is found + */ + def_socket = s; + } if (to->sat_addr.s_net == at->src_net && (to->sat_addr.s_node == at->src_node || @@ -116,7 +129,7 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, goto found; } } - s = NULL; + s = def_socket; found: read_unlock_bh(&atalk_sockets_lock); return s;