aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ax25/af_ax25.c4
-rw-r--r--net/ax25/ax25_iface.c103
-rw-r--r--net/ax25/ax25_route.c2
-rw-r--r--net/ipv4/route.c3
-rw-r--r--net/ipv4/tcp_ipv4.c3
-rw-r--r--net/ipv6/netfilter/Kconfig5
-rw-r--r--net/netrom/af_netrom.c15
-rw-r--r--net/netrom/nr_dev.c24
-rw-r--r--net/netrom/nr_route.c19
-rw-r--r--net/rose/af_rose.c18
-rw-r--r--net/rose/rose_dev.c22
-rw-r--r--net/rose/rose_loopback.c5
-rw-r--r--net/rose/rose_route.c47
13 files changed, 135 insertions, 135 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 6cabf6d8a751..42233df2b099 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1088,8 +1088,8 @@ out:
1088/* 1088/*
1089 * FIXME: nonblock behaviour looks like it may have a bug. 1089 * FIXME: nonblock behaviour looks like it may have a bug.
1090 */ 1090 */
1091static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, 1091static int __must_check ax25_connect(struct socket *sock,
1092 int addr_len, int flags) 1092 struct sockaddr *uaddr, int addr_len, int flags)
1093{ 1093{
1094 struct sock *sk = sock->sk; 1094 struct sock *sk = sock->sk;
1095 ax25_cb *ax25 = ax25_sk(sk), *ax25t; 1095 ax25_cb *ax25 = ax25_sk(sk), *ax25t;
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index 07ac0207eb69..aff3e652c2d1 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -29,17 +29,10 @@
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31 31
32static struct protocol_struct { 32static struct ax25_protocol *protocol_list;
33 struct protocol_struct *next;
34 unsigned int pid;
35 int (*func)(struct sk_buff *, ax25_cb *);
36} *protocol_list = NULL;
37static DEFINE_RWLOCK(protocol_list_lock); 33static DEFINE_RWLOCK(protocol_list_lock);
38 34
39static struct linkfail_struct { 35static HLIST_HEAD(ax25_linkfail_list);
40 struct linkfail_struct *next;
41 void (*func)(ax25_cb *, int);
42} *linkfail_list = NULL;
43static DEFINE_SPINLOCK(linkfail_lock); 36static DEFINE_SPINLOCK(linkfail_lock);
44 37
45static struct listen_struct { 38static struct listen_struct {
@@ -49,36 +42,23 @@ static struct listen_struct {
49} *listen_list = NULL; 42} *listen_list = NULL;
50static DEFINE_SPINLOCK(listen_lock); 43static DEFINE_SPINLOCK(listen_lock);
51 44
52int ax25_protocol_register(unsigned int pid, 45/*
53 int (*func)(struct sk_buff *, ax25_cb *)) 46 * Do not register the internal protocols AX25_P_TEXT, AX25_P_SEGMENT,
47 * AX25_P_IP or AX25_P_ARP ...
48 */
49void ax25_register_pid(struct ax25_protocol *ap)
54{ 50{
55 struct protocol_struct *protocol;
56
57 if (pid == AX25_P_TEXT || pid == AX25_P_SEGMENT)
58 return 0;
59#ifdef CONFIG_INET
60 if (pid == AX25_P_IP || pid == AX25_P_ARP)
61 return 0;
62#endif
63 if ((protocol = kmalloc(sizeof(*protocol), GFP_ATOMIC)) == NULL)
64 return 0;
65
66 protocol->pid = pid;
67 protocol->func = func;
68
69 write_lock_bh(&protocol_list_lock); 51 write_lock_bh(&protocol_list_lock);
70 protocol->next = protocol_list; 52 ap->next = protocol_list;
71 protocol_list = protocol; 53 protocol_list = ap;
72 write_unlock_bh(&protocol_list_lock); 54 write_unlock_bh(&protocol_list_lock);
73
74 return 1;
75} 55}
76 56
77EXPORT_SYMBOL(ax25_protocol_register); 57EXPORT_SYMBOL_GPL(ax25_register_pid);
78 58
79void ax25_protocol_release(unsigned int pid) 59void ax25_protocol_release(unsigned int pid)
80{ 60{
81 struct protocol_struct *s, *protocol; 61 struct ax25_protocol *s, *protocol;
82 62
83 write_lock_bh(&protocol_list_lock); 63 write_lock_bh(&protocol_list_lock);
84 protocol = protocol_list; 64 protocol = protocol_list;
@@ -110,54 +90,19 @@ void ax25_protocol_release(unsigned int pid)
110 90
111EXPORT_SYMBOL(ax25_protocol_release); 91EXPORT_SYMBOL(ax25_protocol_release);
112 92
113int ax25_linkfail_register(void (*func)(ax25_cb *, int)) 93void ax25_linkfail_register(struct ax25_linkfail *lf)
114{ 94{
115 struct linkfail_struct *linkfail;
116
117 if ((linkfail = kmalloc(sizeof(*linkfail), GFP_ATOMIC)) == NULL)
118 return 0;
119
120 linkfail->func = func;
121
122 spin_lock_bh(&linkfail_lock); 95 spin_lock_bh(&linkfail_lock);
123 linkfail->next = linkfail_list; 96 hlist_add_head(&lf->lf_node, &ax25_linkfail_list);
124 linkfail_list = linkfail;
125 spin_unlock_bh(&linkfail_lock); 97 spin_unlock_bh(&linkfail_lock);
126
127 return 1;
128} 98}
129 99
130EXPORT_SYMBOL(ax25_linkfail_register); 100EXPORT_SYMBOL(ax25_linkfail_register);
131 101
132void ax25_linkfail_release(void (*func)(ax25_cb *, int)) 102void ax25_linkfail_release(struct ax25_linkfail *lf)
133{ 103{
134 struct linkfail_struct *s, *linkfail;
135
136 spin_lock_bh(&linkfail_lock); 104 spin_lock_bh(&linkfail_lock);
137 linkfail = linkfail_list; 105 hlist_del_init(&lf->lf_node);
138 if (linkfail == NULL) {
139 spin_unlock_bh(&linkfail_lock);
140 return;
141 }
142
143 if (linkfail->func == func) {
144 linkfail_list = linkfail->next;
145 spin_unlock_bh(&linkfail_lock);
146 kfree(linkfail);
147 return;
148 }
149
150 while (linkfail != NULL && linkfail->next != NULL) {
151 if (linkfail->next->func == func) {
152 s = linkfail->next;
153 linkfail->next = linkfail->next->next;
154 spin_unlock_bh(&linkfail_lock);
155 kfree(s);
156 return;
157 }
158
159 linkfail = linkfail->next;
160 }
161 spin_unlock_bh(&linkfail_lock); 106 spin_unlock_bh(&linkfail_lock);
162} 107}
163 108
@@ -171,7 +116,7 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
171 return 0; 116 return 0;
172 117
173 if ((listen = kmalloc(sizeof(*listen), GFP_ATOMIC)) == NULL) 118 if ((listen = kmalloc(sizeof(*listen), GFP_ATOMIC)) == NULL)
174 return 0; 119 return -ENOMEM;
175 120
176 listen->callsign = *callsign; 121 listen->callsign = *callsign;
177 listen->dev = dev; 122 listen->dev = dev;
@@ -181,7 +126,7 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
181 listen_list = listen; 126 listen_list = listen;
182 spin_unlock_bh(&listen_lock); 127 spin_unlock_bh(&listen_lock);
183 128
184 return 1; 129 return 0;
185} 130}
186 131
187EXPORT_SYMBOL(ax25_listen_register); 132EXPORT_SYMBOL(ax25_listen_register);
@@ -223,7 +168,7 @@ EXPORT_SYMBOL(ax25_listen_release);
223int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *) 168int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *)
224{ 169{
225 int (*res)(struct sk_buff *, ax25_cb *) = NULL; 170 int (*res)(struct sk_buff *, ax25_cb *) = NULL;
226 struct protocol_struct *protocol; 171 struct ax25_protocol *protocol;
227 172
228 read_lock(&protocol_list_lock); 173 read_lock(&protocol_list_lock);
229 for (protocol = protocol_list; protocol != NULL; protocol = protocol->next) 174 for (protocol = protocol_list; protocol != NULL; protocol = protocol->next)
@@ -242,7 +187,8 @@ int ax25_listen_mine(ax25_address *callsign, struct net_device *dev)
242 187
243 spin_lock_bh(&listen_lock); 188 spin_lock_bh(&listen_lock);
244 for (listen = listen_list; listen != NULL; listen = listen->next) 189 for (listen = listen_list; listen != NULL; listen = listen->next)
245 if (ax25cmp(&listen->callsign, callsign) == 0 && (listen->dev == dev || listen->dev == NULL)) { 190 if (ax25cmp(&listen->callsign, callsign) == 0 &&
191 (listen->dev == dev || listen->dev == NULL)) {
246 spin_unlock_bh(&listen_lock); 192 spin_unlock_bh(&listen_lock);
247 return 1; 193 return 1;
248 } 194 }
@@ -253,17 +199,18 @@ int ax25_listen_mine(ax25_address *callsign, struct net_device *dev)
253 199
254void ax25_link_failed(ax25_cb *ax25, int reason) 200void ax25_link_failed(ax25_cb *ax25, int reason)
255{ 201{
256 struct linkfail_struct *linkfail; 202 struct ax25_linkfail *lf;
203 struct hlist_node *node;
257 204
258 spin_lock_bh(&linkfail_lock); 205 spin_lock_bh(&linkfail_lock);
259 for (linkfail = linkfail_list; linkfail != NULL; linkfail = linkfail->next) 206 hlist_for_each_entry(lf, node, &ax25_linkfail_list, lf_node)
260 (linkfail->func)(ax25, reason); 207 lf->func(ax25, reason);
261 spin_unlock_bh(&linkfail_lock); 208 spin_unlock_bh(&linkfail_lock);
262} 209}
263 210
264int ax25_protocol_is_registered(unsigned int pid) 211int ax25_protocol_is_registered(unsigned int pid)
265{ 212{
266 struct protocol_struct *protocol; 213 struct ax25_protocol *protocol;
267 int res = 0; 214 int res = 0;
268 215
269 read_lock_bh(&protocol_list_lock); 216 read_lock_bh(&protocol_list_lock);
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 8580356ace5c..0a0381622b1c 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -71,7 +71,7 @@ void ax25_rt_device_down(struct net_device *dev)
71 write_unlock(&ax25_route_lock); 71 write_unlock(&ax25_route_lock);
72} 72}
73 73
74static int ax25_rt_add(struct ax25_routes_struct *route) 74static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
75{ 75{
76 ax25_route *ax25_rt; 76 ax25_route *ax25_rt;
77 ax25_dev *ax25_dev; 77 ax25_dev *ax25_dev;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1aaff0a2e098..2daa0dc19d33 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1325,7 +1325,8 @@ void ip_rt_send_redirect(struct sk_buff *skb)
1325 /* Check for load limit; set rate_last to the latest sent 1325 /* Check for load limit; set rate_last to the latest sent
1326 * redirect. 1326 * redirect.
1327 */ 1327 */
1328 if (time_after(jiffies, 1328 if (rt->u.dst.rate_tokens == 0 ||
1329 time_after(jiffies,
1329 (rt->u.dst.rate_last + 1330 (rt->u.dst.rate_last +
1330 (ip_rt_redirect_load << rt->u.dst.rate_tokens)))) { 1331 (ip_rt_redirect_load << rt->u.dst.rate_tokens)))) {
1331 icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt->rt_gateway); 1332 icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt->rt_gateway);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a1222d6968c4..bf7a22412bcb 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -928,6 +928,7 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr)
928 if (tp->md5sig_info->entries4 == 0) { 928 if (tp->md5sig_info->entries4 == 0) {
929 kfree(tp->md5sig_info->keys4); 929 kfree(tp->md5sig_info->keys4);
930 tp->md5sig_info->keys4 = NULL; 930 tp->md5sig_info->keys4 = NULL;
931 tp->md5sig_info->alloced4 = 0;
931 } else if (tp->md5sig_info->entries4 != i) { 932 } else if (tp->md5sig_info->entries4 != i) {
932 /* Need to do some manipulation */ 933 /* Need to do some manipulation */
933 memcpy(&tp->md5sig_info->keys4[i], 934 memcpy(&tp->md5sig_info->keys4[i],
@@ -1185,7 +1186,7 @@ done_opts:
1185 return 0; 1186 return 0;
1186 1187
1187 if (hash_expected && !hash_location) { 1188 if (hash_expected && !hash_location) {
1188 LIMIT_NETDEBUG(KERN_INFO "MD5 Hash NOT expected but found " 1189 LIMIT_NETDEBUG(KERN_INFO "MD5 Hash expected but NOT found "
1189 "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n", 1190 "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
1190 NIPQUAD(iph->saddr), ntohs(th->source), 1191 NIPQUAD(iph->saddr), ntohs(th->source),
1191 NIPQUAD(iph->daddr), ntohs(th->dest)); 1192 NIPQUAD(iph->daddr), ntohs(th->dest));
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index fc3e5eb4bc3f..adcd6131df2a 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -7,7 +7,7 @@ menu "IPv6: Netfilter Configuration (EXPERIMENTAL)"
7 7
8config NF_CONNTRACK_IPV6 8config NF_CONNTRACK_IPV6
9 tristate "IPv6 connection tracking support (EXPERIMENTAL)" 9 tristate "IPv6 connection tracking support (EXPERIMENTAL)"
10 depends on EXPERIMENTAL && NF_CONNTRACK 10 depends on INET && IPV6 && EXPERIMENTAL && NF_CONNTRACK
11 ---help--- 11 ---help---
12 Connection tracking keeps a record of what packets have passed 12 Connection tracking keeps a record of what packets have passed
13 through your machine, in order to figure out how they are related 13 through your machine, in order to figure out how they are related
@@ -21,6 +21,7 @@ config NF_CONNTRACK_IPV6
21 21
22config IP6_NF_QUEUE 22config IP6_NF_QUEUE
23 tristate "IP6 Userspace queueing via NETLINK (OBSOLETE)" 23 tristate "IP6 Userspace queueing via NETLINK (OBSOLETE)"
24 depends on INET && IPV6 && NETFILTER && EXPERIMENTAL
24 ---help--- 25 ---help---
25 26
26 This option adds a queue handler to the kernel for IPv6 27 This option adds a queue handler to the kernel for IPv6
@@ -41,7 +42,7 @@ config IP6_NF_QUEUE
41 42
42config IP6_NF_IPTABLES 43config IP6_NF_IPTABLES
43 tristate "IP6 tables support (required for filtering)" 44 tristate "IP6 tables support (required for filtering)"
44 depends on NETFILTER_XTABLES 45 depends on INET && IPV6 && EXPERIMENTAL && NETFILTER_XTABLES
45 help 46 help
46 ip6tables is a general, extensible packet identification framework. 47 ip6tables is a general, extensible packet identification framework.
47 Currently only the packet filtering and packet mangling subsystem 48 Currently only the packet filtering and packet mangling subsystem
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 1d50f801f181..43bbe2c9e49a 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1377,6 +1377,15 @@ static struct notifier_block nr_dev_notifier = {
1377 1377
1378static struct net_device **dev_nr; 1378static struct net_device **dev_nr;
1379 1379
1380static struct ax25_protocol nr_pid = {
1381 .pid = AX25_P_NETROM,
1382 .func = nr_route_frame
1383};
1384
1385static struct ax25_linkfail nr_linkfail_notifier = {
1386 .func = nr_link_failed,
1387};
1388
1380static int __init nr_proto_init(void) 1389static int __init nr_proto_init(void)
1381{ 1390{
1382 int i; 1391 int i;
@@ -1424,8 +1433,8 @@ static int __init nr_proto_init(void)
1424 1433
1425 register_netdevice_notifier(&nr_dev_notifier); 1434 register_netdevice_notifier(&nr_dev_notifier);
1426 1435
1427 ax25_protocol_register(AX25_P_NETROM, nr_route_frame); 1436 ax25_register_pid(&nr_pid);
1428 ax25_linkfail_register(nr_link_failed); 1437 ax25_linkfail_register(&nr_linkfail_notifier);
1429 1438
1430#ifdef CONFIG_SYSCTL 1439#ifdef CONFIG_SYSCTL
1431 nr_register_sysctl(); 1440 nr_register_sysctl();
@@ -1474,7 +1483,7 @@ static void __exit nr_exit(void)
1474 nr_unregister_sysctl(); 1483 nr_unregister_sysctl();
1475#endif 1484#endif
1476 1485
1477 ax25_linkfail_release(nr_link_failed); 1486 ax25_linkfail_release(&nr_linkfail_notifier);
1478 ax25_protocol_release(AX25_P_NETROM); 1487 ax25_protocol_release(AX25_P_NETROM);
1479 1488
1480 unregister_netdevice_notifier(&nr_dev_notifier); 1489 unregister_netdevice_notifier(&nr_dev_notifier);
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 9b8eb54971ab..4700d5225b78 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -128,25 +128,37 @@ static int nr_header(struct sk_buff *skb, struct net_device *dev, unsigned short
128 return -37; 128 return -37;
129} 129}
130 130
131static int nr_set_mac_address(struct net_device *dev, void *addr) 131static int __must_check nr_set_mac_address(struct net_device *dev, void *addr)
132{ 132{
133 struct sockaddr *sa = addr; 133 struct sockaddr *sa = addr;
134 int err;
135
136 if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len))
137 return 0;
138
139 if (dev->flags & IFF_UP) {
140 err = ax25_listen_register((ax25_address *)sa->sa_data, NULL);
141 if (err)
142 return err;
134 143
135 if (dev->flags & IFF_UP)
136 ax25_listen_release((ax25_address *)dev->dev_addr, NULL); 144 ax25_listen_release((ax25_address *)dev->dev_addr, NULL);
145 }
137 146
138 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); 147 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
139 148
140 if (dev->flags & IFF_UP)
141 ax25_listen_register((ax25_address *)dev->dev_addr, NULL);
142
143 return 0; 149 return 0;
144} 150}
145 151
146static int nr_open(struct net_device *dev) 152static int nr_open(struct net_device *dev)
147{ 153{
154 int err;
155
156 err = ax25_listen_register((ax25_address *)dev->dev_addr, NULL);
157 if (err)
158 return err;
159
148 netif_start_queue(dev); 160 netif_start_queue(dev);
149 ax25_listen_register((ax25_address *)dev->dev_addr, NULL); 161
150 return 0; 162 return 0;
151} 163}
152 164
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 0096105bcd47..8f88964099ef 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -87,8 +87,9 @@ static void nr_remove_neigh(struct nr_neigh *);
87 * Add a new route to a node, and in the process add the node and the 87 * Add a new route to a node, and in the process add the node and the
88 * neighbour if it is new. 88 * neighbour if it is new.
89 */ 89 */
90static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax25, 90static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
91 ax25_digi *ax25_digi, struct net_device *dev, int quality, int obs_count) 91 ax25_address *ax25, ax25_digi *ax25_digi, struct net_device *dev,
92 int quality, int obs_count)
92{ 93{
93 struct nr_node *nr_node; 94 struct nr_node *nr_node;
94 struct nr_neigh *nr_neigh; 95 struct nr_neigh *nr_neigh;
@@ -406,7 +407,8 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n
406/* 407/*
407 * Lock a neighbour with a quality. 408 * Lock a neighbour with a quality.
408 */ 409 */
409static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality) 410static int __must_check nr_add_neigh(ax25_address *callsign,
411 ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality)
410{ 412{
411 struct nr_neigh *nr_neigh; 413 struct nr_neigh *nr_neigh;
412 414
@@ -777,9 +779,13 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
777 nr_src = (ax25_address *)(skb->data + 0); 779 nr_src = (ax25_address *)(skb->data + 0);
778 nr_dest = (ax25_address *)(skb->data + 7); 780 nr_dest = (ax25_address *)(skb->data + 7);
779 781
780 if (ax25 != NULL) 782 if (ax25 != NULL) {
781 nr_add_node(nr_src, "", &ax25->dest_addr, ax25->digipeat, 783 ret = nr_add_node(nr_src, "", &ax25->dest_addr, ax25->digipeat,
782 ax25->ax25_dev->dev, 0, sysctl_netrom_obsolescence_count_initialiser); 784 ax25->ax25_dev->dev, 0,
785 sysctl_netrom_obsolescence_count_initialiser);
786 if (ret)
787 return ret;
788 }
783 789
784 if ((dev = nr_dev_get(nr_dest)) != NULL) { /* Its for me */ 790 if ((dev = nr_dev_get(nr_dest)) != NULL) { /* Its for me */
785 if (ax25 == NULL) /* Its from me */ 791 if (ax25 == NULL) /* Its from me */
@@ -844,6 +850,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
844 ret = (nr_neigh->ax25 != NULL); 850 ret = (nr_neigh->ax25 != NULL);
845 nr_node_unlock(nr_node); 851 nr_node_unlock(nr_node);
846 nr_node_put(nr_node); 852 nr_node_put(nr_node);
853
847 return ret; 854 return ret;
848} 855}
849 856
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 08a542855654..9e279464c9d1 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1314,7 +1314,8 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1314 if (copy_from_user(&rose_callsign, argp, sizeof(ax25_address))) 1314 if (copy_from_user(&rose_callsign, argp, sizeof(ax25_address)))
1315 return -EFAULT; 1315 return -EFAULT;
1316 if (ax25cmp(&rose_callsign, &null_ax25_address) != 0) 1316 if (ax25cmp(&rose_callsign, &null_ax25_address) != 0)
1317 ax25_listen_register(&rose_callsign, NULL); 1317 return ax25_listen_register(&rose_callsign, NULL);
1318
1318 return 0; 1319 return 0;
1319 1320
1320 case SIOCRSGL2CALL: 1321 case SIOCRSGL2CALL:
@@ -1481,6 +1482,15 @@ static struct notifier_block rose_dev_notifier = {
1481 1482
1482static struct net_device **dev_rose; 1483static struct net_device **dev_rose;
1483 1484
1485static struct ax25_protocol rose_pid = {
1486 .pid = AX25_P_ROSE,
1487 .func = rose_route_frame
1488};
1489
1490static struct ax25_linkfail rose_linkfail_notifier = {
1491 .func = rose_link_failed
1492};
1493
1484static int __init rose_proto_init(void) 1494static int __init rose_proto_init(void)
1485{ 1495{
1486 int i; 1496 int i;
@@ -1530,8 +1540,8 @@ static int __init rose_proto_init(void)
1530 sock_register(&rose_family_ops); 1540 sock_register(&rose_family_ops);
1531 register_netdevice_notifier(&rose_dev_notifier); 1541 register_netdevice_notifier(&rose_dev_notifier);
1532 1542
1533 ax25_protocol_register(AX25_P_ROSE, rose_route_frame); 1543 ax25_register_pid(&rose_pid);
1534 ax25_linkfail_register(rose_link_failed); 1544 ax25_linkfail_register(&rose_linkfail_notifier);
1535 1545
1536#ifdef CONFIG_SYSCTL 1546#ifdef CONFIG_SYSCTL
1537 rose_register_sysctl(); 1547 rose_register_sysctl();
@@ -1579,7 +1589,7 @@ static void __exit rose_exit(void)
1579 rose_rt_free(); 1589 rose_rt_free();
1580 1590
1581 ax25_protocol_release(AX25_P_ROSE); 1591 ax25_protocol_release(AX25_P_ROSE);
1582 ax25_linkfail_release(rose_link_failed); 1592 ax25_linkfail_release(&rose_linkfail_notifier);
1583 1593
1584 if (ax25cmp(&rose_callsign, &null_ax25_address) != 0) 1594 if (ax25cmp(&rose_callsign, &null_ax25_address) != 0)
1585 ax25_listen_release(&rose_callsign, NULL); 1595 ax25_listen_release(&rose_callsign, NULL);
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index 7c279e2659ec..50824d345fa6 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -93,20 +93,34 @@ static int rose_rebuild_header(struct sk_buff *skb)
93static int rose_set_mac_address(struct net_device *dev, void *addr) 93static int rose_set_mac_address(struct net_device *dev, void *addr)
94{ 94{
95 struct sockaddr *sa = addr; 95 struct sockaddr *sa = addr;
96 int err;
96 97
97 rose_del_loopback_node((rose_address *)dev->dev_addr); 98 if (!memcpy(dev->dev_addr, sa->sa_data, dev->addr_len))
99 return 0;
98 100
99 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); 101 if (dev->flags & IFF_UP) {
102 err = rose_add_loopback_node((rose_address *)dev->dev_addr);
103 if (err)
104 return err;
105
106 rose_del_loopback_node((rose_address *)dev->dev_addr);
107 }
100 108
101 rose_add_loopback_node((rose_address *)dev->dev_addr); 109 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
102 110
103 return 0; 111 return 0;
104} 112}
105 113
106static int rose_open(struct net_device *dev) 114static int rose_open(struct net_device *dev)
107{ 115{
116 int err;
117
118 err = rose_add_loopback_node((rose_address *)dev->dev_addr);
119 if (err)
120 return err;
121
108 netif_start_queue(dev); 122 netif_start_queue(dev);
109 rose_add_loopback_node((rose_address *)dev->dev_addr); 123
110 return 0; 124 return 0;
111} 125}
112 126
diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c
index 103b4d38f88a..3e41bd93ab9f 100644
--- a/net/rose/rose_loopback.c
+++ b/net/rose/rose_loopback.c
@@ -79,7 +79,8 @@ static void rose_loopback_timer(unsigned long param)
79 79
80 skb->h.raw = skb->data; 80 skb->h.raw = skb->data;
81 81
82 if ((sk = rose_find_socket(lci_o, rose_loopback_neigh)) != NULL) { 82 sk = rose_find_socket(lci_o, &rose_loopback_neigh);
83 if (sk) {
83 if (rose_process_rx_frame(sk, skb) == 0) 84 if (rose_process_rx_frame(sk, skb) == 0)
84 kfree_skb(skb); 85 kfree_skb(skb);
85 continue; 86 continue;
@@ -87,7 +88,7 @@ static void rose_loopback_timer(unsigned long param)
87 88
88 if (frametype == ROSE_CALL_REQUEST) { 89 if (frametype == ROSE_CALL_REQUEST) {
89 if ((dev = rose_dev_get(dest)) != NULL) { 90 if ((dev = rose_dev_get(dest)) != NULL) {
90 if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0) 91 if (rose_rx_call_request(skb, dev, &rose_loopback_neigh, lci_o) == 0)
91 kfree_skb(skb); 92 kfree_skb(skb);
92 } else { 93 } else {
93 kfree_skb(skb); 94 kfree_skb(skb);
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index 7252344779a0..8028c0d425dc 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -46,13 +46,13 @@ static DEFINE_SPINLOCK(rose_neigh_list_lock);
46static struct rose_route *rose_route_list; 46static struct rose_route *rose_route_list;
47static DEFINE_SPINLOCK(rose_route_list_lock); 47static DEFINE_SPINLOCK(rose_route_list_lock);
48 48
49struct rose_neigh *rose_loopback_neigh; 49struct rose_neigh rose_loopback_neigh;
50 50
51/* 51/*
52 * Add a new route to a node, and in the process add the node and the 52 * Add a new route to a node, and in the process add the node and the
53 * neighbour if it is new. 53 * neighbour if it is new.
54 */ 54 */
55static int rose_add_node(struct rose_route_struct *rose_route, 55static int __must_check rose_add_node(struct rose_route_struct *rose_route,
56 struct net_device *dev) 56 struct net_device *dev)
57{ 57{
58 struct rose_node *rose_node, *rose_tmpn, *rose_tmpp; 58 struct rose_node *rose_node, *rose_tmpn, *rose_tmpp;
@@ -361,33 +361,30 @@ out:
361/* 361/*
362 * Add the loopback neighbour. 362 * Add the loopback neighbour.
363 */ 363 */
364int rose_add_loopback_neigh(void) 364void rose_add_loopback_neigh(void)
365{ 365{
366 if ((rose_loopback_neigh = kmalloc(sizeof(struct rose_neigh), GFP_ATOMIC)) == NULL) 366 struct rose_neigh *sn = &rose_loopback_neigh;
367 return -ENOMEM;
368 367
369 rose_loopback_neigh->callsign = null_ax25_address; 368 sn->callsign = null_ax25_address;
370 rose_loopback_neigh->digipeat = NULL; 369 sn->digipeat = NULL;
371 rose_loopback_neigh->ax25 = NULL; 370 sn->ax25 = NULL;
372 rose_loopback_neigh->dev = NULL; 371 sn->dev = NULL;
373 rose_loopback_neigh->count = 0; 372 sn->count = 0;
374 rose_loopback_neigh->use = 0; 373 sn->use = 0;
375 rose_loopback_neigh->dce_mode = 1; 374 sn->dce_mode = 1;
376 rose_loopback_neigh->loopback = 1; 375 sn->loopback = 1;
377 rose_loopback_neigh->number = rose_neigh_no++; 376 sn->number = rose_neigh_no++;
378 rose_loopback_neigh->restarted = 1; 377 sn->restarted = 1;
379 378
380 skb_queue_head_init(&rose_loopback_neigh->queue); 379 skb_queue_head_init(&sn->queue);
381 380
382 init_timer(&rose_loopback_neigh->ftimer); 381 init_timer(&sn->ftimer);
383 init_timer(&rose_loopback_neigh->t0timer); 382 init_timer(&sn->t0timer);
384 383
385 spin_lock_bh(&rose_neigh_list_lock); 384 spin_lock_bh(&rose_neigh_list_lock);
386 rose_loopback_neigh->next = rose_neigh_list; 385 sn->next = rose_neigh_list;
387 rose_neigh_list = rose_loopback_neigh; 386 rose_neigh_list = sn;
388 spin_unlock_bh(&rose_neigh_list_lock); 387 spin_unlock_bh(&rose_neigh_list_lock);
389
390 return 0;
391} 388}
392 389
393/* 390/*
@@ -421,13 +418,13 @@ int rose_add_loopback_node(rose_address *address)
421 rose_node->mask = 10; 418 rose_node->mask = 10;
422 rose_node->count = 1; 419 rose_node->count = 1;
423 rose_node->loopback = 1; 420 rose_node->loopback = 1;
424 rose_node->neighbour[0] = rose_loopback_neigh; 421 rose_node->neighbour[0] = &rose_loopback_neigh;
425 422
426 /* Insert at the head of list. Address is always mask=10 */ 423 /* Insert at the head of list. Address is always mask=10 */
427 rose_node->next = rose_node_list; 424 rose_node->next = rose_node_list;
428 rose_node_list = rose_node; 425 rose_node_list = rose_node;
429 426
430 rose_loopback_neigh->count++; 427 rose_loopback_neigh.count++;
431 428
432out: 429out:
433 spin_unlock_bh(&rose_node_list_lock); 430 spin_unlock_bh(&rose_node_list_lock);
@@ -458,7 +455,7 @@ void rose_del_loopback_node(rose_address *address)
458 455
459 rose_remove_node(rose_node); 456 rose_remove_node(rose_node);
460 457
461 rose_loopback_neigh->count--; 458 rose_loopback_neigh.count--;
462 459
463out: 460out:
464 spin_unlock_bh(&rose_node_list_lock); 461 spin_unlock_bh(&rose_node_list_lock);