aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
commitcb18eccff48ef3986d1072964590bce6fec705fb (patch)
tree777fb1d15e0281341e1e02c9803d989538d346f2 /net/decnet
parentc827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff)
parent5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits) [IPV4]: Restore multipath routing after rt_next changes. [XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch. [NET]: Reorder fields of struct dst_entry [DECNET]: Convert decnet route to use the new dst_entry 'next' pointer [IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer [IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer [NET]: Introduce union in struct dst_entry to hold 'next' pointer [DECNET]: fix misannotation of linkinfo_dn [DECNET]: FRA_{DST,SRC} are le16 for decnet [UDP]: UDP can use sk_hash to speedup lookups [NET]: Fix whitespace errors. [NET] XFRM: Fix whitespace errors. [NET] X25: Fix whitespace errors. [NET] WANROUTER: Fix whitespace errors. [NET] UNIX: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] SCHED: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. ...
Diffstat (limited to 'net/decnet')
-rw-r--r--net/decnet/af_decnet.c130
-rw-r--r--net/decnet/dn_dev.c102
-rw-r--r--net/decnet/dn_fib.c132
-rw-r--r--net/decnet/dn_neigh.c24
-rw-r--r--net/decnet/dn_nsp_in.c74
-rw-r--r--net/decnet/dn_nsp_out.c56
-rw-r--r--net/decnet/dn_route.c204
-rw-r--r--net/decnet/dn_table.c238
-rw-r--r--net/decnet/netfilter/dn_rtmsg.c2
-rw-r--r--net/decnet/sysctl_net_decnet.c84
10 files changed, 523 insertions, 523 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 21f20f21dd32..70061641ee59 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -45,7 +45,7 @@
45 45
46/****************************************************************************** 46/******************************************************************************
47 (c) 1995-1998 E.M. Serrat emserrat@geocities.com 47 (c) 1995-1998 E.M. Serrat emserrat@geocities.com
48 48
49 This program is free software; you can redistribute it and/or modify 49 This program is free software; you can redistribute it and/or modify
50 it under the terms of the GNU General Public License as published by 50 it under the terms of the GNU General Public License as published by
51 the Free Software Foundation; either version 2 of the License, or 51 the Free Software Foundation; either version 2 of the License, or
@@ -63,7 +63,7 @@ Version Kernel Date Author/Comments
63Version 0.0.1 2.0.30 01-dic-97 Eduardo Marcelo Serrat 63Version 0.0.1 2.0.30 01-dic-97 Eduardo Marcelo Serrat
64 (emserrat@geocities.com) 64 (emserrat@geocities.com)
65 65
66 First Development of DECnet Socket La- 66 First Development of DECnet Socket La-
67 yer for Linux. Only supports outgoing 67 yer for Linux. Only supports outgoing
68 connections. 68 connections.
69 69
@@ -75,28 +75,28 @@ Version 0.0.2 2.1.105 20-jun-98 Patrick J. Caulfield
75Version 0.0.3 2.1.106 25-jun-98 Eduardo Marcelo Serrat 75Version 0.0.3 2.1.106 25-jun-98 Eduardo Marcelo Serrat
76 (emserrat@geocities.com) 76 (emserrat@geocities.com)
77 _ 77 _
78 Added support for incoming connections 78 Added support for incoming connections
79 so we can start developing server apps 79 so we can start developing server apps
80 on Linux. 80 on Linux.
81 - 81 -
82 Module Support 82 Module Support
83Version 0.0.4 2.1.109 21-jul-98 Eduardo Marcelo Serrat 83Version 0.0.4 2.1.109 21-jul-98 Eduardo Marcelo Serrat
84 (emserrat@geocities.com) 84 (emserrat@geocities.com)
85 _ 85 _
86 Added support for X11R6.4. Now we can 86 Added support for X11R6.4. Now we can
87 use DECnet transport for X on Linux!!! 87 use DECnet transport for X on Linux!!!
88 - 88 -
89Version 0.0.5 2.1.110 01-aug-98 Eduardo Marcelo Serrat 89Version 0.0.5 2.1.110 01-aug-98 Eduardo Marcelo Serrat
90 (emserrat@geocities.com) 90 (emserrat@geocities.com)
91 Removed bugs on flow control 91 Removed bugs on flow control
92 Removed bugs on incoming accessdata 92 Removed bugs on incoming accessdata
93 order 93 order
94 - 94 -
95Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat 95Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat
96 dn_recvmsg fixes 96 dn_recvmsg fixes
97 97
98 Patrick J. Caulfield 98 Patrick J. Caulfield
99 dn_bind fixes 99 dn_bind fixes
100*******************************************************************************/ 100*******************************************************************************/
101 101
102#include <linux/module.h> 102#include <linux/module.h>
@@ -169,7 +169,7 @@ static struct hlist_head *dn_find_list(struct sock *sk)
169 return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK]; 169 return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK];
170} 170}
171 171
172/* 172/*
173 * Valid ports are those greater than zero and not already in use. 173 * Valid ports are those greater than zero and not already in use.
174 */ 174 */
175static int check_port(__le16 port) 175static int check_port(__le16 port)
@@ -218,7 +218,7 @@ static int dn_hash_sock(struct sock *sk)
218 BUG_ON(sk_hashed(sk)); 218 BUG_ON(sk_hashed(sk));
219 219
220 write_lock_bh(&dn_hash_lock); 220 write_lock_bh(&dn_hash_lock);
221 221
222 if (!scp->addrloc && !port_alloc(sk)) 222 if (!scp->addrloc && !port_alloc(sk))
223 goto out; 223 goto out;
224 224
@@ -400,7 +400,7 @@ struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr)
400 400
401 sk = sk_head(&dn_wild_sk); 401 sk = sk_head(&dn_wild_sk);
402 if (sk) { 402 if (sk) {
403 if (sk->sk_state == TCP_LISTEN) 403 if (sk->sk_state == TCP_LISTEN)
404 sock_hold(sk); 404 sock_hold(sk);
405 else 405 else
406 sk = NULL; 406 sk = NULL;
@@ -500,7 +500,7 @@ static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp)
500 scp->ackxmt_oth = 0; /* Last oth data ack'ed */ 500 scp->ackxmt_oth = 0; /* Last oth data ack'ed */
501 scp->ackrcv_dat = 0; /* Highest data ack recv*/ 501 scp->ackrcv_dat = 0; /* Highest data ack recv*/
502 scp->ackrcv_oth = 0; /* Last oth data ack rec*/ 502 scp->ackrcv_oth = 0; /* Last oth data ack rec*/
503 scp->flowrem_sw = DN_SEND; 503 scp->flowrem_sw = DN_SEND;
504 scp->flowloc_sw = DN_SEND; 504 scp->flowloc_sw = DN_SEND;
505 scp->flowrem_dat = 0; 505 scp->flowrem_dat = 0;
506 scp->flowrem_oth = 1; 506 scp->flowrem_oth = 1;
@@ -690,7 +690,7 @@ static int dn_create(struct socket *sock, int protocol)
690 } 690 }
691 691
692 692
693 if ((sk = dn_alloc_sock(sock, GFP_KERNEL)) == NULL) 693 if ((sk = dn_alloc_sock(sock, GFP_KERNEL)) == NULL)
694 return -ENOBUFS; 694 return -ENOBUFS;
695 695
696 sk->sk_protocol = protocol; 696 sk->sk_protocol = protocol;
@@ -713,7 +713,7 @@ dn_release(struct socket *sock)
713 sock_put(sk); 713 sock_put(sk);
714 } 714 }
715 715
716 return 0; 716 return 0;
717} 717}
718 718
719static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 719static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
@@ -770,7 +770,7 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
770 } 770 }
771 release_sock(sk); 771 release_sock(sk);
772 772
773 return rv; 773 return rv;
774} 774}
775 775
776 776
@@ -791,7 +791,7 @@ static int dn_auto_bind(struct socket *sock)
791 */ 791 */
792 if ((scp->accessdata.acc_accl != 0) && 792 if ((scp->accessdata.acc_accl != 0) &&
793 (scp->accessdata.acc_accl <= 12)) { 793 (scp->accessdata.acc_accl <= 12)) {
794 794
795 scp->addr.sdn_objnamel = dn_htons(scp->accessdata.acc_accl); 795 scp->addr.sdn_objnamel = dn_htons(scp->accessdata.acc_accl);
796 memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, dn_ntohs(scp->addr.sdn_objnamel)); 796 memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, dn_ntohs(scp->addr.sdn_objnamel));
797 797
@@ -997,20 +997,20 @@ static inline int dn_check_state(struct sock *sk, struct sockaddr_dn *addr, int
997 997
998static void dn_access_copy(struct sk_buff *skb, struct accessdata_dn *acc) 998static void dn_access_copy(struct sk_buff *skb, struct accessdata_dn *acc)
999{ 999{
1000 unsigned char *ptr = skb->data; 1000 unsigned char *ptr = skb->data;
1001 1001
1002 acc->acc_userl = *ptr++; 1002 acc->acc_userl = *ptr++;
1003 memcpy(&acc->acc_user, ptr, acc->acc_userl); 1003 memcpy(&acc->acc_user, ptr, acc->acc_userl);
1004 ptr += acc->acc_userl; 1004 ptr += acc->acc_userl;
1005 1005
1006 acc->acc_passl = *ptr++; 1006 acc->acc_passl = *ptr++;
1007 memcpy(&acc->acc_pass, ptr, acc->acc_passl); 1007 memcpy(&acc->acc_pass, ptr, acc->acc_passl);
1008 ptr += acc->acc_passl; 1008 ptr += acc->acc_passl;
1009 1009
1010 acc->acc_accl = *ptr++; 1010 acc->acc_accl = *ptr++;
1011 memcpy(&acc->acc_acc, ptr, acc->acc_accl); 1011 memcpy(&acc->acc_acc, ptr, acc->acc_accl);
1012 1012
1013 skb_pull(skb, acc->acc_accl + acc->acc_passl + acc->acc_userl + 3); 1013 skb_pull(skb, acc->acc_accl + acc->acc_passl + acc->acc_userl + 3);
1014 1014
1015} 1015}
1016 1016
@@ -1071,7 +1071,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
1071 1071
1072 lock_sock(sk); 1072 lock_sock(sk);
1073 1073
1074 if (sk->sk_state != TCP_LISTEN || DN_SK(sk)->state != DN_O) { 1074 if (sk->sk_state != TCP_LISTEN || DN_SK(sk)->state != DN_O) {
1075 release_sock(sk); 1075 release_sock(sk);
1076 return -EINVAL; 1076 return -EINVAL;
1077 } 1077 }
@@ -1098,13 +1098,13 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
1098 dst_release(xchg(&newsk->sk_dst_cache, skb->dst)); 1098 dst_release(xchg(&newsk->sk_dst_cache, skb->dst));
1099 skb->dst = NULL; 1099 skb->dst = NULL;
1100 1100
1101 DN_SK(newsk)->state = DN_CR; 1101 DN_SK(newsk)->state = DN_CR;
1102 DN_SK(newsk)->addrrem = cb->src_port; 1102 DN_SK(newsk)->addrrem = cb->src_port;
1103 DN_SK(newsk)->services_rem = cb->services; 1103 DN_SK(newsk)->services_rem = cb->services;
1104 DN_SK(newsk)->info_rem = cb->info; 1104 DN_SK(newsk)->info_rem = cb->info;
1105 DN_SK(newsk)->segsize_rem = cb->segsize; 1105 DN_SK(newsk)->segsize_rem = cb->segsize;
1106 DN_SK(newsk)->accept_mode = DN_SK(sk)->accept_mode; 1106 DN_SK(newsk)->accept_mode = DN_SK(sk)->accept_mode;
1107 1107
1108 if (DN_SK(newsk)->segsize_rem < 230) 1108 if (DN_SK(newsk)->segsize_rem < 230)
1109 DN_SK(newsk)->segsize_rem = 230; 1109 DN_SK(newsk)->segsize_rem = 230;
1110 1110
@@ -1154,15 +1154,15 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
1154 dn_send_conn_ack(newsk); 1154 dn_send_conn_ack(newsk);
1155 1155
1156 /* 1156 /*
1157 * Here we use sk->sk_allocation since although the conn conf is 1157 * Here we use sk->sk_allocation since although the conn conf is
1158 * for the newsk, the context is the old socket. 1158 * for the newsk, the context is the old socket.
1159 */ 1159 */
1160 if (DN_SK(newsk)->accept_mode == ACC_IMMED) 1160 if (DN_SK(newsk)->accept_mode == ACC_IMMED)
1161 err = dn_confirm_accept(newsk, &timeo, 1161 err = dn_confirm_accept(newsk, &timeo,
1162 sk->sk_allocation); 1162 sk->sk_allocation);
1163 } 1163 }
1164 release_sock(newsk); 1164 release_sock(newsk);
1165 return err; 1165 return err;
1166} 1166}
1167 1167
1168 1168
@@ -1177,10 +1177,10 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len
1177 lock_sock(sk); 1177 lock_sock(sk);
1178 1178
1179 if (peer) { 1179 if (peer) {
1180 if ((sock->state != SS_CONNECTED && 1180 if ((sock->state != SS_CONNECTED &&
1181 sock->state != SS_CONNECTING) && 1181 sock->state != SS_CONNECTING) &&
1182 scp->accept_mode == ACC_IMMED) { 1182 scp->accept_mode == ACC_IMMED) {
1183 release_sock(sk); 1183 release_sock(sk);
1184 return -ENOTCONN; 1184 return -ENOTCONN;
1185 } 1185 }
1186 1186
@@ -1191,7 +1191,7 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len
1191 1191
1192 release_sock(sk); 1192 release_sock(sk);
1193 1193
1194 return 0; 1194 return 0;
1195} 1195}
1196 1196
1197 1197
@@ -1285,7 +1285,7 @@ static int dn_listen(struct socket *sock, int backlog)
1285out: 1285out:
1286 release_sock(sk); 1286 release_sock(sk);
1287 1287
1288 return err; 1288 return err;
1289} 1289}
1290 1290
1291 1291
@@ -1333,7 +1333,7 @@ static int dn_setsockopt(struct socket *sock, int level, int optname, char __use
1333 return err; 1333 return err;
1334} 1334}
1335 1335
1336static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags) 1336static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags)
1337{ 1337{
1338 struct sock *sk = sock->sk; 1338 struct sock *sk = sock->sk;
1339 struct dn_scp *scp = DN_SK(sk); 1339 struct dn_scp *scp = DN_SK(sk);
@@ -1360,7 +1360,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
1360 1360
1361 switch(optname) { 1361 switch(optname) {
1362 case DSO_CONDATA: 1362 case DSO_CONDATA:
1363 if (sock->state == SS_CONNECTED) 1363 if (sock->state == SS_CONNECTED)
1364 return -EISCONN; 1364 return -EISCONN;
1365 if ((scp->state != DN_O) && (scp->state != DN_CR)) 1365 if ((scp->state != DN_O) && (scp->state != DN_CR))
1366 return -EINVAL; 1366 return -EINVAL;
@@ -1375,7 +1375,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
1375 break; 1375 break;
1376 1376
1377 case DSO_DISDATA: 1377 case DSO_DISDATA:
1378 if (sock->state != SS_CONNECTED && scp->accept_mode == ACC_IMMED) 1378 if (sock->state != SS_CONNECTED && scp->accept_mode == ACC_IMMED)
1379 return -ENOTCONN; 1379 return -ENOTCONN;
1380 1380
1381 if (optlen != sizeof(struct optdata_dn)) 1381 if (optlen != sizeof(struct optdata_dn))
@@ -1388,7 +1388,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
1388 break; 1388 break;
1389 1389
1390 case DSO_CONACCESS: 1390 case DSO_CONACCESS:
1391 if (sock->state == SS_CONNECTED) 1391 if (sock->state == SS_CONNECTED)
1392 return -EISCONN; 1392 return -EISCONN;
1393 if (scp->state != DN_O) 1393 if (scp->state != DN_O)
1394 return -EINVAL; 1394 return -EINVAL;
@@ -1521,7 +1521,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
1521 1521
1522 if(get_user(r_len , optlen)) 1522 if(get_user(r_len , optlen))
1523 return -EFAULT; 1523 return -EFAULT;
1524 1524
1525 switch(optname) { 1525 switch(optname) {
1526 case DSO_CONDATA: 1526 case DSO_CONDATA:
1527 if (r_len > sizeof(struct optdata_dn)) 1527 if (r_len > sizeof(struct optdata_dn))
@@ -1573,11 +1573,11 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
1573#ifdef CONFIG_NETFILTER 1573#ifdef CONFIG_NETFILTER
1574 { 1574 {
1575 int val, len; 1575 int val, len;
1576 1576
1577 if(get_user(len, optlen)) 1577 if(get_user(len, optlen))
1578 return -EFAULT; 1578 return -EFAULT;
1579 1579
1580 val = nf_getsockopt(sk, PF_DECnet, optname, 1580 val = nf_getsockopt(sk, PF_DECnet, optname,
1581 optval, &len); 1581 optval, &len);
1582 if (val >= 0) 1582 if (val >= 0)
1583 val = put_user(len, optlen); 1583 val = put_user(len, optlen);
@@ -1588,7 +1588,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
1588 case DSO_SEQPACKET: 1588 case DSO_SEQPACKET:
1589 case DSO_CONACCEPT: 1589 case DSO_CONACCEPT:
1590 case DSO_CONREJECT: 1590 case DSO_CONREJECT:
1591 return -ENOPROTOOPT; 1591 return -ENOPROTOOPT;
1592 1592
1593 case DSO_MAXWINDOW: 1593 case DSO_MAXWINDOW:
1594 if (r_len > sizeof(unsigned long)) 1594 if (r_len > sizeof(unsigned long))
@@ -1724,7 +1724,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
1724 } 1724 }
1725 } 1725 }
1726 } 1726 }
1727 1727
1728 if (scp->state != DN_RUN) 1728 if (scp->state != DN_RUN)
1729 goto out; 1729 goto out;
1730 1730
@@ -1773,7 +1773,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
1773 if (skb->len == 0) { 1773 if (skb->len == 0) {
1774 skb_unlink(skb, queue); 1774 skb_unlink(skb, queue);
1775 kfree_skb(skb); 1775 kfree_skb(skb);
1776 /* 1776 /*
1777 * N.B. Don't refer to skb or cb after this point 1777 * N.B. Don't refer to skb or cb after this point
1778 * in loop. 1778 * in loop.
1779 */ 1779 */
@@ -1783,7 +1783,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
1783 } 1783 }
1784 } 1784 }
1785 1785
1786 if (eor) { 1786 if (eor) {
1787 if (sk->sk_type == SOCK_SEQPACKET) 1787 if (sk->sk_type == SOCK_SEQPACKET)
1788 break; 1788 break;
1789 if (!(flags & MSG_WAITALL)) 1789 if (!(flags & MSG_WAITALL))
@@ -1884,7 +1884,7 @@ static inline unsigned int dn_current_mss(struct sock *sk, int flags)
1884 return mss_now; 1884 return mss_now;
1885} 1885}
1886 1886
1887/* 1887/*
1888 * N.B. We get the timeout wrong here, but then we always did get it 1888 * N.B. We get the timeout wrong here, but then we always did get it
1889 * wrong before and this is another step along the road to correcting 1889 * wrong before and this is another step along the road to correcting
1890 * it. It ought to get updated each time we pass through the routine, 1890 * it. It ought to get updated each time we pass through the routine,
@@ -2044,7 +2044,7 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock,
2044 cb->nsp_flags |= 0x20; 2044 cb->nsp_flags |= 0x20;
2045 2045
2046 scp->seg_total += len; 2046 scp->seg_total += len;
2047 2047
2048 if (((sent + len) == size) && (flags & MSG_EOR)) { 2048 if (((sent + len) == size) && (flags & MSG_EOR)) {
2049 cb->nsp_flags |= 0x40; 2049 cb->nsp_flags |= 0x40;
2050 scp->seg_total = 0; 2050 scp->seg_total = 0;
@@ -2202,7 +2202,7 @@ static void dn_socket_seq_stop(struct seq_file *seq, void *v)
2202static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf) 2202static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf)
2203{ 2203{
2204 int i; 2204 int i;
2205 2205
2206 switch (dn_ntohs(dn->sdn_objnamel)) { 2206 switch (dn_ntohs(dn->sdn_objnamel)) {
2207 case 0: 2207 case 0:
2208 sprintf(buf, "%d", dn->sdn_objnum); 2208 sprintf(buf, "%d", dn->sdn_objnum);
@@ -2214,7 +2214,7 @@ static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf)
2214 buf[i] = '.'; 2214 buf[i] = '.';
2215 } 2215 }
2216 buf[i] = 0; 2216 buf[i] = 0;
2217 } 2217 }
2218} 2218}
2219 2219
2220static char *dn_state2asc(unsigned char state) 2220static char *dn_state2asc(unsigned char state)
@@ -2381,7 +2381,7 @@ static int __init decnet_init(void)
2381{ 2381{
2382 int rc; 2382 int rc;
2383 2383
2384 printk(banner); 2384 printk(banner);
2385 2385
2386 rc = proto_register(&dn_proto, 1); 2386 rc = proto_register(&dn_proto, 1);
2387 if (rc != 0) 2387 if (rc != 0)
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 90b3dfd72b49..c5e28114beb8 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -224,27 +224,27 @@ static struct dn_dev_sysctl_table {
224 {0} 224 {0}
225 }, 225 },
226 {{ 226 {{
227 .ctl_name = 0, 227 .ctl_name = 0,
228 .procname = "", 228 .procname = "",
229 .mode = 0555, 229 .mode = 0555,
230 .child = dn_dev_sysctl.dn_dev_vars 230 .child = dn_dev_sysctl.dn_dev_vars
231 }, {0}}, 231 }, {0}},
232 {{ 232 {{
233 .ctl_name = NET_DECNET_CONF, 233 .ctl_name = NET_DECNET_CONF,
234 .procname = "conf", 234 .procname = "conf",
235 .mode = 0555, 235 .mode = 0555,
236 .child = dn_dev_sysctl.dn_dev_dev 236 .child = dn_dev_sysctl.dn_dev_dev
237 }, {0}}, 237 }, {0}},
238 {{ 238 {{
239 .ctl_name = NET_DECNET, 239 .ctl_name = NET_DECNET,
240 .procname = "decnet", 240 .procname = "decnet",
241 .mode = 0555, 241 .mode = 0555,
242 .child = dn_dev_sysctl.dn_dev_conf_dir 242 .child = dn_dev_sysctl.dn_dev_conf_dir
243 }, {0}}, 243 }, {0}},
244 {{ 244 {{
245 .ctl_name = CTL_NET, 245 .ctl_name = CTL_NET,
246 .procname = "net", 246 .procname = "net",
247 .mode = 0555, 247 .mode = 0555,
248 .child = dn_dev_sysctl.dn_dev_proto_dir 248 .child = dn_dev_sysctl.dn_dev_proto_dir
249 }, {0}} 249 }, {0}}
250}; 250};
@@ -299,7 +299,7 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms)
299 } 299 }
300} 300}
301 301
302static int dn_forwarding_proc(ctl_table *table, int write, 302static int dn_forwarding_proc(ctl_table *table, int write,
303 struct file *filep, 303 struct file *filep,
304 void __user *buffer, 304 void __user *buffer,
305 size_t *lenp, loff_t *ppos) 305 size_t *lenp, loff_t *ppos)
@@ -456,7 +456,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
456 456
457 ASSERT_RTNL(); 457 ASSERT_RTNL();
458 458
459 /* Check for duplicates */ 459 /* Check for duplicates */
460 for(ifa1 = dn_db->ifa_list; ifa1; ifa1 = ifa1->ifa_next) { 460 for(ifa1 = dn_db->ifa_list; ifa1; ifa1 = ifa1->ifa_next) {
461 if (ifa1->ifa_local == ifa->ifa_local) 461 if (ifa1->ifa_local == ifa->ifa_local)
462 return -EEXIST; 462 return -EEXIST;
@@ -708,7 +708,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
708 if (!dn_db) 708 if (!dn_db)
709 return err; 709 return err;
710 } 710 }
711 711
712 if ((ifa = dn_dev_alloc_ifa()) == NULL) 712 if ((ifa = dn_dev_alloc_ifa()) == NULL)
713 return -ENOBUFS; 713 return -ENOBUFS;
714 714
@@ -853,7 +853,7 @@ out:
853 return rv; 853 return rv;
854} 854}
855 855
856/* 856/*
857 * Find a default address to bind to. 857 * Find a default address to bind to.
858 * 858 *
859 * This is one of those areas where the initial VMS concepts don't really 859 * This is one of those areas where the initial VMS concepts don't really
@@ -884,39 +884,39 @@ last_chance:
884 884
885static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) 885static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
886{ 886{
887 struct endnode_hello_message *msg; 887 struct endnode_hello_message *msg;
888 struct sk_buff *skb = NULL; 888 struct sk_buff *skb = NULL;
889 __le16 *pktlen; 889 __le16 *pktlen;
890 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; 890 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
891 891
892 if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL) 892 if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL)
893 return; 893 return;
894 894
895 skb->dev = dev; 895 skb->dev = dev;
896 896
897 msg = (struct endnode_hello_message *)skb_put(skb,sizeof(*msg)); 897 msg = (struct endnode_hello_message *)skb_put(skb,sizeof(*msg));
898 898
899 msg->msgflg = 0x0D; 899 msg->msgflg = 0x0D;
900 memcpy(msg->tiver, dn_eco_version, 3); 900 memcpy(msg->tiver, dn_eco_version, 3);
901 dn_dn2eth(msg->id, ifa->ifa_local); 901 dn_dn2eth(msg->id, ifa->ifa_local);
902 msg->iinfo = DN_RT_INFO_ENDN; 902 msg->iinfo = DN_RT_INFO_ENDN;
903 msg->blksize = dn_htons(mtu2blksize(dev)); 903 msg->blksize = dn_htons(mtu2blksize(dev));
904 msg->area = 0x00; 904 msg->area = 0x00;
905 memset(msg->seed, 0, 8); 905 memset(msg->seed, 0, 8);
906 memcpy(msg->neighbor, dn_hiord, ETH_ALEN); 906 memcpy(msg->neighbor, dn_hiord, ETH_ALEN);
907 907
908 if (dn_db->router) { 908 if (dn_db->router) {
909 struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; 909 struct dn_neigh *dn = (struct dn_neigh *)dn_db->router;
910 dn_dn2eth(msg->neighbor, dn->addr); 910 dn_dn2eth(msg->neighbor, dn->addr);
911 } 911 }
912 912
913 msg->timer = dn_htons((unsigned short)dn_db->parms.t3); 913 msg->timer = dn_htons((unsigned short)dn_db->parms.t3);
914 msg->mpd = 0x00; 914 msg->mpd = 0x00;
915 msg->datalen = 0x02; 915 msg->datalen = 0x02;
916 memset(msg->data, 0xAA, 2); 916 memset(msg->data, 0xAA, 2);
917 917
918 pktlen = (__le16 *)skb_push(skb,2); 918 pktlen = (__le16 *)skb_push(skb,2);
919 *pktlen = dn_htons(skb->len - 2); 919 *pktlen = dn_htons(skb->len - 2);
920 920
921 skb->nh.raw = skb->data; 921 skb->nh.raw = skb->data;
922 922
@@ -986,11 +986,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
986 dn_dn2eth(ptr, ifa->ifa_local); 986 dn_dn2eth(ptr, ifa->ifa_local);
987 src = ptr; 987 src = ptr;
988 ptr += ETH_ALEN; 988 ptr += ETH_ALEN;
989 *ptr++ = dn_db->parms.forwarding == 1 ? 989 *ptr++ = dn_db->parms.forwarding == 1 ?
990 DN_RT_INFO_L1RT : DN_RT_INFO_L2RT; 990 DN_RT_INFO_L1RT : DN_RT_INFO_L2RT;
991 *((__le16 *)ptr) = dn_htons(mtu2blksize(dev)); 991 *((__le16 *)ptr) = dn_htons(mtu2blksize(dev));
992 ptr += 2; 992 ptr += 2;
993 *ptr++ = dn_db->parms.priority; /* Priority */ 993 *ptr++ = dn_db->parms.priority; /* Priority */
994 *ptr++ = 0; /* Area: Reserved */ 994 *ptr++ = 0; /* Area: Reserved */
995 *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3); 995 *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3);
996 ptr += 2; 996 ptr += 2;
@@ -1408,18 +1408,18 @@ static char *dn_type2asc(char type)
1408static int dn_dev_seq_show(struct seq_file *seq, void *v) 1408static int dn_dev_seq_show(struct seq_file *seq, void *v)
1409{ 1409{
1410 if (v == SEQ_START_TOKEN) 1410 if (v == SEQ_START_TOKEN)
1411 seq_puts(seq, "Name Flags T1 Timer1 T3 Timer3 BlkSize Pri State DevType Router Peer\n"); 1411 seq_puts(seq, "Name Flags T1 Timer1 T3 Timer3 BlkSize Pri State DevType Router Peer\n");
1412 else { 1412 else {
1413 struct net_device *dev = v; 1413 struct net_device *dev = v;
1414 char peer_buf[DN_ASCBUF_LEN]; 1414 char peer_buf[DN_ASCBUF_LEN];
1415 char router_buf[DN_ASCBUF_LEN]; 1415 char router_buf[DN_ASCBUF_LEN];
1416 struct dn_dev *dn_db = dev->dn_ptr; 1416 struct dn_dev *dn_db = dev->dn_ptr;
1417 1417
1418 seq_printf(seq, "%-8s %1s %04u %04u %04lu %04lu" 1418 seq_printf(seq, "%-8s %1s %04u %04u %04lu %04lu"
1419 " %04hu %03d %02x %-10s %-7s %-7s\n", 1419 " %04hu %03d %02x %-10s %-7s %-7s\n",
1420 dev->name ? dev->name : "???", 1420 dev->name ? dev->name : "???",
1421 dn_type2asc(dn_db->parms.mode), 1421 dn_type2asc(dn_db->parms.mode),
1422 0, 0, 1422 0, 0,
1423 dn_db->t3, dn_db->parms.t3, 1423 dn_db->t3, dn_db->parms.t3,
1424 mtu2blksize(dev), 1424 mtu2blksize(dev),
1425 dn_db->parms.priority, 1425 dn_db->parms.priority,
@@ -1476,17 +1476,17 @@ MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node");
1476 1476
1477void __init dn_dev_init(void) 1477void __init dn_dev_init(void)
1478{ 1478{
1479 if (addr[0] > 63 || addr[0] < 0) { 1479 if (addr[0] > 63 || addr[0] < 0) {
1480 printk(KERN_ERR "DECnet: Area must be between 0 and 63"); 1480 printk(KERN_ERR "DECnet: Area must be between 0 and 63");
1481 return; 1481 return;
1482 } 1482 }
1483 1483
1484 if (addr[1] > 1023 || addr[1] < 0) { 1484 if (addr[1] > 1023 || addr[1] < 0) {
1485 printk(KERN_ERR "DECnet: Node must be between 0 and 1023"); 1485 printk(KERN_ERR "DECnet: Node must be between 0 and 1023");
1486 return; 1486 return;
1487 } 1487 }
1488 1488
1489 decnet_address = dn_htons((addr[0] << 10) | addr[1]); 1489 decnet_address = dn_htons((addr[0] << 10) | addr[1]);
1490 1490
1491 dn_dev_devices_on(); 1491 dn_dev_devices_on();
1492 1492
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 1cf010124ec5..3cbfddc98430 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -527,7 +527,7 @@ int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
527 return -EINVAL; 527 return -EINVAL;
528 528
529 tb = dn_fib_get_table(rtm_get_table(rta, r->rtm_table), 1); 529 tb = dn_fib_get_table(rtm_get_table(rta, r->rtm_table), 1);
530 if (tb) 530 if (tb)
531 return tb->insert(tb, r, (struct dn_kern_rta *)rta, nlh, &NETLINK_CB(skb)); 531 return tb->insert(tb, r, (struct dn_kern_rta *)rta, nlh, &NETLINK_CB(skb));
532 532
533 return -ENOBUFS; 533 return -ENOBUFS;
@@ -654,80 +654,80 @@ static int dn_fib_dnaddr_event(struct notifier_block *this, unsigned long event,
654 654
655static int dn_fib_sync_down(__le16 local, struct net_device *dev, int force) 655static int dn_fib_sync_down(__le16 local, struct net_device *dev, int force)
656{ 656{
657 int ret = 0; 657 int ret = 0;
658 int scope = RT_SCOPE_NOWHERE; 658 int scope = RT_SCOPE_NOWHERE;
659 659
660 if (force) 660 if (force)
661 scope = -1; 661 scope = -1;
662 662
663 for_fib_info() { 663 for_fib_info() {
664 /* 664 /*
665 * This makes no sense for DECnet.... we will almost 665 * This makes no sense for DECnet.... we will almost
666 * certainly have more than one local address the same 666 * certainly have more than one local address the same
667 * over all our interfaces. It needs thinking about 667 * over all our interfaces. It needs thinking about
668 * some more. 668 * some more.
669 */ 669 */
670 if (local && fi->fib_prefsrc == local) { 670 if (local && fi->fib_prefsrc == local) {
671 fi->fib_flags |= RTNH_F_DEAD; 671 fi->fib_flags |= RTNH_F_DEAD;
672 ret++; 672 ret++;
673 } else if (dev && fi->fib_nhs) { 673 } else if (dev && fi->fib_nhs) {
674 int dead = 0; 674 int dead = 0;
675 675
676 change_nexthops(fi) { 676 change_nexthops(fi) {
677 if (nh->nh_flags&RTNH_F_DEAD) 677 if (nh->nh_flags&RTNH_F_DEAD)
678 dead++; 678 dead++;
679 else if (nh->nh_dev == dev && 679 else if (nh->nh_dev == dev &&
680 nh->nh_scope != scope) { 680 nh->nh_scope != scope) {
681 spin_lock_bh(&dn_fib_multipath_lock); 681 spin_lock_bh(&dn_fib_multipath_lock);
682 nh->nh_flags |= RTNH_F_DEAD; 682 nh->nh_flags |= RTNH_F_DEAD;
683 fi->fib_power -= nh->nh_power; 683 fi->fib_power -= nh->nh_power;
684 nh->nh_power = 0; 684 nh->nh_power = 0;
685 spin_unlock_bh(&dn_fib_multipath_lock); 685 spin_unlock_bh(&dn_fib_multipath_lock);
686 dead++; 686 dead++;
687 } 687 }
688 } endfor_nexthops(fi) 688 } endfor_nexthops(fi)
689 if (dead == fi->fib_nhs) { 689 if (dead == fi->fib_nhs) {
690 fi->fib_flags |= RTNH_F_DEAD; 690 fi->fib_flags |= RTNH_F_DEAD;
691 ret++; 691 ret++;
692 } 692 }
693 } 693 }
694 } endfor_fib_info(); 694 } endfor_fib_info();
695 return ret; 695 return ret;
696} 696}
697 697
698 698
699static int dn_fib_sync_up(struct net_device *dev) 699static int dn_fib_sync_up(struct net_device *dev)
700{ 700{
701 int ret = 0; 701 int ret = 0;
702 702
703 if (!(dev->flags&IFF_UP)) 703 if (!(dev->flags&IFF_UP))
704 return 0; 704 return 0;
705 705
706 for_fib_info() { 706 for_fib_info() {
707 int alive = 0; 707 int alive = 0;
708 708
709 change_nexthops(fi) { 709 change_nexthops(fi) {
710 if (!(nh->nh_flags&RTNH_F_DEAD)) { 710 if (!(nh->nh_flags&RTNH_F_DEAD)) {
711 alive++; 711 alive++;
712 continue; 712 continue;
713 } 713 }
714 if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) 714 if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP))
715 continue; 715 continue;
716 if (nh->nh_dev != dev || dev->dn_ptr == NULL) 716 if (nh->nh_dev != dev || dev->dn_ptr == NULL)
717 continue; 717 continue;
718 alive++; 718 alive++;
719 spin_lock_bh(&dn_fib_multipath_lock); 719 spin_lock_bh(&dn_fib_multipath_lock);
720 nh->nh_power = 0; 720 nh->nh_power = 0;
721 nh->nh_flags &= ~RTNH_F_DEAD; 721 nh->nh_flags &= ~RTNH_F_DEAD;
722 spin_unlock_bh(&dn_fib_multipath_lock); 722 spin_unlock_bh(&dn_fib_multipath_lock);
723 } endfor_nexthops(fi); 723 } endfor_nexthops(fi);
724 724
725 if (alive > 0) { 725 if (alive > 0) {
726 fi->fib_flags &= ~RTNH_F_DEAD; 726 fi->fib_flags &= ~RTNH_F_DEAD;
727 ret++; 727 ret++;
728 } 728 }
729 } endfor_fib_info(); 729 } endfor_fib_info();
730 return ret; 730 return ret;
731} 731}
732 732
733static struct notifier_block dn_fib_dnaddr_notifier = { 733static struct notifier_block dn_fib_dnaddr_notifier = {
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 7322bb36e825..11d692dfb4f3 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -3,7 +3,7 @@
3 * operating system. DECnet is implemented using the BSD Socket 3 * operating system. DECnet is implemented using the BSD Socket
4 * interface as the means of communication with the user level. 4 * interface as the means of communication with the user level.
5 * 5 *
6 * DECnet Neighbour Functions (Adjacency Database and 6 * DECnet Neighbour Functions (Adjacency Database and
7 * On-Ethernet Cache) 7 * On-Ethernet Cache)
8 * 8 *
9 * Author: Steve Whitehouse <SteveW@ACM.org> 9 * Author: Steve Whitehouse <SteveW@ACM.org>
@@ -277,19 +277,19 @@ static int dn_short_output(struct sk_buff *skb)
277 struct dn_skb_cb *cb = DN_SKB_CB(skb); 277 struct dn_skb_cb *cb = DN_SKB_CB(skb);
278 278
279 279
280 if (skb_headroom(skb) < headroom) { 280 if (skb_headroom(skb) < headroom) {
281 struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom); 281 struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom);
282 if (skb2 == NULL) { 282 if (skb2 == NULL) {
283 if (net_ratelimit()) 283 if (net_ratelimit())
284 printk(KERN_CRIT "dn_short_output: no memory\n"); 284 printk(KERN_CRIT "dn_short_output: no memory\n");
285 kfree_skb(skb); 285 kfree_skb(skb);
286 return -ENOBUFS; 286 return -ENOBUFS;
287 } 287 }
288 kfree_skb(skb); 288 kfree_skb(skb);
289 skb = skb2; 289 skb = skb2;
290 if (net_ratelimit()) 290 if (net_ratelimit())
291 printk(KERN_INFO "dn_short_output: Increasing headroom\n"); 291 printk(KERN_INFO "dn_short_output: Increasing headroom\n");
292 } 292 }
293 293
294 data = skb_push(skb, sizeof(struct dn_short_packet) + 2); 294 data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
295 *((__le16 *)data) = dn_htons(skb->len - 2); 295 *((__le16 *)data) = dn_htons(skb->len - 2);
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index 39a6cf7fb566..0f244e81a377 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -33,7 +33,7 @@
33 33
34/****************************************************************************** 34/******************************************************************************
35 (c) 1995-1998 E.M. Serrat emserrat@geocities.com 35 (c) 1995-1998 E.M. Serrat emserrat@geocities.com
36 36
37 This program is free software; you can redistribute it and/or modify 37 This program is free software; you can redistribute it and/or modify
38 it under the terms of the GNU General Public License as published by 38 it under the terms of the GNU General Public License as published by
39 the Free Software Foundation; either version 2 of the License, or 39 the Free Software Foundation; either version 2 of the License, or
@@ -63,7 +63,7 @@
63#include <asm/system.h> 63#include <asm/system.h>
64#include <linux/fcntl.h> 64#include <linux/fcntl.h>
65#include <linux/mm.h> 65#include <linux/mm.h>
66#include <linux/termios.h> 66#include <linux/termios.h>
67#include <linux/interrupt.h> 67#include <linux/interrupt.h>
68#include <linux/proc_fs.h> 68#include <linux/proc_fs.h>
69#include <linux/stat.h> 69#include <linux/stat.h>
@@ -139,7 +139,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth)
139 ptr++; 139 ptr++;
140 len += 2; 140 len += 2;
141 if ((ack & 0x4000) == 0) { 141 if ((ack & 0x4000) == 0) {
142 if (oth) 142 if (oth)
143 ack ^= 0x2000; 143 ack ^= 0x2000;
144 dn_ack(sk, skb, ack); 144 dn_ack(sk, skb, ack);
145 } 145 }
@@ -152,7 +152,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth)
152 skb_pull(skb, 2); 152 skb_pull(skb, 2);
153 len += 2; 153 len += 2;
154 if ((ack & 0x4000) == 0) { 154 if ((ack & 0x4000) == 0) {
155 if (oth) 155 if (oth)
156 ack ^= 0x2000; 156 ack ^= 0x2000;
157 dn_ack(sk, skb, ack); 157 dn_ack(sk, skb, ack);
158 } 158 }
@@ -349,9 +349,9 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
349 349
350 if ((scp->state == DN_CI) || (scp->state == DN_CD)) { 350 if ((scp->state == DN_CI) || (scp->state == DN_CD)) {
351 scp->persist = 0; 351 scp->persist = 0;
352 scp->addrrem = cb->src_port; 352 scp->addrrem = cb->src_port;
353 sk->sk_state = TCP_ESTABLISHED; 353 sk->sk_state = TCP_ESTABLISHED;
354 scp->state = DN_RUN; 354 scp->state = DN_RUN;
355 scp->services_rem = cb->services; 355 scp->services_rem = cb->services;
356 scp->info_rem = cb->info; 356 scp->info_rem = cb->info;
357 scp->segsize_rem = cb->segsize; 357 scp->segsize_rem = cb->segsize;
@@ -366,13 +366,13 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
366 memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); 366 memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen);
367 } 367 }
368 } 368 }
369 dn_nsp_send_link(sk, DN_NOCHANGE, 0); 369 dn_nsp_send_link(sk, DN_NOCHANGE, 0);
370 if (!sock_flag(sk, SOCK_DEAD)) 370 if (!sock_flag(sk, SOCK_DEAD))
371 sk->sk_state_change(sk); 371 sk->sk_state_change(sk);
372 } 372 }
373 373
374out: 374out:
375 kfree_skb(skb); 375 kfree_skb(skb);
376} 376}
377 377
378static void dn_nsp_conn_ack(struct sock *sk, struct sk_buff *skb) 378static void dn_nsp_conn_ack(struct sock *sk, struct sk_buff *skb)
@@ -435,7 +435,7 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb)
435 sk->sk_state_change(sk); 435 sk->sk_state_change(sk);
436 } 436 }
437 437
438 /* 438 /*
439 * It appears that its possible for remote machines to send disc 439 * It appears that its possible for remote machines to send disc
440 * init messages with no port identifier if we are in the CI and 440 * init messages with no port identifier if we are in the CI and
441 * possibly also the CD state. Obviously we shouldn't reply with 441 * possibly also the CD state. Obviously we shouldn't reply with
@@ -519,7 +519,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
519 519
520 /* 520 /*
521 * Here we ignore erronous packets which should really 521 * Here we ignore erronous packets which should really
522 * should cause a connection abort. It is not critical 522 * should cause a connection abort. It is not critical
523 * for now though. 523 * for now though.
524 */ 524 */
525 if (lsflags & 0xf8) 525 if (lsflags & 0xf8)
@@ -530,7 +530,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
530 switch(lsflags & 0x04) { /* FCVAL INT */ 530 switch(lsflags & 0x04) { /* FCVAL INT */
531 case 0x00: /* Normal Request */ 531 case 0x00: /* Normal Request */
532 switch(lsflags & 0x03) { /* FCVAL MOD */ 532 switch(lsflags & 0x03) { /* FCVAL MOD */
533 case 0x00: /* Request count */ 533 case 0x00: /* Request count */
534 if (fcval < 0) { 534 if (fcval < 0) {
535 unsigned char p_fcval = -fcval; 535 unsigned char p_fcval = -fcval;
536 if ((scp->flowrem_dat > p_fcval) && 536 if ((scp->flowrem_dat > p_fcval) &&
@@ -541,7 +541,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
541 scp->flowrem_dat += fcval; 541 scp->flowrem_dat += fcval;
542 wake_up = 1; 542 wake_up = 1;
543 } 543 }
544 break; 544 break;
545 case 0x01: /* Stop outgoing data */ 545 case 0x01: /* Stop outgoing data */
546 scp->flowrem_sw = DN_DONTSEND; 546 scp->flowrem_sw = DN_DONTSEND;
547 break; 547 break;
@@ -557,10 +557,10 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
557 wake_up = 1; 557 wake_up = 1;
558 } 558 }
559 break; 559 break;
560 } 560 }
561 if (wake_up && !sock_flag(sk, SOCK_DEAD)) 561 if (wake_up && !sock_flag(sk, SOCK_DEAD))
562 sk->sk_state_change(sk); 562 sk->sk_state_change(sk);
563 } 563 }
564 564
565 dn_nsp_send_oth_ack(sk); 565 dn_nsp_send_oth_ack(sk);
566 566
@@ -576,38 +576,38 @@ out:
576static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue) 576static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
577{ 577{
578 int err; 578 int err;
579 579
580 /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces 580 /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
581 number of warnings when compiling with -W --ANK 581 number of warnings when compiling with -W --ANK
582 */ 582 */
583 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= 583 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
584 (unsigned)sk->sk_rcvbuf) { 584 (unsigned)sk->sk_rcvbuf) {
585 err = -ENOMEM; 585 err = -ENOMEM;
586 goto out; 586 goto out;
587 } 587 }
588 588
589 err = sk_filter(sk, skb); 589 err = sk_filter(sk, skb);
590 if (err) 590 if (err)
591 goto out; 591 goto out;
592 592
593 skb_set_owner_r(skb, sk); 593 skb_set_owner_r(skb, sk);
594 skb_queue_tail(queue, skb); 594 skb_queue_tail(queue, skb);
595 595
596 /* This code only runs from BH or BH protected context. 596 /* This code only runs from BH or BH protected context.
597 * Therefore the plain read_lock is ok here. -DaveM 597 * Therefore the plain read_lock is ok here. -DaveM
598 */ 598 */
599 read_lock(&sk->sk_callback_lock); 599 read_lock(&sk->sk_callback_lock);
600 if (!sock_flag(sk, SOCK_DEAD)) { 600 if (!sock_flag(sk, SOCK_DEAD)) {
601 struct socket *sock = sk->sk_socket; 601 struct socket *sock = sk->sk_socket;
602 wake_up_interruptible(sk->sk_sleep); 602 wake_up_interruptible(sk->sk_sleep);
603 if (sock && sock->fasync_list && 603 if (sock && sock->fasync_list &&
604 !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) 604 !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
605 __kill_fasync(sock->fasync_list, sig, 605 __kill_fasync(sock->fasync_list, sig,
606 (sig == SIGURG) ? POLL_PRI : POLL_IN); 606 (sig == SIGURG) ? POLL_PRI : POLL_IN);
607 } 607 }
608 read_unlock(&sk->sk_callback_lock); 608 read_unlock(&sk->sk_callback_lock);
609out: 609out:
610 return err; 610 return err;
611} 611}
612 612
613static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb) 613static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb)
@@ -652,16 +652,16 @@ static void dn_nsp_data(struct sock *sk, struct sk_buff *skb)
652 skb_pull(skb, 2); 652 skb_pull(skb, 2);
653 653
654 if (seq_next(scp->numdat_rcv, segnum)) { 654 if (seq_next(scp->numdat_rcv, segnum)) {
655 if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) { 655 if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) {
656 seq_add(&scp->numdat_rcv, 1); 656 seq_add(&scp->numdat_rcv, 1);
657 queued = 1; 657 queued = 1;
658 } 658 }
659 659
660 if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) { 660 if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) {
661 scp->flowloc_sw = DN_DONTSEND; 661 scp->flowloc_sw = DN_DONTSEND;
662 dn_nsp_send_link(sk, DN_DONTSEND, 0); 662 dn_nsp_send_link(sk, DN_DONTSEND, 0);
663 } 663 }
664 } 664 }
665 665
666 dn_nsp_send_data_ack(sk); 666 dn_nsp_send_data_ack(sk);
667out: 667out:
@@ -732,7 +732,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb)
732 if (decnet_debug_level & 2) 732 if (decnet_debug_level & 2)
733 printk(KERN_DEBUG "dn_nsp_rx: Message type 0x%02x\n", (int)cb->nsp_flags); 733 printk(KERN_DEBUG "dn_nsp_rx: Message type 0x%02x\n", (int)cb->nsp_flags);
734 734
735 if (cb->nsp_flags & 0x83) 735 if (cb->nsp_flags & 0x83)
736 goto free_out; 736 goto free_out;
737 737
738 /* 738 /*
@@ -852,7 +852,7 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
852 case 0x30: 852 case 0x30:
853 dn_nsp_disc_init(sk, skb); 853 dn_nsp_disc_init(sk, skb);
854 break; 854 break;
855 case 0x40: 855 case 0x40:
856 dn_nsp_disc_conf(sk, skb); 856 dn_nsp_disc_conf(sk, skb);
857 break; 857 break;
858 } 858 }
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index b342e4e8f5f8..23d5ca88dfa3 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -26,7 +26,7 @@
26 26
27/****************************************************************************** 27/******************************************************************************
28 (c) 1995-1998 E.M. Serrat emserrat@geocities.com 28 (c) 1995-1998 E.M. Serrat emserrat@geocities.com
29 29
30 This program is free software; you can redistribute it and/or modify 30 This program is free software; you can redistribute it and/or modify
31 it under the terms of the GNU General Public License as published by 31 it under the terms of the GNU General Public License as published by
32 the Free Software Foundation; either version 2 of the License, or 32 the Free Software Foundation; either version 2 of the License, or
@@ -55,7 +55,7 @@
55#include <asm/system.h> 55#include <asm/system.h>
56#include <linux/fcntl.h> 56#include <linux/fcntl.h>
57#include <linux/mm.h> 57#include <linux/mm.h>
58#include <linux/termios.h> 58#include <linux/termios.h>
59#include <linux/interrupt.h> 59#include <linux/interrupt.h>
60#include <linux/proc_fs.h> 60#include <linux/proc_fs.h>
61#include <linux/stat.h> 61#include <linux/stat.h>
@@ -176,14 +176,14 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
176 * gathering this value might turn out negative, so we make sure 176 * gathering this value might turn out negative, so we make sure
177 * that is it always positive here. 177 * that is it always positive here.
178 */ 178 */
179 if (rtt < 0) 179 if (rtt < 0)
180 rtt = -rtt; 180 rtt = -rtt;
181 /* 181 /*
182 * Add new rtt to smoothed average 182 * Add new rtt to smoothed average
183 */ 183 */
184 delta = ((rtt << 3) - srtt); 184 delta = ((rtt << 3) - srtt);
185 srtt += (delta >> 3); 185 srtt += (delta >> 3);
186 if (srtt >= 1) 186 if (srtt >= 1)
187 scp->nsp_srtt = (unsigned long)srtt; 187 scp->nsp_srtt = (unsigned long)srtt;
188 else 188 else
189 scp->nsp_srtt = 1; 189 scp->nsp_srtt = 1;
@@ -193,7 +193,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
193 */ 193 */
194 delta >>= 1; 194 delta >>= 1;
195 rttvar += ((((delta>0)?(delta):(-delta)) - rttvar) >> 2); 195 rttvar += ((((delta>0)?(delta):(-delta)) - rttvar) >> 2);
196 if (rttvar >= 1) 196 if (rttvar >= 1)
197 scp->nsp_rttvar = (unsigned long)rttvar; 197 scp->nsp_rttvar = (unsigned long)rttvar;
198 else 198 else
199 scp->nsp_rttvar = 1; 199 scp->nsp_rttvar = 1;
@@ -434,7 +434,7 @@ int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff
434 * further. 434 * further.
435 */ 435 */
436 if (xmit_count == 1) { 436 if (xmit_count == 1) {
437 if (dn_equal(segnum, acknum)) 437 if (dn_equal(segnum, acknum))
438 dn_nsp_rtt(sk, (long)(pkttime - reftime)); 438 dn_nsp_rtt(sk, (long)(pkttime - reftime));
439 439
440 if (scp->snd_window < scp->max_window) 440 if (scp->snd_window < scp->max_window)
@@ -486,16 +486,16 @@ void dn_send_conn_ack (struct sock *sk)
486{ 486{
487 struct dn_scp *scp = DN_SK(sk); 487 struct dn_scp *scp = DN_SK(sk);
488 struct sk_buff *skb = NULL; 488 struct sk_buff *skb = NULL;
489 struct nsp_conn_ack_msg *msg; 489 struct nsp_conn_ack_msg *msg;
490 490
491 if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL) 491 if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL)
492 return; 492 return;
493 493
494 msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); 494 msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3);
495 msg->msgflg = 0x24; 495 msg->msgflg = 0x24;
496 msg->dstaddr = scp->addrrem; 496 msg->dstaddr = scp->addrrem;
497 497
498 dn_nsp_send(skb); 498 dn_nsp_send(skb);
499} 499}
500 500
501void dn_nsp_delayed_ack(struct sock *sk) 501void dn_nsp_delayed_ack(struct sock *sk)
@@ -523,25 +523,25 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
523{ 523{
524 struct dn_scp *scp = DN_SK(sk); 524 struct dn_scp *scp = DN_SK(sk);
525 struct sk_buff *skb = NULL; 525 struct sk_buff *skb = NULL;
526 struct nsp_conn_init_msg *msg; 526 struct nsp_conn_init_msg *msg;
527 __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl); 527 __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl);
528 528
529 if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) 529 if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL)
530 return; 530 return;
531 531
532 msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); 532 msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg));
533 msg->msgflg = 0x28; 533 msg->msgflg = 0x28;
534 msg->dstaddr = scp->addrrem; 534 msg->dstaddr = scp->addrrem;
535 msg->srcaddr = scp->addrloc; 535 msg->srcaddr = scp->addrloc;
536 msg->services = scp->services_loc; 536 msg->services = scp->services_loc;
537 msg->info = scp->info_loc; 537 msg->info = scp->info_loc;
538 msg->segsize = dn_htons(scp->segsize_loc); 538 msg->segsize = dn_htons(scp->segsize_loc);
539 539
540 *skb_put(skb,1) = len; 540 *skb_put(skb,1) = len;
541 541
542 if (len > 0) 542 if (len > 0)
543 memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len); 543 memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len);
544 544
545 545
546 dn_nsp_send(skb); 546 dn_nsp_send(skb);
547 547
@@ -550,7 +550,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
550} 550}
551 551
552 552
553static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, 553static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
554 unsigned short reason, gfp_t gfp, 554 unsigned short reason, gfp_t gfp,
555 struct dst_entry *dst, 555 struct dst_entry *dst,
556 int ddl, unsigned char *dd, __le16 rem, __le16 loc) 556 int ddl, unsigned char *dd, __le16 rem, __le16 loc)
@@ -593,7 +593,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
593} 593}
594 594
595 595
596void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, 596void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
597 unsigned short reason, gfp_t gfp) 597 unsigned short reason, gfp_t gfp)
598{ 598{
599 struct dn_scp *scp = DN_SK(sk); 599 struct dn_scp *scp = DN_SK(sk);
@@ -605,19 +605,19 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
605 if (reason == 0) 605 if (reason == 0)
606 reason = dn_ntohs(scp->discdata_out.opt_status); 606 reason = dn_ntohs(scp->discdata_out.opt_status);
607 607
608 dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, 608 dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl,
609 scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); 609 scp->discdata_out.opt_data, scp->addrrem, scp->addrloc);
610} 610}
611 611
612 612
613void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg, 613void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,
614 unsigned short reason) 614 unsigned short reason)
615{ 615{
616 struct dn_skb_cb *cb = DN_SKB_CB(skb); 616 struct dn_skb_cb *cb = DN_SKB_CB(skb);
617 int ddl = 0; 617 int ddl = 0;
618 gfp_t gfp = GFP_ATOMIC; 618 gfp_t gfp = GFP_ATOMIC;
619 619
620 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, 620 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl,
621 NULL, cb->src_port, cb->dst_port); 621 NULL, cb->src_port, cb->dst_port);
622} 622}
623 623
@@ -676,8 +676,8 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
676 676
677 msg->srcaddr = scp->addrloc; 677 msg->srcaddr = scp->addrloc;
678 msg->services = scp->services_loc; /* Requested flow control */ 678 msg->services = scp->services_loc; /* Requested flow control */
679 msg->info = scp->info_loc; /* Version Number */ 679 msg->info = scp->info_loc; /* Version Number */
680 msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */ 680 msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */
681 681
682 if (scp->peer.sdn_objnum) 682 if (scp->peer.sdn_objnum)
683 type = 0; 683 type = 0;
@@ -692,7 +692,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
692 menuver |= DN_MENUVER_UIC; 692 menuver |= DN_MENUVER_UIC;
693 693
694 *skb_put(skb, 1) = menuver; /* Menu Version */ 694 *skb_put(skb, 1) = menuver; /* Menu Version */
695 695
696 aux = scp->accessdata.acc_userl; 696 aux = scp->accessdata.acc_userl;
697 *skb_put(skb, 1) = aux; 697 *skb_put(skb, 1) = aux;
698 if (aux > 0) 698 if (aux > 0)
@@ -718,6 +718,6 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
718 718
719 cb->rt_flags = DN_RT_F_RQR; 719 cb->rt_flags = DN_RT_F_RQR;
720 720
721 dn_nsp_send(skb); 721 dn_nsp_send(skb);
722} 722}
723 723
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 9881933167bd..efccc42ff1c6 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -43,7 +43,7 @@
43 43
44/****************************************************************************** 44/******************************************************************************
45 (c) 1995-1998 E.M. Serrat emserrat@geocities.com 45 (c) 1995-1998 E.M. Serrat emserrat@geocities.com
46 46
47 This program is free software; you can redistribute it and/or modify 47 This program is free software; you can redistribute it and/or modify
48 it under the terms of the GNU General Public License as published by 48 it under the terms of the GNU General Public License as published by
49 the Free Software Foundation; either version 2 of the License, or 49 the Free Software Foundation; either version 2 of the License, or
@@ -167,11 +167,11 @@ static void dn_dst_check_expire(unsigned long dummy)
167 while((rt=*rtp) != NULL) { 167 while((rt=*rtp) != NULL) {
168 if (atomic_read(&rt->u.dst.__refcnt) || 168 if (atomic_read(&rt->u.dst.__refcnt) ||
169 (now - rt->u.dst.lastuse) < expire) { 169 (now - rt->u.dst.lastuse) < expire) {
170 rtp = &rt->u.rt_next; 170 rtp = &rt->u.dst.dn_next;
171 continue; 171 continue;
172 } 172 }
173 *rtp = rt->u.rt_next; 173 *rtp = rt->u.dst.dn_next;
174 rt->u.rt_next = NULL; 174 rt->u.dst.dn_next = NULL;
175 dnrt_free(rt); 175 dnrt_free(rt);
176 } 176 }
177 spin_unlock(&dn_rt_hash_table[i].lock); 177 spin_unlock(&dn_rt_hash_table[i].lock);
@@ -198,11 +198,11 @@ static int dn_dst_gc(void)
198 while((rt=*rtp) != NULL) { 198 while((rt=*rtp) != NULL) {
199 if (atomic_read(&rt->u.dst.__refcnt) || 199 if (atomic_read(&rt->u.dst.__refcnt) ||
200 (now - rt->u.dst.lastuse) < expire) { 200 (now - rt->u.dst.lastuse) < expire) {
201 rtp = &rt->u.rt_next; 201 rtp = &rt->u.dst.dn_next;
202 continue; 202 continue;
203 } 203 }
204 *rtp = rt->u.rt_next; 204 *rtp = rt->u.dst.dn_next;
205 rt->u.rt_next = NULL; 205 rt->u.dst.dn_next = NULL;
206 dnrt_drop(rt); 206 dnrt_drop(rt);
207 break; 207 break;
208 } 208 }
@@ -246,7 +246,7 @@ static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu)
246 } 246 }
247} 247}
248 248
249/* 249/*
250 * When a route has been marked obsolete. (e.g. routing cache flush) 250 * When a route has been marked obsolete. (e.g. routing cache flush)
251 */ 251 */
252static struct dst_entry *dn_dst_check(struct dst_entry *dst, __u32 cookie) 252static struct dst_entry *dn_dst_check(struct dst_entry *dst, __u32 cookie)
@@ -286,8 +286,8 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
286 while((rth = *rthp) != NULL) { 286 while((rth = *rthp) != NULL) {
287 if (compare_keys(&rth->fl, &rt->fl)) { 287 if (compare_keys(&rth->fl, &rt->fl)) {
288 /* Put it first */ 288 /* Put it first */
289 *rthp = rth->u.rt_next; 289 *rthp = rth->u.dst.dn_next;
290 rcu_assign_pointer(rth->u.rt_next, 290 rcu_assign_pointer(rth->u.dst.dn_next,
291 dn_rt_hash_table[hash].chain); 291 dn_rt_hash_table[hash].chain);
292 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); 292 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
293 293
@@ -300,12 +300,12 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
300 *rp = rth; 300 *rp = rth;
301 return 0; 301 return 0;
302 } 302 }
303 rthp = &rth->u.rt_next; 303 rthp = &rth->u.dst.dn_next;
304 } 304 }
305 305
306 rcu_assign_pointer(rt->u.rt_next, dn_rt_hash_table[hash].chain); 306 rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain);
307 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); 307 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
308 308
309 dst_hold(&rt->u.dst); 309 dst_hold(&rt->u.dst);
310 rt->u.dst.__use++; 310 rt->u.dst.__use++;
311 rt->u.dst.lastuse = now; 311 rt->u.dst.lastuse = now;
@@ -326,8 +326,8 @@ void dn_run_flush(unsigned long dummy)
326 goto nothing_to_declare; 326 goto nothing_to_declare;
327 327
328 for(; rt; rt=next) { 328 for(; rt; rt=next) {
329 next = rt->u.rt_next; 329 next = rt->u.dst.dn_next;
330 rt->u.rt_next = NULL; 330 rt->u.dst.dn_next = NULL;
331 dst_free((struct dst_entry *)rt); 331 dst_free((struct dst_entry *)rt);
332 } 332 }
333 333
@@ -506,23 +506,23 @@ static int dn_route_rx_long(struct sk_buff *skb)
506 skb_pull(skb, 20); 506 skb_pull(skb, 20);
507 skb->h.raw = skb->data; 507 skb->h.raw = skb->data;
508 508
509 /* Destination info */ 509 /* Destination info */
510 ptr += 2; 510 ptr += 2;
511 cb->dst = dn_eth2dn(ptr); 511 cb->dst = dn_eth2dn(ptr);
512 if (memcmp(ptr, dn_hiord_addr, 4) != 0) 512 if (memcmp(ptr, dn_hiord_addr, 4) != 0)
513 goto drop_it; 513 goto drop_it;
514 ptr += 6; 514 ptr += 6;
515 515
516 516
517 /* Source info */ 517 /* Source info */
518 ptr += 2; 518 ptr += 2;
519 cb->src = dn_eth2dn(ptr); 519 cb->src = dn_eth2dn(ptr);
520 if (memcmp(ptr, dn_hiord_addr, 4) != 0) 520 if (memcmp(ptr, dn_hiord_addr, 4) != 0)
521 goto drop_it; 521 goto drop_it;
522 ptr += 6; 522 ptr += 6;
523 /* Other junk */ 523 /* Other junk */
524 ptr++; 524 ptr++;
525 cb->hops = *ptr++; /* Visit Count */ 525 cb->hops = *ptr++; /* Visit Count */
526 526
527 return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet); 527 return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet);
528 528
@@ -545,16 +545,16 @@ static int dn_route_rx_short(struct sk_buff *skb)
545 skb->h.raw = skb->data; 545 skb->h.raw = skb->data;
546 546
547 cb->dst = *(__le16 *)ptr; 547 cb->dst = *(__le16 *)ptr;
548 ptr += 2; 548 ptr += 2;
549 cb->src = *(__le16 *)ptr; 549 cb->src = *(__le16 *)ptr;
550 ptr += 2; 550 ptr += 2;
551 cb->hops = *ptr & 0x3f; 551 cb->hops = *ptr & 0x3f;
552 552
553 return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet); 553 return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet);
554 554
555drop_it: 555drop_it:
556 kfree_skb(skb); 556 kfree_skb(skb);
557 return NET_RX_DROP; 557 return NET_RX_DROP;
558} 558}
559 559
560static int dn_route_discard(struct sk_buff *skb) 560static int dn_route_discard(struct sk_buff *skb)
@@ -626,20 +626,20 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
626 cb->rt_flags = flags; 626 cb->rt_flags = flags;
627 627
628 if (decnet_debug_level & 1) 628 if (decnet_debug_level & 1)
629 printk(KERN_DEBUG 629 printk(KERN_DEBUG
630 "dn_route_rcv: got 0x%02x from %s [%d %d %d]\n", 630 "dn_route_rcv: got 0x%02x from %s [%d %d %d]\n",
631 (int)flags, (dev) ? dev->name : "???", len, skb->len, 631 (int)flags, (dev) ? dev->name : "???", len, skb->len,
632 padlen); 632 padlen);
633 633
634 if (flags & DN_RT_PKT_CNTL) { 634 if (flags & DN_RT_PKT_CNTL) {
635 if (unlikely(skb_linearize(skb))) 635 if (unlikely(skb_linearize(skb)))
636 goto dump_it; 636 goto dump_it;
637 637
638 switch(flags & DN_RT_CNTL_MSK) { 638 switch(flags & DN_RT_CNTL_MSK) {
639 case DN_RT_PKT_INIT: 639 case DN_RT_PKT_INIT:
640 dn_dev_init_pkt(skb); 640 dn_dev_init_pkt(skb);
641 break; 641 break;
642 case DN_RT_PKT_VERI: 642 case DN_RT_PKT_VERI:
643 dn_dev_veri_pkt(skb); 643 dn_dev_veri_pkt(skb);
644 break; 644 break;
645 } 645 }
@@ -648,31 +648,31 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
648 goto dump_it; 648 goto dump_it;
649 649
650 switch(flags & DN_RT_CNTL_MSK) { 650 switch(flags & DN_RT_CNTL_MSK) {
651 case DN_RT_PKT_HELO: 651 case DN_RT_PKT_HELO:
652 return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_route_ptp_hello); 652 return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_route_ptp_hello);
653 653
654 case DN_RT_PKT_L1RT: 654 case DN_RT_PKT_L1RT:
655 case DN_RT_PKT_L2RT: 655 case DN_RT_PKT_L2RT:
656 return NF_HOOK(PF_DECnet, NF_DN_ROUTE, skb, skb->dev, NULL, dn_route_discard); 656 return NF_HOOK(PF_DECnet, NF_DN_ROUTE, skb, skb->dev, NULL, dn_route_discard);
657 case DN_RT_PKT_ERTH: 657 case DN_RT_PKT_ERTH:
658 return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_router_hello); 658 return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_router_hello);
659 659
660 case DN_RT_PKT_EEDH: 660 case DN_RT_PKT_EEDH:
661 return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_endnode_hello); 661 return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_endnode_hello);
662 } 662 }
663 } else { 663 } else {
664 if (dn->parms.state != DN_DEV_S_RU) 664 if (dn->parms.state != DN_DEV_S_RU)
665 goto dump_it; 665 goto dump_it;
666 666
667 skb_pull(skb, 1); /* Pull flags */ 667 skb_pull(skb, 1); /* Pull flags */
668 668
669 switch(flags & DN_RT_PKT_MSK) { 669 switch(flags & DN_RT_PKT_MSK) {
670 case DN_RT_PKT_LONG: 670 case DN_RT_PKT_LONG:
671 return dn_route_rx_long(skb); 671 return dn_route_rx_long(skb);
672 case DN_RT_PKT_SHORT: 672 case DN_RT_PKT_SHORT:
673 return dn_route_rx_short(skb); 673 return dn_route_rx_short(skb);
674 } 674 }
675 } 675 }
676 676
677dump_it: 677dump_it:
678 kfree_skb(skb); 678 kfree_skb(skb);
@@ -815,8 +815,8 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
815 rt->u.dst.neighbour = n; 815 rt->u.dst.neighbour = n;
816 } 816 }
817 817
818 if (rt->u.dst.metrics[RTAX_MTU-1] == 0 || 818 if (rt->u.dst.metrics[RTAX_MTU-1] == 0 ||
819 rt->u.dst.metrics[RTAX_MTU-1] > rt->u.dst.dev->mtu) 819 rt->u.dst.metrics[RTAX_MTU-1] > rt->u.dst.dev->mtu)
820 rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; 820 rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu;
821 mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst)); 821 mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst));
822 if (rt->u.dst.metrics[RTAX_ADVMSS-1] == 0 || 822 if (rt->u.dst.metrics[RTAX_ADVMSS-1] == 0 ||
@@ -876,7 +876,7 @@ static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_re
876 876
877static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *oldflp, int try_hard) 877static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *oldflp, int try_hard)
878{ 878{
879 struct flowi fl = { .nl_u = { .dn_u = 879 struct flowi fl = { .nl_u = { .dn_u =
880 { .daddr = oldflp->fld_dst, 880 { .daddr = oldflp->fld_dst,
881 .saddr = oldflp->fld_src, 881 .saddr = oldflp->fld_src,
882 .scope = RT_SCOPE_UNIVERSE, 882 .scope = RT_SCOPE_UNIVERSE,
@@ -899,7 +899,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
899 "dn_route_output_slow: dst=%04x src=%04x mark=%d" 899 "dn_route_output_slow: dst=%04x src=%04x mark=%d"
900 " iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst), 900 " iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst),
901 dn_ntohs(oldflp->fld_src), 901 dn_ntohs(oldflp->fld_src),
902 oldflp->mark, loopback_dev.ifindex, oldflp->oif); 902 oldflp->mark, loopback_dev.ifindex, oldflp->oif);
903 903
904 /* If we have an output interface, verify its a DECnet device */ 904 /* If we have an output interface, verify its a DECnet device */
905 if (oldflp->oif) { 905 if (oldflp->oif) {
@@ -982,19 +982,19 @@ source_ok:
982 if (err != -ESRCH) 982 if (err != -ESRCH)
983 goto out; 983 goto out;
984 /* 984 /*
985 * Here the fallback is basically the standard algorithm for 985 * Here the fallback is basically the standard algorithm for
986 * routing in endnodes which is described in the DECnet routing 986 * routing in endnodes which is described in the DECnet routing
987 * docs 987 * docs
988 * 988 *
989 * If we are not trying hard, look in neighbour cache. 989 * If we are not trying hard, look in neighbour cache.
990 * The result is tested to ensure that if a specific output 990 * The result is tested to ensure that if a specific output
991 * device/source address was requested, then we honour that 991 * device/source address was requested, then we honour that
992 * here 992 * here
993 */ 993 */
994 if (!try_hard) { 994 if (!try_hard) {
995 neigh = neigh_lookup_nodev(&dn_neigh_table, &fl.fld_dst); 995 neigh = neigh_lookup_nodev(&dn_neigh_table, &fl.fld_dst);
996 if (neigh) { 996 if (neigh) {
997 if ((oldflp->oif && 997 if ((oldflp->oif &&
998 (neigh->dev->ifindex != oldflp->oif)) || 998 (neigh->dev->ifindex != oldflp->oif)) ||
999 (oldflp->fld_src && 999 (oldflp->fld_src &&
1000 (!dn_dev_islocal(neigh->dev, 1000 (!dn_dev_islocal(neigh->dev,
@@ -1044,7 +1044,7 @@ select_source:
1044 if (fl.fld_src == 0) { 1044 if (fl.fld_src == 0) {
1045 fl.fld_src = dnet_select_source(dev_out, gateway, 1045 fl.fld_src = dnet_select_source(dev_out, gateway,
1046 res.type == RTN_LOCAL ? 1046 res.type == RTN_LOCAL ?
1047 RT_SCOPE_HOST : 1047 RT_SCOPE_HOST :
1048 RT_SCOPE_LINK); 1048 RT_SCOPE_LINK);
1049 if (fl.fld_src == 0 && res.type != RTN_LOCAL) 1049 if (fl.fld_src == 0 && res.type != RTN_LOCAL)
1050 goto e_addr; 1050 goto e_addr;
@@ -1074,14 +1074,14 @@ select_source:
1074 if (res.fi->fib_nhs > 1 && fl.oif == 0) 1074 if (res.fi->fib_nhs > 1 && fl.oif == 0)
1075 dn_fib_select_multipath(&fl, &res); 1075 dn_fib_select_multipath(&fl, &res);
1076 1076
1077 /* 1077 /*
1078 * We could add some logic to deal with default routes here and 1078 * We could add some logic to deal with default routes here and
1079 * get rid of some of the special casing above. 1079 * get rid of some of the special casing above.
1080 */ 1080 */
1081 1081
1082 if (!fl.fld_src) 1082 if (!fl.fld_src)
1083 fl.fld_src = DN_FIB_RES_PREFSRC(res); 1083 fl.fld_src = DN_FIB_RES_PREFSRC(res);
1084 1084
1085 if (dev_out) 1085 if (dev_out)
1086 dev_put(dev_out); 1086 dev_put(dev_out);
1087 dev_out = DN_FIB_RES_DEV(res); 1087 dev_out = DN_FIB_RES_DEV(res);
@@ -1144,8 +1144,8 @@ out:
1144 return err; 1144 return err;
1145 1145
1146e_addr: 1146e_addr:
1147 err = -EADDRNOTAVAIL; 1147 err = -EADDRNOTAVAIL;
1148 goto done; 1148 goto done;
1149e_inval: 1149e_inval:
1150 err = -EINVAL; 1150 err = -EINVAL;
1151 goto done; 1151 goto done;
@@ -1169,7 +1169,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
1169 if (!(flags & MSG_TRYHARD)) { 1169 if (!(flags & MSG_TRYHARD)) {
1170 rcu_read_lock_bh(); 1170 rcu_read_lock_bh();
1171 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt; 1171 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt;
1172 rt = rcu_dereference(rt->u.rt_next)) { 1172 rt = rcu_dereference(rt->u.dst.dn_next)) {
1173 if ((flp->fld_dst == rt->fl.fld_dst) && 1173 if ((flp->fld_dst == rt->fl.fld_dst) &&
1174 (flp->fld_src == rt->fl.fld_src) && 1174 (flp->fld_src == rt->fl.fld_src) &&
1175 (flp->mark == rt->fl.mark) && 1175 (flp->mark == rt->fl.mark) &&
@@ -1223,7 +1223,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
1223 int flags = 0; 1223 int flags = 0;
1224 __le16 gateway = 0; 1224 __le16 gateway = 0;
1225 __le16 local_src = 0; 1225 __le16 local_src = 0;
1226 struct flowi fl = { .nl_u = { .dn_u = 1226 struct flowi fl = { .nl_u = { .dn_u =
1227 { .daddr = cb->dst, 1227 { .daddr = cb->dst,
1228 .saddr = cb->src, 1228 .saddr = cb->src,
1229 .scope = RT_SCOPE_UNIVERSE, 1229 .scope = RT_SCOPE_UNIVERSE,
@@ -1311,7 +1311,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
1311 if (res.fi->fib_nhs > 1 && fl.oif == 0) 1311 if (res.fi->fib_nhs > 1 && fl.oif == 0)
1312 dn_fib_select_multipath(&fl, &res); 1312 dn_fib_select_multipath(&fl, &res);
1313 1313
1314 /* 1314 /*
1315 * Check for out_dev == in_dev. We use the RTCF_DOREDIRECT 1315 * Check for out_dev == in_dev. We use the RTCF_DOREDIRECT
1316 * flag as a hint to set the intra-ethernet bit when 1316 * flag as a hint to set the intra-ethernet bit when
1317 * forwarding. If we've got NAT in operation, we don't do 1317 * forwarding. If we've got NAT in operation, we don't do
@@ -1443,9 +1443,9 @@ int dn_route_input(struct sk_buff *skb)
1443 1443
1444 rcu_read_lock(); 1444 rcu_read_lock();
1445 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; 1445 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL;
1446 rt = rcu_dereference(rt->u.rt_next)) { 1446 rt = rcu_dereference(rt->u.dst.dn_next)) {
1447 if ((rt->fl.fld_src == cb->src) && 1447 if ((rt->fl.fld_src == cb->src) &&
1448 (rt->fl.fld_dst == cb->dst) && 1448 (rt->fl.fld_dst == cb->dst) &&
1449 (rt->fl.oif == 0) && 1449 (rt->fl.oif == 0) &&
1450 (rt->fl.mark == skb->mark) && 1450 (rt->fl.mark == skb->mark) &&
1451 (rt->fl.iif == cb->iif)) { 1451 (rt->fl.iif == cb->iif)) {
@@ -1514,8 +1514,8 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
1514 1514
1515nlmsg_failure: 1515nlmsg_failure:
1516rtattr_failure: 1516rtattr_failure:
1517 skb_trim(skb, b - skb->data); 1517 skb_trim(skb, b - skb->data);
1518 return -1; 1518 return -1;
1519} 1519}
1520 1520
1521/* 1521/*
@@ -1627,12 +1627,12 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
1627 rcu_read_lock_bh(); 1627 rcu_read_lock_bh();
1628 for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0; 1628 for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0;
1629 rt; 1629 rt;
1630 rt = rcu_dereference(rt->u.rt_next), idx++) { 1630 rt = rcu_dereference(rt->u.dst.dn_next), idx++) {
1631 if (idx < s_idx) 1631 if (idx < s_idx)
1632 continue; 1632 continue;
1633 skb->dst = dst_clone(&rt->u.dst); 1633 skb->dst = dst_clone(&rt->u.dst);
1634 if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).pid, 1634 if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).pid,
1635 cb->nlh->nlmsg_seq, RTM_NEWROUTE, 1635 cb->nlh->nlmsg_seq, RTM_NEWROUTE,
1636 1, NLM_F_MULTI) <= 0) { 1636 1, NLM_F_MULTI) <= 0) {
1637 dst_release(xchg(&skb->dst, NULL)); 1637 dst_release(xchg(&skb->dst, NULL));
1638 rcu_read_unlock_bh(); 1638 rcu_read_unlock_bh();
@@ -1673,7 +1673,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
1673{ 1673{
1674 struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); 1674 struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private);
1675 1675
1676 rt = rt->u.rt_next; 1676 rt = rt->u.dst.dn_next;
1677 while(!rt) { 1677 while(!rt) {
1678 rcu_read_unlock_bh(); 1678 rcu_read_unlock_bh();
1679 if (--s->bucket < 0) 1679 if (--s->bucket < 0)
@@ -1721,7 +1721,7 @@ static int dn_rt_cache_seq_show(struct seq_file *seq, void *v)
1721 rt->u.dst.__use, 1721 rt->u.dst.__use,
1722 (int) dst_metric(&rt->u.dst, RTAX_RTT)); 1722 (int) dst_metric(&rt->u.dst, RTAX_RTT));
1723 return 0; 1723 return 0;
1724} 1724}
1725 1725
1726static struct seq_operations dn_rt_cache_seq_ops = { 1726static struct seq_operations dn_rt_cache_seq_ops = {
1727 .start = dn_rt_cache_seq_start, 1727 .start = dn_rt_cache_seq_start,
@@ -1778,38 +1778,38 @@ void __init dn_route_init(void)
1778 for(order = 0; (1UL << order) < goal; order++) 1778 for(order = 0; (1UL << order) < goal; order++)
1779 /* NOTHING */; 1779 /* NOTHING */;
1780 1780
1781 /* 1781 /*
1782 * Only want 1024 entries max, since the table is very, very unlikely 1782 * Only want 1024 entries max, since the table is very, very unlikely
1783 * to be larger than that. 1783 * to be larger than that.
1784 */ 1784 */
1785 while(order && ((((1UL << order) * PAGE_SIZE) / 1785 while(order && ((((1UL << order) * PAGE_SIZE) /
1786 sizeof(struct dn_rt_hash_bucket)) >= 2048)) 1786 sizeof(struct dn_rt_hash_bucket)) >= 2048))
1787 order--; 1787 order--;
1788 1788
1789 do { 1789 do {
1790 dn_rt_hash_mask = (1UL << order) * PAGE_SIZE / 1790 dn_rt_hash_mask = (1UL << order) * PAGE_SIZE /
1791 sizeof(struct dn_rt_hash_bucket); 1791 sizeof(struct dn_rt_hash_bucket);
1792 while(dn_rt_hash_mask & (dn_rt_hash_mask - 1)) 1792 while(dn_rt_hash_mask & (dn_rt_hash_mask - 1))
1793 dn_rt_hash_mask--; 1793 dn_rt_hash_mask--;
1794 dn_rt_hash_table = (struct dn_rt_hash_bucket *) 1794 dn_rt_hash_table = (struct dn_rt_hash_bucket *)
1795 __get_free_pages(GFP_ATOMIC, order); 1795 __get_free_pages(GFP_ATOMIC, order);
1796 } while (dn_rt_hash_table == NULL && --order > 0); 1796 } while (dn_rt_hash_table == NULL && --order > 0);
1797 1797
1798 if (!dn_rt_hash_table) 1798 if (!dn_rt_hash_table)
1799 panic("Failed to allocate DECnet route cache hash table\n"); 1799 panic("Failed to allocate DECnet route cache hash table\n");
1800 1800
1801 printk(KERN_INFO 1801 printk(KERN_INFO
1802 "DECnet: Routing cache hash table of %u buckets, %ldKbytes\n", 1802 "DECnet: Routing cache hash table of %u buckets, %ldKbytes\n",
1803 dn_rt_hash_mask, 1803 dn_rt_hash_mask,
1804 (long)(dn_rt_hash_mask*sizeof(struct dn_rt_hash_bucket))/1024); 1804 (long)(dn_rt_hash_mask*sizeof(struct dn_rt_hash_bucket))/1024);
1805 1805
1806 dn_rt_hash_mask--; 1806 dn_rt_hash_mask--;
1807 for(i = 0; i <= dn_rt_hash_mask; i++) { 1807 for(i = 0; i <= dn_rt_hash_mask; i++) {
1808 spin_lock_init(&dn_rt_hash_table[i].lock); 1808 spin_lock_init(&dn_rt_hash_table[i].lock);
1809 dn_rt_hash_table[i].chain = NULL; 1809 dn_rt_hash_table[i].chain = NULL;
1810 } 1810 }
1811 1811
1812 dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1); 1812 dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
1813 1813
1814 proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops); 1814 proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
1815} 1815}
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index 720501e1ae20..780a141f8342 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -60,7 +60,7 @@ struct dn_hash
60#define dz_prefix(key,dz) ((key).datum) 60#define dz_prefix(key,dz) ((key).datum)
61 61
62#define for_nexthops(fi) { int nhsel; const struct dn_fib_nh *nh;\ 62#define for_nexthops(fi) { int nhsel; const struct dn_fib_nh *nh;\
63 for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) 63 for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++)
64 64
65#define endfor_nexthops(fi) } 65#define endfor_nexthops(fi) }
66 66
@@ -290,82 +290,82 @@ static inline size_t dn_fib_nlmsg_size(struct dn_fib_info *fi)
290} 290}
291 291
292static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, 292static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
293 u32 tb_id, u8 type, u8 scope, void *dst, int dst_len, 293 u32 tb_id, u8 type, u8 scope, void *dst, int dst_len,
294 struct dn_fib_info *fi, unsigned int flags) 294 struct dn_fib_info *fi, unsigned int flags)
295{ 295{
296 struct rtmsg *rtm; 296 struct rtmsg *rtm;
297 struct nlmsghdr *nlh; 297 struct nlmsghdr *nlh;
298 unsigned char *b = skb->tail; 298 unsigned char *b = skb->tail;
299 299
300 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); 300 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags);
301 rtm = NLMSG_DATA(nlh); 301 rtm = NLMSG_DATA(nlh);
302 rtm->rtm_family = AF_DECnet; 302 rtm->rtm_family = AF_DECnet;
303 rtm->rtm_dst_len = dst_len; 303 rtm->rtm_dst_len = dst_len;
304 rtm->rtm_src_len = 0; 304 rtm->rtm_src_len = 0;
305 rtm->rtm_tos = 0; 305 rtm->rtm_tos = 0;
306 rtm->rtm_table = tb_id; 306 rtm->rtm_table = tb_id;
307 RTA_PUT_U32(skb, RTA_TABLE, tb_id); 307 RTA_PUT_U32(skb, RTA_TABLE, tb_id);
308 rtm->rtm_flags = fi->fib_flags; 308 rtm->rtm_flags = fi->fib_flags;
309 rtm->rtm_scope = scope; 309 rtm->rtm_scope = scope;
310 rtm->rtm_type = type; 310 rtm->rtm_type = type;
311 if (rtm->rtm_dst_len) 311 if (rtm->rtm_dst_len)
312 RTA_PUT(skb, RTA_DST, 2, dst); 312 RTA_PUT(skb, RTA_DST, 2, dst);
313 rtm->rtm_protocol = fi->fib_protocol; 313 rtm->rtm_protocol = fi->fib_protocol;
314 if (fi->fib_priority) 314 if (fi->fib_priority)
315 RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority); 315 RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority);
316 if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0) 316 if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0)
317 goto rtattr_failure; 317 goto rtattr_failure;
318 if (fi->fib_nhs == 1) { 318 if (fi->fib_nhs == 1) {
319 if (fi->fib_nh->nh_gw) 319 if (fi->fib_nh->nh_gw)
320 RTA_PUT(skb, RTA_GATEWAY, 2, &fi->fib_nh->nh_gw); 320 RTA_PUT(skb, RTA_GATEWAY, 2, &fi->fib_nh->nh_gw);
321 if (fi->fib_nh->nh_oif) 321 if (fi->fib_nh->nh_oif)
322 RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif); 322 RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif);
323 } 323 }
324 if (fi->fib_nhs > 1) { 324 if (fi->fib_nhs > 1) {
325 struct rtnexthop *nhp; 325 struct rtnexthop *nhp;
326 struct rtattr *mp_head; 326 struct rtattr *mp_head;
327 if (skb_tailroom(skb) <= RTA_SPACE(0)) 327 if (skb_tailroom(skb) <= RTA_SPACE(0))
328 goto rtattr_failure; 328 goto rtattr_failure;
329 mp_head = (struct rtattr *)skb_put(skb, RTA_SPACE(0)); 329 mp_head = (struct rtattr *)skb_put(skb, RTA_SPACE(0));
330 330
331 for_nexthops(fi) { 331 for_nexthops(fi) {
332 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) 332 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4))
333 goto rtattr_failure; 333 goto rtattr_failure;
334 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); 334 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp)));
335 nhp->rtnh_flags = nh->nh_flags & 0xFF; 335 nhp->rtnh_flags = nh->nh_flags & 0xFF;
336 nhp->rtnh_hops = nh->nh_weight - 1; 336 nhp->rtnh_hops = nh->nh_weight - 1;
337 nhp->rtnh_ifindex = nh->nh_oif; 337 nhp->rtnh_ifindex = nh->nh_oif;
338 if (nh->nh_gw) 338 if (nh->nh_gw)
339 RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); 339 RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw);
340 nhp->rtnh_len = skb->tail - (unsigned char *)nhp; 340 nhp->rtnh_len = skb->tail - (unsigned char *)nhp;
341 } endfor_nexthops(fi); 341 } endfor_nexthops(fi);
342 mp_head->rta_type = RTA_MULTIPATH; 342 mp_head->rta_type = RTA_MULTIPATH;
343 mp_head->rta_len = skb->tail - (u8*)mp_head; 343 mp_head->rta_len = skb->tail - (u8*)mp_head;
344 } 344 }
345 345
346 nlh->nlmsg_len = skb->tail - b; 346 nlh->nlmsg_len = skb->tail - b;
347 return skb->len; 347 return skb->len;
348 348
349 349
350nlmsg_failure: 350nlmsg_failure:
351rtattr_failure: 351rtattr_failure:
352 skb_trim(skb, b - skb->data); 352 skb_trim(skb, b - skb->data);
353 return -EMSGSIZE; 353 return -EMSGSIZE;
354} 354}
355 355
356 356
357static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id, 357static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,
358 struct nlmsghdr *nlh, struct netlink_skb_parms *req) 358 struct nlmsghdr *nlh, struct netlink_skb_parms *req)
359{ 359{
360 struct sk_buff *skb; 360 struct sk_buff *skb;
361 u32 pid = req ? req->pid : 0; 361 u32 pid = req ? req->pid : 0;
362 int err = -ENOBUFS; 362 int err = -ENOBUFS;
363 363
364 skb = nlmsg_new(dn_fib_nlmsg_size(DN_FIB_INFO(f)), GFP_KERNEL); 364 skb = nlmsg_new(dn_fib_nlmsg_size(DN_FIB_INFO(f)), GFP_KERNEL);
365 if (skb == NULL) 365 if (skb == NULL)
366 goto errout; 366 goto errout;
367 367
368 err = dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id, 368 err = dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id,
369 f->fn_type, f->fn_scope, &f->fn_key, z, 369 f->fn_type, f->fn_scope, &f->fn_key, z,
370 DN_FIB_INFO(f), 0); 370 DN_FIB_INFO(f), 0);
371 if (err < 0) { 371 if (err < 0) {
@@ -380,7 +380,7 @@ errout:
380 rtnl_set_sk_err(RTNLGRP_DECnet_ROUTE, err); 380 rtnl_set_sk_err(RTNLGRP_DECnet_ROUTE, err);
381} 381}
382 382
383static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, 383static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
384 struct netlink_callback *cb, 384 struct netlink_callback *cb,
385 struct dn_fib_table *tb, 385 struct dn_fib_table *tb,
386 struct dn_zone *dz, 386 struct dn_zone *dz,
@@ -394,12 +394,12 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
394 continue; 394 continue;
395 if (f->fn_state & DN_S_ZOMBIE) 395 if (f->fn_state & DN_S_ZOMBIE)
396 continue; 396 continue;
397 if (dn_fib_dump_info(skb, NETLINK_CB(cb->skb).pid, 397 if (dn_fib_dump_info(skb, NETLINK_CB(cb->skb).pid,
398 cb->nlh->nlmsg_seq, 398 cb->nlh->nlmsg_seq,
399 RTM_NEWROUTE, 399 RTM_NEWROUTE,
400 tb->n, 400 tb->n,
401 (f->fn_state & DN_S_ZOMBIE) ? 0 : f->fn_type, 401 (f->fn_state & DN_S_ZOMBIE) ? 0 : f->fn_type,
402 f->fn_scope, &f->fn_key, dz->dz_order, 402 f->fn_scope, &f->fn_key, dz->dz_order,
403 f->fn_info, NLM_F_MULTI) < 0) { 403 f->fn_info, NLM_F_MULTI) < 0) {
404 cb->args[4] = i; 404 cb->args[4] = i;
405 return -1; 405 return -1;
@@ -409,7 +409,7 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
409 return skb->len; 409 return skb->len;
410} 410}
411 411
412static __inline__ int dn_hash_dump_zone(struct sk_buff *skb, 412static __inline__ int dn_hash_dump_zone(struct sk_buff *skb,
413 struct netlink_callback *cb, 413 struct netlink_callback *cb,
414 struct dn_fib_table *tb, 414 struct dn_fib_table *tb,
415 struct dn_zone *dz) 415 struct dn_zone *dz)
@@ -433,10 +433,10 @@ static __inline__ int dn_hash_dump_zone(struct sk_buff *skb,
433 return skb->len; 433 return skb->len;
434} 434}
435 435
436static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb, 436static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb,
437 struct netlink_callback *cb) 437 struct netlink_callback *cb)
438{ 438{
439 int m, s_m; 439 int m, s_m;
440 struct dn_zone *dz; 440 struct dn_zone *dz;
441 struct dn_hash *table = (struct dn_hash *)tb->data; 441 struct dn_hash *table = (struct dn_hash *)tb->data;
442 442
@@ -457,7 +457,7 @@ static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb,
457 read_unlock(&dn_fib_tables_lock); 457 read_unlock(&dn_fib_tables_lock);
458 cb->args[2] = m; 458 cb->args[2] = m;
459 459
460 return skb->len; 460 return skb->len;
461} 461}
462 462
463int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb) 463int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
@@ -482,7 +482,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
482 goto next; 482 goto next;
483 if (dumped) 483 if (dumped)
484 memset(&cb->args[2], 0, sizeof(cb->args) - 484 memset(&cb->args[2], 0, sizeof(cb->args) -
485 2 * sizeof(cb->args[0])); 485 2 * sizeof(cb->args[0]));
486 if (tb->dump(tb, skb, cb) < 0) 486 if (tb->dump(tb, skb, cb) < 0)
487 goto out; 487 goto out;
488 dumped = 1; 488 dumped = 1;
@@ -503,13 +503,13 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct
503 struct dn_fib_node *new_f, *f, **fp, **del_fp; 503 struct dn_fib_node *new_f, *f, **fp, **del_fp;
504 struct dn_zone *dz; 504 struct dn_zone *dz;
505 struct dn_fib_info *fi; 505 struct dn_fib_info *fi;
506 int z = r->rtm_dst_len; 506 int z = r->rtm_dst_len;
507 int type = r->rtm_type; 507 int type = r->rtm_type;
508 dn_fib_key_t key; 508 dn_fib_key_t key;
509 int err; 509 int err;
510 510
511 if (z > 16) 511 if (z > 16)
512 return -EINVAL; 512 return -EINVAL;
513 513
514 dz = table->dh_zones[z]; 514 dz = table->dh_zones[z];
515 if (!dz && !(dz = dn_new_zone(table, z))) 515 if (!dz && !(dz = dn_new_zone(table, z)))
@@ -524,8 +524,8 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct
524 key = dz_key(dst, dz); 524 key = dz_key(dst, dz);
525 } 525 }
526 526
527 if ((fi = dn_fib_create_info(r, rta, n, &err)) == NULL) 527 if ((fi = dn_fib_create_info(r, rta, n, &err)) == NULL)
528 return err; 528 return err;
529 529
530 if (dz->dz_nent > (dz->dz_divisor << 2) && 530 if (dz->dz_nent > (dz->dz_divisor << 2) &&
531 dz->dz_divisor > DN_MAX_DIVISOR && 531 dz->dz_divisor > DN_MAX_DIVISOR &&
@@ -624,9 +624,9 @@ replace:
624 dn_rt_cache_flush(-1); 624 dn_rt_cache_flush(-1);
625 } 625 }
626 626
627 dn_rtmsg_fib(RTM_NEWROUTE, new_f, z, tb->n, n, req); 627 dn_rtmsg_fib(RTM_NEWROUTE, new_f, z, tb->n, n, req);
628 628
629 return 0; 629 return 0;
630out: 630out:
631 dn_fib_release_info(fi); 631 dn_fib_release_info(fi);
632 return err; 632 return err;
@@ -637,14 +637,14 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
637{ 637{
638 struct dn_hash *table = (struct dn_hash*)tb->data; 638 struct dn_hash *table = (struct dn_hash*)tb->data;
639 struct dn_fib_node **fp, **del_fp, *f; 639 struct dn_fib_node **fp, **del_fp, *f;
640 int z = r->rtm_dst_len; 640 int z = r->rtm_dst_len;
641 struct dn_zone *dz; 641 struct dn_zone *dz;
642 dn_fib_key_t key; 642 dn_fib_key_t key;
643 int matched; 643 int matched;
644 644
645 645
646 if (z > 16) 646 if (z > 16)
647 return -EINVAL; 647 return -EINVAL;
648 648
649 if ((dz = table->dh_zones[z]) == NULL) 649 if ((dz = table->dh_zones[z]) == NULL)
650 return -ESRCH; 650 return -ESRCH;
@@ -680,7 +680,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
680 if (del_fp == NULL && 680 if (del_fp == NULL &&
681 (!r->rtm_type || f->fn_type == r->rtm_type) && 681 (!r->rtm_type || f->fn_type == r->rtm_type) &&
682 (r->rtm_scope == RT_SCOPE_NOWHERE || f->fn_scope == r->rtm_scope) && 682 (r->rtm_scope == RT_SCOPE_NOWHERE || f->fn_scope == r->rtm_scope) &&
683 (!r->rtm_protocol || 683 (!r->rtm_protocol ||
684 fi->fib_protocol == r->rtm_protocol) && 684 fi->fib_protocol == r->rtm_protocol) &&
685 dn_fib_nh_match(r, n, rta, fi) == 0) 685 dn_fib_nh_match(r, n, rta, fi) == 0)
686 del_fp = fp; 686 del_fp = fp;
@@ -688,7 +688,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
688 688
689 if (del_fp) { 689 if (del_fp) {
690 f = *del_fp; 690 f = *del_fp;
691 dn_rtmsg_fib(RTM_DELROUTE, f, z, tb->n, n, req); 691 dn_rtmsg_fib(RTM_DELROUTE, f, z, tb->n, n, req);
692 692
693 if (matched != 1) { 693 if (matched != 1) {
694 write_lock_bh(&dn_fib_tables_lock); 694 write_lock_bh(&dn_fib_tables_lock);
@@ -712,7 +712,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
712 return 0; 712 return 0;
713 } 713 }
714 714
715 return -ESRCH; 715 return -ESRCH;
716} 716}
717 717
718static inline int dn_flush_list(struct dn_fib_node **fp, int z, struct dn_hash *table) 718static inline int dn_flush_list(struct dn_fib_node **fp, int z, struct dn_hash *table)
@@ -759,7 +759,7 @@ static int dn_fib_table_flush(struct dn_fib_table *tb)
759 759
760static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, struct dn_fib_res *res) 760static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, struct dn_fib_res *res)
761{ 761{
762 int err; 762 int err;
763 struct dn_zone *dz; 763 struct dn_zone *dz;
764 struct dn_hash *t = (struct dn_hash *)tb->data; 764 struct dn_hash *t = (struct dn_hash *)tb->data;
765 765
@@ -788,7 +788,7 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp,
788 788
789 if (err == 0) { 789 if (err == 0) {
790 res->type = f->fn_type; 790 res->type = f->fn_type;
791 res->scope = f->fn_scope; 791 res->scope = f->fn_scope;
792 res->prefixlen = dz->dz_order; 792 res->prefixlen = dz->dz_order;
793 goto out; 793 goto out;
794 } 794 }
@@ -799,21 +799,21 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp,
799 err = 1; 799 err = 1;
800out: 800out:
801 read_unlock(&dn_fib_tables_lock); 801 read_unlock(&dn_fib_tables_lock);
802 return err; 802 return err;
803} 803}
804 804
805 805
806struct dn_fib_table *dn_fib_get_table(u32 n, int create) 806struct dn_fib_table *dn_fib_get_table(u32 n, int create)
807{ 807{
808 struct dn_fib_table *t; 808 struct dn_fib_table *t;
809 struct hlist_node *node; 809 struct hlist_node *node;
810 unsigned int h; 810 unsigned int h;
811 811
812 if (n < RT_TABLE_MIN) 812 if (n < RT_TABLE_MIN)
813 return NULL; 813 return NULL;
814 814
815 if (n > RT_TABLE_MAX) 815 if (n > RT_TABLE_MAX)
816 return NULL; 816 return NULL;
817 817
818 h = n & (DN_FIB_TABLE_HASHSZ - 1); 818 h = n & (DN_FIB_TABLE_HASHSZ - 1);
819 rcu_read_lock(); 819 rcu_read_lock();
@@ -825,54 +825,54 @@ struct dn_fib_table *dn_fib_get_table(u32 n, int create)
825 } 825 }
826 rcu_read_unlock(); 826 rcu_read_unlock();
827 827
828 if (!create) 828 if (!create)
829 return NULL; 829 return NULL;
830 830
831 if (in_interrupt() && net_ratelimit()) { 831 if (in_interrupt() && net_ratelimit()) {
832 printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n"); 832 printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n");
833 return NULL; 833 return NULL;
834 } 834 }
835 835
836 t = kzalloc(sizeof(struct dn_fib_table) + sizeof(struct dn_hash), 836 t = kzalloc(sizeof(struct dn_fib_table) + sizeof(struct dn_hash),
837 GFP_KERNEL); 837 GFP_KERNEL);
838 if (t == NULL) 838 if (t == NULL)
839 return NULL; 839 return NULL;
840 840
841 t->n = n; 841 t->n = n;
842 t->insert = dn_fib_table_insert; 842 t->insert = dn_fib_table_insert;
843 t->delete = dn_fib_table_delete; 843 t->delete = dn_fib_table_delete;
844 t->lookup = dn_fib_table_lookup; 844 t->lookup = dn_fib_table_lookup;
845 t->flush = dn_fib_table_flush; 845 t->flush = dn_fib_table_flush;
846 t->dump = dn_fib_table_dump; 846 t->dump = dn_fib_table_dump;
847 hlist_add_head_rcu(&t->hlist, &dn_fib_table_hash[h]); 847 hlist_add_head_rcu(&t->hlist, &dn_fib_table_hash[h]);
848 848
849 return t; 849 return t;
850} 850}
851 851
852struct dn_fib_table *dn_fib_empty_table(void) 852struct dn_fib_table *dn_fib_empty_table(void)
853{ 853{
854 u32 id; 854 u32 id;
855 855
856 for(id = RT_TABLE_MIN; id <= RT_TABLE_MAX; id++) 856 for(id = RT_TABLE_MIN; id <= RT_TABLE_MAX; id++)
857 if (dn_fib_get_table(id, 0) == NULL) 857 if (dn_fib_get_table(id, 0) == NULL)
858 return dn_fib_get_table(id, 1); 858 return dn_fib_get_table(id, 1);
859 return NULL; 859 return NULL;
860} 860}
861 861
862void dn_fib_flush(void) 862void dn_fib_flush(void)
863{ 863{
864 int flushed = 0; 864 int flushed = 0;
865 struct dn_fib_table *tb; 865 struct dn_fib_table *tb;
866 struct hlist_node *node; 866 struct hlist_node *node;
867 unsigned int h; 867 unsigned int h;
868 868
869 for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) { 869 for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) {
870 hlist_for_each_entry(tb, node, &dn_fib_table_hash[h], hlist) 870 hlist_for_each_entry(tb, node, &dn_fib_table_hash[h], hlist)
871 flushed += tb->flush(tb); 871 flushed += tb->flush(tb);
872 } 872 }
873 873
874 if (flushed) 874 if (flushed)
875 dn_rt_cache_flush(-1); 875 dn_rt_cache_flush(-1);
876} 876}
877 877
878void __init dn_fib_table_init(void) 878void __init dn_fib_table_init(void)
@@ -892,7 +892,7 @@ void __exit dn_fib_table_cleanup(void)
892 write_lock(&dn_fib_tables_lock); 892 write_lock(&dn_fib_tables_lock);
893 for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) { 893 for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) {
894 hlist_for_each_entry_safe(t, node, next, &dn_fib_table_hash[h], 894 hlist_for_each_entry_safe(t, node, next, &dn_fib_table_hash[h],
895 hlist) { 895 hlist) {
896 hlist_del(&t->hlist); 896 hlist_del(&t->hlist);
897 kfree(t); 897 kfree(t);
898 } 898 }
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c
index 8b99bd33540d..0e62def05a58 100644
--- a/net/decnet/netfilter/dn_rtmsg.c
+++ b/net/decnet/netfilter/dn_rtmsg.c
@@ -138,7 +138,7 @@ static int __init dn_rtmsg_init(void)
138 int rv = 0; 138 int rv = 0;
139 139
140 dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, DNRNG_NLGRP_MAX, 140 dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, DNRNG_NLGRP_MAX,
141 dnrmg_receive_user_sk, THIS_MODULE); 141 dnrmg_receive_user_sk, THIS_MODULE);
142 if (dnrmg == NULL) { 142 if (dnrmg == NULL) {
143 printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket"); 143 printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket");
144 return -ENOMEM; 144 return -ENOMEM;
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index a4065eb1341e..a6c067b593ab 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -164,7 +164,7 @@ static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen
164 return 0; 164 return 0;
165} 165}
166 166
167static int dn_node_address_handler(ctl_table *table, int write, 167static int dn_node_address_handler(ctl_table *table, int write,
168 struct file *filp, 168 struct file *filp,
169 void __user *buffer, 169 void __user *buffer,
170 size_t *lenp, loff_t *ppos) 170 size_t *lenp, loff_t *ppos)
@@ -240,7 +240,7 @@ static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen,
240 } 240 }
241 241
242 namel = strlen(devname) + 1; 242 namel = strlen(devname) + 1;
243 if (len > namel) len = namel; 243 if (len > namel) len = namel;
244 244
245 if (copy_to_user(oldval, devname, len)) 245 if (copy_to_user(oldval, devname, len))
246 return -EFAULT; 246 return -EFAULT;
@@ -275,7 +275,7 @@ static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen,
275} 275}
276 276
277 277
278static int dn_def_dev_handler(ctl_table *table, int write, 278static int dn_def_dev_handler(ctl_table *table, int write,
279 struct file * filp, 279 struct file * filp,
280 void __user *buffer, 280 void __user *buffer,
281 size_t *lenp, loff_t *ppos) 281 size_t *lenp, loff_t *ppos)
@@ -341,17 +341,17 @@ static int dn_def_dev_handler(ctl_table *table, int write,
341 341
342static ctl_table dn_table[] = { 342static ctl_table dn_table[] = {
343 { 343 {
344 .ctl_name = NET_DECNET_NODE_ADDRESS, 344 .ctl_name = NET_DECNET_NODE_ADDRESS,
345 .procname = "node_address", 345 .procname = "node_address",
346 .maxlen = 7, 346 .maxlen = 7,
347 .mode = 0644, 347 .mode = 0644,
348 .proc_handler = dn_node_address_handler, 348 .proc_handler = dn_node_address_handler,
349 .strategy = dn_node_address_strategy, 349 .strategy = dn_node_address_strategy,
350 }, 350 },
351 { 351 {
352 .ctl_name = NET_DECNET_NODE_NAME, 352 .ctl_name = NET_DECNET_NODE_NAME,
353 .procname = "node_name", 353 .procname = "node_name",
354 .data = node_name, 354 .data = node_name,
355 .maxlen = 7, 355 .maxlen = 7,
356 .mode = 0644, 356 .mode = 0644,
357 .proc_handler = &proc_dostring, 357 .proc_handler = &proc_dostring,
@@ -359,8 +359,8 @@ static ctl_table dn_table[] = {
359 }, 359 },
360 { 360 {
361 .ctl_name = NET_DECNET_DEFAULT_DEVICE, 361 .ctl_name = NET_DECNET_DEFAULT_DEVICE,
362 .procname = "default_device", 362 .procname = "default_device",
363 .maxlen = 16, 363 .maxlen = 16,
364 .mode = 0644, 364 .mode = 0644,
365 .proc_handler = dn_def_dev_handler, 365 .proc_handler = dn_def_dev_handler,
366 .strategy = dn_def_dev_strategy, 366 .strategy = dn_def_dev_strategy,
@@ -432,32 +432,32 @@ static ctl_table dn_table[] = {
432 .extra2 = &max_decnet_no_fc_max_cwnd 432 .extra2 = &max_decnet_no_fc_max_cwnd
433 }, 433 },
434 { 434 {
435 .ctl_name = NET_DECNET_MEM, 435 .ctl_name = NET_DECNET_MEM,
436 .procname = "decnet_mem", 436 .procname = "decnet_mem",
437 .data = &sysctl_decnet_mem, 437 .data = &sysctl_decnet_mem,
438 .maxlen = sizeof(sysctl_decnet_mem), 438 .maxlen = sizeof(sysctl_decnet_mem),
439 .mode = 0644, 439 .mode = 0644,
440 .proc_handler = &proc_dointvec, 440 .proc_handler = &proc_dointvec,
441 .strategy = &sysctl_intvec, 441 .strategy = &sysctl_intvec,
442 }, 442 },
443 { 443 {
444 .ctl_name = NET_DECNET_RMEM, 444 .ctl_name = NET_DECNET_RMEM,
445 .procname = "decnet_rmem", 445 .procname = "decnet_rmem",
446 .data = &sysctl_decnet_rmem, 446 .data = &sysctl_decnet_rmem,
447 .maxlen = sizeof(sysctl_decnet_rmem), 447 .maxlen = sizeof(sysctl_decnet_rmem),
448 .mode = 0644, 448 .mode = 0644,
449 .proc_handler = &proc_dointvec, 449 .proc_handler = &proc_dointvec,
450 .strategy = &sysctl_intvec, 450 .strategy = &sysctl_intvec,
451 }, 451 },
452 { 452 {
453 .ctl_name = NET_DECNET_WMEM, 453 .ctl_name = NET_DECNET_WMEM,
454 .procname = "decnet_wmem", 454 .procname = "decnet_wmem",
455 .data = &sysctl_decnet_wmem, 455 .data = &sysctl_decnet_wmem,
456 .maxlen = sizeof(sysctl_decnet_wmem), 456 .maxlen = sizeof(sysctl_decnet_wmem),
457 .mode = 0644, 457 .mode = 0644,
458 .proc_handler = &proc_dointvec, 458 .proc_handler = &proc_dointvec,
459 .strategy = &sysctl_intvec, 459 .strategy = &sysctl_intvec,
460 }, 460 },
461 { 461 {
462 .ctl_name = NET_DECNET_DEBUG_LEVEL, 462 .ctl_name = NET_DECNET_DEBUG_LEVEL,
463 .procname = "debug", 463 .procname = "debug",
@@ -472,18 +472,18 @@ static ctl_table dn_table[] = {
472 472
473static ctl_table dn_dir_table[] = { 473static ctl_table dn_dir_table[] = {
474 { 474 {
475 .ctl_name = NET_DECNET, 475 .ctl_name = NET_DECNET,
476 .procname = "decnet", 476 .procname = "decnet",
477 .mode = 0555, 477 .mode = 0555,
478 .child = dn_table}, 478 .child = dn_table},
479 {0} 479 {0}
480}; 480};
481 481
482static ctl_table dn_root_table[] = { 482static ctl_table dn_root_table[] = {
483 { 483 {
484 .ctl_name = CTL_NET, 484 .ctl_name = CTL_NET,
485 .procname = "net", 485 .procname = "net",
486 .mode = 0555, 486 .mode = 0555,
487 .child = dn_dir_table 487 .child = dn_dir_table
488 }, 488 },
489 {0} 489 {0}