Skip to contentSkip to conversation

/net/ax25/: some cleanups

PATCH Applied Adrian Bunk 3 participants 5 messages Dec 12, 2004 – Dec 28, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /net/ax25/: some cleanups

The patch below contains the following cleanups:
- make two needlessly global functions static
- net/ax25/ax25_addr.c: remove the unused global function ax25digicmp

diffstat output:

 include/net/ax25.h      |    3 ---
 net/ax25/af_ax25.c      |    2 +-
 net/ax25/ax25_addr.c    |   20 --------------------
 net/ax25/ax25_ds_subr.c |    2 +-
 4 files changed, 2 insertions(+), 25 deletions(-)
include/net/ax25.h renamed from include/net/ax25.h.old +0 -3
@@ -231,7 +231,6 @@
 extern void ax25_destroy_socket(ax25_cb *);
 extern ax25_cb *ax25_create_cb(void);
 extern void ax25_fillin_cb(ax25_cb *, ax25_dev *);
-extern int  ax25_create(struct socket *, int);
 extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *);
 
 /* ax25_addr.c */
@@ -239,7 +238,6 @@
 extern char *ax2asc(ax25_address *);
 extern ax25_address *asc2ax(char *);
 extern int  ax25cmp(ax25_address *, ax25_address *);
-extern int  ax25digicmp(ax25_digi *, ax25_digi *);
 extern unsigned char *ax25_addr_parse(unsigned char *, int, ax25_address *, ax25_address *, ax25_digi *, int *, int *);
 extern int  ax25_addr_build(unsigned char *, ax25_address *, ax25_address *, ax25_digi *, int, int);
 extern int  ax25_addr_size(ax25_digi *);
@@ -268,7 +266,6 @@
 extern void ax25_ds_nr_error_recovery(ax25_cb *);
 extern void ax25_ds_enquiry_response(ax25_cb *);
 extern void ax25_ds_establish_data_link(ax25_cb *);
-extern void ax25_dev_dama_on(ax25_dev *);
 extern void ax25_dev_dama_off(ax25_dev *);
 extern void ax25_dama_on(ax25_cb *);
 extern void ax25_dama_off(ax25_cb *);
net/ax25/af_ax25.c renamed from net/ax25/af_ax25.c.old +1 -1
@@ -755,7 +755,7 @@
 	return res;
 }
 
-int ax25_create(struct socket *sock, int protocol)
+static int ax25_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
 	ax25_cb *ax25;
net/ax25/ax25_addr.c renamed from net/ax25/ax25_addr.c.old +0 -20
@@ -121,26 +121,6 @@
 }
 
 /*
- *	Compare two AX.25 digipeater paths.
- */
-int ax25digicmp(ax25_digi *digi1, ax25_digi *digi2)
-{
-	int i;
-
-	if (digi1->ndigi != digi2->ndigi)
-		return 1;
-
-	if (digi1->lastrepeat != digi2->lastrepeat)
-		return 1;
-
-	for (i = 0; i < digi1->ndigi; i++)
-		if (ax25cmp(&digi1->calls[i], &digi2->calls[i]) != 0)
-			return 1;
-
-	return 0;
-}
-
-/*
  *	Given an AX.25 address pull of to, from, digi list, command/response and the start of data
  *
  */
net/ax25/ax25_ds_subr.c renamed from net/ax25/ax25_ds_subr.c.old +1 -1
@@ -174,7 +174,7 @@
 	return res;
 }
 
-void ax25_dev_dama_on(ax25_dev *ax25_dev)
+static void ax25_dev_dama_on(ax25_dev *ax25_dev)
 {
 	if (ax25_dev == NULL)
 		return;
maintainer Applied
#1 lore raw
Quoted 3 lines · On Sun, 12 Dec 2004 22:13:39 +0100 Adrian Bunk <[email protected]> wrote:

The patch below contains the following cleanups:
- make two needlessly global functions static
- net/ax25/ax25_addr.c: remove the unused global function ax25digicmp

Applied, thanks Adrian.

#2 lore raw
Quoted 6 lines · David S. Miller
Quoted 3 lines · On Sun, 12 Dec 2004 22:13:39 +0100 Adrian Bunk <[email protected]> wrote:

The patch below contains the following cleanups:
- make two needlessly global functions static
- net/ax25/ax25_addr.c: remove the unused global function ax25digicmp

Dave this function is only unused because a patch in 2.6.10 broke AX.25 protocol support by removing the device and path checks. AX.25 is a link layer protocol it is supposed to check the devices and arguably the path.

maintainer
#3 lore raw
Quoted 4 lines · On Tue, 28 Dec 2004 14:27:08 +0000 Alan Cox <[email protected]> wrote:
Quoted 3 lines · David S. Miller

On Sun, 12 Dec 2004 22:13:39 +0100
Adrian Bunk <[email protected]> wrote:

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

The patch below contains the following cleanups:
- make two needlessly global functions static
- net/ax25/ax25_addr.c: remove the unused global function ax25digicmp

Dave this function is only unused because a patch in 2.6.10 broke AX.25 protocol support by removing the device and path checks. AX.25 is a link layer protocol it is supposed to check the devices and arguably the path.

Send a patch to netdev and CC: me to fix this as is standard procedure for getting changes into the networking. :-)

#4 lore raw
Quoted 2 lines · David S. Miller

Send a patch to netdev and CC: me to fix this as is standard procedure for getting changes into the networking. :-)

Attached - revert to 2.6.9 behaviour.

I suspect given that someone made the change for a reason that there should probably be a sysctl to switch between AX.25 (as 2.6.9) and "kind of routed AX.25-ish" (as 2.6.10).

ax25/af_ax25.c renamed from linux.vanilla-2.6.10/net/ax25/af_ax25.c +10 -2
@@ -207,8 +207,16 @@
 			continue;
 		if (s->ax25_dev == NULL)
 			continue;
-		if (ax25cmp(&s->source_addr, src_addr) == 0 &&
-		    ax25cmp(&s->dest_addr, dest_addr) == 0) {
+		if (ax25cmp(&s->source_addr, src_addr) == 0 && ax25cmp(&s->dest_addr, dest_addr) == 0 && s->ax25_dev->dev == dev) {
+			if (digi != NULL && digi->ndigi != 0) {
+				if (s->digipeat == NULL)
+					continue;
+				if (ax25digicmp(s->digipeat, digi) != 0)
+					continue;
+			} else {
+				if (s->digipeat != NULL && s->digipeat->ndigi != 0)
+					continue;
+			}
 			ax25_cb_hold(s);
 			spin_unlock_bh(&ax25_list_lock);