diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 11:38:13 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 11:38:13 -0800 |
commit | cb18eccff48ef3986d1072964590bce6fec705fb (patch) | |
tree | 777fb1d15e0281341e1e02c9803d989538d346f2 /net/decnet | |
parent | c827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff) | |
parent | 5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits)
[IPV4]: Restore multipath routing after rt_next changes.
[XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch.
[NET]: Reorder fields of struct dst_entry
[DECNET]: Convert decnet route to use the new dst_entry 'next' pointer
[IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer
[IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer
[NET]: Introduce union in struct dst_entry to hold 'next' pointer
[DECNET]: fix misannotation of linkinfo_dn
[DECNET]: FRA_{DST,SRC} are le16 for decnet
[UDP]: UDP can use sk_hash to speedup lookups
[NET]: Fix whitespace errors.
[NET] XFRM: Fix whitespace errors.
[NET] X25: Fix whitespace errors.
[NET] WANROUTER: Fix whitespace errors.
[NET] UNIX: Fix whitespace errors.
[NET] TIPC: Fix whitespace errors.
[NET] SUNRPC: Fix whitespace errors.
[NET] SCTP: Fix whitespace errors.
[NET] SCHED: Fix whitespace errors.
[NET] RXRPC: Fix whitespace errors.
...
Diffstat (limited to 'net/decnet')
-rw-r--r-- | net/decnet/af_decnet.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 | 204 | ||||
-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, 523 insertions, 523 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> #include <linux/proc_fs.h> #include <linux/stat.h> @@ -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 * that is it always positive here. */ - if (rtt < 0) + if (rtt < 0) rtt = -rtt; /* * Add new rtt to smoothed average */ delta = ((rtt << 3) - srtt); srtt += (delta >> 3); - if (srtt >= 1) + if (srtt >= 1) scp->nsp_srtt = (unsigned long)srtt; else scp->nsp_srtt = 1; @@ -193,7 +193,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt) */ delta >>= 1; rttvar += ((((delta>0)?(delta):(-delta)) - rttvar) >> 2); - if (rttvar >= 1) + if (rttvar >= 1) scp->nsp_rttvar = (unsigned long)rttvar; else scp->nsp_rttvar = 1; @@ -434,7 +434,7 @@ int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff * further. */ if (xmit_count == 1) { - if (dn_equal(segnum, acknum)) + if (dn_equal(segnum, acknum)) dn_nsp_rtt(sk, (long)(pkttime - reftime)); if (scp->snd_window < scp->max_window) @@ -486,16 +486,16 @@ void dn_send_conn_ack (struct sock *sk) { struct dn_scp *scp = DN_SK(sk); 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) return; - msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); - msg->msgflg = 0x24; + msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); + msg->msgflg = 0x24; msg->dstaddr = scp->addrrem; - dn_nsp_send(skb); + dn_nsp_send(skb); } void dn_nsp_delayed_ack(struct sock *sk) @@ -523,25 +523,25 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) { struct dn_scp *scp = DN_SK(sk); 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); if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) return; - msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); - msg->msgflg = 0x28; + msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); + msg->msgflg = 0x28; msg->dstaddr = scp->addrrem; - msg->srcaddr = scp->addrloc; - msg->services = scp->services_loc; - msg->info = scp->info_loc; - msg->segsize = dn_htons(scp->segsize_loc); + msg->srcaddr = scp->addrloc; + msg->services = scp->services_loc; + msg->info = scp->info_loc; + msg->segsize = dn_htons(scp->segsize_loc); *skb_put(skb,1) = len; - if (len > 0) + if (len > 0) memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len); - + dn_nsp_send(skb); @@ -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, struct dst_entry *dst, 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, } -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) { struct dn_scp *scp = DN_SK(sk); @@ -605,19 +605,19 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, if (reason == 0) 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); } -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) { struct dn_skb_cb *cb = DN_SKB_CB(skb); int ddl = 0; 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); } @@ -676,8 +676,8 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) msg->srcaddr = scp->addrloc; msg->services = scp->services_loc; /* Requested flow control */ - msg->info = scp->info_loc; /* Version Number */ - msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */ + msg->info = scp->info_loc; /* Version Number */ + msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */ if (scp->peer.sdn_objnum) type = 0; @@ -692,7 +692,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) menuver |= DN_MENUVER_UIC; *skb_put(skb, 1) = menuver; /* Menu Version */ - + aux = scp->accessdata.acc_userl; *skb_put(skb, 1) = aux; if (aux > 0) @@ -718,6 +718,6 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) cb->rt_flags = DN_RT_F_RQR; - dn_nsp_send(skb); + dn_nsp_send(skb); } diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 9881933167b..efccc42ff1c 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -43,7 +43,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 @@ -167,11 +167,11 @@ static void dn_dst_check_expire(unsigned long dummy) while((rt=*rtp) != NULL) { if (atomic_read(&rt->u.dst.__refcnt) || (now - rt->u.dst.lastuse) < expire) { - rtp = &rt->u.rt_next; + rtp = &rt->u.dst.dn_next; continue; } - *rtp = rt->u.rt_next; - rt->u.rt_next = NULL; + *rtp = rt->u.dst.dn_next; + rt->u.dst.dn_next = NULL; dnrt_free(rt); } spin_unlock(&dn_rt_hash_table[i].lock); @@ -198,11 +198,11 @@ static int dn_dst_gc(void) while((rt=*rtp) != NULL) { if (atomic_read(&rt->u.dst.__refcnt) || (now - rt->u.dst.lastuse) < expire) { - rtp = &rt->u.rt_next; + rtp = &rt->u.dst.dn_next; continue; } - *rtp = rt->u.rt_next; - rt->u.rt_next = NULL; + *rtp = rt->u.dst.dn_next; + rt->u.dst.dn_next = NULL; dnrt_drop(rt); break; } @@ -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) */ static struct dst_entry *dn_dst_check(struct dst_entry *dst, __u32 cookie) @@ -286,8 +286,8 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * while((rth = *rthp) != NULL) { if (compare_keys(&rth->fl, &rt->fl)) { /* Put it first */ - *rthp = rth->u.rt_next; - rcu_assign_pointer(rth->u.rt_next, + *rthp = rth->u.dst.dn_next; + rcu_assign_pointer(rth->u.dst.dn_next, dn_rt_hash_table[hash].chain); rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); @@ -300,12 +300,12 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * *rp = rth; return 0; } - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.dn_next; } - rcu_assign_pointer(rt->u.rt_next, dn_rt_hash_table[hash].chain); + rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain); rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); - + dst_hold(&rt->u.dst); rt->u.dst.__use++; rt->u.dst.lastuse = now; @@ -326,8 +326,8 @@ void dn_run_flush(unsigned long dummy) goto nothing_to_declare; for(; rt; rt=next) { - next = rt->u.rt_next; - rt->u.rt_next = NULL; + next = rt->u.dst.dn_next; + rt->u.dst.dn_next = NULL; dst_free((struct dst_entry *)rt); } @@ -506,23 +506,23 @@ static int dn_route_rx_long(struct sk_buff *skb) skb_pull(skb, 20); skb->h.raw = skb->data; - /* Destination info */ - ptr += 2; + /* Destination info */ + ptr += 2; cb->dst = dn_eth2dn(ptr); - if (memcmp(ptr, dn_hiord_addr, 4) != 0) - goto drop_it; - ptr += 6; + if (memcmp(ptr, dn_hiord_addr, 4) != 0) + goto drop_it; + ptr += 6; - /* Source info */ - ptr += 2; + /* Source info */ + ptr += 2; cb->src = dn_eth2dn(ptr); - if (memcmp(ptr, dn_hiord_addr, 4) != 0) - goto drop_it; - ptr += 6; - /* Other junk */ - ptr++; - cb->hops = *ptr++; /* Visit Count */ + if (memcmp(ptr, dn_hiord_addr, 4) != 0) + goto drop_it; + ptr += 6; + /* Other junk */ + ptr++; + cb->hops = *ptr++; /* Visit Count */ 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) skb->h.raw = skb->data; cb->dst = *(__le16 *)ptr; - ptr += 2; - cb->src = *(__le16 *)ptr; - ptr += 2; - cb->hops = *ptr & 0x3f; + ptr += 2; + cb->src = *(__le16 *)ptr; + ptr += 2; + cb->hops = *ptr & 0x3f; return NF_HOOK(PF_DECnet, NF_DN_PRE_ROUTING, skb, skb->dev, NULL, dn_route_rx_packet); drop_it: - kfree_skb(skb); - return NET_RX_DROP; + kfree_skb(skb); + return NET_RX_DROP; } 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 cb->rt_flags = flags; if (decnet_debug_level & 1) - printk(KERN_DEBUG + printk(KERN_DEBUG "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); - if (flags & DN_RT_PKT_CNTL) { + if (flags & DN_RT_PKT_CNTL) { if (unlikely(skb_linearize(skb))) goto dump_it; - switch(flags & DN_RT_CNTL_MSK) { - case DN_RT_PKT_INIT: + switch(flags & DN_RT_CNTL_MSK) { + case DN_RT_PKT_INIT: dn_dev_init_pkt(skb); break; - case DN_RT_PKT_VERI: + case DN_RT_PKT_VERI: dn_dev_veri_pkt(skb); break; } @@ -648,31 +648,31 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type goto dump_it; 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); - case DN_RT_PKT_L1RT: - case DN_RT_PKT_L2RT: - return NF_HOOK(PF_DECnet, NF_DN_ROUTE, skb, skb->dev, NULL, dn_route_discard); - case DN_RT_PKT_ERTH: + case DN_RT_PKT_L1RT: + case DN_RT_PKT_L2RT: + return NF_HOOK(PF_DECnet, NF_DN_ROUTE, skb, skb->dev, NULL, dn_route_discard); + case DN_RT_PKT_ERTH: 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); - } - } else { + } + } else { if (dn->parms.state != DN_DEV_S_RU) goto dump_it; skb_pull(skb, 1); /* Pull flags */ - switch(flags & DN_RT_PKT_MSK) { - case DN_RT_PKT_LONG: - return dn_route_rx_long(skb); - case DN_RT_PKT_SHORT: - return dn_route_rx_short(skb); + switch(flags & DN_RT_PKT_MSK) { + case DN_RT_PKT_LONG: + return dn_route_rx_long(skb); + case DN_RT_PKT_SHORT: + return dn_route_rx_short(skb); } - } + } dump_it: kfree_skb(skb); @@ -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; } - if (rt->u.dst.metrics[RTAX_MTU-1] == 0 || - rt->u.dst.metrics[RTAX_MTU-1] > rt->u.dst.dev->mtu) + 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; mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst)); 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 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, .saddr = oldflp->fld_src, .scope = RT_SCOPE_UNIVERSE, @@ -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" " iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst), 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 (oldflp->oif) { @@ -982,19 +982,19 @@ source_ok: if (err != -ESRCH) 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 * docs * * If we are not trying hard, look in neighbour cache. * 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 */ if (!try_hard) { neigh = neigh_lookup_nodev(&dn_neigh_table, &fl.fld_dst); if (neigh) { - if ((oldflp->oif && + if ((oldflp->oif && (neigh->dev->ifindex != oldflp->oif)) || (oldflp->fld_src && (!dn_dev_islocal(neigh->dev, @@ -1044,7 +1044,7 @@ select_source: if (fl.fld_src == 0) { fl.fld_src = dnet_select_source(dev_out, gateway, res.type == RTN_LOCAL ? - RT_SCOPE_HOST : + RT_SCOPE_HOST : RT_SCOPE_LINK); if (fl.fld_src == 0 && res.type != RTN_LOCAL) goto e_addr; @@ -1074,14 +1074,14 @@ select_source: if (res.fi->fib_nhs > 1 && fl.oif == 0) dn_fib_select_multipath(&fl, &res); - /* + /* * We could add some logic to deal with default routes here and * get rid of some of the special casing above. */ if (!fl.fld_src) fl.fld_src = DN_FIB_RES_PREFSRC(res); - + if (dev_out) dev_put(dev_out); dev_out = DN_FIB_RES_DEV(res); @@ -1144,8 +1144,8 @@ out: return err; e_addr: - err = -EADDRNOTAVAIL; - goto done; + err = -EADDRNOTAVAIL; + goto done; e_inval: err = -EINVAL; goto done; @@ -1169,7 +1169,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl if (!(flags & MSG_TRYHARD)) { rcu_read_lock_bh(); for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt; - rt = rcu_dereference(rt->u.rt_next)) { + rt = rcu_dereference(rt->u.dst.dn_next)) { if ((flp->fld_dst == rt->fl.fld_dst) && (flp->fld_src == rt->fl.fld_src) && (flp->mark == rt->fl.mark) && @@ -1223,7 +1223,7 @@ static int dn_route_input_slow(struct sk_buff *skb) int flags = 0; __le16 gateway = 0; __le16 local_src = 0; - struct flowi fl = { .nl_u = { .dn_u = + struct flowi fl = { .nl_u = { .dn_u = { .daddr = cb->dst, .saddr = cb->src, .scope = RT_SCOPE_UNIVERSE, @@ -1311,7 +1311,7 @@ static int dn_route_input_slow(struct sk_buff *skb) if (res.fi->fib_nhs > 1 && fl.oif == 0) dn_fib_select_multipath(&fl, &res); - /* + /* * Check for out_dev == in_dev. We use the RTCF_DOREDIRECT * flag as a hint to set the intra-ethernet bit when * forwarding. If we've got NAT in operation, we don't do @@ -1443,9 +1443,9 @@ int dn_route_input(struct sk_buff *skb) rcu_read_lock(); for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; - rt = rcu_dereference(rt->u.rt_next)) { + rt = rcu_dereference(rt->u.dst.dn_next)) { 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.mark == skb->mark) && (rt->fl.iif == cb->iif)) { @@ -1514,8 +1514,8 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, nlmsg_failure: rtattr_failure: - skb_trim(skb, b - skb->data); - return -1; + skb_trim(skb, b - skb->data); + return -1; } /* @@ -1627,12 +1627,12 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) rcu_read_lock_bh(); for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0; rt; - rt = rcu_dereference(rt->u.rt_next), idx++) { + rt = rcu_dereference(rt->u.dst.dn_next), idx++) { if (idx < s_idx) continue; skb->dst = dst_clone(&rt->u.dst); 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) { dst_release(xchg(&skb->dst, NULL)); rcu_read_unlock_bh(); @@ -1673,7 +1673,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou { struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); - rt = rt->u.rt_next; + rt = rt->u.dst.dn_next; while(!rt) { rcu_read_unlock_bh(); if (--s->bucket < 0) @@ -1721,7 +1721,7 @@ static int dn_rt_cache_seq_show(struct seq_file *seq, void *v) rt->u.dst.__use, (int) dst_metric(&rt->u.dst, RTAX_RTT)); return 0; -} +} static struct seq_operations dn_rt_cache_seq_ops = { .start = dn_rt_cache_seq_start, @@ -1778,38 +1778,38 @@ void __init dn_route_init(void) for(order = 0; (1UL << order) < goal; order++) /* NOTHING */; - /* - * Only want 1024 entries max, since the table is very, very unlikely - * to be larger than that. - */ - while(order && ((((1UL << order) * PAGE_SIZE) / - sizeof(struct dn_rt_hash_bucket)) >= 2048)) - order--; - - do { - dn_rt_hash_mask = (1UL << order) * PAGE_SIZE / - sizeof(struct dn_rt_hash_bucket); - while(dn_rt_hash_mask & (dn_rt_hash_mask - 1)) - dn_rt_hash_mask--; - dn_rt_hash_table = (struct dn_rt_hash_bucket *) - __get_free_pages(GFP_ATOMIC, order); - } while (dn_rt_hash_table == NULL && --order > 0); + /* + * Only want 1024 entries max, since the table is very, very unlikely + * to be larger than that. + */ + while(order && ((((1UL << order) * PAGE_SIZE) / + sizeof(struct dn_rt_hash_bucket)) >= 2048)) + order--; + + do { + dn_rt_hash_mask = (1UL << order) * PAGE_SIZE / + sizeof(struct dn_rt_hash_bucket); + while(dn_rt_hash_mask & (dn_rt_hash_mask - 1)) + dn_rt_hash_mask--; + dn_rt_hash_table = (struct dn_rt_hash_bucket *) + __get_free_pages(GFP_ATOMIC, order); + } while (dn_rt_hash_table == NULL && --order > 0); 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 - "DECnet: Routing cache hash table of %u buckets, %ldKbytes\n", - dn_rt_hash_mask, + printk(KERN_INFO + "DECnet: Routing cache hash table of %u buckets, %ldKbytes\n", + dn_rt_hash_mask, (long)(dn_rt_hash_mask*sizeof(struct dn_rt_hash_bucket))/1024); dn_rt_hash_mask--; - for(i = 0; i <= dn_rt_hash_mask; i++) { - spin_lock_init(&dn_rt_hash_table[i].lock); - dn_rt_hash_table[i].chain = NULL; - } + for(i = 0; i <= dn_rt_hash_mask; i++) { + spin_lock_init(&dn_rt_hash_table[i].lock); + 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); } diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index 720501e1ae2..780a141f834 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c @@ -60,7 +60,7 @@ struct dn_hash #define dz_prefix(key,dz) ((key).datum) #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) } @@ -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, - u32 tb_id, u8 type, u8 scope, void *dst, int dst_len, - struct dn_fib_info *fi, unsigned int flags) + u32 tb_id, u8 type, u8 scope, void *dst, int dst_len, + struct dn_fib_info *fi, unsigned int flags) { - struct rtmsg *rtm; - struct nlmsghdr *nlh; - unsigned char *b = skb->tail; - - nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); - rtm = NLMSG_DATA(nlh); - rtm->rtm_family = AF_DECnet; - rtm->rtm_dst_len = dst_len; - rtm->rtm_src_len = 0; - rtm->rtm_tos = 0; - rtm->rtm_table = tb_id; + struct rtmsg *rtm; + struct nlmsghdr *nlh; + unsigned char *b = skb->tail; + + nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); + rtm = NLMSG_DATA(nlh); + rtm->rtm_family = AF_DECnet; + rtm->rtm_dst_len = dst_len; + rtm->rtm_src_len = 0; + rtm->rtm_tos = 0; + rtm->rtm_table = tb_id; RTA_PUT_U32(skb, RTA_TABLE, tb_id); - rtm->rtm_flags = fi->fib_flags; - rtm->rtm_scope = scope; + rtm->rtm_flags = fi->fib_flags; + rtm->rtm_scope = scope; rtm->rtm_type = type; - if (rtm->rtm_dst_len) - RTA_PUT(skb, RTA_DST, 2, dst); - rtm->rtm_protocol = fi->fib_protocol; - if (fi->fib_priority) - RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority); + if (rtm->rtm_dst_len) + RTA_PUT(skb, RTA_DST, 2, dst); + rtm->rtm_protocol = fi->fib_protocol; + if (fi->fib_priority) + RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority); if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0) goto rtattr_failure; - if (fi->fib_nhs == 1) { - if (fi->fib_nh->nh_gw) - RTA_PUT(skb, RTA_GATEWAY, 2, &fi->fib_nh->nh_gw); - if (fi->fib_nh->nh_oif) - RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif); - } - if (fi->fib_nhs > 1) { - struct rtnexthop *nhp; - struct rtattr *mp_head; - if (skb_tailroom(skb) <= RTA_SPACE(0)) - goto rtattr_failure; - mp_head = (struct rtattr *)skb_put(skb, RTA_SPACE(0)); - - for_nexthops(fi) { - if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) - goto rtattr_failure; - nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); - nhp->rtnh_flags = nh->nh_flags & 0xFF; - nhp->rtnh_hops = nh->nh_weight - 1; - nhp->rtnh_ifindex = nh->nh_oif; - if (nh->nh_gw) - RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); - nhp->rtnh_len = skb->tail - (unsigned char *)nhp; - } endfor_nexthops(fi); - mp_head->rta_type = RTA_MULTIPATH; - mp_head->rta_len = skb->tail - (u8*)mp_head; - } - - nlh->nlmsg_len = skb->tail - b; - return skb->len; + if (fi->fib_nhs == 1) { + if (fi->fib_nh->nh_gw) + RTA_PUT(skb, RTA_GATEWAY, 2, &fi->fib_nh->nh_gw); + if (fi->fib_nh->nh_oif) + RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif); + } + if (fi->fib_nhs > 1) { + struct rtnexthop *nhp; + struct rtattr *mp_head; + if (skb_tailroom(skb) <= RTA_SPACE(0)) + goto rtattr_failure; + mp_head = (struct rtattr *)skb_put(skb, RTA_SPACE(0)); + + for_nexthops(fi) { + if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) + goto rtattr_failure; + nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); + nhp->rtnh_flags = nh->nh_flags & 0xFF; + nhp->rtnh_hops = nh->nh_weight - 1; + nhp->rtnh_ifindex = nh->nh_oif; + if (nh->nh_gw) + RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); + nhp->rtnh_len = skb->tail - (unsigned char *)nhp; + } endfor_nexthops(fi); + mp_head->rta_type = RTA_MULTIPATH; + mp_head->rta_len = skb->tail - (u8*)mp_head; + } + + nlh->nlmsg_len = skb->tail - b; + return skb->len; nlmsg_failure: rtattr_failure: - skb_trim(skb, b - skb->data); - return -EMSGSIZE; + skb_trim(skb, b - skb->data); + return -EMSGSIZE; } 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; - u32 pid = req ? req->pid : 0; + struct sk_buff *skb; + u32 pid = req ? req->pid : 0; int err = -ENOBUFS; - skb = nlmsg_new(dn_fib_nlmsg_size(DN_FIB_INFO(f)), GFP_KERNEL); - if (skb == NULL) + skb = nlmsg_new(dn_fib_nlmsg_size(DN_FIB_INFO(f)), GFP_KERNEL); + if (skb == NULL) 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, DN_FIB_INFO(f), 0); if (err < 0) { @@ -380,7 +380,7 @@ errout: 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 dn_fib_table *tb, struct dn_zone *dz, @@ -394,12 +394,12 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, continue; if (f->fn_state & DN_S_ZOMBIE) 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, RTM_NEWROUTE, - tb->n, + tb->n, (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) { cb->args[4] = i; return -1; @@ -409,7 +409,7 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, 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 dn_fib_table *tb, struct dn_zone *dz) @@ -433,10 +433,10 @@ static __inline__ int dn_hash_dump_zone(struct sk_buff *skb, return skb->len; } -static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb, - struct netlink_callback *cb) +static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb, + struct netlink_callback *cb) { - int m, s_m; + int m, s_m; struct dn_zone *dz; 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, read_unlock(&dn_fib_tables_lock); cb->args[2] = m; - return skb->len; + return skb->len; } 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; if (dumped) 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) goto out; dumped = 1; @@ -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_zone *dz; struct dn_fib_info *fi; - int z = r->rtm_dst_len; + int z = r->rtm_dst_len; int type = r->rtm_type; dn_fib_key_t key; - int err; + int err; - if (z > 16) - return -EINVAL; + if (z > 16) + return -EINVAL; dz = table->dh_zones[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 key = dz_key(dst, dz); } - if ((fi = dn_fib_create_info(r, rta, n, &err)) == NULL) - return err; + if ((fi = dn_fib_create_info(r, rta, n, &err)) == NULL) + return err; if (dz->dz_nent > (dz->dz_divisor << 2) && dz->dz_divisor > DN_MAX_DIVISOR && @@ -624,9 +624,9 @@ replace: 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: dn_fib_release_info(fi); return err; @@ -637,14 +637,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_fib_node **fp, **del_fp, *f; - int z = r->rtm_dst_len; + int z = r->rtm_dst_len; struct dn_zone *dz; dn_fib_key_t key; int matched; - if (z > 16) - return -EINVAL; + if (z > 16) + return -EINVAL; if ((dz = table->dh_zones[z]) == NULL) return -ESRCH; @@ -680,7 +680,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct if (del_fp == NULL && (!r->rtm_type || f->fn_type == r->rtm_type) && (r->rtm_scope == RT_SCOPE_NOWHERE || f->fn_scope == r->rtm_scope) && - (!r->rtm_protocol || + (!r->rtm_protocol || fi->fib_protocol == r->rtm_protocol) && dn_fib_nh_match(r, n, rta, fi) == 0) del_fp = fp; @@ -688,7 +688,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct if (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) { write_lock_bh(&dn_fib_tables_lock); @@ -712,7 +712,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct return 0; } - return -ESRCH; + return -ESRCH; } static inline int dn_flush_list(struct dn_fib_node **fp, int z, struct dn_hash *table) @@ -759,7 +759,7 @@ static int dn_fib_table_flush(struct dn_fib_table *tb) 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_hash *t = (struct dn_hash *)tb->data; @@ -788,7 +788,7 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, if (err == 0) { res->type = f->fn_type; - res->scope = f->fn_scope; + res->scope = f->fn_scope; res->prefixlen = dz->dz_order; goto out; } @@ -799,21 +799,21 @@ static int dn_fib_table_lookup(struct dn_fib_table *tb, const struct flowi *flp, err = 1; out: 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 *t; + struct dn_fib_table *t; struct hlist_node *node; unsigned int h; - if (n < RT_TABLE_MIN) - return NULL; + if (n < RT_TABLE_MIN) + return NULL; - if (n > RT_TABLE_MAX) - return NULL; + if (n > RT_TABLE_MAX) + return NULL; h = n & (DN_FIB_TABLE_HASHSZ - 1); rcu_read_lock(); @@ -825,54 +825,54 @@ struct dn_fib_table *dn_fib_get_table(u32 n, int create) } rcu_read_unlock(); - if (!create) - return NULL; + if (!create) + return NULL; - if (in_interrupt() && net_ratelimit()) { - printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n"); - return NULL; - } + if (in_interrupt() && net_ratelimit()) { + printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n"); + 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); - if (t == NULL) - return NULL; - - t->n = n; - t->insert = dn_fib_table_insert; - t->delete = dn_fib_table_delete; - t->lookup = dn_fib_table_lookup; - t->flush = dn_fib_table_flush; - t->dump = dn_fib_table_dump; + if (t == NULL) + return NULL; + + t->n = n; + t->insert = dn_fib_table_insert; + t->delete = dn_fib_table_delete; + t->lookup = dn_fib_table_lookup; + t->flush = dn_fib_table_flush; + t->dump = dn_fib_table_dump; hlist_add_head_rcu(&t->hlist, &dn_fib_table_hash[h]); - return t; + return t; } 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) - return dn_fib_get_table(id, 1); - return NULL; + return dn_fib_get_table(id, 1); + return NULL; } void dn_fib_flush(void) { - int flushed = 0; - struct dn_fib_table *tb; + int flushed = 0; + struct dn_fib_table *tb; struct hlist_node *node; unsigned int h; for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) { hlist_for_each_entry(tb, node, &dn_fib_table_hash[h], hlist) - flushed += tb->flush(tb); - } + flushed += tb->flush(tb); + } - if (flushed) - dn_rt_cache_flush(-1); + if (flushed) + dn_rt_cache_flush(-1); } void __init dn_fib_table_init(void) @@ -892,7 +892,7 @@ void __exit dn_fib_table_cleanup(void) write_lock(&dn_fib_tables_lock); for (h = 0; h < DN_FIB_TABLE_HASHSZ; h++) { hlist_for_each_entry_safe(t, node, next, &dn_fib_table_hash[h], - hlist) { + hlist) { hlist_del(&t->hlist); kfree(t); } diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index 8b99bd33540..0e62def05a5 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c @@ -138,7 +138,7 @@ static int __init dn_rtmsg_init(void) int rv = 0; dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, DNRNG_NLGRP_MAX, - dnrmg_receive_user_sk, THIS_MODULE); + dnrmg_receive_user_sk, THIS_MODULE); if (dnrmg == NULL) { printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket"); return -ENOMEM; diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index a4065eb1341..a6c067b593a 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c @@ -164,7 +164,7 @@ static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen 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, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -240,7 +240,7 @@ static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen, } namel = strlen(devname) + 1; - if (len > namel) len = namel; + if (len > namel) len = namel; if (copy_to_user(oldval, devname, len)) return -EFAULT; @@ -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, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -341,17 +341,17 @@ static int dn_def_dev_handler(ctl_table *table, int write, static ctl_table dn_table[] = { { - .ctl_name = NET_DECNET_NODE_ADDRESS, - .procname = "node_address", - .maxlen = 7, - .mode = 0644, + .ctl_name = NET_DECNET_NODE_ADDRESS, + .procname = "node_address", + .maxlen = 7, + .mode = 0644, .proc_handler = dn_node_address_handler, .strategy = dn_node_address_strategy, }, { .ctl_name = NET_DECNET_NODE_NAME, .procname = "node_name", - .data = node_name, + .data = node_name, .maxlen = 7, .mode = 0644, .proc_handler = &proc_dostring, @@ -359,8 +359,8 @@ static ctl_table dn_table[] = { }, { .ctl_name = NET_DECNET_DEFAULT_DEVICE, - .procname = "default_device", - .maxlen = 16, + .procname = "default_device", + .maxlen = 16, .mode = 0644, .proc_handler = dn_def_dev_handler, .strategy = dn_def_dev_strategy, @@ -432,32 +432,32 @@ static ctl_table dn_table[] = { .extra2 = &max_decnet_no_fc_max_cwnd }, { - .ctl_name = NET_DECNET_MEM, - .procname = "decnet_mem", - .data = &sysctl_decnet_mem, - .maxlen = sizeof(sysctl_decnet_mem), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = NET_DECNET_RMEM, - .procname = "decnet_rmem", - .data = &sysctl_decnet_rmem, - .maxlen = sizeof(sysctl_decnet_rmem), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = NET_DECNET_WMEM, - .procname = "decnet_wmem", - .data = &sysctl_decnet_wmem, - .maxlen = sizeof(sysctl_decnet_wmem), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, + .ctl_name = NET_DECNET_MEM, + .procname = "decnet_mem", + .data = &sysctl_decnet_mem, + .maxlen = sizeof(sysctl_decnet_mem), + .mode = 0644, + .proc_handler = &proc_dointvec, + .strategy = &sysctl_intvec, + }, + { + .ctl_name = NET_DECNET_RMEM, + .procname = "decnet_rmem", + .data = &sysctl_decnet_rmem, + .maxlen = sizeof(sysctl_decnet_rmem), + .mode = 0644, + .proc_handler = &proc_dointvec, + .strategy = &sysctl_intvec, + }, + { + .ctl_name = NET_DECNET_WMEM, + .procname = "decnet_wmem", + .data = &sysctl_decnet_wmem, + .maxlen = sizeof(sysctl_decnet_wmem), + .mode = 0644, + .proc_handler = &proc_dointvec, + .strategy = &sysctl_intvec, + }, { .ctl_name = NET_DECNET_DEBUG_LEVEL, .procname = "debug", @@ -472,18 +472,18 @@ static ctl_table dn_table[] = { static ctl_table dn_dir_table[] = { { - .ctl_name = NET_DECNET, - .procname = "decnet", - .mode = 0555, + .ctl_name = NET_DECNET, + .procname = "decnet", + .mode = 0555, .child = dn_table}, {0} }; static ctl_table dn_root_table[] = { { - .ctl_name = CTL_NET, - .procname = "net", - .mode = 0555, + .ctl_name = CTL_NET, + .procname = "net", + .mode = 0555, .child = dn_dir_table }, {0} |