diff options
-rw-r--r-- | net/decnet/af_decnet.c | 130 | ||||
-rw-r--r-- | net/decnet/dn_dev.c | 102 | ||||
-rw-r--r-- | net/decnet/dn_fib.c | 132 | ||||
-rw-r--r-- | net/decnet/dn_neigh.c | 24 | ||||
-rw-r--r-- | net/decnet/dn_nsp_in.c | 74 | ||||
-rw-r--r-- | net/decnet/dn_nsp_out.c | 56 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 172 | ||||
-rw-r--r-- | net/decnet/dn_table.c | 238 | ||||
-rw-r--r-- | net/decnet/netfilter/dn_rtmsg.c | 2 | ||||
-rw-r--r-- | net/decnet/sysctl_net_decnet.c | 84 |
10 files changed, 507 insertions, 507 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 21f20f21dd3..70061641ee5 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -45,7 +45,7 @@ /****************************************************************************** (c) 1995-1998 E.M. Serrat emserrat@geocities.com - + 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 the Free Software Foundation; either version 2 of the License, or @@ -63,7 +63,7 @@ Version Kernel Date Author/Comments Version 0.0.1 2.0.30 01-dic-97 Eduardo Marcelo Serrat (emserrat@geocities.com) - First Development of DECnet Socket La- + First Development of DECnet Socket La- yer for Linux. Only supports outgoing connections. @@ -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 (emserrat@geocities.com) _ - Added support for incoming connections - so we can start developing server apps - on Linux. + Added support for incoming connections + so we can start developing server apps + on Linux. - Module Support Version 0.0.4 2.1.109 21-jul-98 Eduardo Marcelo Serrat - (emserrat@geocities.com) - _ - Added support for X11R6.4. Now we can - use DECnet transport for X on Linux!!! - - + (emserrat@geocities.com) + _ + Added support for X11R6.4. Now we can + use DECnet transport for X on Linux!!! + - Version 0.0.5 2.1.110 01-aug-98 Eduardo Marcelo Serrat - (emserrat@geocities.com) - Removed bugs on flow control - Removed bugs on incoming accessdata - order - - + (emserrat@geocities.com) + Removed bugs on flow control + Removed bugs on incoming accessdata + order + - Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat - dn_recvmsg fixes + dn_recvmsg fixes - Patrick J. Caulfield - dn_bind fixes + Patrick J. Caulfield + dn_bind fixes *******************************************************************************/ #include <linux/module.h> @@ -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]; } -/* +/* * Valid ports are those greater than zero and not already in use. */ static int check_port(__le16 port) @@ -218,7 +218,7 @@ static int dn_hash_sock(struct sock *sk) BUG_ON(sk_hashed(sk)); write_lock_bh(&dn_hash_lock); - + if (!scp->addrloc && !port_alloc(sk)) goto out; @@ -400,7 +400,7 @@ struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr) sk = sk_head(&dn_wild_sk); if (sk) { - if (sk->sk_state == TCP_LISTEN) + if (sk->sk_state == TCP_LISTEN) sock_hold(sk); else sk = NULL; @@ -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->ackrcv_dat = 0; /* Highest data ack recv*/ 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->flowrem_dat = 0; scp->flowrem_oth = 1; @@ -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; sk->sk_protocol = protocol; @@ -713,7 +713,7 @@ dn_release(struct socket *sock) sock_put(sk); } - return 0; + return 0; } 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); - return rv; + return rv; } @@ -791,7 +791,7 @@ static int dn_auto_bind(struct socket *sock) */ if ((scp->accessdata.acc_accl != 0) && (scp->accessdata.acc_accl <= 12)) { - + 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)); @@ -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) { - unsigned char *ptr = skb->data; + unsigned char *ptr = skb->data; - acc->acc_userl = *ptr++; - memcpy(&acc->acc_user, ptr, acc->acc_userl); - ptr += acc->acc_userl; + acc->acc_userl = *ptr++; + memcpy(&acc->acc_user, ptr, acc->acc_userl); + ptr += acc->acc_userl; - acc->acc_passl = *ptr++; - memcpy(&acc->acc_pass, ptr, acc->acc_passl); - ptr += acc->acc_passl; + acc->acc_passl = *ptr++; + memcpy(&acc->acc_pass, ptr, acc->acc_passl); + ptr += acc->acc_passl; - acc->acc_accl = *ptr++; - memcpy(&acc->acc_acc, ptr, acc->acc_accl); + acc->acc_accl = *ptr++; + 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) 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); return -EINVAL; } @@ -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)); 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)->services_rem = cb->services; DN_SK(newsk)->info_rem = cb->info; DN_SK(newsk)->segsize_rem = cb->segsize; DN_SK(newsk)->accept_mode = DN_SK(sk)->accept_mode; - + if (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) dn_send_conn_ack(newsk); /* - * Here we use sk->sk_allocation since although the conn conf is - * for the newsk, the context is the old socket. - */ + * Here we use sk->sk_allocation since although the conn conf is + * for the newsk, the context is the old socket. + */ if (DN_SK(newsk)->accept_mode == ACC_IMMED) err = dn_confirm_accept(newsk, &timeo, sk->sk_allocation); } release_sock(newsk); - return err; + return err; } @@ -1177,10 +1177,10 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len lock_sock(sk); if (peer) { - if ((sock->state != SS_CONNECTED && - sock->state != SS_CONNECTING) && + if ((sock->state != SS_CONNECTED && + sock->state != SS_CONNECTING) && scp->accept_mode == ACC_IMMED) { - release_sock(sk); + release_sock(sk); return -ENOTCONN; } @@ -1191,7 +1191,7 @@ static int dn_getname(struct socket *sock, struct sockaddr *uaddr,int *uaddr_len release_sock(sk); - return 0; + return 0; } @@ -1285,7 +1285,7 @@ static int dn_listen(struct socket *sock, int backlog) out: release_sock(sk); - return err; + return err; } @@ -1333,7 +1333,7 @@ static int dn_setsockopt(struct socket *sock, int level, int optname, char __use 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 dn_scp *scp = DN_SK(sk); @@ -1360,7 +1360,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us switch(optname) { case DSO_CONDATA: - if (sock->state == SS_CONNECTED) + if (sock->state == SS_CONNECTED) return -EISCONN; if ((scp->state != DN_O) && (scp->state != DN_CR)) return -EINVAL; @@ -1375,7 +1375,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us break; 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; if (optlen != sizeof(struct optdata_dn)) @@ -1388,7 +1388,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us break; case DSO_CONACCESS: - if (sock->state == SS_CONNECTED) + if (sock->state == SS_CONNECTED) return -EISCONN; if (scp->state != DN_O) return -EINVAL; @@ -1521,7 +1521,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us if(get_user(r_len , optlen)) return -EFAULT; - + switch(optname) { case DSO_CONDATA: if (r_len > sizeof(struct optdata_dn)) @@ -1573,11 +1573,11 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us #ifdef CONFIG_NETFILTER { int val, len; - + if(get_user(len, optlen)) return -EFAULT; - - val = nf_getsockopt(sk, PF_DECnet, optname, + + val = nf_getsockopt(sk, PF_DECnet, optname, optval, &len); if (val >= 0) val = put_user(len, optlen); @@ -1588,7 +1588,7 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us case DSO_SEQPACKET: case DSO_CONACCEPT: case DSO_CONREJECT: - return -ENOPROTOOPT; + return -ENOPROTOOPT; case DSO_MAXWINDOW: if (r_len > sizeof(unsigned long)) @@ -1724,7 +1724,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, } } } - + if (scp->state != DN_RUN) goto out; @@ -1773,7 +1773,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, if (skb->len == 0) { skb_unlink(skb, queue); kfree_skb(skb); - /* + /* * N.B. Don't refer to skb or cb after this point * in loop. */ @@ -1783,7 +1783,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, } } - if (eor) { + if (eor) { if (sk->sk_type == SOCK_SEQPACKET) break; if (!(flags & MSG_WAITALL)) @@ -1884,7 +1884,7 @@ static inline unsigned int dn_current_mss(struct sock *sk, int flags) return mss_now; } -/* +/* * 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 * 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, cb->nsp_flags |= 0x20; scp->seg_total += len; - + if (((sent + len) == size) && (flags & MSG_EOR)) { cb->nsp_flags |= 0x40; scp->seg_total = 0; @@ -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) { int i; - + switch (dn_ntohs(dn->sdn_objnamel)) { case 0: sprintf(buf, "%d", dn->sdn_objnum); @@ -2214,7 +2214,7 @@ static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf) buf[i] = '.'; } buf[i] = 0; - } + } } static char *dn_state2asc(unsigned char state) @@ -2381,7 +2381,7 @@ static int __init decnet_init(void) { int rc; - printk(banner); + printk(banner); rc = proto_register(&dn_proto, 1); if (rc != 0) diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 90b3dfd72b4..c5e28114beb 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -224,27 +224,27 @@ static struct dn_dev_sysctl_table { {0} }, {{ - .ctl_name = 0, - .procname = "", - .mode = 0555, + .ctl_name = 0, + .procname = "", + .mode = 0555, .child = dn_dev_sysctl.dn_dev_vars }, {0}}, {{ .ctl_name = NET_DECNET_CONF, - .procname = "conf", - .mode = 0555, + .procname = "conf", + .mode = 0555, .child = dn_dev_sysctl.dn_dev_dev }, {0}}, {{ - .ctl_name = NET_DECNET, - .procname = "decnet", - .mode = 0555, + .ctl_name = NET_DECNET, + .procname = "decnet", + .mode = 0555, .child = dn_dev_sysctl.dn_dev_conf_dir }, {0}}, {{ - .ctl_name = CTL_NET, - .procname = "net", - .mode = 0555, + .ctl_name = CTL_NET, + .procname = "net", + .mode = 0555, .child = dn_dev_sysctl.dn_dev_proto_dir }, {0}} }; @@ -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, void __user *buffer, 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) ASSERT_RTNL(); - /* Check for duplicates */ + /* Check for duplicates */ for(ifa1 = dn_db->ifa_list; ifa1; ifa1 = ifa1->ifa_next) { if (ifa1->ifa_local == ifa->ifa_local) return -EEXIST; @@ -708,7 +708,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) if (!dn_db) return err; } - + if ((ifa = dn_dev_alloc_ifa()) == NULL) return -ENOBUFS; @@ -853,7 +853,7 @@ out: return rv; } -/* +/* * Find a default address to bind to. * * This is one of those areas where the initial VMS concepts don't really @@ -884,39 +884,39 @@ last_chance: static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) { - struct endnode_hello_message *msg; - struct sk_buff *skb = NULL; - __le16 *pktlen; + struct endnode_hello_message *msg; + struct sk_buff *skb = NULL; + __le16 *pktlen; 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; - 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; - memcpy(msg->tiver, dn_eco_version, 3); + msg->msgflg = 0x0D; + memcpy(msg->tiver, dn_eco_version, 3); dn_dn2eth(msg->id, ifa->ifa_local); - msg->iinfo = DN_RT_INFO_ENDN; - msg->blksize = dn_htons(mtu2blksize(dev)); - msg->area = 0x00; - memset(msg->seed, 0, 8); - memcpy(msg->neighbor, dn_hiord, ETH_ALEN); + msg->iinfo = DN_RT_INFO_ENDN; + msg->blksize = dn_htons(mtu2blksize(dev)); + msg->area = 0x00; + memset(msg->seed, 0, 8); + memcpy(msg->neighbor, dn_hiord, ETH_ALEN); if (dn_db->router) { struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; dn_dn2eth(msg->neighbor, dn->addr); } - msg->timer = dn_htons((unsigned short)dn_db->parms.t3); - msg->mpd = 0x00; - msg->datalen = 0x02; - memset(msg->data, 0xAA, 2); - - pktlen = (__le16 *)skb_push(skb,2); - *pktlen = dn_htons(skb->len - 2); + msg->timer = dn_htons((unsigned short)dn_db->parms.t3); + msg->mpd = 0x00; + msg->datalen = 0x02; + memset(msg->data, 0xAA, 2); + + pktlen = (__le16 *)skb_push(skb,2); + *pktlen = dn_htons(skb->len - 2); skb->nh.raw = skb->data; @@ -986,11 +986,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa) dn_dn2eth(ptr, ifa->ifa_local); src = ptr; ptr += ETH_ALEN; - *ptr++ = dn_db->parms.forwarding == 1 ? + *ptr++ = dn_db->parms.forwarding == 1 ? DN_RT_INFO_L1RT : DN_RT_INFO_L2RT; *((__le16 *)ptr) = dn_htons(mtu2blksize(dev)); ptr += 2; - *ptr++ = dn_db->parms.priority; /* Priority */ + *ptr++ = dn_db->parms.priority; /* Priority */ *ptr++ = 0; /* Area: Reserved */ *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3); ptr += 2; @@ -1408,18 +1408,18 @@ static char *dn_type2asc(char type) static int dn_dev_seq_show(struct seq_file *seq, void *v) { 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 { struct net_device *dev = v; char peer_buf[DN_ASCBUF_LEN]; char router_buf[DN_ASCBUF_LEN]; 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", - dev->name ? dev->name : "???", - dn_type2asc(dn_db->parms.mode), - 0, 0, + dev->name ? dev->name : "???", + dn_type2asc(dn_db->parms.mode), + 0, 0, dn_db->t3, dn_db->parms.t3, mtu2blksize(dev), dn_db->parms.priority, @@ -1476,17 +1476,17 @@ MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); void __init dn_dev_init(void) { - if (addr[0] > 63 || addr[0] < 0) { - printk(KERN_ERR "DECnet: Area must be between 0 and 63"); - return; - } + if (addr[0] > 63 || addr[0] < 0) { + printk(KERN_ERR "DECnet: Area must be between 0 and 63"); + return; + } - if (addr[1] > 1023 || addr[1] < 0) { - printk(KERN_ERR "DECnet: Node must be between 0 and 1023"); - return; - } + if (addr[1] > 1023 || addr[1] < 0) { + printk(KERN_ERR "DECnet: Node must be between 0 and 1023"); + return; + } - decnet_address = dn_htons((addr[0] << 10) | addr[1]); + decnet_address = dn_htons((addr[0] << 10) | addr[1]); dn_dev_devices_on(); diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 1cf010124ec..3cbfddc9843 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) return -EINVAL; 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 -ENOBUFS; @@ -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) { - int ret = 0; - int scope = RT_SCOPE_NOWHERE; - - if (force) - scope = -1; - - for_fib_info() { - /* - * This makes no sense for DECnet.... we will almost - * certainly have more than one local address the same - * over all our interfaces. It needs thinking about - * some more. - */ - if (local && fi->fib_prefsrc == local) { - fi->fib_flags |= RTNH_F_DEAD; - ret++; - } else if (dev && fi->fib_nhs) { - int dead = 0; - - change_nexthops(fi) { - if (nh->nh_flags&RTNH_F_DEAD) - dead++; - else if (nh->nh_dev == dev && - nh->nh_scope != scope) { + int ret = 0; + int scope = RT_SCOPE_NOWHERE; + + if (force) + scope = -1; + + for_fib_info() { + /* + * This makes no sense for DECnet.... we will almost + * certainly have more than one local address the same + * over all our interfaces. It needs thinking about + * some more. + */ + if (local && fi->fib_prefsrc == local) { + fi->fib_flags |= RTNH_F_DEAD; + ret++; + } else if (dev && fi->fib_nhs) { + int dead = 0; + + change_nexthops(fi) { + if (nh->nh_flags&RTNH_F_DEAD) + dead++; + else if (nh->nh_dev == dev && + nh->nh_scope != scope) { spin_lock_bh(&dn_fib_multipath_lock); - nh->nh_flags |= RTNH_F_DEAD; - fi->fib_power -= nh->nh_power; - nh->nh_power = 0; + nh->nh_flags |= RTNH_F_DEAD; + fi->fib_power -= nh->nh_power; + nh->nh_power = 0; spin_unlock_bh(&dn_fib_multipath_lock); - dead++; - } - } endfor_nexthops(fi) - if (dead == fi->fib_nhs) { - fi->fib_flags |= RTNH_F_DEAD; - ret++; - } - } - } endfor_fib_info(); - return ret; + dead++; + } + } endfor_nexthops(fi) + if (dead == fi->fib_nhs) { + fi->fib_flags |= RTNH_F_DEAD; + ret++; + } + } + } endfor_fib_info(); + return ret; } static int dn_fib_sync_up(struct net_device *dev) { - int ret = 0; - - if (!(dev->flags&IFF_UP)) - return 0; - - for_fib_info() { - int alive = 0; - - change_nexthops(fi) { - if (!(nh->nh_flags&RTNH_F_DEAD)) { - alive++; - continue; - } - if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) - continue; - if (nh->nh_dev != dev || dev->dn_ptr == NULL) - continue; - alive++; + int ret = 0; + + if (!(dev->flags&IFF_UP)) + return 0; + + for_fib_info() { + int alive = 0; + + change_nexthops(fi) { + if (!(nh->nh_flags&RTNH_F_DEAD)) { + alive++; + continue; + } + if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) + continue; + if (nh->nh_dev != dev || dev->dn_ptr == NULL) + continue; + alive++; spin_lock_bh(&dn_fib_multipath_lock); - nh->nh_power = 0; - nh->nh_flags &= ~RTNH_F_DEAD; + nh->nh_power = 0; + nh->nh_flags &= ~RTNH_F_DEAD; spin_unlock_bh(&dn_fib_multipath_lock); - } endfor_nexthops(fi); - - if (alive > 0) { - fi->fib_flags &= ~RTNH_F_DEAD; - ret++; - } - } endfor_fib_info(); - return ret; + } endfor_nexthops(fi); + + if (alive > 0) { + fi->fib_flags &= ~RTNH_F_DEAD; + ret++; + } + } endfor_fib_info(); + return ret; } static struct notifier_block dn_fib_dnaddr_notifier = { diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index 7322bb36e82..11d692dfb4f 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c @@ -3,7 +3,7 @@ * operating system. DECnet is implemented using the BSD Socket * 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) * * Author: Steve Whitehouse <SteveW@ACM.org> @@ -277,19 +277,19 @@ static int dn_short_output(struct sk_buff *skb) struct dn_skb_cb *cb = DN_SKB_CB(skb); - if (skb_headroom(skb) < headroom) { - struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom); - if (skb2 == NULL) { + if (skb_headroom(skb) < headroom) { + struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom); + if (skb2 == NULL) { if (net_ratelimit()) - printk(KERN_CRIT "dn_short_output: no memory\n"); - kfree_skb(skb); - return -ENOBUFS; - } - kfree_skb(skb); - skb = skb2; + printk(KERN_CRIT "dn_short_output: no memory\n"); + kfree_skb(skb); + return -ENOBUFS; + } + kfree_skb(skb); + skb = skb2; 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); *((__le16 *)data) = dn_htons(skb->len - 2); diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c index 39a6cf7fb56..0f244e81a37 100644 --- a/net/decnet/dn_nsp_in.c +++ b/net/decnet/dn_nsp_in.c @@ -33,7 +33,7 @@ /****************************************************************************** (c) 1995-1998 E.M. Serrat emserrat@geocities.com - + 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 the Free Software Foundation; either version 2 of the License, or @@ -63,7 +63,7 @@ #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> -#include <linux/termios.h> +#include <linux/termios.h> #include <linux/interrupt.h> #include <linux/proc_fs.h> #include <linux/stat.h> @@ -139,7 +139,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) ptr++; len += 2; if ((ack & 0x4000) == 0) { - if (oth) + if (oth) ack ^= 0x2000; dn_ack(sk, skb, ack); } @@ -152,7 +152,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) skb_pull(skb, 2); len += 2; if ((ack & 0x4000) == 0) { - if (oth) + if (oth) ack ^= 0x2000; dn_ack(sk, skb, ack); } @@ -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)) { scp->persist = 0; - scp->addrrem = cb->src_port; - sk->sk_state = TCP_ESTABLISHED; - scp->state = DN_RUN; + scp->addrrem = cb->src_port; + sk->sk_state = TCP_ESTABLISHED; + scp->state = DN_RUN; scp->services_rem = cb->services; scp->info_rem = cb->info; scp->segsize_rem = cb->segsize; @@ -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); } } - dn_nsp_send_link(sk, DN_NOCHANGE, 0); - if (!sock_flag(sk, SOCK_DEAD)) - sk->sk_state_change(sk); - } + dn_nsp_send_link(sk, DN_NOCHANGE, 0); + if (!sock_flag(sk, SOCK_DEAD)) + sk->sk_state_change(sk); + } out: - kfree_skb(skb); + kfree_skb(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) sk->sk_state_change(sk); } - /* + /* * It appears that its possible for remote machines to send disc * init messages with no port identifier if we are in the CI and * 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) /* * 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. */ if (lsflags & 0xf8) @@ -530,7 +530,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) switch(lsflags & 0x04) { /* FCVAL INT */ case 0x00: /* Normal Request */ switch(lsflags & 0x03) { /* FCVAL MOD */ - case 0x00: /* Request count */ + case 0x00: /* Request count */ if (fcval < 0) { unsigned char p_fcval = -fcval; if ((scp->flowrem_dat > p_fcval) && @@ -541,7 +541,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) scp->flowrem_dat += fcval; wake_up = 1; } - break; + break; case 0x01: /* Stop outgoing data */ scp->flowrem_sw = DN_DONTSEND; break; @@ -557,10 +557,10 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) wake_up = 1; } break; - } + } if (wake_up && !sock_flag(sk, SOCK_DEAD)) sk->sk_state_change(sk); - } + } dn_nsp_send_oth_ack(sk); @@ -576,38 +576,38 @@ out: static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue) { int err; - - /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces - number of warnings when compiling with -W --ANK - */ - if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= + + /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces + number of warnings when compiling with -W --ANK + */ + if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= (unsigned)sk->sk_rcvbuf) { - err = -ENOMEM; - goto out; - } + err = -ENOMEM; + goto out; + } err = sk_filter(sk, skb); if (err) goto out; - skb_set_owner_r(skb, sk); - skb_queue_tail(queue, skb); + skb_set_owner_r(skb, sk); + skb_queue_tail(queue, skb); /* This code only runs from BH or BH protected context. * Therefore the plain read_lock is ok here. -DaveM */ read_lock(&sk->sk_callback_lock); - if (!sock_flag(sk, SOCK_DEAD)) { + if (!sock_flag(sk, SOCK_DEAD)) { struct socket *sock = sk->sk_socket; wake_up_interruptible(sk->sk_sleep); if (sock && sock->fasync_list && !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); } read_unlock(&sk->sk_callback_lock); out: - return err; + return err; } 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) skb_pull(skb, 2); 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); - queued = 1; - } + queued = 1; + } if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) { scp->flowloc_sw = DN_DONTSEND; dn_nsp_send_link(sk, DN_DONTSEND, 0); } - } + } dn_nsp_send_data_ack(sk); out: @@ -732,7 +732,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb) if (decnet_debug_level & 2) 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; /* @@ -852,7 +852,7 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb) case 0x30: dn_nsp_disc_init(sk, skb); break; - case 0x40: + case 0x40: dn_nsp_disc_conf(sk, skb); break; } diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index b342e4e8f5f..23d5ca88dfa 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c @@ -26,7 +26,7 @@ /****************************************************************************** (c) 1995-1998 E.M. Serrat emserrat@geocities.com - + 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 the Free Software Foundation; either version 2 of the License, or @@ -55,7 +55,7 @@ #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> -#include <linux/termios.h> +#include <linux/termios.h> #include <linux/interrupt.h> |