Commit 2a2ff7fc authored by Jeroen Vreeken's avatar Jeroen Vreeken Committed by David S. Miller

[NETROM]: Better control over the AX25 devices.

parent 94ca866c
...@@ -1363,6 +1363,7 @@ static int __init nr_proto_init(void) ...@@ -1363,6 +1363,7 @@ static int __init nr_proto_init(void)
for (i = 0; i < nr_ndevs; i++) { for (i = 0; i < nr_ndevs; i++) {
sprintf(dev_nr[i].name, "nr%d", i); sprintf(dev_nr[i].name, "nr%d", i);
dev_nr[i].base_addr = i;
dev_nr[i].init = nr_init; dev_nr[i].init = nr_init;
register_netdev(&dev_nr[i]); register_netdev(&dev_nr[i]);
} }
...@@ -1407,23 +1408,23 @@ static void __exit nr_exit(void) ...@@ -1407,23 +1408,23 @@ static void __exit nr_exit(void)
nr_rt_free(); nr_rt_free();
ax25_protocol_release(AX25_P_NETROM); #ifdef CONFIG_SYSCTL
nr_unregister_sysctl();
#endif
ax25_linkfail_release(nr_link_failed); ax25_linkfail_release(nr_link_failed);
ax25_protocol_release(AX25_P_NETROM);
unregister_netdevice_notifier(&nr_dev_notifier); unregister_netdevice_notifier(&nr_dev_notifier);
#ifdef CONFIG_SYSCTL
nr_unregister_sysctl();
#endif
sock_unregister(PF_NETROM); sock_unregister(PF_NETROM);
for (i = 0; i < nr_ndevs; i++) { for (i = 0; i < nr_ndevs; i++) {
if (dev_nr[i].priv != NULL) { if (dev_nr[i].priv != NULL) {
unregister_netdev(&dev_nr[i]);
kfree(dev_nr[i].priv); kfree(dev_nr[i].priv);
dev_nr[i].priv = NULL; dev_nr[i].priv = NULL;
unregister_netdev(&dev_nr[i]);
} }
kfree(dev_nr[i].name);
} }
kfree(dev_nr); kfree(dev_nr);
......
...@@ -159,11 +159,13 @@ static int nr_set_mac_address(struct net_device *dev, void *addr) ...@@ -159,11 +159,13 @@ static int nr_set_mac_address(struct net_device *dev, void *addr)
{ {
struct sockaddr *sa = addr; struct sockaddr *sa = addr;
ax25_listen_release((ax25_address *)dev->dev_addr, NULL); if (dev->flags & IFF_UP)
ax25_listen_release((ax25_address *)dev->dev_addr, NULL);
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
ax25_listen_register((ax25_address *)dev->dev_addr, NULL); if (dev->flags & IFF_UP)
ax25_listen_register((ax25_address *)dev->dev_addr, NULL);
return 0; return 0;
} }
...@@ -177,8 +179,8 @@ static int nr_open(struct net_device *dev) ...@@ -177,8 +179,8 @@ static int nr_open(struct net_device *dev)
static int nr_close(struct net_device *dev) static int nr_close(struct net_device *dev)
{ {
netif_stop_queue(dev);
ax25_listen_release((ax25_address *)dev->dev_addr, NULL); ax25_listen_release((ax25_address *)dev->dev_addr, NULL);
netif_stop_queue(dev);
return 0; return 0;
} }
...@@ -207,6 +209,7 @@ int nr_init(struct net_device *dev) ...@@ -207,6 +209,7 @@ int nr_init(struct net_device *dev)
dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN;
dev->addr_len = AX25_ADDR_LEN; dev->addr_len = AX25_ADDR_LEN;
dev->type = ARPHRD_NETROM; dev->type = ARPHRD_NETROM;
dev->tx_queue_len = 40;
dev->rebuild_header = nr_rebuild_header; dev->rebuild_header = nr_rebuild_header;
dev->set_mac_address = nr_set_mac_address; dev->set_mac_address = nr_set_mac_address;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment