aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-12-07 18:47:08 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-08 20:19:26 -0500
commit15b1c0e822f578306332d4f4c449250db5c5dceb (patch)
treec577cadd3edb7a9915501f1bcb4be086961bb316
parente8cc49bb0fdb9e18a99e6780073d1400ba2b0d1f (diff)
[AX.25]: Fix default address and broadcast address initialization.
Only the callsign but not the SSID part of an AX.25 address is ASCII based but Linux by initializes the SSID which should be just a 4-bit number from ASCII anyway. Fix that and convert the code to use a shared constant for both default addresses. While at it, use the same style for null_ax25_address also. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/hamradio/6pack.c9
-rw-r--r--drivers/net/hamradio/baycom_epp.c10
-rw-r--r--drivers/net/hamradio/bpqether.c9
-rw-r--r--drivers/net/hamradio/dmascc.c10
-rw-r--r--drivers/net/hamradio/hdlcdrv.c16
-rw-r--r--drivers/net/hamradio/mkiss.c9
-rw-r--r--drivers/net/hamradio/scc.c9
-rw-r--r--drivers/net/hamradio/yam.c9
-rw-r--r--include/net/ax25.h6
-rw-r--r--net/ax25/ax25_addr.c15
10 files changed, 31 insertions, 71 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 92420f007b97..760d04a671f9 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -325,11 +325,6 @@ static int sp_rebuild_header(struct sk_buff *skb)
325 325
326static void sp_setup(struct net_device *dev) 326static void sp_setup(struct net_device *dev)
327{ 327{
328 static char ax25_bcast[AX25_ADDR_LEN] =
329 {'Q'<<1,'S'<<1,'T'<<1,' '<<1,' '<<1,' '<<1,'0'<<1};
330 static char ax25_test[AX25_ADDR_LEN] =
331 {'L'<<1,'I'<<1,'N'<<1,'U'<<1,'X'<<1,' '<<1,'1'<<1};
332
333 /* Finish setting up the DEVICE info. */ 328 /* Finish setting up the DEVICE info. */
334 dev->mtu = SIXP_MTU; 329 dev->mtu = SIXP_MTU;
335 dev->hard_start_xmit = sp_xmit; 330 dev->hard_start_xmit = sp_xmit;
@@ -347,8 +342,8 @@ static void sp_setup(struct net_device *dev)
347 dev->tx_timeout = NULL; 342 dev->tx_timeout = NULL;
348 343
349 /* Only activated in AX.25 mode */ 344 /* Only activated in AX.25 mode */
350 memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); 345 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
351 memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN); 346 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
352 347
353 SET_MODULE_OWNER(dev); 348 SET_MODULE_OWNER(dev);
354 349
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 3c33d6f6a6a6..8a83db0fb3b7 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -1141,12 +1141,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1141 */ 1141 */
1142static void baycom_probe(struct net_device *dev) 1142static void baycom_probe(struct net_device *dev)
1143{ 1143{
1144 static char ax25_bcast[AX25_ADDR_LEN] = {
1145 'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1
1146 };
1147 static char ax25_nocall[AX25_ADDR_LEN] = {
1148 'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1
1149 };
1150 const struct hdlcdrv_channel_params dflt_ch_params = { 1144 const struct hdlcdrv_channel_params dflt_ch_params = {
1151 20, 2, 10, 40, 0 1145 20, 2, 10, 40, 0
1152 }; 1146 };
@@ -1182,8 +1176,8 @@ static void baycom_probe(struct net_device *dev)
1182 dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN; 1176 dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
1183 dev->mtu = AX25_DEF_PACLEN; /* eth_mtu is the default */ 1177 dev->mtu = AX25_DEF_PACLEN; /* eth_mtu is the default */
1184 dev->addr_len = AX25_ADDR_LEN; /* sizeof an ax.25 address */ 1178 dev->addr_len = AX25_ADDR_LEN; /* sizeof an ax.25 address */
1185 memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); 1179 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
1186 memcpy(dev->dev_addr, ax25_nocall, AX25_ADDR_LEN); 1180 memcpy(dev->dev_addr, &ax25_nocall, AX25_ADDR_LEN);
1187 dev->tx_queue_len = 16; 1181 dev->tx_queue_len = 16;
1188 1182
1189 /* New style flags */ 1183 /* New style flags */
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 889f338132fa..5b788d84011f 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -88,11 +88,6 @@
88 88
89static char banner[] __initdata = KERN_INFO "AX.25: bpqether driver version 004\n"; 89static char banner[] __initdata = KERN_INFO "AX.25: bpqether driver version 004\n";
90 90
91static unsigned char ax25_bcast[AX25_ADDR_LEN] =
92 {'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1};
93static unsigned char ax25_defaddr[AX25_ADDR_LEN] =
94 {'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1};
95
96static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; 91static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
97 92
98static char bpq_eth_addr[6]; 93static char bpq_eth_addr[6];
@@ -487,8 +482,8 @@ static void bpq_setup(struct net_device *dev)
487 dev->do_ioctl = bpq_ioctl; 482 dev->do_ioctl = bpq_ioctl;
488 dev->destructor = free_netdev; 483 dev->destructor = free_netdev;
489 484
490 memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); 485 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
491 memcpy(dev->dev_addr, ax25_defaddr, AX25_ADDR_LEN); 486 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
492 487
493 dev->flags = 0; 488 dev->flags = 0;
494 489
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index e6e721aff6f6..0fbb414b5a4d 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -264,12 +264,6 @@ static int io[MAX_NUM_DEVS] __initdata = { 0, };
264 264
265/* Beware! hw[] is also used in cleanup_module(). */ 265/* Beware! hw[] is also used in cleanup_module(). */
266static struct scc_hardware hw[NUM_TYPES] __initdata_or_module = HARDWARE; 266static struct scc_hardware hw[NUM_TYPES] __initdata_or_module = HARDWARE;
267static char ax25_broadcast[7] __initdata =
268 { 'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1,
269'0' << 1 };
270static char ax25_test[7] __initdata =
271 { 'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1,
272'1' << 1 };
273 267
274 268
275/* Global variables */ 269/* Global variables */
@@ -443,8 +437,8 @@ static void __init dev_setup(struct net_device *dev)
443 dev->mtu = 1500; 437 dev->mtu = 1500;
444 dev->addr_len = AX25_ADDR_LEN; 438 dev->addr_len = AX25_ADDR_LEN;
445 dev->tx_queue_len = 64; 439 dev->tx_queue_len = 64;
446 memcpy(dev->broadcast, ax25_broadcast, AX25_ADDR_LEN); 440 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
447 memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN); 441 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
448} 442}
449 443
450static int __init setup_adapter(int card_base, int type, int n) 444static int __init setup_adapter(int card_base, int type, int n)
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index dacc7687b97f..452873e7c68f 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -63,18 +63,6 @@
63 63
64/* --------------------------------------------------------------------- */ 64/* --------------------------------------------------------------------- */
65 65
66/*
67 * The name of the card. Is used for messages and in the requests for
68 * io regions, irqs and dma channels
69 */
70
71static char ax25_bcast[AX25_ADDR_LEN] =
72{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1};
73static char ax25_nocall[AX25_ADDR_LEN] =
74{'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1};
75
76/* --------------------------------------------------------------------- */
77
78#define KISS_VERBOSE 66#define KISS_VERBOSE
79 67
80/* --------------------------------------------------------------------- */ 68/* --------------------------------------------------------------------- */
@@ -709,8 +697,8 @@ static void hdlcdrv_setup(struct net_device *dev)
709 dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN; 697 dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
710 dev->mtu = AX25_DEF_PACLEN; /* eth_mtu is the default */ 698 dev->mtu = AX25_DEF_PACLEN; /* eth_mtu is the default */
711 dev->addr_len = AX25_ADDR_LEN; /* sizeof an ax.25 address */ 699 dev->addr_len = AX25_ADDR_LEN; /* sizeof an ax.25 address */
712 memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); 700 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
713 memcpy(dev->dev_addr, ax25_nocall, AX25_ADDR_LEN); 701 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
714 dev->tx_queue_len = 16; 702 dev->tx_queue_len = 16;
715} 703}
716 704
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index d8715b200c17..d08fbc396648 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -672,11 +672,6 @@ static struct net_device_stats *ax_get_stats(struct net_device *dev)
672 672
673static void ax_setup(struct net_device *dev) 673static void ax_setup(struct net_device *dev)
674{ 674{
675 static char ax25_bcast[AX25_ADDR_LEN] =
676 {'Q'<<1,'S'<<1,'T'<<1,' '<<1,' '<<1,' '<<1,'0'<<1};
677 static char ax25_test[AX25_ADDR_LEN] =
678 {'L'<<1,'I'<<1,'N'<<1,'U'<<1,'X'<<1,' '<<1,'1'<<1};
679
680 /* Finish setting up the DEVICE info. */ 675 /* Finish setting up the DEVICE info. */
681 dev->mtu = AX_MTU; 676 dev->mtu = AX_MTU;
682 dev->hard_start_xmit = ax_xmit; 677 dev->hard_start_xmit = ax_xmit;
@@ -691,8 +686,8 @@ static void ax_setup(struct net_device *dev)
691 dev->hard_header = ax_header; 686 dev->hard_header = ax_header;
692 dev->rebuild_header = ax_rebuild_header; 687 dev->rebuild_header = ax_rebuild_header;
693 688
694 memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); 689 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
695 memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN); 690 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
696 691
697 dev->flags = IFF_BROADCAST | IFF_MULTICAST; 692 dev->flags = IFF_BROADCAST | IFF_MULTICAST;
698} 693}
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index ec9b6d9b6f05..2ce047e9d262 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1540,11 +1540,6 @@ static int scc_net_alloc(const char *name, struct scc_channel *scc)
1540/* * Network driver methods * */ 1540/* * Network driver methods * */
1541/* ******************************************************************** */ 1541/* ******************************************************************** */
1542 1542
1543static unsigned char ax25_bcast[AX25_ADDR_LEN] =
1544{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1};
1545static unsigned char ax25_nocall[AX25_ADDR_LEN] =
1546{'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1};
1547
1548/* ----> Initialize device <----- */ 1543/* ----> Initialize device <----- */
1549 1544
1550static void scc_net_setup(struct net_device *dev) 1545static void scc_net_setup(struct net_device *dev)
@@ -1562,8 +1557,8 @@ static void scc_net_setup(struct net_device *dev)
1562 dev->do_ioctl = scc_net_ioctl; 1557 dev->do_ioctl = scc_net_ioctl;
1563 dev->tx_timeout = NULL; 1558 dev->tx_timeout = NULL;
1564 1559
1565 memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); 1560 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
1566 memcpy(dev->dev_addr, ax25_nocall, AX25_ADDR_LEN); 1561 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
1567 1562
1568 dev->flags = 0; 1563 dev->flags = 0;
1569 1564
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 3c4455bd466d..6d74f08720d5 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -156,11 +156,6 @@ static struct net_device *yam_devs[NR_PORTS];
156 156
157static struct yam_mcs *yam_data; 157static struct yam_mcs *yam_data;
158 158
159static char ax25_bcast[7] =
160{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1};
161static char ax25_test[7] =
162{'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1};
163
164static DEFINE_TIMER(yam_timer, NULL, 0, 0); 159static DEFINE_TIMER(yam_timer, NULL, 0, 0);
165 160
166/* --------------------------------------------------------------------- */ 161/* --------------------------------------------------------------------- */
@@ -1115,8 +1110,8 @@ static void yam_setup(struct net_device *dev)
1115 dev->hard_header_len = AX25_MAX_HEADER_LEN; 1110 dev->hard_header_len = AX25_MAX_HEADER_LEN;
1116 dev->mtu = AX25_MTU; 1111 dev->mtu = AX25_MTU;
1117 dev->addr_len = AX25_ADDR_LEN; 1112 dev->addr_len = AX25_ADDR_LEN;
1118 memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); 1113 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
1119 memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN); 1114 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
1120} 1115}
1121 1116
1122static int __init yam_init_driver(void) 1117static int __init yam_init_driver(void)
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 41acb093caae..e1d116f11923 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -282,9 +282,9 @@ extern void ax25_fillin_cb(ax25_cb *, ax25_dev *);
282extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *); 282extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *);
283 283
284/* ax25_addr.c */ 284/* ax25_addr.c */
285extern ax25_address null_ax25_address; 285extern const ax25_address ax25_bcast;
286extern char *ax2asc(char *buf, const ax25_address *); 286extern const ax25_address ax25_defaddr;
287extern void asc2ax(ax25_address *addr, const char *callsign); 287extern const ax25_address null_ax25_address;
288extern int ax25cmp(const ax25_address *, const ax25_address *); 288extern int ax25cmp(const ax25_address *, const ax25_address *);
289extern int ax25digicmp(const ax25_digi *, const ax25_digi *); 289extern int ax25digicmp(const ax25_digi *, const ax25_digi *);
290extern const unsigned char *ax25_addr_parse(const unsigned char *, int, 290extern const unsigned char *ax25_addr_parse(const unsigned char *, int,
diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c
index 5524f9cb7b83..21a0616152fc 100644
--- a/net/ax25/ax25_addr.c
+++ b/net/ax25/ax25_addr.c
@@ -29,11 +29,20 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30 30
31/* 31/*
32 * The null address is defined as a callsign of all spaces with an 32 * The default broadcast address of an interface is QST-0; the default address
33 * SSID of zero. 33 * is LINUX-1. The null address is defined as a callsign of all spaces with
34 * an SSID of zero.
34 */ 35 */
35ax25_address null_ax25_address = {{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}};
36 36
37const ax25_address ax25_bcast =
38 {{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, 0 << 1}};
39const ax25_address ax25_defaddr =
40 {{'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, 1 << 1}};
41const ax25_address null_ax25_address =
42 {{' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, 0 << 1}};
43
44EXPORT_SYMBOL_GPL(ax25_bcast);
45EXPORT_SYMBOL_GPL(ax25_defaddr);
37EXPORT_SYMBOL(null_ax25_address); 46EXPORT_SYMBOL(null_ax25_address);
38 47
39/* 48/*