patch-2.0.35 linux/net/netrom/nr_dev.c

Next file: linux/net/netrom/nr_in.c
Previous file: linux/net/netrom/af_netrom.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.34/linux/net/netrom/nr_dev.c linux/net/netrom/nr_dev.c
@@ -1,8 +1,5 @@
 /*
- *	NET/ROM release 003
- *
- *	This is ALPHA test software. This code may break your machine, randomly fail to work with new 
- *	releases, misbehave and/or generally screw up. It might even work. 
+ *	NET/ROM release 006
  *
  *	This code REQUIRES 1.3.0 or higher/ NET3.029
  *
@@ -17,10 +14,12 @@
  *	NET/ROM 002	Steve Whitehouse(GW7RRM) fixed the set_mac_address
  *	NET/ROM 003	Jonathan(G4KLX)	Put nr_rebuild_header into line with
  *					ax25_rebuild_header
+ *	NET/ROM 004	Jonathan(G4KLX)	Callsign registration with AX.25.
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_NETROM
+#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
+#include <linux/proc_fs.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/interrupt.h>
@@ -80,19 +79,19 @@
 	unsigned char *buff = skb_push(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
 
 	memcpy(buff, (saddr != NULL) ? saddr : dev->dev_addr, dev->addr_len);
-	buff[6] &= ~LAPB_C;
-	buff[6] &= ~LAPB_E;
-	buff[6] |= SSSID_SPARE;
+	buff[6] &= ~AX25_CBIT;
+	buff[6] &= ~AX25_EBIT;
+	buff[6] |= AX25_SSSID_SPARE;
 	buff    += AX25_ADDR_LEN;
 
 	if (daddr != NULL)
 		memcpy(buff, daddr, dev->addr_len);
-	buff[6] &= ~LAPB_C;
-	buff[6] |= LAPB_E;
-	buff[6] |= SSSID_SPARE;
+	buff[6] &= ~AX25_CBIT;
+	buff[6] |= AX25_EBIT;
+	buff[6] |= AX25_SSSID_SPARE;
 	buff    += AX25_ADDR_LEN;
 
-	*buff++ = nr_default.ttl;
+	*buff++ = sysctl_netrom_network_ttl_initialiser;
 
 	*buff++ = NR_PROTO_IP;
 	*buff++ = NR_PROTO_IP;
@@ -102,8 +101,8 @@
 
 	if (daddr != NULL)
 		return 37;
-	
-	return -37;	
+
+	return -37;
 }
 
 static int nr_rebuild_header(void *buff, struct device *dev,
@@ -118,14 +117,14 @@
 		return 1;
 	}
 
-	bp[6] &= ~LAPB_C;
-	bp[6] &= ~LAPB_E;
-	bp[6] |= SSSID_SPARE;
+	bp[6] &= ~AX25_CBIT;
+	bp[6] &= ~AX25_EBIT;
+	bp[6] |= AX25_SSSID_SPARE;
 	bp    += AX25_ADDR_LEN;
-	
-	bp[6] &= ~LAPB_C;
-	bp[6] |= LAPB_E;
-	bp[6] |= SSSID_SPARE;
+
+	bp[6] &= ~AX25_CBIT;
+	bp[6] |= AX25_EBIT;
+	bp[6] |= AX25_SSSID_SPARE;
 
 	if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
 		dev_kfree_skb(skb, FREE_WRITE);
@@ -151,9 +150,14 @@
 
 static int nr_set_mac_address(struct device *dev, void *addr)
 {
-	struct sockaddr *sa=addr;
+	struct sockaddr *sa = addr;
+
+	ax25_listen_release((ax25_address *)dev->dev_addr, NULL);
+
 	memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
 
+	ax25_listen_register((ax25_address *)dev->dev_addr, NULL);
+
 	return 0;
 }
 
@@ -162,6 +166,8 @@
 	dev->tbusy = 0;
 	dev->start = 1;
 
+	ax25_listen_register((ax25_address *)dev->dev_addr, NULL);
+
 	return 0;
 }
 
@@ -170,6 +176,8 @@
 	dev->tbusy = 1;
 	dev->start = 0;
 
+	ax25_listen_release((ax25_address *)dev->dev_addr, NULL);
+
 	return 0;
 }
 
@@ -217,7 +225,7 @@
 {
 	int i;
 
-	dev->mtu		= 236;		/* MTU			*/
+	dev->mtu		= NR_MAX_PACKET_SIZE;
 	dev->tbusy		= 0;
 	dev->hard_start_xmit	= nr_xmit;
 	dev->open		= nr_open;
@@ -234,13 +242,14 @@
 	dev->flags		= 0;
 	dev->family		= AF_INET;
 
-	dev->pa_addr		= 0;
-	dev->pa_brdaddr		= 0;
-	dev->pa_mask		= 0;
-	dev->pa_alen		= sizeof(unsigned long);
+#ifdef CONFIG_INET
+	dev->pa_addr		= in_aton("192.168.0.1");
+	dev->pa_brdaddr		= in_aton("192.168.0.255");
+	dev->pa_mask		= in_aton("255.255.255.0");
+	dev->pa_alen		= 4;
+#endif
 
-	dev->priv = kmalloc(sizeof(struct enet_statistics), GFP_KERNEL);
-	if (dev->priv == NULL)
+	if ((dev->priv = kmalloc(sizeof(struct enet_statistics), GFP_KERNEL)) == NULL)
 		return -ENOMEM;
 
 	memset(dev->priv, 0, sizeof(struct enet_statistics));

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov