netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] appletalk: Fix atalk_proc_init return path
@ 2020-07-22 11:37 Vincent Duvert
  2020-07-22 11:37 ` [PATCH 2/2] appletalk: Improve handling of broadcast packets Vincent Duvert
  2020-07-23  0:30 ` [PATCH 1/2] appletalk: Fix atalk_proc_init return path David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Vincent Duvert @ 2020-07-22 11:37 UTC (permalink / raw)
  To: netdev; +Cc: Vincent Duvert

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 <vincent.ldev@duvert.net>
---
 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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] appletalk: Improve handling of broadcast packets
  2020-07-22 11:37 [PATCH 1/2] appletalk: Fix atalk_proc_init return path Vincent Duvert
@ 2020-07-22 11:37 ` Vincent Duvert
  2020-07-23  0:31   ` David Miller
  2020-07-23  0:30 ` [PATCH 1/2] appletalk: Fix atalk_proc_init return path David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Vincent Duvert @ 2020-07-22 11:37 UTC (permalink / raw)
  To: netdev; +Cc: Vincent Duvert

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 <vincent.ldev@duvert.net>
---
 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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] appletalk: Fix atalk_proc_init return path
  2020-07-22 11:37 [PATCH 1/2] appletalk: Fix atalk_proc_init return path Vincent Duvert
  2020-07-22 11:37 ` [PATCH 2/2] appletalk: Improve handling of broadcast packets Vincent Duvert
@ 2020-07-23  0:30 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2020-07-23  0:30 UTC (permalink / raw)
  To: vincent.ldev; +Cc: netdev

From: Vincent Duvert <vincent.ldev@duvert.net>
Date: Wed, 22 Jul 2020 13:37:51 +0200

> 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 <vincent.ldev@duvert.net>

Need an appropriate "Fixes: " tag here, if the module hasn't loaded
it means nobody has been using it at all.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] appletalk: Improve handling of broadcast packets
  2020-07-22 11:37 ` [PATCH 2/2] appletalk: Improve handling of broadcast packets Vincent Duvert
@ 2020-07-23  0:31   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-07-23  0:31 UTC (permalink / raw)
  To: vincent.ldev; +Cc: netdev

From: Vincent Duvert <vincent.ldev@duvert.net>
Date: Wed, 22 Jul 2020 13:37:52 +0200

> @@ -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) {

Please use reverse christmas tree ordering for local variables.

Also, please post the next revision of this patch series with
a proper "[PATCH net 0/N]" header posting, explaining what the
patch series is doing, how it is doing it, and why it is
doing it this way.

Your Subject lines should all also indicate the proper target GIT tree
your changes are for.  This is indicated in the "[]" bracket area,
as either 'net' or 'net-next', f.e. "[PATCH net 1/2] ..."

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-23  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 11:37 [PATCH 1/2] appletalk: Fix atalk_proc_init return path Vincent Duvert
2020-07-22 11:37 ` [PATCH 2/2] appletalk: Improve handling of broadcast packets Vincent Duvert
2020-07-23  0:31   ` David Miller
2020-07-23  0:30 ` [PATCH 1/2] appletalk: Fix atalk_proc_init return path David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).