Commit 429eb0fa authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller

[NET] DECNET: Fix whitespace errors.

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c9eaf173
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
/****************************************************************************** /******************************************************************************
(c) 1995-1998 E.M. Serrat emserrat@geocities.com (c) 1995-1998 E.M. Serrat emserrat@geocities.com
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
...@@ -63,7 +63,7 @@ Version Kernel Date Author/Comments ...@@ -63,7 +63,7 @@ Version Kernel Date Author/Comments
Version 0.0.1 2.0.30 01-dic-97 Eduardo Marcelo Serrat Version 0.0.1 2.0.30 01-dic-97 Eduardo Marcelo Serrat
(emserrat@geocities.com) (emserrat@geocities.com)
First Development of DECnet Socket La- First Development of DECnet Socket La-
yer for Linux. Only supports outgoing yer for Linux. Only supports outgoing
connections. connections.
...@@ -75,28 +75,28 @@ Version 0.0.2 2.1.105 20-jun-98 Patrick J. Caulfield ...@@ -75,28 +75,28 @@ Version 0.0.2 2.1.105 20-jun-98 Patrick J. Caulfield
Version 0.0.3 2.1.106 25-jun-98 Eduardo Marcelo Serrat Version 0.0.3 2.1.106 25-jun-98 Eduardo Marcelo Serrat
(emserrat@geocities.com) (emserrat@geocities.com)
_ _
Added support for incoming connections Added support for incoming connections
so we can start developing server apps so we can start developing server apps
on Linux. on Linux.
- -
Module Support Module Support
Version 0.0.4 2.1.109 21-jul-98 Eduardo Marcelo Serrat Version 0.0.4 2.1.109 21-jul-98 Eduardo Marcelo Serrat
(emserrat@geocities.com) (emserrat@geocities.com)
_ _
Added support for X11R6.4. Now we can Added support for X11R6.4. Now we can
use DECnet transport for X on Linux!!! use DECnet transport for X on Linux!!!
- -
Version 0.0.5 2.1.110 01-aug-98 Eduardo Marcelo Serrat Version 0.0.5 2.1.110 01-aug-98 Eduardo Marcelo Serrat
(emserrat@geocities.com) (emserrat@geocities.com)
Removed bugs on flow control Removed bugs on flow control
Removed bugs on incoming accessdata Removed bugs on incoming accessdata
order order
- -
Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat
dn_recvmsg fixes dn_recvmsg fixes
Patrick J. Caulfield Patrick J. Caulfield
dn_bind fixes dn_bind fixes
*******************************************************************************/ *******************************************************************************/
#include <linux/module.h> #include <linux/module.h>
...@@ -169,7 +169,7 @@ static struct hlist_head *dn_find_list(struct sock *sk) ...@@ -169,7 +169,7 @@ static struct hlist_head *dn_find_list(struct sock *sk)
return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK]; return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK];
} }
/* /*
* Valid ports are those greater than zero and not already in use. * Valid ports are those greater than zero and not already in use.
*/ */
static int check_port(__le16 port) static int check_port(__le16 port)
...@@ -218,7 +218,7 @@ static int dn_hash_sock(struct sock *sk) ...@@ -218,7 +218,7 @@ static int dn_hash_sock(struct sock *sk)
BUG_ON(sk_hashed(sk)); BUG_ON(sk_hashed(sk));
write_lock_bh(&dn_hash_lock); write_lock_bh(&dn_hash_lock);
if (!scp->addrloc && !port_alloc(sk)) if (!scp->addrloc && !port_alloc(sk))
goto out; goto out;
...@@ -400,7 +400,7 @@ struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr) ...@@ -400,7 +400,7 @@ struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr)
sk = sk_head(&dn_wild_sk); sk = sk_head(&dn_wild_sk);
if (sk) { if (sk) {
if (sk->sk_state == TCP_LISTEN) if (sk->sk_state == TCP_LISTEN)
sock_hold(sk); sock_hold(sk);
else else
sk = NULL; sk = NULL;
...@@ -500,7 +500,7 @@ static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp) ...@@ -500,7 +500,7 @@ static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp)
scp->ackxmt_oth = 0; /* Last oth data ack'ed */ scp->ackxmt_oth = 0; /* Last oth data ack'ed */
scp->ackrcv_dat = 0; /* Highest data ack recv*/ scp->ackrcv_dat = 0; /* Highest data ack recv*/
scp->ackrcv_oth = 0; /* Last oth data ack rec*/ scp->ackrcv_oth = 0; /* Last oth data ack rec*/
scp->flowrem_sw = DN_SEND; scp->flowrem_sw = DN_SEND;
scp->flowloc_sw = DN_SEND; scp->flowloc_sw = DN_SEND;
scp->flowrem_dat = 0; scp->flowrem_dat = 0;
scp->flowrem_oth = 1; scp->flowrem_oth = 1;
...@@ -690,7 +690,7 @@ static int dn_create(struct socket *sock, int protocol) ...@@ -690,7 +690,7 @@ static int dn_create(struct socket *sock, int protocol)
} }
if ((sk = dn_alloc_sock(sock, GFP_KERNEL)) == NULL) if ((sk = dn_alloc_sock(sock, GFP_KERNEL)) == NULL)
return -ENOBUFS; return -ENOBUFS;
sk->sk_protocol = protocol; sk->sk_protocol = protocol;
...@@ -713,7 +713,7 @@ dn_release(struct socket *sock) ...@@ -713,7 +713,7 @@ dn_release(struct socket *sock)
sock_put(sk); sock_put(sk);
} }
return 0; return 0;
} }
static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) static 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,7 +770,7 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
} }
release_sock(sk); release_sock(sk);
return rv; return rv;
} }
...@@ -791,7 +791,7 @@ static int dn_auto_bind(struct socket *sock) ...@@ -791,7 +791,7 @@ static int dn_auto_bind(struct socket *sock)
*/ */
if ((scp->accessdata.acc_accl != 0) && if ((scp->accessdata.acc_accl != 0) &&
(scp->accessdata.acc_accl <= 12)) { (scp->accessdata.acc_accl <= 12)) {
scp->addr.sdn_objnamel = dn_htons(scp->accessdata.acc_accl); scp->addr.sdn_objnamel = dn_htons(scp->accessdata.acc_accl);
memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, dn_ntohs(scp->addr.sdn_objnamel)); memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, dn_ntohs(scp->addr.sdn_objnamel));
...@@ -997,20 +997,20 @@ static inline int dn_check_state(struct sock *sk, struct sockaddr_dn *addr, int ...@@ -997,20 +997,20 @@ static inline int dn_check_state(struct sock *sk, struct sockaddr_dn *addr, int
static void dn_access_copy(struct sk_buff *skb, struct accessdata_dn *acc) static void dn_access_copy(struct sk_buff *skb, struct accessdata_dn *acc)
{ {
unsigned char *ptr = skb->data; unsigned char *ptr = skb->data;
acc->acc_userl = *ptr++; acc->acc_userl = *ptr++;
memcpy(&acc->acc_user, ptr, acc->acc_userl); memcpy(&acc->acc_user, ptr, acc->acc_userl);
ptr += acc->acc_userl; ptr += acc->acc_userl;
acc->acc_passl = *ptr++; acc->acc_passl = *ptr++;
memcpy(&acc->acc_pass, ptr, acc->acc_passl); memcpy(&acc->acc_pass, ptr, acc->acc_passl);
ptr += acc->acc_passl; ptr += acc->acc_passl;
acc->acc_accl = *ptr++; acc->acc_accl = *ptr++;
memcpy(&acc->acc_acc, ptr, acc->acc_accl); memcpy(&acc->acc_acc, ptr, acc->acc_accl);
skb_pull(skb, acc->acc_accl + acc->acc_passl + acc->acc_userl + 3); skb_pull(skb, acc->acc_accl + acc->acc_passl + acc->acc_userl + 3);
} }
...@@ -1071,7 +1071,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -1071,7 +1071,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
lock_sock(sk); lock_sock(sk);
if (sk->sk_state != TCP_LISTEN || DN_SK(sk)->state != DN_O) { if (sk->sk_state != TCP_LISTEN || DN_SK(sk)->state != DN_O) {
release_sock(sk); release_sock(sk);
return -EINVAL; return -EINVAL;
} }
...@@ -1098,13 +1098,13 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -1098,13 +1098,13 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
dst_release(xchg(&newsk->sk_dst_cache, skb->dst)); dst_release(xchg(&newsk->sk_dst_cache, skb->dst));
skb->dst = NULL; skb->dst = NULL;
DN_SK(newsk)->state = DN_CR; DN_SK(newsk)->state = DN_CR;
DN_SK(newsk)->addrrem = cb->src_port; DN_SK(newsk)->addrrem = cb->src_port;
DN_SK(newsk)->services_rem = cb->services; DN_SK(newsk)->services_rem = cb->services;
DN_SK(newsk)->info_rem = cb->info; DN_SK(newsk)->info_rem = cb->info;
DN_SK(newsk)->segsize_rem = cb->segsize; DN_SK(newsk)->segsize_rem = cb->segsize;
DN_SK(newsk)->accept_mode = DN_SK(sk)->accept_mode; DN_SK(newsk)->accept_mode = DN_SK(sk)->accept_mode;
if (DN_SK(newsk)->segsize_rem < 230) if (DN_SK(newsk)->segsize_rem < 230)
DN_SK(newsk)->segsize_rem = 230; DN_SK(newsk)->segsize_rem = 230;
...@@ -1154,15 +1154,15 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -1154,15 +1154,15 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
dn_send_conn_ack(newsk); dn_send_conn_ack(newsk);
/* /*
* Here we use sk->sk_allocation since although the conn conf is * Here we use sk->sk_allocation since although the conn conf is
* for the newsk, the context is the old socket. * for the newsk, the context is the old socket.
*/ */
if (DN_SK(newsk)->accept_mode == ACC_IMMED) if (DN_SK(newsk)->accept_mode == ACC_IMMED)
err = dn_confirm_accept(newsk, &timeo, err = dn_confirm_accept(newsk, &timeo,
sk->sk_allocation); sk->sk_allocation);
} }
release_sock(newsk); release_sock(newsk);
return err; return err;
} }
...@@ -1177,10 +1177,10 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len ...@@ -1177,10 +1177,10 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len
lock_sock(sk); lock_sock(sk);
if (peer) { if (peer) {
if ((sock->state != SS_CONNECTED && if ((sock->state != SS_CONNECTED &&
sock->state != SS_CONNECTING) && sock->state != SS_CONNECTING) &&
scp->accept_mode == ACC_IMMED) { scp->accept_mode == ACC_IMMED) {
release_sock(sk); release_sock(sk);
return -ENOTCONN; return -ENOTCONN;
} }
...@@ -1191,7 +1191,7 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len ...@@ -1191,7 +1191,7 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len
release_sock(sk); release_sock(sk);
return 0; return 0;
} }
...@@ -1285,7 +1285,7 @@ static int dn_listen(struct socket *sock, int backlog) ...@@ -1285,7 +1285,7 @@ static int dn_listen(struct socket *sock, int backlog)
out: out:
release_sock(sk); release_sock(sk);
return err; return err;
} }
...@@ -1333,7 +1333,7 @@ static int dn_setsockopt(struct socket *sock, int level, int optname, char __use ...@@ -1333,7 +1333,7 @@ static int dn_setsockopt(struct socket *sock, int level, int optname, char __use
return err; return err;
} }
static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags) static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct dn_scp *scp = DN_SK(sk); 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,7 +1360,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
switch(optname) { switch(optname) {
case DSO_CONDATA: case DSO_CONDATA:
if (sock->state == SS_CONNECTED) if (sock->state == SS_CONNECTED)
return -EISCONN; return -EISCONN;
if ((scp->state != DN_O) && (scp->state != DN_CR)) if ((scp->state != DN_O) && (scp->state != DN_CR))
return -EINVAL; return -EINVAL;
...@@ -1375,7 +1375,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us ...@@ -1375,7 +1375,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
break; break;
case DSO_DISDATA: case DSO_DISDATA:
if (sock->state != SS_CONNECTED && scp->accept_mode == ACC_IMMED) if (sock->state != SS_CONNECTED && scp->accept_mode == ACC_IMMED)
return -ENOTCONN; return -ENOTCONN;
if (optlen != sizeof(struct optdata_dn)) if (optlen != sizeof(struct optdata_dn))
...@@ -1388,7 +1388,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us ...@@ -1388,7 +1388,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
break; break;
case DSO_CONACCESS: case DSO_CONACCESS:
if (sock->state == SS_CONNECTED) if (sock->state == SS_CONNECTED)
return -EISCONN; return -EISCONN;
if (scp->state != DN_O) if (scp->state != DN_O)
return -EINVAL; return -EINVAL;
...@@ -1521,7 +1521,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us ...@@ -1521,7 +1521,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
if(get_user(r_len , optlen)) if(get_user(r_len , optlen))
return -EFAULT; return -EFAULT;
switch(optname) { switch(optname) {
case DSO_CONDATA: case DSO_CONDATA:
if (r_len > sizeof(struct optdata_dn)) 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,11 +1573,11 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
{ {
int val, len; int val, len;
if(get_user(len, optlen)) if(get_user(len, optlen))
return -EFAULT; return -EFAULT;
val = nf_getsockopt(sk, PF_DECnet, optname, val = nf_getsockopt(sk, PF_DECnet, optname,
optval, &len); optval, &len);
if (val >= 0) if (val >= 0)
val = put_user(len, optlen); val = put_user(len, optlen);
...@@ -1588,7 +1588,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us ...@@ -1588,7 +1588,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
case DSO_SEQPACKET: case DSO_SEQPACKET:
case DSO_CONACCEPT: case DSO_CONACCEPT:
case DSO_CONREJECT: case DSO_CONREJECT:
return -ENOPROTOOPT; return -ENOPROTOOPT;
case DSO_MAXWINDOW: case DSO_MAXWINDOW:
if (r_len > sizeof(unsigned long)) if (r_len > sizeof(unsigned long))
...@@ -1724,7 +1724,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1724,7 +1724,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
} }
} }
} }
if (scp->state != DN_RUN) if (scp->state != DN_RUN)
goto out; goto out;
...@@ -1773,7 +1773,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1773,7 +1773,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
if (skb->len == 0) { if (skb->len == 0) {
skb_unlink(skb, queue); skb_unlink(skb, queue);
kfree_skb(skb); kfree_skb(skb);
/* /*
* N.B. Don't refer to skb or cb after this point * N.B. Don't refer to skb or cb after this point
* in loop. * in loop.
*/ */
...@@ -1783,7 +1783,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1783,7 +1783,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
} }
} }
if (eor) { if (eor) {
if (sk->sk_type == SOCK_SEQPACKET) if (sk->sk_type == SOCK_SEQPACKET)
break; break;
if (!(flags & MSG_WAITALL)) if (!(flags & MSG_WAITALL))
...@@ -1884,7 +1884,7 @@ static inline unsigned int dn_current_mss(struct sock *sk, int flags) ...@@ -1884,7 +1884,7 @@ static inline unsigned int dn_current_mss(struct sock *sk, int flags)
return mss_now; return mss_now;
} }
/* /*
* N.B. We get the timeout wrong here, but then we always did get it * N.B. We get the timeout wrong here, but then we always did get it
* wrong before and this is another step along the road to correcting * wrong before and this is another step along the road to correcting
* it. It ought to get updated each time we pass through the routine, * 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,7 +2044,7 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock,
cb->nsp_flags |= 0x20; cb->nsp_flags |= 0x20;
scp->seg_total += len; scp->seg_total += len;
if (((sent + len) == size) && (flags & MSG_EOR)) { if (((sent + len) == size) && (flags & MSG_EOR)) {
cb->nsp_flags |= 0x40; cb->nsp_flags |= 0x40;
scp->seg_total = 0; scp->seg_total = 0;
...@@ -2202,7 +2202,7 @@ static void dn_socket_seq_stop(struct seq_file *seq, void *v) ...@@ -2202,7 +2202,7 @@ static void dn_socket_seq_stop(struct seq_file *seq, void *v)
static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf) static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf)
{ {
int i; int i;
switch (dn_ntohs(dn->sdn_objnamel)) { switch (dn_ntohs(dn->sdn_objnamel)) {
case 0: case 0:
sprintf(buf, "%d", dn->sdn_objnum); sprintf(buf, "%d", dn->sdn_objnum);
...@@ -2214,7 +2214,7 @@ static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf) ...@@ -2214,7 +2214,7 @@ static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf)
buf[i] = '.'; buf[i] = '.';
} }
buf[i] = 0; buf[i] = 0;
} }
} }
static char *dn_state2asc(unsigned char state) static char *dn_state2asc(unsigned char state)
...@@ -2381,7 +2381,7 @@ static int __init decnet_init(void) ...@@ -2381,7 +2381,7 @@ static int __init decnet_init(void)
{ {
int rc; int rc;
printk(banner); printk(banner);
rc = proto_register(&dn_proto, 1); rc = proto_register(&dn_proto, 1);
if (rc != 0) if (rc != 0)
......
...@@ -224,27 +224,27 @@ static struct dn_dev_sysctl_table { ...@@ -224,27 +224,27 @@ static struct dn_dev_sysctl_table {
{0} {0}
}, },
{{ {{
.ctl_name = 0, .ctl_name = 0,
.procname = "", .procname = "",
.mode = 0555, .mode = 0555,
.child = dn_dev_sysctl.dn_dev_vars .child = dn_dev_sysctl.dn_dev_vars
}, {0}}, }, {0}},
{{ {{
.ctl_name = NET_DECNET_CONF, .ctl_name = NET_DECNET_CONF,
.procname = "conf", .procname = "conf",
.mode = 0555, .mode = 0555,
.child = dn_dev_sysctl.dn_dev_dev .child = dn_dev_sysctl.dn_dev_dev
}, {0}}, }, {0}},
{{ {{
.ctl_name = NET_DECNET, .ctl_name = NET_DECNET,
.procname = "decnet", .procname = "decnet",
.mode = 0555, .mode = 0555,
.child = dn_dev_sysctl.dn_dev_conf_dir .child = dn_dev_sysctl.dn_dev_conf_dir
}, {0}}, }, {0}},
{{ {{
.ctl_name = CTL_NET, .ctl_name = CTL_NET,
.procname = "net", .procname = "net",
.mode = 0555, .mode = 0555,
.child = dn_dev_sysctl.dn_dev_proto_dir .child = dn_dev_sysctl.dn_dev_proto_dir
}, {0}} }, {0}}
}; };
...@@ -299,7 +299,7 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms) ...@@ -299,7 +299,7 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms)
} }
} }
static int dn_forwarding_proc(ctl_table *table, int write, static int dn_forwarding_proc(ctl_table *table, int write,
struct file *filep, struct file *filep,
void __user *buffer, void __user *buffer,
size_t *lenp, loff_t *ppos) 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,7 +456,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
ASSERT_RTNL(); ASSERT_RTNL();
/* Check for duplicates */ /* Check for duplicates */
for(ifa1 = dn_db->ifa_list; ifa1; ifa1 = ifa1->ifa_next) { for(ifa1 = dn_db->ifa_list; ifa1; ifa1 = ifa1->ifa_next) {
if (ifa1->ifa_local == ifa->ifa_local) if (ifa1->ifa_local == ifa->ifa_local)
return -EEXIST; return -EEXIST;
...@@ -708,7 +708,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -708,7 +708,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
if (!dn_db) if (!dn_db)
return err; return err;
} }
if ((ifa = dn_dev_alloc_ifa()) == NULL) if ((ifa = dn_dev_alloc_ifa()) == NULL)
return -ENOBUFS; return -ENOBUFS;
...@@ -853,7 +853,7 @@ static int dn_dev_get_first(struct net_device *dev, __le16 *addr) ...@@ -853,7 +853,7 @@ static int dn_dev_get_first(struct net_device *dev, __le16 *addr)
return rv; return rv;
} }
/* /*
* Find a default address to bind to. * Find a default address to bind to.
* *
* This is one of those areas where the initial VMS concepts don't really * This is one of those areas where the initial VMS concepts don't really
...@@ -884,39 +884,39 @@ int dn_dev_bind_default(__le16 *addr) ...@@ -884,39 +884,39 @@ int dn_dev_bind_default(__le16 *addr)
static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
{ {
struct endnode_hello_message *msg; struct endnode_hello_message *msg;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
__le16 *pktlen; __le16 *pktlen;
struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL) if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL)
return; return;
skb->dev = dev; skb->dev = dev;
msg = (struct endnode_hello_message *)skb_put(skb,sizeof(*msg)); msg = (struct endnode_hello_message *)skb_put(skb,sizeof(*msg));
msg->msgflg = 0x0D; msg->msgflg = 0x0D;
memcpy(msg->tiver, dn_eco_version, 3); memcpy(msg->tiver, dn_eco_version, 3);
dn_dn2eth(msg->id, ifa->ifa_local); dn_dn2eth(msg->id, ifa->ifa_local);
msg->iinfo = DN_RT_INFO_ENDN; msg->iinfo = DN_RT_INFO_ENDN;
msg->blksize = dn_htons(mtu2blksize(dev)); msg->blksize = dn_htons(mtu2blksize(dev));
msg->area = 0x00; msg->area = 0x00;
memset(msg->seed, 0, 8); memset(msg->seed, 0, 8);
memcpy(msg->neighbor, dn_hiord, ETH_ALEN); memcpy(msg->neighbor, dn_hiord, ETH_ALEN);
if (dn_db->router) { if (dn_db->router) {
struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; struct dn_neigh *dn = (struct dn_neigh *)dn_db->router;
dn_dn2eth(msg->neighbor, dn->addr); dn_dn2eth(msg->neighbor, dn->addr);
} }
msg->timer = dn_htons((unsigned short)dn_db->parms.t3); msg->timer = dn_htons((unsigned short)dn_db->parms.t3);
msg->mpd = 0x00; msg->mpd = 0x00;
msg->datalen = 0x02; msg->datalen = 0x02;
memset(msg->data, 0xAA, 2); memset(msg->data, 0xAA, 2);
pktlen = (__le16 *)skb_push(skb,2); pktlen = (__le16 *)skb_push(skb,2);
*pktlen = dn_htons(skb->len - 2); *pktlen = dn_htons(skb->len - 2);
skb->nh.raw = skb->data; skb->nh.raw = skb->data;
...@@ -986,11 +986,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa) ...@@ -986,11 +986,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
dn_dn2eth(ptr, ifa->ifa_local); dn_dn2eth(ptr, ifa->ifa_local);
src = ptr; src = ptr;
ptr += ETH_ALEN; ptr += ETH_ALEN;
*ptr++ = dn_db->parms.forwarding == 1 ? *ptr++ = dn_db->parms.forwarding == 1 ?
DN_RT_INFO_L1RT : DN_RT_INFO_L2RT; DN_RT_INFO_L1RT : DN_RT_INFO_L2RT;
*((__le16 *)ptr) = dn_htons(mtu2blksize(dev)); *((__le16 *)ptr) = dn_htons(mtu2blksize(dev));
ptr += 2; ptr += 2;
*ptr++ = dn_db->parms.priority; /* Priority */ *ptr++ = dn_db->parms.priority; /* Priority */
*ptr++ = 0; /* Area: Reserved */ *ptr++ = 0; /* Area: Reserved */
*((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3); *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3);
ptr += 2; ptr += 2;
...@@ -1408,18 +1408,18 @@ static char *dn_type2asc(char type) ...@@ -1408,18 +1408,18 @@ static char *dn_type2asc(char type)
static int dn_dev_seq_show(struct seq_file *seq, void *v) static int dn_dev_seq_show(struct seq_file *seq, void *v)
{ {
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
seq_puts(seq, "Name Flags T1 Timer1 T3 Timer3 BlkSize Pri State DevType Router Peer\n"); seq_puts(seq, "Name Flags T1 Timer1 T3 Timer3 BlkSize Pri State DevType Router Peer\n");
else { else {
struct net_device *dev = v; struct net_device *dev = v;
char peer_buf[DN_ASCBUF_LEN]; char peer_buf[DN_ASCBUF_LEN];
char router_buf[DN_ASCBUF_LEN]; char router_buf[DN_ASCBUF_LEN];
struct dn_dev *dn_db = dev->dn_ptr; struct dn_dev *dn_db = dev->dn_ptr;
seq_printf(seq, "%-8s %1s %04u %04u %04lu %04lu" seq_printf(seq, "%-8s %1s %04u %04u %04lu %04lu"
" %04hu %03d %02x %-10s %-7s %-7s\n", " %04hu %03d %02x %-10s %-7s %-7s\n",
dev->name ? dev->name : "???", dev->name ? dev->name : "???",
dn_type2asc(dn_db->parms.mode), dn_type2asc(dn_db->parms.mode),
0, 0, 0, 0,
dn_db->t3, dn_db->parms.t3, dn_db->t3, dn_db->parms.t3,
mtu2blksize(dev), mtu2blksize(dev),
dn_db->parms.priority, dn_db->parms.priority,
...@@ -1476,17 +1476,17 @@ MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); ...@@ -1476,17 +1476,17 @@ MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node");
void __init dn_dev_init(void) void __init dn_dev_init(void)
{ {
if (addr[0] > 63 || addr[0] < 0) { if (addr[0] > 63 || addr[0] < 0) {
printk(KERN_ERR "DECnet: Area must be between 0 and 63"); printk(KERN_ERR "DECnet: Area must be between 0 and 63");
return; return;
} }
if (addr[1] > 1023 || addr[1] < 0) { if (addr[1] > 1023 || addr[1] < 0) {
printk(KERN_ERR "DECnet: Node must be between 0 and 1023"); printk(KERN_ERR "DECnet: Node must be between 0 and 1023");
return; return;
} }
decnet_address = dn_htons((addr[0] << 10) | addr[1]); decnet_address = dn_htons((addr[0] << 10) | addr[1]);
dn_dev_devices_on(); dn_dev_devices_on();
......
...@@ -527,7 +527,7 @@ int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -527,7 +527,7 @@ int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
return -EINVAL; return -EINVAL;
tb = dn_fib_get_table(rtm_get_table(rta, r->rtm_table), 1); tb = dn_fib_get_table(rtm_get_table(rta, r->rtm_table), 1);
if (tb) if (tb)
return tb->insert(tb, r, (struct dn_kern_rta *)rta, nlh, &NETLINK_CB(skb)); return tb->insert(tb, r, (struct dn_kern_rta *)rta, nlh, &NETLINK_CB(skb));
return -ENOBUFS; return -ENOBUFS;
...@@ -654,80 +654,80 @@ static int dn_fib_dnaddr_event(struct notifier_block *this, unsigned long event, ...@@ -654,80 +654,80 @@ static int dn_fib_dnaddr_event(struct notifier_block *this, unsigned long event,
static int dn_fib_sync_down(__le16 local, struct net_device *dev, int force) static int dn_fib_sync_down(__le16 local, struct net_device *dev, int force)
{ {
int ret = 0; int ret = 0;
int scope = RT_SCOPE_NOWHERE; int scope = RT_SCOPE_NOWHERE;
if (force) if (force)
scope = -1; scope = -1;
for_fib_info() { for_fib_info() {
/* /*
* This makes no sense for DECnet.... we will almost * This makes no sense for DECnet.... we will almost
* certainly have more than one local address the same * certainly have more than one local address the same
* over all our interfaces. It needs thinking about * over all our interfaces. It needs thinking about
* some more. * some more.
*/ */
if (local && fi->fib_prefsrc == local) { if (local && fi->fib_prefsrc == local) {
fi->fib_flags |= RTNH_F_DEAD; fi->fib_flags |= RTNH_F_DEAD;
ret++; ret++;
} else if (dev && fi->fib_nhs) { } else if (dev && fi->fib_nhs) {
int dead = 0; int dead = 0;
change_nexthops(fi) { change_nexthops(fi) {
if (nh->nh_flags&RTNH_F_DEAD) if (nh->nh_flags&RTNH_F_DEAD)
dead++; dead++;
else if (nh->nh_dev == dev && else if (nh->nh_dev == dev &&
nh->nh_scope != scope) { nh->nh_scope != scope) {
spin_lock_bh(&dn_fib_multipath_lock); spin_lock_bh(&dn_fib_multipath_lock);
nh->nh_flags |= RTNH_F_DEAD; nh->nh_flags |= RTNH_F_DEAD;
fi->fib_power -= nh->nh_power; fi->fib_power -= nh->nh_power;
nh->nh_power = 0; nh->nh_power = 0;
spin_unlock_bh(&dn_fib_multipath_lock); spin_unlock_bh(&dn_fib_multipath_lock);
dead++; dead++;
} }
} endfor_nexthops(fi) } endfor_nexthops(fi)
if (dead == fi->fib_nhs) { if (dead == fi->fib_nhs) {
fi->fib_flags |= RTNH_F_DEAD; fi->fib_flags |= RTNH_F_DEAD;
ret++; ret++;
} }
} }
} endfor_fib_info(); } endfor_fib_info();
return ret; return ret;
} }
static int dn_fib_sync_up(struct net_device *dev) static int dn_fib_sync_up(struct net_device *dev)
{ {
int ret = 0; int ret = 0;
if (!(dev->flags&IFF_UP)) if (!(dev->flags&IFF_UP))
return 0; return 0;
for_fib_info() { for_fib_info() {
int alive = 0; int alive = 0;
change_nexthops(fi) { change_nexthops(fi) {
if (!(nh->nh_flags&RTNH_F_DEAD)) { if (!(nh->nh_flags&RTNH_F_DEAD)) {
alive++; alive++;
continue; continue;
} }
if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP))
continue; continue;
if (nh->nh_dev != dev || dev->dn_ptr == NULL) if (nh->nh_dev != dev || dev->dn_ptr == NULL)
continue; continue;
alive++; alive++;
spin_lock_bh(&dn_fib_multipath_lock); spin_lock_bh(&dn_fib_multipath_lock);
nh->nh_power = 0; nh->nh_power = 0;
nh->nh_flags &= ~RTNH_F_DEAD; nh->nh_flags &= ~RTNH_F_DEAD;
spin_unlock_bh(&dn_fib_multipath_lock); spin_unlock_bh(&dn_fib_multipath_lock);
} endfor_nexthops(fi); } endfor_nexthops(fi);
if (alive > 0) { if (alive > 0) {
fi->fib_flags &= ~RTNH_F_DEAD; fi->fib_flags &= ~RTNH_F_DEAD;
ret++; ret++;
} }
} endfor_fib_info(); } endfor_fib_info();
return ret; return ret;
} }
static struct notifier_block dn_fib_dnaddr_notifier = { static struct notifier_block dn_fib_dnaddr_notifier = {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* operating system. DECnet is implemented using the BSD Socket * operating system. DECnet is implemented using the BSD Socket
* interface as the means of communication with the user level. * interface as the means of communication with the user level.
* *
* DECnet Neighbour Functions (Adjacency Database and * DECnet Neighbour Functions (Adjacency Database and
* On-Ethernet Cache) * On-Ethernet Cache)
* *
* Author: Steve Whitehouse <SteveW@ACM.org> * Author: Steve Whitehouse <SteveW@ACM.org>
...@@ -277,19 +277,19 @@ static int dn_short_output(struct sk_buff *skb) ...@@ -277,19 +277,19 @@ static int dn_short_output(struct sk_buff *skb)
struct dn_skb_cb *cb = DN_SKB_CB(skb); struct dn_skb_cb *cb = DN_SKB_CB(skb);
if (skb_headroom(skb) < headroom) { if (skb_headroom(skb) < headroom) {
struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom); struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom);
if (skb2 == NULL) { if (skb2 == NULL) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_CRIT "dn_short_output: no memory\n"); printk(KERN_CRIT "dn_short_output: no memory\n");
kfree_skb(skb); kfree_skb(skb);
return -ENOBUFS; return -ENOBUFS;
} }
kfree_skb(skb); kfree_skb(skb);
skb = skb2; skb = skb2;
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_INFO "dn_short_output: Increasing headroom\n"); printk(KERN_INFO "dn_short_output: Increasing headroom\n");
} }
data = skb_push(skb, sizeof(struct dn_short_packet) + 2); data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
*((__le16 *)data) = dn_htons(skb->len - 2); *((__le16 *)data) = dn_htons(skb->len - 2);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/****************************************************************************** /******************************************************************************
(c) 1995-1998 E.M. Serrat emserrat@geocities.com (c) 1995-1998 E.M. Serrat emserrat@geocities.com
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/termios.h> #include <linux/termios.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/stat.h> #include <linux/stat.h>
...@@ -139,7 +139,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) ...@@ -139,7 +139,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth)
ptr++; ptr++;
len += 2; len += 2;
if ((ack & 0x4000) == 0) { if ((ack & 0x4000) == 0) {
if (oth) if (oth)
ack ^= 0x2000; ack ^= 0x2000;
dn_ack(sk, skb, ack); dn_ack(sk, skb, ack);
} }
...@@ -152,7 +152,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) ...@@ -152,7 +152,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth)
skb_pull(skb, 2); skb_pull(skb, 2);
len += 2; len += 2;
if ((ack & 0x4000) == 0) { if ((ack & 0x4000) == 0) {
if (oth) if (oth)
ack ^= 0x2000; ack ^= 0x2000;
dn_ack(sk, skb, ack); dn_ack(sk, skb, ack);
} }
...@@ -349,9 +349,9 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb) ...@@ -349,9 +349,9 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
if ((scp->state == DN_CI) || (scp->state == DN_CD)) { if ((scp->state == DN_CI) || (scp->state == DN_CD)) {
scp->persist = 0; scp->persist = 0;
scp->addrrem = cb->src_port; scp->addrrem = cb->src_port;
sk->sk_state = TCP_ESTABLISHED; sk->sk_state = TCP_ESTABLISHED;
scp->state = DN_RUN; scp->state = DN_RUN;
scp->services_rem = cb->services; scp->services_rem = cb->services;
scp->info_rem = cb->info; scp->info_rem = cb->info;
scp->segsize_rem = cb->segsize; scp->segsize_rem = cb->segsize;
...@@ -366,13 +366,13 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb) ...@@ -366,13 +366,13 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen);
} }
} }
dn_nsp_send_link(sk, DN_NOCHANGE, 0); dn_nsp_send_link(sk, DN_NOCHANGE, 0);
if (!sock_flag(sk, SOCK_DEAD)) if (!sock_flag(sk, SOCK_DEAD))
sk->sk_state_change(sk); sk->sk_state_change(sk);
} }
out: out:
kfree_skb(skb); kfree_skb(skb);
} }
static void dn_nsp_conn_ack(struct sock *sk, struct sk_buff *skb) static 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,7 +435,7 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb)
sk->sk_state_change(sk); sk->sk_state_change(sk);
} }
/* /*
* It appears that its possible for remote machines to send disc * It appears that its possible for remote machines to send disc
* init messages with no port identifier if we are in the CI and * init messages with no port identifier if we are in the CI and
* possibly also the CD state. Obviously we shouldn't reply with * 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,7 +519,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
/* /*
* Here we ignore erronous packets which should really * Here we ignore erronous packets which should really
* should cause a connection abort. It is not critical * should cause a connection abort. It is not critical
* for now though. * for now though.
*/ */
if (lsflags & 0xf8) if (lsflags & 0xf8)
...@@ -530,7 +530,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) ...@@ -530,7 +530,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
switch(lsflags & 0x04) { /* FCVAL INT */ switch(lsflags & 0x04) { /* FCVAL INT */
case 0x00: /* Normal Request */ case 0x00: /* Normal Request */
switch(lsflags & 0x03) { /* FCVAL MOD */ switch(lsflags & 0x03) { /* FCVAL MOD */
case 0x00: /* Request count */ case 0x00: /* Request count */
if (fcval < 0) { if (fcval < 0) {
unsigned char p_fcval = -fcval; unsigned char p_fcval = -fcval;
if ((scp->flowrem_dat > p_fcval) && if ((scp->flowrem_dat > p_fcval) &&
...@@ -541,7 +541,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) ...@@ -541,7 +541,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
scp->flowrem_dat += fcval; scp->flowrem_dat += fcval;
wake_up = 1; wake_up = 1;
} }
break; break;
case 0x01: /* Stop outgoing data */ case 0x01: /* Stop outgoing data */
scp->flowrem_sw = DN_DONTSEND; scp->flowrem_sw = DN_DONTSEND;
break; break;
...@@ -557,10 +557,10 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) ...@@ -557,10 +557,10 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
wake_up = 1; wake_up = 1;
} }
break; break;
} }
if (wake_up && !sock_flag(sk, SOCK_DEAD)) if (wake_up && !sock_flag(sk, SOCK_DEAD))
sk->sk_state_change(sk); sk->sk_state_change(sk);
} }
dn_nsp_send_oth_ack(sk); dn_nsp_send_oth_ack(sk);
...@@ -576,38 +576,38 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) ...@@ -576,38 +576,38 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue) static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
{ {
int err; int err;
/* Cast skb->rcvbuf to unsigned... It's pointless, but reduces /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
number of warnings when compiling with -W --ANK number of warnings when compiling with -W --ANK
*/ */
if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
(unsigned)sk->sk_rcvbuf) { (unsigned)sk->sk_rcvbuf) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
err = sk_filter(sk, skb); err = sk_filter(sk, skb);
if (err) if (err)
goto out; goto out;
skb_set_owner_r(skb, sk); skb_set_owner_r(skb, sk);
skb_queue_tail(queue, skb); skb_queue_tail(queue, skb);
/* This code only runs from BH or BH protected context. /* This code only runs from BH or BH protected context.
* Therefore the plain read_lock is ok here. -DaveM * Therefore the plain read_lock is ok here. -DaveM
*/ */
read_lock(&sk->sk_callback_lock); read_lock(&sk->sk_callback_lock);
if (!sock_flag(sk, SOCK_DEAD)) { if (!sock_flag(sk, SOCK_DEAD)) {
struct socket *sock = sk->sk_socket; struct socket *sock = sk->sk_socket;
wake_up_interruptible(sk->sk_sleep); wake_up_interruptible(sk->sk_sleep);
if (sock && sock->fasync_list && if (sock && sock->fasync_list &&
!test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
__kill_fasync(sock->fasync_list, sig, __kill_fasync(sock->fasync_list, sig,
(sig == SIGURG) ? POLL_PRI : POLL_IN); (sig == SIGURG) ? POLL_PRI : POLL_IN);
} }
read_unlock(&sk->sk_callback_lock); read_unlock(&sk->sk_callback_lock);
out: out:
return err; return err;
} }
static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb) static 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,16 +652,16 @@ static void dn_nsp_data(struct sock *sk, struct sk_buff *skb)
skb_pull(skb, 2); skb_pull(skb, 2);
if (seq_next(scp->numdat_rcv, segnum)) { if (seq_next(scp->numdat_rcv, segnum)) {
if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) { if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) {
seq_add(&scp->numdat_rcv, 1); seq_add(&scp->numdat_rcv, 1);
queued = 1; queued = 1;
} }
if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) { if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) {
scp->flowloc_sw = DN_DONTSEND; scp->flowloc_sw = DN_DONTSEND;
dn_nsp_send_link(sk, DN_DONTSEND, 0); dn_nsp_send_link(sk, DN_DONTSEND, 0);
} }
} }
dn_nsp_send_data_ack(sk); dn_nsp_send_data_ack(sk);
out: out:
...@@ -732,7 +732,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb) ...@@ -732,7 +732,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb)
if (decnet_debug_level & 2) if (decnet_debug_level & 2)
printk(KERN_DEBUG "dn_nsp_rx: Message type 0x%02x\n", (int)cb->nsp_flags); printk(KERN_DEBUG "dn_nsp_rx: Message type 0x%02x\n", (int)cb->nsp_flags);
if (cb->nsp_flags & 0x83) if (cb->nsp_flags & 0x83)
goto free_out; goto free_out;
/* /*
...@@ -852,7 +852,7 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -852,7 +852,7 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
case 0x30: case 0x30:
dn_nsp_disc_init(sk, skb); dn_nsp_disc_init(sk, skb);
break; break;
case 0x40: case 0x40:
dn_nsp_disc_conf(sk, skb); dn_nsp_disc_conf(sk, skb);
break; break;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
/****************************************************************************** /******************************************************************************
(c) 1995-1998 E.M. Serrat emserrat@geocities.com (c) 1995-1998 E.M. Serrat emserrat@geocities.com
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/termios.h> #include <linux/termios.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/stat.h> #include <linux/stat.h>
...@@ -176,14 +176,14 @@ static void dn_nsp_rtt(struct sock *sk, long rtt) ...@@ -176,14 +176,14 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
* gathering this value might turn out negative, so we make sure * gathering this value might turn out negative, so we make sure
* that is it always positive here. * that is it always positive here.
*/ */
if (rtt < 0) if (rtt < 0)
rtt = -rtt; rtt = -rtt;
/* /*
* Add new rtt to smoothed average * Add new rtt to smoothed average
*/ */
delta = ((rtt << 3) - srtt); delta = ((rtt << 3) - srtt);
srtt += (delta >> 3); srtt += (delta >> 3);
if (srtt >= 1) if (srtt >= 1)
scp->nsp_srtt = (unsigned long)srtt; scp->nsp_srtt = (unsigned long)srtt;
else else
scp->nsp_srtt = 1; scp->nsp_srtt = 1;
...@@ -193,7 +193,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt) ...@@ -193,7 +193,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
*/ */
delta >>= 1; delta >>= 1;
rttvar += ((((delta>0)?(delta):(-delta)) - rttvar) >> 2); rttvar += ((((delta>0)?(delta):(-delta)) - rttvar) >> 2);
if (rttvar >= 1) if (rttvar >= 1)
scp->nsp_rttvar = (unsigned long)rttvar; scp->nsp_rttvar = (unsigned long)rttvar;
else else
scp->nsp_rttvar = 1; 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,7 +434,7 @@ int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff
* further. * further.
*/ */
if (xmit_count == 1) { if (xmit_count == 1) {
if (dn_equal(segnum, acknum)) if (dn_equal(segnum, acknum))
dn_nsp_rtt(sk, (long)(pkttime - reftime)); dn_nsp_rtt(sk, (long)(pkttime - reftime));
if (scp->snd_window < scp->max_window) if (scp->snd_window < scp->max_window)
...@@ -486,16 +486,16 @@ void dn_send_conn_ack (struct sock *sk) ...@@ -486,16 +486,16 @@ void dn_send_conn_ack (struct sock *sk)
{ {
struct dn_scp *scp = DN_SK(sk); struct dn_scp *scp = DN_SK(sk);
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct nsp_conn_ack_msg *msg; struct nsp_conn_ack_msg *msg;
if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL) if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL)
return; return;
msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3);
msg->msgflg = 0x24; msg->msgflg = 0x24;
msg->dstaddr = scp->addrrem; msg->dstaddr = scp->addrrem;
dn_nsp_send(skb); dn_nsp_send(skb);
} }
void dn_nsp_delayed_ack(struct sock *sk) void dn_nsp_delayed_ack(struct sock *sk)
...@@ -523,25 +523,25 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) ...@@ -523,25 +523,25 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
{ {
struct dn_scp *scp = DN_SK(sk); struct dn_scp *scp = DN_SK(sk);
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct nsp_conn_init_msg *msg; struct nsp_conn_init_msg *msg;
__u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl); __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl);
if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL)
return; return;
msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg));
msg->msgflg = 0x28; msg->msgflg = 0x28;
msg->dstaddr = scp->addrrem; msg->dstaddr = scp->addrrem;
msg->srcaddr = scp->addrloc; msg->srcaddr = scp->addrloc;
msg->services = scp->services_loc; msg->services = scp->services_loc;
msg->info = scp->info_loc; msg->info = scp->info_loc;
msg->segsize = dn_htons(scp->segsize_loc); msg->segsize = dn_htons(scp->segsize_loc);
*skb_put(skb,1) = len; *skb_put(skb,1) = len;
if (len > 0) if (len > 0)
memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len); memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len);
dn_nsp_send(skb); dn_nsp_send(skb);
...@@ -550,7 +550,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) ...@@ -550,7 +550,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
} }
static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
unsigned short reason, gfp_t gfp, unsigned short reason, gfp_t gfp,
struct dst_entry *dst, struct dst_entry *dst,
int ddl, unsigned char *dd, __le16 rem, __le16 loc) 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,7 +593,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
} }
void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
unsigned short reason, gfp_t gfp) unsigned short reason, gfp_t gfp)
{ {
struct dn_scp *scp = DN_SK(sk); struct dn_scp *scp = DN_SK(sk);
...@@ -605,19 +605,19 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, ...@@ -605,19 +605,19 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
if (reason == 0) if (reason == 0)
reason = dn_ntohs(scp->discdata_out.opt_status); reason = dn_ntohs(scp->discdata_out.opt_status);
dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl,
scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); scp->discdata_out.opt_data, scp->addrrem, scp->addrloc);
} }
void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg, void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,
unsigned short reason) unsigned short reason)
{ {
struct dn_skb_cb *cb = DN_SKB_CB(skb); struct dn_skb_cb *cb = DN_SKB_CB(skb);
int ddl = 0; int ddl = 0;
gfp_t gfp = GFP_ATOMIC; gfp_t gfp = GFP_ATOMIC;
dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl,
NULL, cb->src_port, cb->dst_port); NULL, cb->src_port, cb->dst_port);
} }
...@@ -676,8 +676,8 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) ...@@ -676,8 +676,8 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
msg->srcaddr = scp->addrloc; msg->srcaddr = scp->addrloc;
msg->services = scp->services_loc; /* Requested flow control */ msg->services = scp->services_loc; /* Requested flow control */
msg->info = scp->info_loc; /* Version Number */ msg->info = scp->info_loc; /* Version Number */
msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */ msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */
if (scp->peer.sdn_objnum) if (scp->peer.sdn_objnum)
type = 0; type = 0;
...@@ -692,7 +692,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) ...@@ -692,7 +692,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
menuver |= DN_MENUVER_UIC; menuver |= DN_MENUVER_UIC;
*skb_put(skb, 1) = menuver; /* Menu Version */ *skb_put(skb, 1) = menuver; /* Menu Version */
aux = scp->accessdata.acc_userl; aux = scp->accessdata.acc_userl;
*skb_put(skb, 1) = aux; *skb_put(skb, 1) = aux;
if (aux > 0) if (aux > 0)
...@@ -718,6 +718,6 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) ...@@ -718,6 +718,6 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
cb->rt_flags = DN_RT_F_RQR; cb->rt_flags = DN_RT_F_RQR;
dn_nsp_send(skb); dn_nsp_send(skb);
} }
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/****************************************************************************** /******************************************************************************
(c) 1995-1998 E.M. Serrat emserrat@geocities.com (c) 1995-1998 E.M. Serrat emserrat@geocities.com
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
...@@ -246,7 +246,7 @@ static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu) ...@@ -246,7 +246,7 @@ static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu)
} }
} }
/* /*
* When a route has been marked obsolete. (e.g. routing cache flush) * When a route has been marked obsolete. (e.g. routing cache flush)
*/ */
static struct dst_entry *dn_dst_check(struct dst_entry *dst, __u32 cookie) static struct dst_entry *dn_dst_check(struct dst_entry *dst, __u32 cookie)
...@@ -305,7 +305,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * ...@@ -305,7 +305,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
rcu_assign_pointer(rt->u.rt_next, dn_rt_hash_table[hash].chain); rcu_assign_pointer(rt->u.rt_next, dn_rt_hash_table[hash].chain);
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
rt->u.dst.__use++; rt->u.dst.__use++;
rt->u.dst.lastuse = now; rt->u.dst.lastuse = now;
...@@ -506,23 +506,23 @@ static int dn_route_rx_long(struct sk_buff *skb) ...@@ -506,23 +506,23 @@ static int dn_route_rx_long(struct sk_buff *skb)
skb_pull(skb, 20); skb_pull(skb, 20);
skb->h.raw = skb->data; skb->h.raw = skb->data;
/* Destination info */ /* Destination info */
ptr += 2; ptr += 2;
cb->dst = dn_eth2dn(ptr); cb->dst = dn_eth2dn(ptr);
if (memcmp(ptr, dn_hiord_addr, 4) != 0) if (memcmp(ptr, dn_hiord_addr, 4) != 0)
goto drop_it; goto drop_it;
ptr += 6; ptr += 6;
/* Source info */ /* Source info */
ptr += 2; ptr += 2;
cb->src = dn_eth2dn(ptr); cb->src = dn_eth2dn(ptr);
if (memcmp(ptr, dn_hiord_addr, 4) != 0) if (memcmp(ptr, dn_hiord_addr, 4) != 0)
goto drop_it; goto drop_it;
ptr += 6; ptr += 6;
/* Other junk */ /* Other junk */
ptr++; ptr++;
cb->hops = *ptr++; /* Visit Count */ cb->hops = *ptr++; /* Visit Count */
return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet); return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet);
...@@ -545,16 +545,16 @@ static int dn_route_rx_short(struct sk_buff *skb) ...@@ -545,16 +545,16 @@ static int dn_route_rx_short(struct sk_buff *skb)
skb->h.raw = skb->data; skb->h.raw = skb->data;
cb->dst = *(__le16 *)ptr; cb->dst = *(__le16 *)ptr;
ptr += 2; ptr += 2;
cb->src = *(__le16 *)ptr; cb->src = *(__le16 *)ptr;
ptr += 2; ptr += 2;
cb->hops = *ptr & 0x3f; cb->hops = *ptr & 0x3f;
return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet); return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet);
drop_it: drop_it:
kfree_skb(skb); kfree_skb(skb);
return NET_RX_DROP; return NET_RX_DROP;
} }
static int dn_route_discard(struct sk_buff *skb) static 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,20 +626,20 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
cb->rt_flags = flags; cb->rt_flags = flags;
if (decnet_debug_level & 1) if (decnet_debug_level & 1)
printk(KERN_DEBUG printk(KERN_DEBUG
"dn_route_rcv: got 0x%02x from %s [%d %d %d]\n", "dn_route_rcv: got 0x%02x from %s [%d %d %d]\n",
(int)flags, (dev) ? dev->name : "???", len, skb->len, (int)flags, (dev) ? dev->name : "???", len, skb->len,
padlen); padlen);
if (flags & DN_RT_PKT_CNTL) { if (flags & DN_RT_PKT_CNTL) {
if (unlikely(skb_linearize(skb))) if (unlikely(skb_linearize(skb)))
goto dump_it; goto dump_it;
switch(flags & DN_RT_CNTL_MSK) { switch(flags & DN_RT_CNTL_MSK) {
case DN_RT_PKT_INIT: case DN_RT_PKT_INIT:
dn_dev_init_pkt(skb); dn_dev_init_pkt(skb);
break; break;
case DN_RT_PKT_VERI: case DN_RT_PKT_VERI:
dn_dev_veri_pkt(skb); dn_dev_veri_pkt(skb);
break; break;
} }
...@@ -648,31 +648,31 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type ...@@ -648,31 +648,31 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
goto dump_it; goto dump_it;
switch(flags & DN_RT_CNTL_MSK) { switch(flags & DN_RT_CNTL_MSK) {
case DN_RT_PKT_HELO: case DN_RT_PKT_HELO:
return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_route_ptp_hello); return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_route_ptp_hello);
case DN_RT_PKT_L1RT: case DN_RT_PKT_L1RT:
case DN_RT_PKT_L2RT: case DN_RT_PKT_L2RT:
return NF_HOOK(PF_DECnet, NF_DN_ROUTE, skb, skb->dev, NULL, dn_route_discard); return NF_HOOK(PF_DECnet, NF_DN_ROUTE, skb, skb->dev, NULL, dn_route_discard);
case DN_RT_PKT_ERTH: case DN_RT_PKT_ERTH:
return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_router_hello); return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_router_hello);
case DN_RT_PKT_EEDH: case DN_RT_PKT_EEDH:
return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_endnode_hello); return NF_HOOK(PF_DECnet, NF_DN_HELLO, skb, skb->dev, NULL, dn_neigh_endnode_hello);
} }
} else { } else {
if (dn->parms.state != DN_DEV_S_RU) if (dn->parms.state != DN_DEV_S_RU)
goto dump_it; goto dump_it;
skb_pull(skb, 1); /* Pull flags */ skb_pull(skb, 1); /* Pull flags */
switch(flags & DN_RT_PKT_MSK) { switch(flags & DN_RT_PKT_MSK) {
case DN_RT_PKT_LONG: case DN_RT_PKT_LONG:
return dn_route_rx_long(skb); return dn_route_rx_long(skb);
case DN_RT_PKT_SHORT: case DN_RT_PKT_SHORT:
return dn_route_rx_short(skb); return dn_route_rx_short(skb);
} }
} }
dump_it: dump_it:
kfree_skb(skb); kfree_skb(skb);
...@@ -815,8 +815,8 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) ...@@ -815,8 +815,8 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
rt->u.dst.neighbour = n; rt->u.dst.neighbour = n;
} }
if (rt->u.dst.metrics[RTAX_MTU-1] == 0 || if (rt->u.dst.metrics[RTAX_MTU-1] == 0 ||
rt->u.dst.metrics[RTAX_MTU-1] > rt->u.dst.dev->mtu) rt->u.dst.metrics[RTAX_MTU-1] > rt->u.dst.dev->mtu)
rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu;
mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst)); mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst));
if (rt->u.dst.metrics[RTAX_ADVMSS-1] == 0 || 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,7 +876,7 @@ static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_re
static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *oldflp, int try_hard) static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *oldflp, int try_hard)
{ {
struct flowi fl = { .nl_u = { .dn_u = struct flowi fl = { .nl_u = { .dn_u =
{ .daddr = oldflp->fld_dst, { .daddr = oldflp->fld_dst,
.saddr = oldflp->fld_src, .saddr = oldflp->fld_src,
.scope = RT_SCOPE_UNIVERSE, .scope = RT_SCOPE_UNIVERSE,
...@@ -899,7 +899,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old ...@@ -899,7 +899,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
"dn_route_output_slow: dst=%04x src=%04x mark=%d" "dn_route_output_slow: dst=%04x src=%04x mark=%d"
" iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst), " iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst),
dn_ntohs(oldflp->fld_src), dn_ntohs(oldflp->fld_src),
oldflp->mark, loopback_dev.ifindex, oldflp->oif); oldflp->mark, loopback_dev.ifindex, oldflp->oif);
/* If we have an output interface, verify its a DECnet device */ /* If we have an output interface, verify its a DECnet device */
if (oldflp->oif) { if (oldflp->oif) {
...@@ -982,19 +982,19 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old ...@@ -982,19 +982,19 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
if (err != -ESRCH) if (err != -ESRCH)
goto out; goto out;
/* /*
* Here the fallback is basically the standard algorithm for * Here the fallback is basically the standard algorithm for
* routing in endnodes which is described in the DECnet routing * routing in endnodes which is described in the DECnet routing
* docs * docs
* *
* If we are not trying hard, look in neighbour cache. * If we are not trying hard, look in neighbour cache.
* The result is tested to ensure that if a specific output * The result is tested to ensure that if a specific output
* device/source address was requested, then we honour that * device/source address was requested, then we honour that
* here * here
*/ */
if (!try_hard) { if (!try_hard) {
neigh = neigh_lookup_nodev(&dn_neigh_table, &fl.fld_dst); neigh = neigh_lookup_nodev(&dn_neigh_table, &fl.fld_dst);
if (neigh) { if (neigh) {
if ((oldflp->oif && if ((oldflp->oif &&
(neigh->dev->ifindex != oldflp->oif)) || (neigh->dev->ifindex != oldflp->oif)) ||
(oldflp->fld_src && (oldflp->fld_src &&
(!dn_dev_islocal(neigh->dev, (!dn_dev_islocal(neigh->dev,
...@@ -1044,7 +1044,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old ...@@ -1044,7 +1044,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
if (fl.fld_src == 0) { if (fl.fld_src == 0) {
fl.fld_src = dnet_select_source(dev_out, gateway, fl.fld_src = dnet_select_source(dev_out, gateway,
res.type == RTN_LOCAL ? res.type == RTN_LOCAL ?
RT_SCOPE_HOST : RT_SCOPE_HOST :
RT_SCOPE_LINK); RT_SCOPE_LINK);
if (fl.fld_src == 0 && res.type != RTN_LOCAL) if (fl.fld_src == 0 && res.type != RTN_LOCAL)
goto e_addr; goto e_addr;
...@@ -1074,14 +1074,14 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old ...@@ -1074,14 +1074,14 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
if (res.fi->fib_nhs > 1 && fl.oif == 0) if (res.fi->fib_nhs > 1 && fl.oif == 0)
dn_fib_select_multipath(&fl, &res); dn_fib_select_multipath(&fl, &res);
/* /*
* We could add some logic to deal with default routes here and * We could add some logic to deal with default routes here and
* get rid of some of the special casing above. * get rid of some of the special casing above.
*/ */
if (!fl.fld_src) if (!fl.fld_src)
fl.fld_src = DN_FIB_RES_PREFSRC(res); fl.fld_src = DN_FIB_RES_PREFSRC(res);
if (dev_out) if (dev_out)
dev_put(dev_out); dev_put(dev_out);
dev_out = DN_FIB_RES_DEV(res); dev_out = DN_FIB_RES_DEV(res);
...@@ -1144,8 +1144,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old ...@@ -1144,8 +1144,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
return err; return err;
e_addr: e_addr:
err = -EADDRNOTAVAIL; err = -EADDRNOTAVAIL;
goto done; goto done;
e_inval: e_inval:
err = -EINVAL; err = -EINVAL;
goto done; goto done;
...@@ -1223,7 +1223,7 @@ static int dn_route_input_slow(struct sk_buff *skb) ...@@ -1223,7 +1223,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
int flags = 0; int flags = 0;
__le16 gateway = 0; __le16 gateway = 0;
__le16 local_src = 0; __le16 local_src = 0;
struct flowi fl = { .nl_u = { .dn_u = struct flowi fl = { .nl_u = { .dn_u =
{ .daddr = cb->dst, { .daddr = cb->dst,
.saddr = cb->src, .saddr = cb->src,
.scope = RT_SCOPE_UNIVERSE, .scope = RT_SCOPE_UNIVERSE,
...@@ -1311,7 +1311,7 @@ static int dn_route_input_slow(struct sk_buff *skb) ...@@ -1311,7 +1311,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
if (res.fi->fib_nhs > 1 && fl.oif == 0) if (res.fi->fib_nhs > 1 && fl.oif == 0)
dn_fib_select_multipath(&fl, &res); dn_fib_select_multipath(&fl, &res);
/* /*
* Check for out_dev == in_dev. We use the RTCF_DOREDIRECT * Check for out_dev == in_dev. We use the RTCF_DOREDIRECT
* flag as a hint to set the intra-ethernet bit when * flag as a hint to set the intra-ethernet bit when
* forwarding. If we've got NAT in operation, we don't do * forwarding. If we've got NAT in operation, we don't do
...@@ -1445,7 +1445,7 @@ int dn_route_input(struct sk_buff *skb) ...@@ -1445,7 +1445,7 @@ int dn_route_input(struct sk_buff *skb)
for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL;
rt = rcu_dereference(rt->u.rt_next)) { rt = rcu_dereference(rt->u.rt_next)) {
if ((rt->fl.fld_src == cb->src) && if ((rt->fl.fld_src == cb->src) &&
(rt->fl.fld_dst == cb->dst) && (rt->fl.fld_dst == cb->dst) &&
(rt->fl.oif == 0) && (rt->fl.oif == 0) &&
(rt->fl.mark == skb->mark) && (rt->fl.mark == skb->mark) &&
(rt->fl.iif == cb->iif)) { (rt->fl.iif == cb->iif)) {
...@@ -1514,8 +1514,8 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -1514,8 +1514,8 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
nlmsg_failure: nlmsg_failure:
rtattr_failure: rtattr_failure:
skb_trim(skb, b - skb->data); skb_trim(skb, b - skb->data);
return -1; return -1;
} }
/* /*
...@@ -1632,7 +1632,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1632,7 +1632,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
continue; continue;
skb->dst = dst_clone(&rt->u.dst); skb->dst = dst_clone(&rt->u.dst);
if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).pid, if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, RTM_NEWROUTE, cb->nlh->nlmsg_seq, RTM_NEWROUTE,
1, NLM_F_MULTI) <= 0) { 1, NLM_F_MULTI) <= 0) {
dst_release(xchg(&skb->dst, NULL)); dst_release(xchg(&skb->dst, NULL));
rcu_read_unlock_bh(); rcu_read_unlock_bh();
...@@ -1721,7 +1721,7 @@ static int dn_rt_cache_seq_show(struct seq_file *seq, void *v) ...@@ -1721,7 +1721,7 @@ static int dn_rt_cache_seq_show(struct seq_file *seq, void *v)
rt->u.dst.__use, rt->u.dst.__use,
(int) dst_metric(&rt->u.dst, RTAX_RTT)); (int) dst_metric(&rt->u.dst, RTAX_RTT));
return 0; return 0;
} }
static struct seq_operations dn_rt_cache_seq_ops = { static struct seq_operations dn_rt_cache_seq_ops = {
.start = dn_rt_cache_seq_start, .start = dn_rt_cache_seq_start,
...@@ -1778,38 +1778,38 @@ void __init dn_route_init(void) ...@@ -1778,38 +1778,38 @@ void __init dn_route_init(void)
for(order = 0; (1UL << order) < goal; order++) for(order = 0; (1UL << order) < goal; order++)
/* NOTHING */; /* NOTHING */;
/* /*
* Only want 1024 entries max, since the table is very, very unlikely * Only want 1024 entries max, since the table is very, very unlikely
* to be larger than that. * to be larger than that.
*/ */
while(order && ((((1UL << order) * PAGE_SIZE) / while(order && ((((1UL << order) * PAGE_SIZE) /
sizeof(struct dn_rt_hash_bucket)) >= 2048)) sizeof(struct dn_rt_hash_bucket)) >= 2048))
order--; order--;
do { do {
dn_rt_hash_mask = (1UL << order) * PAGE_SIZE / dn_rt_hash_mask = (1UL << order) * PAGE_SIZE /
sizeof(struct dn_rt_hash_bucket); sizeof(struct dn_rt_hash_bucket);
while(dn_rt_hash_mask & (dn_rt_hash_mask - 1)) while(dn_rt_hash_mask & (dn_rt_hash_mask - 1))
dn_rt_hash_mask--; dn_rt_hash_mask--;
dn_rt_hash_table = (struct dn_rt_hash_bucket *) dn_rt_hash_table = (struct dn_rt_hash_bucket *)
__get_free_pages(GFP_ATOMIC, order); __get_free_pages(GFP_ATOMIC, order);
} while (dn_rt_hash_table == NULL && --order > 0); } while (dn_rt_hash_table == NULL && --order > 0);
if (!dn_rt_hash_table) if (!dn_rt_hash_table)
panic("Failed to allocate DECnet route cache hash table\n"); panic("Failed to allocate DECnet route cache hash table\n");
printk(KERN_INFO printk(KERN_INFO
"DECnet: Routing cache hash table of %u buckets, %ldKbytes\n", "DECnet: Routing cache hash table of %u buckets, %ldKbytes\n",
dn_rt_hash_mask, dn_rt_hash_mask,
(long)(dn_rt_hash_mask*sizeof(struct dn_rt_hash_bucket))/1024); (long)(dn_rt_hash_mask*sizeof(struct dn_rt_hash_bucket))/1024);
dn_rt_hash_mask--; dn_rt_hash_mask--;
for(i = 0; i <= dn_rt_hash_mask; i++) { for(i = 0; i <= dn_rt_hash_mask; i++) {
spin_lock_init(&dn_rt_hash_table[i].lock); spin_lock_init(&dn_rt_hash_table[i].lock);
dn_rt_hash_table[i].chain = NULL; dn_rt_hash_table[i].chain = NULL;
} }
dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1); dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops); proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
} }
......
...@@ -60,7 +60,7 @@ struct dn_hash ...@@ -60,7 +60,7 @@ struct dn_hash
#define dz_prefix(key,dz) ((key).datum) #define dz_prefix(key,dz) ((key).datum)
#define for_nexthops(fi) { int nhsel; const struct dn_fib_nh *nh;\ #define for_nexthops(fi) { int nhsel; const struct dn_fib_nh *nh;\
for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++)
#define endfor_nexthops(fi) } #define endfor_nexthops(fi) }
...@@ -290,82 +290,82 @@ static inline size_t dn_fib_nlmsg_size(struct dn_fib_info *fi) ...@@ -290,82 +290,82 @@ static inline size_t dn_fib_nlmsg_size(struct dn_fib_info *fi)
} }
static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
u32 tb_id, u8 type, u8 scope, void *dst, int dst_len, u32 tb_id, u8 type, u8 scope, void *dst, int dst_len,
struct dn_fib_info *fi, unsigned int flags) struct dn_fib_info *fi, unsigned int flags)
{ {
struct rtmsg *rtm; struct rtmsg *rtm;
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags);
rtm = NLMSG_DATA(nlh); rtm = NLMSG_DATA(nlh);
rtm->rtm_family = AF_DECnet; rtm->rtm_family = AF_DECnet;
rtm->rtm_dst_len = dst_len; rtm->rtm_dst_len = dst_len;
rtm->rtm_src_len = 0; rtm->rtm_src_len = 0;
rtm->rtm_tos = 0; rtm->rtm_tos = 0;
rtm->rtm_table = tb_id; rtm->rtm_table = tb_id;
RTA_PUT_U32(skb, RTA_TABLE, tb_id); RTA_PUT_U32(skb, RTA_TABLE, tb_id);
rtm->rtm_flags = fi->fib_flags; rtm->rtm_flags = fi->fib_flags;
rtm->rtm_scope = scope; rtm->rtm_scope = scope;
rtm->rtm_type = type; rtm->rtm_type = type;
if (rtm->rtm_dst_len) if (rtm->rtm_dst_len)
RTA_PUT(skb, RTA_DST, 2, dst); RTA_PUT(skb, RTA_DST, 2, dst);
rtm->rtm_protocol = fi->fib_protocol; rtm->rtm_protocol = fi->fib_protocol;
if (fi->fib_priority) if (fi->fib_priority)
RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority); RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority);
if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0) if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0)
goto rtattr_failure; goto rtattr_failure;
if (fi->fib_nhs == 1) { if (fi->fib_nhs == 1) {
if (fi->fib_nh->nh_gw) if (fi->fib_nh->nh_gw)
RTA_PUT(skb, RTA_GATEWAY, 2, &fi->fib_nh->nh_gw); RTA_PUT(skb, RTA_GATEWAY, 2, &fi->fib_nh->nh_gw);
if (fi->fib_nh->nh_oif) if (fi->fib_nh->nh_oif)
RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif); RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif);
} }
if (fi->fib_nhs > 1) { if (fi->fib_nhs > 1) {
struct rtnexthop *nhp; struct rtnexthop *nhp;
struct rtattr *mp_head; struct rtattr *mp_head;
if (skb_tailroom(skb) <= RTA_SPACE(0)) if (skb_tailroom(skb) <= RTA_SPACE(0))
goto rtattr_failure; goto rtattr_failure;
mp_head = (struct rtattr *)skb_put(skb, RTA_SPACE(0)); mp_head = (struct rtattr *)skb_put(skb, RTA_SPACE(0));
for_nexthops(fi) { for_nexthops(fi) {
if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4))
goto rtattr_failure; goto rtattr_failure;
nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp)));
nhp->rtnh_flags = nh->nh_flags & 0xFF; nhp->rtnh_flags = nh->nh_flags & 0xFF;
nhp->rtnh_hops = nh->nh_weight - 1; nhp->rtnh_hops = nh->nh_weight - 1;
nhp->rtnh_ifindex = nh->nh_oif; nhp->rtnh_ifindex = nh->nh_oif;
if (nh->nh_gw) if (nh->nh_gw)
RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw);
nhp->rtnh_len = skb->tail - (unsigned char *)nhp; nhp->rtnh_len = skb->tail - (unsigned char *)nhp;
} endfor_nexthops(fi); } endfor_nexthops(fi);
mp_head->rta_type = RTA_MULTIPATH; mp_head->rta_type = RTA_MULTIPATH;
mp_head->rta_len = skb->tail - (u8*)mp_head; mp_head->rta_len = skb->tail - (u8*)mp_head;
} }
nlh->nlmsg_len = skb->tail - b; nlh->nlmsg_len = skb->tail - b;
return skb->len; return skb->len;
nlmsg_failure: nlmsg_failure:
rtattr_failure: rtattr_failure:
skb_trim(skb, b - skb->data); skb_trim(skb, b - skb->data);
return -EMSGSIZE; return -EMSGSIZE;
} }
static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id, static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,
struct nlmsghdr *nlh, struct netlink_skb_parms *req) struct nlmsghdr *nlh, struct netlink_skb_parms *req)
{ {
struct sk_buff *skb; struct sk_buff *skb;
u32 pid = req ? req->pid : 0; u32 pid = req ? req->pid : 0;
int err = -ENOBUFS; int err = -ENOBUFS;
skb = nlmsg_new(dn_fib_nlmsg_size(DN_FIB_INFO(f)), GFP_KERNEL); skb = nlmsg_new(dn_fib_nlmsg_size(DN_FIB_INFO(f)), GFP_KERNEL);
if (skb == NULL) if (skb == NULL)
goto errout; goto errout;
err = dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id, err = dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id,
f->fn_type, f->fn_scope, &f->fn_key, z, f->fn_type, f->fn_scope, &f->fn_key, z,
DN_FIB_INFO(f), 0); DN_FIB_INFO(f), 0);
if (err < 0) { if (err < 0) {
...@@ -380,7 +380,7 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id, ...@@ -380,7 +380,7 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,
rtnl_set_sk_err(RTNLGRP_DECnet_ROUTE, err); rtnl_set_sk_err(RTNLGRP_DECnet_ROUTE, err);
} }
static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
struct netlink_callback *cb, struct netlink_callback *cb,
struct dn_fib_table *tb, struct dn_fib_table *tb,
struct dn_zone *dz, struct dn_zone *dz,
...@@ -394,12 +394,12 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, ...@@ -394,12 +394,12 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
continue; continue;
if (f->fn_state & DN_S_ZOMBIE) if (f->fn_state & DN_S_ZOMBIE)
continue; continue;
if (dn_fib_dump_info(skb, NETLINK_CB(cb->skb).pid, if (dn_fib_dump_info(skb, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, cb->nlh->nlmsg_seq,
RTM_NEWROUTE, RTM_NEWROUTE,
tb->n, tb->n,
(f->fn_state & DN_S_ZOMBIE) ? 0 : f->fn_type, (f->fn_state & DN_S_ZOMBIE) ? 0 : f->fn_type,
f->fn_scope, &f->fn_key, dz->dz_order, f->fn_scope, &f->fn_key, dz->dz_order,
f->fn_info, NLM_F_MULTI) < 0) { f->fn_info, NLM_F_MULTI) < 0) {
cb->args[4] = i; cb->args[4] = i;
return -1; return -1;
...@@ -409,7 +409,7 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, ...@@ -409,7 +409,7 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
return skb->len; return skb->len;
} }
static __inline__ int dn_hash_dump_zone(struct sk_buff *skb, static __inline__ int dn_hash_dump_zone(struct sk_buff *skb,
struct netlink_callback *cb, struct netlink_callback *cb,
struct dn_fib_table *tb, struct dn_fib_table *tb,
struct dn_zone *dz) struct dn_zone *dz)
...@@ -433,10 +433,10 @@ static __inline__ int dn_hash_dump_zone(struct sk_buff *skb, ...@@ -433,10 +433,10 @@ static __inline__ int dn_hash_dump_zone(struct sk_buff *skb,
return skb->len; return skb->len;
} }
static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb, static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb,
struct netlink_callback *cb) struct netlink_callback *cb)
{ {
int m, s_m; int m, s_m;
struct dn_zone *dz; struct dn_zone *dz;
struct dn_hash *table = (struct dn_hash *)tb->data; struct dn_hash *table = (struct dn_hash *)tb->data;
...@@ -457,7 +457,7 @@ static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb, ...@@ -457,7 +457,7 @@ static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb,
read_unlock(&dn_fib_tables_lock); read_unlock(&dn_fib_tables_lock);
cb->args[2] = m; cb->args[2] = m;
return skb->len; return skb->len;
} }
int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb) int 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,7 +482,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
goto next; goto next;
if (dumped) if (dumped)
memset(&cb->args[2], 0, sizeof(cb->args) - memset(&cb->args[2], 0, sizeof(cb->args) -
2 * sizeof(cb->args[0])); 2 * sizeof(cb->args[0]));
if (tb->dump(tb, skb, cb) < 0) if (tb->dump(tb, skb, cb) < 0)
goto out; goto out;
dumped = 1; dumped = 1;
...@@ -503,13 +503,13 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct ...@@ -503,13 +503,13 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct
struct dn_fib_node *new_f, *f, **fp, **del_fp; struct dn_fib_node *new_f, *f, **fp, **del_fp;
struct dn_zone *dz; struct dn_zone *dz;
struct dn_fib_info *fi; struct dn_fib_info *fi;
int z = r->rtm_dst_len; int z = r->rtm_dst_len;
int type = r->rtm_type; int type = r->rtm_type;
dn_fib_key_t key; dn_fib_key_t key;
int err; int err;
if (z > 16) if (z > 16)
return -EINVAL; return -EINVAL;
dz = table->dh_zones[z]; dz = table->dh_zones[z];
if (!dz && !(dz = dn_new_zone(table, z))) 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,8 +524,8 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct
key = dz_key(dst, dz); key = dz_key(dst, dz);
} }
if ((fi = dn_fib_create_info(r, rta, n, &err)) == NULL) if ((fi = dn_fib_create_info(r, rta, n, &err)) == NULL)
return err; return err;
if (dz->dz_nent > (dz->dz_divisor << 2) && if (dz->dz_nent > (dz->dz_divisor << 2) &&
dz->dz_divisor > DN_MAX_DIVISOR && dz->dz_divisor > DN_MAX_DIVISOR &&
...@@ -626,9 +626,9 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct ...@@ -626,9 +626,9 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct
dn_rt_cache_flush(-1); dn_rt_cache_flush(-1);
} }
dn_rtmsg_fib(RTM_NEWROUTE, new_f, z, tb->n, n, req); dn_rtmsg_fib(RTM_NEWROUTE, new_f, z, tb->n, n, req);
return 0; return 0;
out: out:
dn_fib_release_info(fi); dn_fib_release_info(fi);
return err; return err;
...@@ -639,14 +639,14 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct ...@@ -639,14 +639,14 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
{ {
struct dn_hash *table = (struct dn_hash*)tb->data; struct dn_hash *table = (struct dn_hash*)tb->data;
struct dn_fib_node **fp, **del_fp, *f; struct dn_fib_node **fp, **del_fp, *f;
int z = r->rtm_dst_len; int z = r->rtm_dst_len;
struct dn_zone *dz; struct dn_zone *dz;
dn_fib_key_t key; dn_fib_key_t key;
int matched; int matched;
if (z > 16) if (z > 16)
return -EINVAL; return -EINVAL;
if ((dz = table->dh_zones[z]) == NULL) if ((dz = table->dh_zones[z]) == NULL)
return -ESRCH; return -ESRCH;
...@@ -682,7 +682,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct ...@@ -682,7 +682,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
if (del_fp == NULL && if (del_fp == NULL &&
(!r->rtm_type || f->fn_type == r->rtm_type) && (!r->rtm_type || f->fn_type == r->rtm_type) &&
(r->rtm_scope == RT_SCOPE_NOWHERE || f->fn_scope == r->rtm_scope) && (r->rtm_scope == RT_SCOPE_NOWHERE || f->fn_scope == r->rtm_scope) &&
(!r->rtm_protocol || (!r->rtm_protocol ||
fi->fib_protocol == r->rtm_protocol) && fi->fib_protocol == r->rtm_protocol) &&
dn_fib_nh_match(r, n, rta, fi) == 0) dn_fib_nh_match(r, n, rta, fi) == 0)
del_fp = fp; del_fp = fp;
...@@ -690,7 +690,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct ...@@ -690,7 +690,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
if (del_fp) { if (del_fp) {
f = *del_fp; f = *del_fp;
dn_rtmsg_fib(RTM_DELROUTE, f, z, tb->n, n, req); dn_rtmsg_fib(RTM_DELROUTE, f, z, tb->n, n, req);
if (matched != 1) { if (matched != 1) {
write_lock_bh(&dn_fib_tables_lock); write_lock_bh(&dn_fib_tables_lock);
...@@ -714,7 +714,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct ...@@ -714,7 +714,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
return 0; return 0;
} }
return -ESRCH; return -ESRCH;
} }
static inline int dn_flush_list(struct dn_fib_node **fp, int z, struct dn_hash *table) static inline int dn_flush_list(struct dn_fib_node **fp, int z, struct dn_hash *table)
...@@ -761,7 +761,7 @@ static int dn_fib_table_flush(struct dn_fib_table *tb) ...@@ -761,7 +761,7 @@ static int dn_fib_table_flush(struct dn_fib_table *tb)
static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, struct dn_fib_res *res) static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, struct dn_fib_res *res)
{ {
int err; int err;
struct dn_zone *dz; struct dn_zone *dz;
struct dn_hash *t = (struct dn_hash *)tb->data; struct dn_hash *t = (struct dn_hash *)tb->data;
...@@ -790,7 +790,7 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, ...@@ -790,7 +790,7 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp,
if (err == 0) { if (err == 0) {
res->type = f->fn_type; res->type = f->fn_type;
res->scope = f->fn_scope; res->scope = f->fn_scope;
res->prefixlen = dz->dz_order; res->prefixlen = dz->dz_order;
goto out; goto out;
} }
...@@ -801,21 +801,21 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, ...@@ -801,21 +801,21 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp,
err = 1; err = 1;
out: out:
read_unlock(&dn_fib_tables_lock); read_unlock(&dn_fib_tables_lock);
return err; return err;
} }
struct dn_fib_table *dn_fib_get_table(u32 n, int create) struct dn_fib_table *dn_fib_get_table(u32 n, int create)
{ {
struct dn_fib_table *t; struct dn_fib_table *t;
struct hlist_node *node; struct hlist_node *node;
unsigned int h; unsigned int h;
if (n < RT_TABLE_MIN) if (n < RT_TABLE_MIN)
return NULL; return NULL;
if (n > RT_TABLE_MAX) if (n > RT_TABLE_MAX)
return NULL; return NULL;
h = n & (DN_FIB_TABLE_HASHSZ - 1); h = n & (DN_FIB_TABLE_HASHSZ - 1);
rcu_read_lock(); rcu_read_lock();
...@@ -827,54 +827,54 @@ struct dn_fib_table *dn_fib_get_table(u32 n, int create) ...@@ -827,54 +827,54 @@ struct dn_fib_table *dn_fib_get_table(u32 n, int create)
} }
rcu_read_unlock(); rcu_read_unlock();
if (!create) if (!create)
return NULL; return NULL;
if (in_interrupt() && net_ratelimit()) { if (in_interrupt() && net_ratelimit()) {
printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n"); printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n");
return NULL; return NULL;
} }
t = kzalloc(sizeof(struct dn_fib_table) + sizeof(struct dn_hash), t = kzalloc(sizeof(struct dn_fib_table) + sizeof(struct dn_hash),
GFP_KERNEL); GFP_KERNEL);
if (t == NULL) if (t == NULL)
return NULL; return NULL;
t->n = n; t->n = n;
t->insert = dn_fib_table_insert; t->insert = dn_fib_table_insert;
t->delete = dn_fib_table_delete; t->delete = dn_fib_table_delete;
t->lookup = dn_fib_table_lookup; t->lookup = dn_fib_table_lookup;
t->flush = dn_fib_table_flush; t->flush = dn_fib_table_flush;
t->dump = dn_fib_table_dump; t->dump = dn_fib_table_dump;
hlist_add_head_rcu(&t->hlist, &dn_fib_table_hash[h]); hlist_add_head_rcu(&t->hlist, &dn_fib_table_hash[h]);
return t; return t;
} }
struct dn_fib_table *dn_fib_empty_table(void) struct dn_fib_table *dn_fib_empty_table(void)
{ {
u32 id; u32 id;
for(id = RT_TABLE_MIN; id <= RT_TABLE_MAX; id++) for(id = RT_TABLE_MIN; id <= RT_TABLE_MAX; id++)
if (dn_fib_get_table(id, 0) == NULL) if (dn_fib_get_table(id, 0) == NULL)
return dn_fib_get_table(id, 1); return dn_fib_get_table(id, 1);
return NULL; return NULL;
} }
void dn_fib_flush(void) void dn_fib_flush(void)
{ {
int flushed = 0; int flushed = 0;
struct dn_fib_table *tb; struct dn_fib_table *tb;
struct hlist_node *node; struct hlist_node *node;
unsigned int h; unsigned int h;
for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) { for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) {
hlist_for_each_entry(tb, node, &dn_fib_table_hash[h], hlist) hlist_for_each_entry(tb, node, &dn_fib_table_hash[h], hlist)
flushed += tb->flush(tb); flushed += tb->flush(tb);
} }
if (flushed) if (flushed)
dn_rt_cache_flush(-1); dn_rt_cache_flush(-1);
} }
void __init dn_fib_table_init(void) void __init dn_fib_table_init(void)
...@@ -894,7 +894,7 @@ void __exit dn_fib_table_cleanup(void) ...@@ -894,7 +894,7 @@ void __exit dn_fib_table_cleanup(void)
write_lock(&dn_fib_tables_lock); write_lock(&dn_fib_tables_lock);
for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) { for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) {
hlist_for_each_entry_safe(t, node, next, &dn_fib_table_hash[h], hlist_for_each_entry_safe(t, node, next, &dn_fib_table_hash[h],
hlist) { hlist) {
hlist_del(&t->hlist); hlist_del(&t->hlist);
kfree(t); kfree(t);
} }
......
...@@ -138,7 +138,7 @@ static int __init dn_rtmsg_init(void) ...@@ -138,7 +138,7 @@ static int __init dn_rtmsg_init(void)
int rv = 0; int rv = 0;
dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, DNRNG_NLGRP_MAX, dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, DNRNG_NLGRP_MAX,
dnrmg_receive_user_sk, THIS_MODULE); dnrmg_receive_user_sk, THIS_MODULE);
if (dnrmg == NULL) { if (dnrmg == NULL) {
printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket"); printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket");
return -ENOMEM; return -ENOMEM;
......
...@@ -164,7 +164,7 @@ static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen ...@@ -164,7 +164,7 @@ static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen
return 0; return 0;
} }
static int dn_node_address_handler(ctl_table *table, int write, static int dn_node_address_handler(ctl_table *table, int write,
struct file *filp, struct file *filp,
void __user *buffer, void __user *buffer,
size_t *lenp, loff_t *ppos) 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,7 +240,7 @@ static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen,
} }
namel = strlen(devname) + 1; namel = strlen(devname) + 1;
if (len > namel) len = namel; if (len > namel) len = namel;
if (copy_to_user(oldval, devname, len)) if (copy_to_user(oldval, devname, len))
return -EFAULT; return -EFAULT;
...@@ -275,7 +275,7 @@ static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen, ...@@ -275,7 +275,7 @@ static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen,
} }
static int dn_def_dev_handler(ctl_table *table, int write, static int dn_def_dev_handler(ctl_table *table, int write,
struct file * filp, struct file * filp,
void __user *buffer, void __user *buffer,
size_t *lenp, loff_t *ppos) size_t *lenp, loff_t *ppos)
...@@ -341,17 +341,17 @@ static int dn_def_dev_handler(ctl_table *table, int write, ...@@ -341,17 +341,17 @@ static int dn_def_dev_handler(ctl_table *table, int write,
static ctl_table dn_table[] = { static ctl_table dn_table[] = {
{ {
.ctl_name = NET_DECNET_NODE_ADDRESS, .ctl_name = NET_DECNET_NODE_ADDRESS,
.procname = "node_address", .procname = "node_address",
.maxlen = 7, .maxlen = 7,
.mode = 0644, .mode = 0644,
.proc_handler = dn_node_address_handler, .proc_handler = dn_node_address_handler,
.strategy = dn_node_address_strategy, .strategy = dn_node_address_strategy,
}, },
{ {
.ctl_name = NET_DECNET_NODE_NAME, .ctl_name = NET_DECNET_NODE_NAME,
.procname = "node_name", .procname = "node_name",
.data = node_name, .data = node_name,
.maxlen = 7, .maxlen = 7,
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dostring, .proc_handler = &proc_dostring,
...@@ -359,8 +359,8 @@ static ctl_table dn_table[] = { ...@@ -359,8 +359,8 @@ static ctl_table dn_table[] = {
}, },
{ {
.ctl_name = NET_DECNET_DEFAULT_DEVICE, .ctl_name = NET_DECNET_DEFAULT_DEVICE,
.procname = "default_device", .procname = "default_device",
.maxlen = 16, .maxlen = 16,
.mode = 0644, .mode = 0644,
.proc_handler = dn_def_dev_handler, .proc_handler = dn_def_dev_handler,
.strategy = dn_def_dev_strategy, .strategy = dn_def_dev_strategy,
...@@ -432,32 +432,32 @@ static ctl_table dn_table[] = { ...@@ -432,32 +432,32 @@ static ctl_table dn_table[] = {
.extra2 = &max_decnet_no_fc_max_cwnd .extra2 = &max_decnet_no_fc_max_cwnd
}, },
{ {
.ctl_name = NET_DECNET_MEM, .ctl_name = NET_DECNET_MEM,
.procname = "decnet_mem", .procname = "decnet_mem",
.data = &sysctl_decnet_mem, .data = &sysctl_decnet_mem,
.maxlen = sizeof(sysctl_decnet_mem), .maxlen = sizeof(sysctl_decnet_mem),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
.strategy = &sysctl_intvec, .strategy = &sysctl_intvec,
}, },
{ {
.ctl_name = NET_DECNET_RMEM, .ctl_name = NET_DECNET_RMEM,
.procname = "decnet_rmem", .procname = "decnet_rmem",
.data = &sysctl_decnet_rmem, .data = &sysctl_decnet_rmem,
.maxlen = sizeof(sysctl_decnet_rmem), .maxlen = sizeof(sysctl_decnet_rmem),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
.strategy = &sysctl_intvec, .strategy = &sysctl_intvec,
}, },
{ {
.ctl_name = NET_DECNET_WMEM, .ctl_name = NET_DECNET_WMEM,
.procname = "decnet_wmem", .procname = "decnet_wmem",
.data = &sysctl_decnet_wmem, .data = &sysctl_decnet_wmem,
.maxlen = sizeof(sysctl_decnet_wmem), .maxlen = sizeof(sysctl_decnet_wmem),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
.strategy = &sysctl_intvec, .strategy = &sysctl_intvec,
}, },
{ {
.ctl_name = NET_DECNET_DEBUG_LEVEL, .ctl_name = NET_DECNET_DEBUG_LEVEL,
.procname = "debug", .procname = "debug",
...@@ -472,18 +472,18 @@ static ctl_table dn_table[] = { ...@@ -472,18 +472,18 @@ static ctl_table dn_table[] = {
static ctl_table dn_dir_table[] = { static ctl_table dn_dir_table[] = {
{ {
.ctl_name = NET_DECNET, .ctl_name = NET_DECNET,
.procname = "decnet", .procname = "decnet",
.mode = 0555, .mode = 0555,
.child = dn_table}, .child = dn_table},
{0} {0}
}; };
static ctl_table dn_root_table[] = { static ctl_table dn_root_table[] = {
{ {
.ctl_name = CTL_NET, .ctl_name = CTL_NET,
.procname = "net", .procname = "net",
.mode = 0555, .mode = 0555,
.child = dn_dir_table .child = dn_dir_table
}, },
{0} {0}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment