diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 19:38:13 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 19:38:13 (GMT) |
commit | cb18eccff48ef3986d1072964590bce6fec705fb (patch) | |
tree | 777fb1d15e0281341e1e02c9803d989538d346f2 | |
parent | c827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff) | |
parent | 5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff) | |
download | linux-fsl-qoriq-cb18eccff48ef3986d1072964590bce6fec705fb.tar.xz |
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.
...
539 files changed, 9052 insertions, 9047 deletions
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index 76f957e..a566944 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h @@ -68,9 +68,10 @@ extern void dn_rt_cache_flush(int delay); struct dn_route { union { struct dst_entry dst; - struct dn_route *rt_next; } u; + struct flowi fl; + __le16 rt_saddr; __le16 rt_daddr; __le16 rt_gateway; @@ -80,8 +81,6 @@ struct dn_route { unsigned rt_flags; unsigned rt_type; - - struct flowi fl; }; extern void dn_route_init(void); diff --git a/include/net/dst.h b/include/net/dst.h index 62b7e75..e12a8ce 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -37,9 +37,7 @@ struct sk_buff; struct dst_entry { - struct dst_entry *next; - atomic_t __refcnt; /* client references */ - int __use; + struct rcu_head rcu_head; struct dst_entry *child; struct net_device *dev; short error; @@ -50,7 +48,6 @@ struct dst_entry #define DST_NOPOLICY 4 #define DST_NOHASH 8 #define DST_BALANCED 0x10 - unsigned long lastuse; unsigned long expires; unsigned short header_len; /* more space at head required */ @@ -75,8 +72,16 @@ struct dst_entry #endif struct dst_ops *ops; - struct rcu_head rcu_head; + unsigned long lastuse; + atomic_t __refcnt; /* client references */ + int __use; + union { + struct dst_entry *next; + struct rtable *rt_next; + struct rt6_info *rt6_next; + struct dn_route *dn_next; + }; char info[0]; }; diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 7be4f4e..9eda572 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -83,7 +83,6 @@ struct rt6_info { union { struct dst_entry dst; - struct rt6_info *next; } u; struct inet6_dev *rt6i_idev; diff --git a/include/net/route.h b/include/net/route.h index 1440bdb..749e4df 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -53,9 +53,11 @@ struct rtable union { struct dst_entry dst; - struct rtable *rt_next; } u; + /* Cache lookup keys */ + struct flowi fl; + struct in_device *idev; unsigned rt_flags; @@ -69,9 +71,6 @@ struct rtable /* Info on neighbour */ __be32 rt_gateway; - /* Cache lookup keys */ - struct flowi fl; - /* Miscellaneous cached information */ __be32 rt_spec_dst; /* RFC1122 specific destination */ struct inet_peer *peer; /* long-living peer info */ diff --git a/net/802/fc.c b/net/802/fc.c index 2a27e37..d64e6a5 100644 --- a/net/802/fc.c +++ b/net/802/fc.c @@ -1,6 +1,6 @@ /* * NET3: Fibre Channel device handling subroutines - * + * * 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 @@ -31,18 +31,18 @@ #include <net/arp.h> /* - * Put the headers on a Fibre Channel packet. + * Put the headers on a Fibre Channel packet. */ - + static int fc_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, - void *daddr, void *saddr, unsigned len) + void *daddr, void *saddr, unsigned len) { struct fch_hdr *fch; int hdr_len; - /* - * Add the 802.2 SNAP header if IP as the IPv4 code calls + /* + * Add the 802.2 SNAP header if IP as the IPv4 code calls * dev->hard_header directly. */ if (type == ETH_P_IP || type == ETH_P_ARP) @@ -60,7 +60,7 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev, else { hdr_len = sizeof(struct fch_hdr); - fch = (struct fch_hdr *)skb_push(skb, hdr_len); + fch = (struct fch_hdr *)skb_push(skb, hdr_len); } if(saddr) @@ -68,20 +68,20 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev, else memcpy(fch->saddr,dev->dev_addr,dev->addr_len); - if(daddr) + if(daddr) { memcpy(fch->daddr,daddr,dev->addr_len); return(hdr_len); } return -hdr_len; } - + /* * A neighbour discovery of some species (eg arp) has completed. We * can now send the packet. */ - -static int fc_rebuild_header(struct sk_buff *skb) + +static int fc_rebuild_header(struct sk_buff *skb) { struct fch_hdr *fch=(struct fch_hdr *)skb->data; struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr)); @@ -100,7 +100,7 @@ static void fc_setup(struct net_device *dev) { dev->hard_header = fc_header; dev->rebuild_header = fc_rebuild_header; - + dev->type = ARPHRD_IEEE802; dev->hard_header_len = FC_HLEN; dev->mtu = 2024; diff --git a/net/802/fddi.c b/net/802/fddi.c index 797c6d9..0b98fe2 100644 --- a/net/802/fddi.c +++ b/net/802/fddi.c @@ -15,7 +15,7 @@ * Mark Evans, <evansmp@uhura.aston.ac.uk> * Florian La Roche, <rzsfl@rz.uni-sb.de> * Alan Cox, <gw4pts@gw4pts.ampr.org> - * + * * 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 @@ -25,7 +25,7 @@ * Alan Cox : New arp/rebuild header * Maciej W. Rozycki : IPv6 support */ - + #include <linux/module.h> #include <asm/system.h> #include <linux/types.h> @@ -57,7 +57,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev, { int hl = FDDI_K_SNAP_HLEN; struct fddihdr *fddi; - + if(type != ETH_P_IP && type != ETH_P_IPV6 && type != ETH_P_ARP) hl=FDDI_K_8022_HLEN-3; fddi = (struct fddihdr *)skb_push(skb, hl); @@ -74,7 +74,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev, } /* Set the source and destination hardware addresses */ - + if (saddr != NULL) memcpy(fddi->saddr, saddr, dev->addr_len); else @@ -95,7 +95,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev, * (or in future other address resolution) has completed on * this sk_buff. We now let ARP fill in the other fields. */ - + static int fddi_rebuild_header(struct sk_buff *skb) { struct fddihdr *fddi = (struct fddihdr *)skb->data; @@ -105,7 +105,7 @@ static int fddi_rebuild_header(struct sk_buff *skb) /* Try to get ARP to resolve the header and fill destination address */ return arp_find(fddi->daddr, skb); else -#endif +#endif { printk("%s: Don't know how to resolve type %04X addresses.\n", skb->dev->name, ntohs(fddi->hdr.llc_snap.ethertype)); @@ -120,19 +120,19 @@ static int fddi_rebuild_header(struct sk_buff *skb) * up. It's used to fill in specific skb fields and to set * the proper pointer to the start of packet data (skb->data). */ - + __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev) { struct fddihdr *fddi = (struct fddihdr *)skb->data; __be16 type; - + /* * Set mac.raw field to point to FC byte, set data field to point * to start of packet data. Assume 802.2 SNAP frames for now. */ skb->mac.raw = skb->data; /* point to frame control (FC) */ - + if(fddi->hdr.llc_8022_1.dsap==0xe0) { skb_pull(skb, FDDI_K_8022_HLEN-3); @@ -143,9 +143,9 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev) skb_pull(skb, FDDI_K_SNAP_HLEN); /* adjust for 21 byte header */ type=fddi->hdr.llc_snap.ethertype; } - + /* Set packet type based on destination address and flag settings */ - + if (*fddi->daddr & 0x01) { if (memcmp(fddi->daddr, dev->broadcast, FDDI_K_ALEN) == 0) @@ -153,7 +153,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev) else skb->pkt_type = PACKET_MULTICAST; } - + else if (dev->flags & IFF_PROMISC) { if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN)) @@ -187,7 +187,7 @@ static void fddi_setup(struct net_device *dev) dev->addr_len = FDDI_K_ALEN; dev->tx_queue_len = 100; /* Long queues on FDDI */ dev->flags = IFF_BROADCAST | IFF_MULTICAST; - + memset(dev->broadcast, 0xFF, FDDI_K_ALEN); } diff --git a/net/802/hippi.c b/net/802/hippi.c index 579e2dd..be0da59 100644 --- a/net/802/hippi.c +++ b/net/802/hippi.c @@ -39,7 +39,7 @@ #include <asm/system.h> /* - * Create the HIPPI MAC header for an arbitrary protocol layer + * Create the HIPPI MAC header for an arbitrary protocol layer * * saddr=NULL means use device source address * daddr=NULL means leave destination address (eg unresolved arp) @@ -104,8 +104,8 @@ static int hippi_rebuild_header(struct sk_buff *skb) /* * Only IP is currently supported */ - - if(hip->snap.ethertype != __constant_htons(ETH_P_IP)) + + if(hip->snap.ethertype != __constant_htons(ETH_P_IP)) { printk(KERN_DEBUG "%s: unable to resolve type %X addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype)); return 0; @@ -122,11 +122,11 @@ static int hippi_rebuild_header(struct sk_buff *skb) /* * Determine the packet's protocol ID. */ - + __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev) { struct hippi_hdr *hip; - + hip = (struct hippi_hdr *) skb->data; /* @@ -173,10 +173,10 @@ static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p) { /* Never send broadcast/multicast ARP messages */ p->mcast_probes = 0; - + /* In IPv6 unicast probes are valid even on NBMA, * because they are encapsulated in normal IPv6 protocol. - * Should be a generic flag. + * Should be a generic flag. */ if (p->tbl->family != AF_INET6) p->ucast_probes = 0; @@ -193,7 +193,7 @@ static void hippi_setup(struct net_device *dev) dev->hard_header_parse = NULL; dev->hard_header_cache = NULL; dev->header_cache_update = NULL; - dev->neigh_setup = hippi_neigh_setup_dev; + dev->neigh_setup = hippi_neigh_setup_dev; /* * We don't support HIPPI `ARP' for the time being, and probably @@ -210,9 +210,9 @@ static void hippi_setup(struct net_device *dev) /* * HIPPI doesn't support broadcast+multicast and we only use - * static ARP tables. ARP is disabled by hippi_neigh_setup_dev. + * static ARP tables. ARP is disabled by hippi_neigh_setup_dev. */ - dev->flags = 0; + dev->flags = 0; } /** diff --git a/net/802/psnap.c b/net/802/psnap.c index 270b9d2..6e7c212 100644 --- a/net/802/psnap.c +++ b/net/802/psnap.c @@ -117,7 +117,7 @@ module_exit(snap_exit); */ struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, - struct net_device *, + struct net_device *, struct packet_type *, struct net_device *)) { diff --git a/net/802/tr.c b/net/802/tr.c index 829deb4..31509f6 100644 --- a/net/802/tr.c +++ b/net/802/tr.c @@ -1,6 +1,6 @@ /* * NET3: Token ring device handling subroutines - * + * * 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 @@ -12,7 +12,7 @@ * 22 Jun 98 Paul Norton <p.norton@computer.org> Rearranged * tr_header and tr_type_trans to handle passing IPX SNAP and * 802.2 through the correct layers. Eliminated tr_reformat. - * + * */ #include <asm/uaccess.h> @@ -45,7 +45,7 @@ static void rif_check_expire(unsigned long dummy); /* * Each RIF entry we learn is kept this way */ - + struct rif_cache { unsigned char addr[TR_ALEN]; int iface; @@ -62,7 +62,7 @@ struct rif_cache { * We hash the RIF cache 32 ways. We do after all have to look it * up a lot. */ - + static struct rif_cache *rif_table[RIF_TABLE_SIZE]; static DEFINE_SPINLOCK(rif_lock); @@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(rif_lock); /* * Garbage disposal timer. */ - + static struct timer_list rif_timer; int sysctl_tr_rif_timeout = 60*10*HZ; @@ -96,16 +96,16 @@ static inline unsigned long rif_hash(const unsigned char *addr) * Put the headers on a token ring packet. Token ring source routing * makes this a little more exciting than on ethernet. */ - + static int tr_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, - void *daddr, void *saddr, unsigned len) + void *daddr, void *saddr, unsigned len) { struct trh_hdr *trh; int hdr_len; - /* - * Add the 802.2 SNAP header if IP as the IPv4/IPv6 code calls + /* + * Add the 802.2 SNAP header if IP as the IPv4/IPv6 code calls * dev->hard_header directly. */ if (type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP) @@ -123,7 +123,7 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev, else { hdr_len = sizeof(struct trh_hdr); - trh = (struct trh_hdr *)skb_push(skb, hdr_len); + trh = (struct trh_hdr *)skb_push(skb, hdr_len); } trh->ac=AC; @@ -137,8 +137,8 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev, /* * Build the destination and then source route the frame */ - - if(daddr) + + if(daddr) { memcpy(trh->daddr,daddr,dev->addr_len); tr_source_route(skb,trh,dev); @@ -147,13 +147,13 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev, return -hdr_len; } - + /* * A neighbour discovery of some species (eg arp) has completed. We * can now send the packet. */ - -static int tr_rebuild_header(struct sk_buff *skb) + +static int tr_rebuild_header(struct sk_buff *skb) { struct trh_hdr *trh=(struct trh_hdr *)skb->data; struct trllc *trllc=(struct trllc *)(skb->data+sizeof(struct trh_hdr)); @@ -162,7 +162,7 @@ static int tr_rebuild_header(struct sk_buff *skb) /* * FIXME: We don't yet support IPv6 over token rings */ - + if(trllc->ethertype != htons(ETH_P_IP)) { printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype)); return 0; @@ -172,39 +172,39 @@ static int tr_rebuild_header(struct sk_buff *skb) if(arp_find(trh->daddr, skb)) { return 1; } - else -#endif - { - tr_source_route(skb,trh,dev); + else +#endif + { + tr_source_route(skb,trh,dev); return 0; } } - + /* * Some of this is a bit hackish. We intercept RIF information * used for source routing. We also grab IP directly and don't feed * it via SNAP. */ - + __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) { struct trh_hdr *trh=(struct trh_hdr *)skb->data; struct trllc *trllc; unsigned riflen=0; - + skb->mac.raw = skb->data; - - if(trh->saddr[0] & TR_RII) + + if(trh->saddr[0] & TR_RII) riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8; trllc = (struct trllc *)(skb->data+sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); skb_pull(skb,sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); - if(*trh->daddr & 0x80) + if(*trh->daddr & 0x80) { - if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN)) + if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN)) skb->pkt_type=PACKET_BROADCAST; else skb->pkt_type=PACKET_MULTICAST; @@ -213,7 +213,7 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) { skb->pkt_type=PACKET_MULTICAST; } - else if(dev->flags & IFF_PROMISC) + else if(dev->flags & IFF_PROMISC) { if(memcmp(trh->daddr, dev->dev_addr, TR_ALEN)) skb->pkt_type=PACKET_OTHERHOST; @@ -221,10 +221,10 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) if ((skb->pkt_type != PACKET_BROADCAST) && (skb->pkt_type != PACKET_MULTICAST)) - tr_add_rif_info(trh,dev) ; + tr_add_rif_info(trh,dev) ; /* - * Strip the SNAP header from ARP packets since we don't + * Strip the SNAP header from ARP packets since we don't * pass them through to the 802.2/SNAP layers. */ @@ -241,32 +241,32 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) } /* - * We try to do source routing... + * We try to do source routing... */ -void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev) +void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev) { int slack; unsigned int hash; struct rif_cache *entry; unsigned char *olddata; unsigned long flags; - static const unsigned char mcast_func_addr[] + static const unsigned char mcast_func_addr[] = {0xC0,0x00,0x00,0x04,0x00,0x00}; - + spin_lock_irqsave(&rif_lock, flags); /* - * Broadcasts are single route as stated in RFC 1042 + * Broadcasts are single route as stated in RFC 1042 */ if( (!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) || (!memcmp(&(trh->daddr[0]),&(mcast_func_addr[0]), TR_ALEN)) ) { - trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) + trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST); trh->saddr[0]|=TR_RII; } - else + else { hash = rif_hash(trh->daddr); /* @@ -277,7 +277,7 @@ void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device * /* * If we found an entry we can route the frame. */ - if(entry) + if(entry) { #if TR_SR_DEBUG printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], @@ -287,7 +287,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], { trh->rcf=entry->rcf; memcpy(&trh->rseg[0],&entry->rseg[0],8*sizeof(unsigned short)); - trh->rcf^=htons(TR_RCF_DIR_BIT); + trh->rcf^=htons(TR_RCF_DIR_BIT); trh->rcf&=htons(0x1fff); /* Issam Chehab <ichehab@madge1.demon.co.uk> */ trh->saddr[0]|=TR_RII; @@ -301,14 +301,14 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], } entry->last_used=jiffies; } - else + else { /* * Without the information we simply have to shout * on the wire. The replies should rapidly clean this * situation up. */ - trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) + trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST); trh->saddr[0]|=TR_RII; #if TR_SR_DEBUG @@ -320,7 +320,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], /* Compress the RIF here so we don't have to do it in the driver(s) */ if (!(trh->saddr[0] & 0x80)) slack = 18; - else + else slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8); olddata = skb->data; spin_unlock_irqrestore(&rif_lock, flags); @@ -333,7 +333,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], * We have learned some new RIF information for our source * routing. */ - + static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) { unsigned int hash, rii_p = 0; @@ -343,29 +343,29 @@ static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) spin_lock_irqsave(&rif_lock, flags); saddr0 = trh->saddr[0]; - + /* * Firstly see if the entry exists */ - if(trh->saddr[0] & TR_RII) + if(trh->saddr[0] & TR_RII) { trh->saddr[0]&=0x7f; if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2) { rii_p = 1; - } + } } hash = rif_hash(trh->saddr); for(entry=rif_table[hash];entry && memcmp(&(entry->addr[0]),&(trh->saddr[0]),TR_ALEN);entry=entry->next); - if(entry==NULL) + if(entry==NULL) { #if TR_SR_DEBUG printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", trh->saddr[0],trh->saddr[1],trh->saddr[2], - trh->saddr[3],trh->saddr[4],trh->saddr[5], + trh->saddr[3],trh->saddr[4],trh->saddr[5], ntohs(trh->rcf)); #endif /* @@ -377,7 +377,7 @@ printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", */ entry=kmalloc(sizeof(struct rif_cache),GFP_ATOMIC); - if(!entry) + if(!entry) { printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n"); spin_unlock_irqrestore(&rif_lock, flags); @@ -400,13 +400,13 @@ printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", { entry->local_ring = 1; } - } + } else /* Y. Tahara added */ - { + { /* * Update existing entries */ - if (!entry->local_ring) + if (!entry->local_ring) if (entry->rcf != (trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK)) && !(trh->rcf & htons(TR_RCF_BROADCAST_MASK))) { @@ -417,9 +417,9 @@ printk("updating rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", ntohs(trh->rcf)); #endif entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK); - memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short)); - } - entry->last_used=jiffies; + memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short)); + } + entry->last_used=jiffies; } trh->saddr[0]=saddr0; /* put the routing indicator back for tcpdump */ spin_unlock_irqrestore(&rif_lock, flags); @@ -429,16 +429,16 @@ printk("updating rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", * Scan the cache with a timer and see what we need to throw out. */ -static void rif_check_expire(unsigned long dummy) +static void rif_check_expire(unsigned long dummy) { int i; unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2; spin_lock_irqsave(&rif_lock, flags); - + for(i =0; i < RIF_TABLE_SIZE; i++) { struct rif_cache *entry, **pentry; - + pentry = rif_table+i; while((entry=*pentry) != NULL) { unsigned long expires @@ -455,7 +455,7 @@ static void rif_check_expire(unsigned long dummy) } } } - + spin_unlock_irqrestore(&rif_lock, flags); mod_timer(&rif_timer, next_interval); @@ -466,7 +466,7 @@ static void rif_check_expire(unsigned long dummy) * Generate the /proc/net information for the token ring RIF * routing. */ - + #ifdef CONFIG_PROC_FS static struct rif_cache *rif_get_idx(loff_t pos) @@ -475,7 +475,7 @@ static struct rif_cache *rif_get_idx(loff_t pos) struct rif_cache *entry; loff_t off = 0; - for(i = 0; i < RIF_TABLE_SIZE; i++) + for(i = 0; i < RIF_TABLE_SIZE; i++) for(entry = rif_table[i]; entry; entry = entry->next) { if (off == pos) return entry; @@ -504,7 +504,7 @@ static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos) goto scan; } - if (ent->next) + if (ent->next) return ent->next; i = rif_hash(ent->addr); @@ -541,13 +541,13 @@ static int rif_seq_show(struct seq_file *seq, void *v) ttl/HZ); if (entry->local_ring) - seq_puts(seq, "local\n"); + seq_puts(seq, "local\n"); else { seq_printf(seq, "%04X", ntohs(entry->rcf)); - rcf_len = ((ntohs(entry->rcf) & TR_RCF_LEN_MASK)>>8)-2; + rcf_len = ((ntohs(entry->rcf) & TR_RCF_LEN_MASK)>>8)-2; if (rcf_len) - rcf_len >>= 1; + rcf_len >>= 1; for(j = 1; j < rcf_len; j++) { if(j==1) { segment=ntohs(entry->rseg[j-1])>>4; @@ -559,7 +559,7 @@ static int rif_seq_show(struct seq_file *seq, void *v) } seq_putc(seq, '\n'); } - } + } return 0; } @@ -591,7 +591,7 @@ static void tr_setup(struct net_device *dev) /* * Configure and register */ - + dev->hard_header = tr_header; dev->rebuild_header = tr_rebuild_header; @@ -600,7 +600,7 @@ static void tr_setup(struct net_device *dev) dev->mtu = 2000; dev->addr_len = TR_ALEN; dev->tx_queue_len = 100; /* Long queues on tr */ - + memset(dev->broadcast,0xFF, TR_ALEN); /* New-style flags. */ diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 18fcb9f..c1c205f 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -5,7 +5,7 @@ * Authors: Ben Greear <greearb@candelatech.com> * Please send support related email to: vlan@scry.wanfear.com * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html - * + * * Fixes: * Fix for packet capture - Nick Eggleston <nick@dccinc.com>; * Add HW acceleration hooks - David S. Miller <davem@redhat.com>; @@ -72,7 +72,7 @@ static struct packet_type vlan_packet_type = { /* * Function vlan_proto_init (pro) * - * Initialize VLAN protocol layer, + * Initialize VLAN protocol layer, * */ static int __init vlan_proto_init(void) @@ -87,7 +87,7 @@ static int __init vlan_proto_init(void) /* proc file system initialization */ err = vlan_proc_init(); if (err < 0) { - printk(KERN_ERR + printk(KERN_ERR "%s %s: can't create entry in proc filesystem!\n", __FUNCTION__, VLAN_NAME); return err; @@ -108,7 +108,7 @@ static int __init vlan_proto_init(void) return 0; } -/* Cleanup all vlan devices +/* Cleanup all vlan devices * Note: devices that have been registered that but not * brought up will exist but have no module ref count. */ @@ -132,7 +132,7 @@ static void __exit vlan_cleanup_devices(void) /* * Module 'remove' entry point. * o delete /proc/net/router directory and static entries. - */ + */ static void __exit vlan_cleanup_module(void) { int i; @@ -184,7 +184,7 @@ struct net_device *__find_vlan_dev(struct net_device *real_dev, struct vlan_group *grp = __vlan_find_group(real_dev->ifindex); if (grp) - return grp->vlan_devices[VID]; + return grp->vlan_devices[VID]; return NULL; } @@ -269,7 +269,7 @@ static int unregister_vlan_dev(struct net_device *real_dev, } } - return ret; + return ret; } static int unregister_vlan_device(const char *vlan_IF_name) @@ -295,7 +295,7 @@ static int unregister_vlan_device(const char *vlan_IF_name) if (ret == 1) ret = 0; } else { - printk(VLAN_ERR + printk(VLAN_ERR "%s: ERROR: Tried to remove a non-vlan device " "with VLAN code, name: %s priv_flags: %hX\n", __FUNCTION__, dev->name, dev->priv_flags); @@ -315,7 +315,7 @@ static int unregister_vlan_device(const char *vlan_IF_name) static void vlan_setup(struct net_device *new_dev) { SET_MODULE_OWNER(new_dev); - + /* new_dev->ifindex = 0; it will be set when added to * the global list. * iflink is set as well. @@ -324,7 +324,7 @@ static void vlan_setup(struct net_device *new_dev) /* Make this thing known as a VLAN device */ new_dev->priv_flags |= IFF_802_1Q_VLAN; - + /* Set us up to have no queue, as the underlying Hardware device * can do all the queueing we could want. */ @@ -461,7 +461,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, default: snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID); }; - + new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name, vlan_setup); @@ -477,7 +477,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, new_dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))) | - (1<<__LINK_STATE_PRESENT); + (1<<__LINK_STATE_PRESENT); /* need 4 bytes for extra VLAN header info, * hope the underlying device can handle it. @@ -496,7 +496,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size: %i\n", new_dev->priv, sizeof(struct vlan_dev_info)); - + memcpy(new_dev->broadcast, real_dev->broadcast, real_dev->addr_len); memcpy(new_dev->dev_addr, real_dev->dev_addr, real_dev->addr_len); new_dev->addr_len = real_dev->addr_len; @@ -521,7 +521,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, printk(VLAN_DBG "About to go find the group for idx: %i\n", real_dev->ifindex); #endif - + if (register_netdevice(new_dev)) goto out_free_newdev; @@ -543,22 +543,22 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL); if (!grp) goto out_free_unregister; - + /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */ grp->real_dev_ifindex = real_dev->ifindex; - hlist_add_head_rcu(&grp->hlist, + hlist_add_head_rcu(&grp->hlist, &vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]); if (real_dev->features & NETIF_F_HW_VLAN_RX) real_dev->vlan_rx_register(real_dev, grp); } - + grp->vlan_devices[VLAN_ID] = new_dev; if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */ - printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n", - new_dev->name); + printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n", + new_dev->name); if (real_dev->features & NETIF_F_HW_VLAN_FILTER) real_dev->vlan_rx_add_vid(real_dev, VLAN_ID); @@ -635,7 +635,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, vlandev = grp->vlan_devices[i]; if (!vlandev) continue; - + flgs = vlandev->flags; if (flgs & IFF_UP) continue; @@ -643,7 +643,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, dev_change_flags(vlandev, flgs | IFF_UP); } break; - + case NETDEV_UNREGISTER: /* Delete all VLANs for this dev. */ for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { @@ -755,8 +755,8 @@ static int vlan_ioctl_handler(void __user *arg) /* TODO: Implement err = vlan_dev_get_ingress_priority(args); if (copy_to_user((void*)arg, &args, - sizeof(struct vlan_ioctl_args))) { - err = -EFAULT; + sizeof(struct vlan_ioctl_args))) { + err = -EFAULT; } */ err = -EINVAL; @@ -765,8 +765,8 @@ static int vlan_ioctl_handler(void __user *arg) /* TODO: Implement err = vlan_dev_get_egress_priority(args.device1, &(args.args); if (copy_to_user((void*)arg, &args, - sizeof(struct vlan_ioctl_args))) { - err = -EFAULT; + sizeof(struct vlan_ioctl_args))) { + err = -EFAULT; } */ err = -EINVAL; @@ -788,7 +788,7 @@ static int vlan_ioctl_handler(void __user *arg) args.u.VID = vid; if (copy_to_user(arg, &args, sizeof(struct vlan_ioctl_args))) { - err = -EFAULT; + err = -EFAULT; } break; diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 9ae3a14..1976cdb 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -9,8 +9,8 @@ #define VLAN_ERR KERN_ERR #define VLAN_INF KERN_INFO #define VLAN_DBG KERN_ALERT /* change these... to debug, having a hard time - * changing the log level at run-time..for some reason. - */ + * changing the log level at run-time..for some reason. + */ /* @@ -24,7 +24,7 @@ I'll bet they might prove useful again... --Ben */ /* This way they don't do anything! */ -#define VLAN_MEM_DBG(x, y, z) +#define VLAN_MEM_DBG(x, y, z) #define VLAN_FMEM_DBG(x, y) @@ -51,10 +51,10 @@ struct net_device *__find_vlan_dev(struct net_device* real_dev, /* found in vlan_dev.c */ int vlan_dev_rebuild_header(struct sk_buff *skb); int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, - struct packet_type *ptype, struct net_device *orig_dev); + struct packet_type *ptype, struct net_device *orig_dev); int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, - unsigned short type, void *daddr, void *saddr, - unsigned len); + unsigned short type, void *daddr, void *saddr, + unsigned len); int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 60a508e..2fc8fe2 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -5,14 +5,14 @@ * Authors: Ben Greear <greearb@candelatech.com> * Please send support related email to: vlan@scry.wanfear.com * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html - * + * * Fixes: Mar 22 2001: Martin Bokaemper <mbokaemper@unispherenetworks.com> * - reset skb->pkt_type on incoming packets when MAC was changed * - see that changed MAC is saddr for outgoing packets * Oct 20, 2001: Ard van Breeman: * - Fix MC-list, finally. * - Flush MC-list on VLAN destroy. - * + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -58,12 +58,12 @@ int vlan_dev_rebuild_header(struct sk_buff *skb) /* TODO: Confirm this will work with VLAN headers... */ return arp_find(veth->h_dest, skb); -#endif +#endif default: printk(VLAN_DBG - "%s: unable to resolve type %X addresses.\n", + "%s: unable to resolve type %X addresses.\n", dev->name, ntohs(veth->h_vlan_encapsulated_proto)); - + memcpy(veth->h_source, dev->dev_addr, ETH_ALEN); break; }; @@ -91,7 +91,7 @@ static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) } /* - * Determine the packet's protocol ID. The rule here is that we + * Determine the packet's protocol ID. The rule here is that we * assume 802.3 if the type field is short enough to be a length. * This is normal practice and works for any 'now in use' protocol. * @@ -113,7 +113,7 @@ static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) * */ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, - struct packet_type* ptype, struct net_device *orig_dev) + struct packet_type* ptype, struct net_device *orig_dev) { unsigned char *rawp = NULL; struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data); @@ -175,8 +175,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, #ifdef VLAN_DEBUG printk(VLAN_DBG "%s: dropping skb: %p because came in on wrong device, dev: %s real_dev: %s, skb_dev: %s\n", - __FUNCTION__, skb, dev->name, - VLAN_DEV_INFO(skb->dev)->real_dev->name, + __FUNCTION__, skb, dev->name, + VLAN_DEV_INFO(skb->dev)->real_dev->name, skb->dev->name); #endif kfree_skb(skb); @@ -191,7 +191,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, #ifdef VLAN_DEBUG printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n", - __FUNCTION__, (unsigned long)(skb->priority), + __FUNCTION__, (unsigned long)(skb->priority), ntohs(vhdr->h_vlan_TCI)); #endif @@ -207,7 +207,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, stats->multicast++; break; - case PACKET_OTHERHOST: + case PACKET_OTHERHOST: /* Our lower layer thinks this is not local, let's make sure. * This allows the VLAN to have a different MAC than the underlying * device, and still route correctly. @@ -319,7 +319,7 @@ static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev } /* - * Create the VLAN header for an arbitrary protocol layer + * Create the VLAN header for an arbitrary protocol layer * * saddr=NULL means use device source address * daddr=NULL means leave destination address (eg unresolved arp) @@ -328,8 +328,8 @@ static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev * physical devices. */ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, - unsigned short type, void *daddr, void *saddr, - unsigned len) + unsigned short type, void *daddr, void *saddr, + unsigned len) { struct vlan_hdr *vhdr; unsigned short veth_TCI = 0; @@ -346,7 +346,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, * fixes some programs that get confused when they see a VLAN device * sending a frame that is VLAN encoded (the consensus is that the VLAN * device should look completely like an Ethernet device when the - * REORDER_HEADER flag is set) The drawback to this is some extra + * REORDER_HEADER flag is set) The drawback to this is some extra * header shuffling in the hard_start_xmit. Users can turn off this * REORDER behaviour with the vconfig tool. */ @@ -553,7 +553,7 @@ int vlan_dev_set_egress_priority(char *dev_name, __u32 skb_prio, short vlan_prio struct net_device *dev = dev_get_by_name(dev_name); struct vlan_priority_tci_mapping *mp = NULL; struct vlan_priority_tci_mapping *np; - + if (dev) { if (dev->priv_flags & IFF_802_1Q_VLAN) { /* See if a priority mapping exists.. */ @@ -610,13 +610,13 @@ int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val) return -EINVAL; } } else { - printk(KERN_ERR + printk(KERN_ERR "%s: %s is not a vlan device, priv_flags: %hX.\n", __FUNCTION__, dev->name, dev->priv_flags); dev_put(dev); } } else { - printk(KERN_ERR "%s: Could not find device: %s\n", + printk(KERN_ERR "%s: Could not find device: %s\n", __FUNCTION__, dev_name); } @@ -700,7 +700,7 @@ int vlan_dev_set_mac_address(struct net_device *dev, void *addr_struct_p) } static inline int vlan_dmi_equals(struct dev_mc_list *dmi1, - struct dev_mc_list *dmi2) + struct dev_mc_list *dmi2) { return ((dmi1->dmi_addrlen == dmi2->dmi_addrlen) && (memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0)); @@ -810,7 +810,7 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) case SIOCGMIIPHY: case SIOCGMIIREG: case SIOCSMIIREG: - if (real_dev->do_ioctl && netif_device_present(real_dev)) + if (real_dev->do_ioctl && netif_device_present(real_dev)) err = real_dev->do_ioctl(real_dev, &ifrr, cmd); break; @@ -818,7 +818,7 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) err = dev_ethtool(&ifrr); } - if (!err) + if (!err) ifr->ifr_ifru = ifrr.ifr_ifru; return err; diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index a8fc0de..1b72c98 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c @@ -51,7 +51,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *v); /* - * Names of the proc directory entries + * Names of the proc directory entries */ static const char name_root[] = "vlan"; @@ -66,7 +66,7 @@ static const char name_conf[] = "config"; */ /* - * Generic /proc/net/vlan/<file> file and inode operations + * Generic /proc/net/vlan/<file> file and inode operations */ static struct seq_operations vlan_seq_ops = { @@ -111,13 +111,13 @@ static struct file_operations vlandev_fops = { */ /* - * /proc/net/vlan + * /proc/net/vlan */ static struct proc_dir_entry *proc_vlan_dir; /* - * /proc/net/vlan/config + * /proc/net/vlan/config */ static struct proc_dir_entry *proc_vlan_conf; @@ -238,15 +238,15 @@ int vlan_proc_rem_dev(struct net_device *vlandev) */ /* starting at dev, find a VLAN device */ -static struct net_device *vlan_skip(struct net_device *dev) +static struct net_device *vlan_skip(struct net_device *dev) { - while (dev && !(dev->priv_flags & IFF_802_1Q_VLAN)) + while (dev && !(dev->priv_flags & IFF_802_1Q_VLAN)) dev = dev->next; return dev; } -/* start read of /proc/net/vlan/config */ +/* start read of /proc/net/vlan/config */ static void *vlan_seq_start(struct seq_file *seq, loff_t *pos) { struct net_device *dev; @@ -256,19 +256,19 @@ static void *vlan_seq_start(struct seq_file *seq, loff_t *pos) if (*pos == 0) return SEQ_START_TOKEN; - - for (dev = vlan_skip(dev_base); dev && i < *pos; + + for (dev = vlan_skip(dev_base); dev && i < *pos; dev = vlan_skip(dev->next), ++i); - + return (i == *pos) ? dev : NULL; -} +} static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return vlan_skip((v == SEQ_START_TOKEN) - ? dev_base + return vlan_skip((v == SEQ_START_TOKEN) + ? dev_base : ((struct net_device *)v)->next); } @@ -287,13 +287,13 @@ static int vlan_seq_show(struct seq_file *seq, void *v) if (vlan_name_type < ARRAY_SIZE(vlan_name_type_str)) nmtype = vlan_name_type_str[vlan_name_type]; - seq_printf(seq, "Name-Type: %s\n", + seq_printf(seq, "Name-Type: %s\n", nmtype ? nmtype : "UNKNOWN" ); } else { const struct net_device *vlandev = v; const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev); - seq_printf(seq, "%-15s| %d | %s\n", vlandev->name, + seq_printf(seq, "%-15s| %d | %s\n", vlandev->name, dev_info->vlan_id, dev_info->real_dev->name); } return 0; @@ -323,13 +323,13 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset) seq_puts(seq, "\n"); seq_printf(seq, fmt, "total frames transmitted", stats->tx_packets); seq_printf(seq, fmt, "total bytes transmitted", stats->tx_bytes); - seq_printf(seq, fmt, "total headroom inc", + seq_printf(seq, fmt, "total headroom inc", dev_info->cnt_inc_headroom_on_tx); - seq_printf(seq, fmt, "total encap on xmit", + seq_printf(seq, fmt, "total encap on xmit", dev_info->cnt_encap_on_xmit); seq_printf(seq, "Device: %s", dev_info->real_dev->name); /* now show all PRIORITY mappings relating to this VLAN */ - seq_printf(seq, + seq_printf(seq, "\nINGRESS priority mappings: 0:%lu 1:%lu 2:%lu 3:%lu 4:%lu 5:%lu 6:%lu 7:%lu\n", dev_info->ingress_priority_map[0], dev_info->ingress_priority_map[1], diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index f3777ec..27e845d 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c @@ -895,7 +895,7 @@ struct aarp_iter_state { /* * Get the aarp entry that is in the chain described - * by the iterator. + * by the iterator. * If pos is set then skip till that index. * pos = 1 is the first entry */ @@ -905,7 +905,7 @@ static struct aarp_entry *iter_next(struct aarp_iter_state *iter, loff_t *pos) struct aarp_entry **table = iter->table; loff_t off = 0; struct aarp_entry *entry; - + rescan: while(ct < AARP_HASH_SIZE) { for (entry = table[ct]; entry; entry = entry->next) { @@ -950,9 +950,9 @@ static void *aarp_seq_next(struct seq_file *seq, void *v, loff_t *pos) ++*pos; /* first line after header */ - if (v == SEQ_START_TOKEN) + if (v == SEQ_START_TOKEN) entry = iter_next(iter, NULL); - + /* next entry in current bucket */ else if (entry->next) entry = entry->next; @@ -986,7 +986,7 @@ static int aarp_seq_show(struct seq_file *seq, void *v) unsigned long now = jiffies; if (v == SEQ_START_TOKEN) - seq_puts(seq, + seq_puts(seq, "Address Interface Hardware Address" " Expires LastSend Retry Status\n"); else { @@ -1014,7 +1014,7 @@ static int aarp_seq_show(struct seq_file *seq, void *v) : (iter->table == unresolved) ? "unresolved" : (iter->table == proxies) ? "proxies" : "unknown"); - } + } return 0; } @@ -1030,7 +1030,7 @@ static int aarp_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct aarp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index 7ae4916..bc3015f 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c @@ -292,7 +292,7 @@ int __init atalk_proc_init(void) p->proc_fops = &atalk_seq_socket_fops; p = create_proc_entry("arp", S_IRUGO, atalk_proc_dir); - if (!p) + if (!p) goto out_arp; p->proc_fops = &atalk_seq_arp_fops; diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 3a70522..113c175 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -28,16 +28,16 @@ * Bradford Johnson : IP-over-DDP (experimental) * Jay Schulist : Moved IP-over-DDP to its own * driver file. (ipddp.c & ipddp.h) - * Jay Schulist : Made work as module with + * Jay Schulist : Made work as module with * AppleTalk drivers, cleaned it. * Rob Newberry : Added proxy AARP and AARP * procfs, moved probing to AARP * module. - * Adrian Sun/ - * Michael Zuelsdorff : fix for net.0 packets. don't + * Adrian Sun/ + * Michael Zuelsdorff : fix for net.0 packets. don't * allow illegal ether/tokentalk - * port assignment. we lose a - * valid localtalk port as a + * port assignment. we lose a + * valid localtalk port as a * result. * Arnaldo C. de Melo : Cleanup, in preparation for * shared skb support 8) @@ -48,7 +48,7 @@ * 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 (at your option) any later version. - * + * */ #include <linux/capability.h> @@ -100,17 +100,17 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, if (to->sat_port != at->src_port) continue; - if (to->sat_addr.s_net == ATADDR_ANYNET && + if (to->sat_addr.s_net == ATADDR_ANYNET && to->sat_addr.s_node == ATADDR_BCAST) goto found; - if (to->sat_addr.s_net == at->src_net && + if (to->sat_addr.s_net == at->src_net && (to->sat_addr.s_node == at->src_node || to->sat_addr.s_node == ATADDR_BCAST || to->sat_addr.s_node == ATADDR_ANYNODE)) goto found; - /* XXXX.0 -- we got a request for this router. make sure + /* XXXX.0 -- we got a request for this router. make sure * that the node is appropriately set. */ if (to->sat_addr.s_node == ATADDR_ANYNODE && to->sat_addr.s_net != ATADDR_ANYNET && @@ -314,7 +314,7 @@ static int atif_proxy_probe_device(struct atalk_iface *atif, if (probe_node == ATADDR_ANYNODE) probe_node = jiffies & 0xFF; - + /* Scan the networks */ for (netct = 0; netct <= netrange; netct++) { /* Sweep the available nodes from a given start */ @@ -417,7 +417,7 @@ static struct atalk_iface *atalk_find_interface(__be16 net, int node) if (node == ATADDR_ANYNODE && net != ATADDR_ANYNET && ntohs(iface->nets.nr_firstnet) <= ntohs(net) && ntohs(net) <= ntohs(iface->nets.nr_lastnet)) - break; + break; } read_unlock_bh(&atalk_interfaces_lock); return iface; @@ -432,13 +432,13 @@ static struct atalk_iface *atalk_find_interface(__be16 net, int node) static struct atalk_route *atrtr_find(struct atalk_addr *target) { /* - * we must search through all routes unless we find a + * we must search through all routes unless we find a * host route, because some host routes might overlap * network routes */ struct atalk_route *net_route = NULL; struct atalk_route *r; - + read_lock_bh(&atalk_routes_lock); for (r = atalk_routes; r; r = r->next) { if (!(r->flags & RTF_UP)) @@ -460,8 +460,8 @@ static struct atalk_route *atrtr_find(struct atalk_addr *target) net_route = r; } } - - /* + + /* * if we found a network route but not a direct host * route, then return it */ @@ -540,15 +540,15 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint) for (iface = atalk_interfaces; iface; iface = iface->next) { if (!riface && ntohs(ga->sat_addr.s_net) >= - ntohs(iface->nets.nr_firstnet) && + ntohs(iface->nets.nr_firstnet) && ntohs(ga->sat_addr.s_net) <= - ntohs(iface->nets.nr_lastnet)) + ntohs(iface->nets.nr_lastnet)) riface = iface; if (ga->sat_addr.s_net == iface->address.s_net && ga->sat_addr.s_node == iface->address.s_node) riface = iface; - } + } read_unlock_bh(&atalk_interfaces_lock); retval = -ENETUNREACH; @@ -649,7 +649,7 @@ static int ddp_device_event(struct notifier_block *this, unsigned long event, { if (event == NETDEV_DOWN) /* Discard any use of this */ - atalk_dev_down(ptr); + atalk_dev_down(ptr); return NOTIFY_DONE; } @@ -701,13 +701,13 @@ static int atif_ioctl(int cmd, void __user *arg) */ if ((dev->flags & IFF_POINTOPOINT) && atalk_find_interface(sa->sat_addr.s_net, - sa->sat_addr.s_node)) { + sa->sat_addr.s_node)) { printk(KERN_DEBUG "AppleTalk: point-to-point " "interface added with " "existing address\n"); add_route = 0; } - + /* * Phase 1 is fine on LocalTalk but we don't do * EtherTalk phase 1. Anyone wanting to add it go ahead. @@ -797,78 +797,78 @@ static int atif_ioctl(int cmd, void __user *arg) sa->sat_addr.s_node = ATADDR_BCAST; break; - case SIOCATALKDIFADDR: - case SIOCDIFADDR: + case SIOCATALKDIFADDR: + case SIOCDIFADDR: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (sa->sat_family != AF_APPLETALK) return -EINVAL; atalk_dev_down(dev); - break; + break; case SIOCSARP: if (!capable(CAP_NET_ADMIN)) - return -EPERM; - if (sa->sat_family != AF_APPLETALK) - return -EINVAL; - if (!atif) - return -EADDRNOTAVAIL; - - /* - * for now, we only support proxy AARP on ELAP; - * we should be able to do it for LocalTalk, too. - */ - if (dev->type != ARPHRD_ETHER) - return -EPROTONOSUPPORT; - - /* - * atif points to the current interface on this network; - * we aren't concerned about its current status (at + return -EPERM; + if (sa->sat_family != AF_APPLETALK) + return -EINVAL; + if (!atif) + return -EADDRNOTAVAIL; + + /* + * for now, we only support proxy AARP on ELAP; + * we should be able to do it for LocalTalk, too. + */ + if (dev->type != ARPHRD_ETHER) + return -EPROTONOSUPPORT; + + /* + * atif points to the current interface on this network; + * we aren't concerned about its current status (at * least for now), but it has all the settings about * the network we're going to probe. Consequently, it * must exist. - */ - if (!atif) - return -EADDRNOTAVAIL; - - nr = (struct atalk_netrange *)&(atif->nets); - /* - * Phase 1 is fine on Localtalk but we don't do - * Ethertalk phase 1. Anyone wanting to add it go ahead. - */ - if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2) - return -EPROTONOSUPPORT; - - if (sa->sat_addr.s_node == ATADDR_BCAST || + */ + if (!atif) + return -EADDRNOTAVAIL; + + nr = (struct atalk_netrange *)&(atif->nets); + /* + * Phase 1 is fine on Localtalk but we don't do + * Ethertalk phase 1. Anyone wanting to add it go ahead. + */ + if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2) + return -EPROTONOSUPPORT; + + if (sa->sat_addr.s_node == ATADDR_BCAST || sa->sat_addr.s_node == 254) - return -EINVAL; - - /* - * Check if the chosen address is used. If so we - * error and ATCP will try another. - */ - if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0) - return -EADDRINUSE; - + return -EINVAL; + /* - * We now have an address on the local network, and + * Check if the chosen address is used. If so we + * error and ATCP will try another. + */ + if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0) + return -EADDRINUSE; + + /* + * We now have an address on the local network, and * the AARP code will defend it for us until we take it * down. We don't set up any routes right now, because * ATCP will install them manually via SIOCADDRT. - */ - break; - - case SIOCDARP: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - if (sa->sat_family != AF_APPLETALK) - return -EINVAL; - if (!atif) - return -EADDRNOTAVAIL; - - /* give to aarp module to remove proxy entry */ - aarp_proxy_remove(atif->dev, &(sa->sat_addr)); - return 0; + */ + break; + + case SIOCDARP: + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + if (sa->sat_family != AF_APPLETALK) + return -EINVAL; + if (!atif) + return -EADDRNOTAVAIL; + + /* give to aarp module to remove proxy entry */ + aarp_proxy_remove(atif->dev, &(sa->sat_addr)); + return 0; } return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 0; @@ -899,7 +899,7 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg) dev = __dev_get_by_name(name); if (!dev) return -ENODEV; - } + } return atrtr_create(&rt, dev); } } @@ -917,7 +917,7 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg) * Checksum: This is 'optional'. It's quite likely also a good * candidate for assembler hackery 8) */ -static unsigned long atalk_sum_partial(const unsigned char *data, +static unsigned long atalk_sum_partial(const unsigned char *data, int len, unsigned long sum) { /* This ought to be unwrapped neatly. I'll trust gcc for now */ @@ -945,7 +945,7 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, if (copy > len) copy = len; sum = atalk_sum_partial(skb->data + offset, copy, sum); - if ( (len -= copy) == 0) + if ( (len -= copy) == 0) return sum; offset += copy; @@ -1031,7 +1031,7 @@ static int atalk_create(struct socket *sock, int protocol) /* * We permit SOCK_DGRAM and RAW is an extension. It is trivial to do - * and gives you the full ELAP frame. Should be handy for CAP 8) + * and gives you the full ELAP frame. Should be handy for CAP 8) */ if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) goto out; @@ -1196,14 +1196,14 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr, if (addr->sat_addr.s_node == ATADDR_BCAST && !sock_flag(sk, SOCK_BROADCAST)) { -#if 1 +#if 1 printk(KERN_WARNING "%s is broken and did not set " "SO_BROADCAST. It will break when 2.2 is " "released.\n", current->comm); #else return -EACCES; -#endif +#endif } if (sock_flag(sk, SOCK_ZAPPED)) @@ -1260,27 +1260,27 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, #if defined(CONFIG_IPDDP) || defined(CONFIG_IPDDP_MODULE) static __inline__ int is_ip_over_ddp(struct sk_buff *skb) { - return skb->data[12] == 22; + return skb->data[12] == 22; } static int handle_ip_over_ddp(struct sk_buff *skb) { - struct net_device *dev = __dev_get_by_name("ipddp0"); + struct net_device *dev = __dev_get_by_name("ipddp0"); struct net_device_stats *stats; /* This needs to be able to handle ipddp"N" devices */ - if (!dev) - return -ENODEV; + if (!dev) + return -ENODEV; - skb->protocol = htons(ETH_P_IP); - skb_pull(skb, 13); - skb->dev = dev; - skb->h.raw = skb->data; + skb->protocol = htons(ETH_P_IP); + skb_pull(skb, 13); + skb->dev = dev; + skb->h.raw = skb->data; stats = dev->priv; - stats->rx_packets++; - stats->rx_bytes += skb->len + 13; - netif_rx(skb); /* Send the SKB up to a higher place. */ + stats->rx_packets++; + stats->rx_bytes += skb->len + 13; + netif_rx(skb); /* Send the SKB up to a higher place. */ return 0; } #else @@ -1298,7 +1298,7 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev, /* * Don't route multicast, etc., packets, or packets sent to "this - * network" + * network" */ if (skb->pkt_type != PACKET_HOST || !ddp->deh_dnet) { /* @@ -1335,8 +1335,8 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev, ta.s_node = rt->gateway.s_node; } - /* Fix up skb->len field */ - skb_trim(skb, min_t(unsigned int, origlen, + /* Fix up skb->len field */ + skb_trim(skb, min_t(unsigned int, origlen, (rt->dev->hard_header_len + ddp_dl->header_length + (len_hops & 1023)))); @@ -1358,12 +1358,12 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev, /* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */ struct sk_buff *nskb = skb_realloc_headroom(skb, 32); kfree_skb(skb); - if (!nskb) + if (!nskb) goto out; skb = nskb; } else skb = skb_unshare(skb, GFP_ATOMIC); - + /* * If the buffer didn't vanish into the lack of space bitbucket we can * send it. @@ -1395,13 +1395,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, struct sock *sock; struct atalk_iface *atif; struct sockaddr_at tosat; - int origlen; + int origlen; __u16 len_hops; /* Don't mangle buffer if shared */ - if (!(skb = skb_share_check(skb, GFP_ATOMIC))) + if (!(skb = skb_share_check(skb, GFP_ATOMIC))) goto out; - + /* Size check and make sure header is contiguous */ if (!pskb_may_pull(skb, sizeof(*ddp))) goto freeit; @@ -1490,7 +1490,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, goto freeit; /* Don't mangle buffer if shared */ - if (!(skb = skb_share_check(skb, GFP_ATOMIC))) + if (!(skb = skb_share_check(skb, GFP_ATOMIC))) return 0; /* @@ -1501,11 +1501,11 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, /* Now fill in the long header */ - /* - * These two first. The mac overlays the new source/dest - * network information so we MUST copy these before - * we write the network numbers ! - */ + /* + * These two first. The mac overlays the new source/dest + * network information so we MUST copy these before + * we write the network numbers ! + */ ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */ ddp->deh_snode = skb->mac.raw[1]; /* From physical header */ @@ -1605,7 +1605,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err); if (!skb) return err; - + skb->sk = sk; skb_reserve(skb, ddp_dl->header_length); skb_reserve(skb, dev->hard_header_len); diff --git a/net/appletalk/dev.c b/net/appletalk/dev.c index 1237e20..9e4dffc 100644 --- a/net/appletalk/dev.c +++ b/net/appletalk/dev.c @@ -15,14 +15,14 @@ static int ltalk_change_mtu(struct net_device *dev, int mtu) } static int ltalk_mac_addr(struct net_device *dev, void *addr) -{ +{ return -EINVAL; } static void ltalk_setup(struct net_device *dev) { /* Fill in the fields of the device structure with localtalk-generic values. */ - + dev->change_mtu = ltalk_change_mtu; dev->hard_header = NULL; dev->rebuild_header = NULL; @@ -34,8 +34,8 @@ static void ltalk_setup(struct net_device *dev) dev->hard_header_len = LTALK_HLEN; dev->mtu = LTALK_MTU; dev->addr_len = LTALK_ALEN; - dev->tx_queue_len = 10; - + dev->tx_queue_len = 10; + dev->broadcast[0] = 0xFF; dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index 62f6ed1..f094a08 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c @@ -30,15 +30,15 @@ static ssize_t show_address(struct class_device *cdev, char *buf) static ssize_t show_atmaddress(struct class_device *cdev, char *buf) { - unsigned long flags; + unsigned long flags; char *pos = buf; struct atm_dev *adev = to_atm_dev(cdev); - struct atm_dev_addr *aaddr; + struct atm_dev_addr *aaddr; int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin; int i, j; - spin_lock_irqsave(&adev->lock, flags); - list_for_each_entry(aaddr, &adev->local, entry) { + spin_lock_irqsave(&adev->lock, flags); + list_for_each_entry(aaddr, &adev->local, entry) { for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) { if (j == *fmt) { pos += sprintf(pos, "."); @@ -49,7 +49,7 @@ static ssize_t show_atmaddress(struct class_device *cdev, char *buf) } pos += sprintf(pos, "\n"); } - spin_unlock_irqrestore(&adev->lock, flags); + spin_unlock_irqrestore(&adev->lock, flags); return pos - buf; } @@ -61,7 +61,7 @@ static ssize_t show_carrier(struct class_device *cdev, char *buf) pos += sprintf(pos, "%d\n", adev->signal == ATM_PHY_SIG_LOST ? 0 : 1); - + return pos - buf; } @@ -86,7 +86,7 @@ static ssize_t show_link_rate(struct class_device *cdev, char *buf) link_rate = adev->link_rate * 8 * 53; } pos += sprintf(pos, "%d\n", link_rate); - + return pos - buf; } diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 83a1c1b..f949b5c 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c @@ -182,7 +182,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev, ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); if (!atm_may_send(atmvcc, skb->truesize)) { - /* we free this here for now, because we cannot know in a higher + /* we free this here for now, because we cannot know in a higher layer whether the skb point it supplied wasn't freed yet. now, it always is. */ @@ -718,7 +718,7 @@ static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos) ++*pos; - brd = list_entry(brd->br2684_devs.next, + brd = list_entry(brd->br2684_devs.next, struct br2684_dev, br2684_devs); return (&brd->br2684_devs != &br2684_devs) ? brd : NULL; } diff --git a/net/atm/common.c b/net/atm/common.c index a2878e9..282d761 100644 --- a/net/atm/common.c +++ b/net/atm/common.c @@ -109,11 +109,11 @@ static inline int vcc_writable(struct sock *sk) struct atm_vcc *vcc = atm_sk(sk); return (vcc->qos.txtp.max_sdu + - atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf; + atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf; } static void vcc_write_space(struct sock *sk) -{ +{ read_lock(&sk->sk_callback_lock); if (vcc_writable(sk)) { @@ -131,7 +131,7 @@ static struct proto vcc_proto = { .owner = THIS_MODULE, .obj_size = sizeof(struct atm_vcc), }; - + int vcc_create(struct socket *sock, int protocol, int family) { struct sock *sk; @@ -359,7 +359,7 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi, return error; vcc->dev = dev; write_lock_irq(&vcc_sklist_lock); - if (test_bit(ATM_DF_REMOVED, &dev->flags) || + if (test_bit(ATM_DF_REMOVED, &dev->flags) || (error = find_ci(vcc, &vpi, &vci))) { write_unlock_irq(&vcc_sklist_lock); goto fail_module_put; @@ -494,20 +494,20 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, if (!skb) return error; - copied = skb->len; + copied = skb->len; if (copied > size) { - copied = size; + copied = size; msg->msg_flags |= MSG_TRUNC; } - error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); - if (error) - return error; - sock_recv_timestamp(msg, sk, skb); - DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize); - atm_return(vcc, skb->truesize); - skb_free_datagram(sk, skb); - return copied; + error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); + if (error) + return error; + sock_recv_timestamp(msg, sk, skb); + DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize); + atm_return(vcc, skb->truesize); + skb_free_datagram(sk, skb); + return copied; } @@ -675,7 +675,7 @@ static int check_qos(struct atm_qos *qos) int error; if (!qos->txtp.traffic_class && !qos->rxtp.traffic_class) - return -EINVAL; + return -EINVAL; if (qos->txtp.traffic_class != qos->rxtp.traffic_class && qos->txtp.traffic_class && qos->rxtp.traffic_class && qos->txtp.traffic_class != ATM_ANYCLASS && @@ -786,11 +786,11 @@ static int __init atm_init(void) printk(KERN_ERR "atmsvc_init() failed with %d\n", error); goto out_atmpvc_exit; } - if ((error = atm_proc_init()) < 0) { + if ((error = atm_proc_init()) < 0) { printk(KERN_ERR "atm_proc_init() failed with %d\n",error); goto out_atmsvc_exit; } - if ((error = atm_sysfs_init()) < 0) { + if ((error = atm_sysfs_init()) < 0) { printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error); goto out_atmproc_exit; } diff --git a/net/atm/common.h b/net/atm/common.h index a422da7..ad78c9e 100644 --- a/net/atm/common.h +++ b/net/atm/common.h @@ -1,5 +1,5 @@ /* net/atm/common.h - ATM sockets (common part for PVC and SVC) */ - + /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c index 8c2022c..8ccee45 100644 --- a/net/atm/ioctl.c +++ b/net/atm/ioctl.c @@ -76,7 +76,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) } skb = skb_peek(&sk->sk_receive_queue); error = put_user(skb ? skb->len : 0, - (int __user *)argp) ? -EFAULT : 0; + (int __user *)argp) ? -EFAULT : 0; goto done; } case SIOCGSTAMP: /* borrowed from IP */ diff --git a/net/atm/lec.c b/net/atm/lec.c index 3fc0abe..57dc2ab 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c @@ -1,5 +1,5 @@ /* - * lec.c: Lan Emulation driver + * lec.c: Lan Emulation driver * * Marko Kiiskila <mkiiskila@yahoo.com> */ @@ -1457,7 +1457,7 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr, static void lec_arp_check_expire(struct work_struct *work); static void lec_arp_expire_arp(unsigned long data); -/* +/* * Arp table funcs */ @@ -1473,9 +1473,9 @@ static void lec_arp_init(struct lec_priv *priv) for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); } - INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); - INIT_HLIST_HEAD(&priv->lec_no_forward); - INIT_HLIST_HEAD(&priv->mcast_fwds); + INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); + INIT_HLIST_HEAD(&priv->lec_no_forward); + INIT_HLIST_HEAD(&priv->mcast_fwds); spin_lock_init(&priv->lec_arp_lock); INIT_DELAYED_WORK(&priv->lec_arp_work, lec_arp_check_expire); schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL); @@ -1770,7 +1770,7 @@ static void lec_arp_destroy(struct lec_priv *priv) spin_unlock_irqrestore(&priv->lec_arp_lock, flags); } -/* +/* * Find entry by mac_address */ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, @@ -1949,7 +1949,7 @@ restart: /* * Try to find vcc where mac_address is attached. - * + * */ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find, int is_rdesc, @@ -2075,7 +2075,7 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr, } /* - * Notifies: Response to arp_request (atm_addr != NULL) + * Notifies: Response to arp_request (atm_addr != NULL) */ static void lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, @@ -2176,7 +2176,7 @@ out: } /* - * Notifies: Vcc setup ready + * Notifies: Vcc setup ready */ static void lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, @@ -2380,7 +2380,7 @@ lec_set_flush_tran_id(struct lec_priv *priv, if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { entry->flush_tran_id = tran_id; DPRINTK("Set flush transaction id to %lx for %p\n", - tran_id, entry); + tran_id, entry); } } spin_unlock_irqrestore(&priv->lec_arp_lock, flags); diff --git a/net/atm/lec.h b/net/atm/lec.h index 99136ba..b41cda7 100644 --- a/net/atm/lec.h +++ b/net/atm/lec.h @@ -52,12 +52,12 @@ struct lane2_ops { /* * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType - * frames. + * frames. * * 1. Dix Ethernet EtherType frames encoded by placing EtherType * field in h_type field. Data follows immediatelly after header. * 2. LLC Data frames whose total length, including LLC field and data, - * but not padding required to meet the minimum data frame length, + * but not padding required to meet the minimum data frame length, * is less than 1536(0x0600) MUST be encoded by placing that length * in the h_type field. The LLC field follows header immediatelly. * 3. LLC data frames longer than this maximum MUST be encoded by placing diff --git a/net/atm/mpc.c b/net/atm/mpc.c index c18f737..cb3c004 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c @@ -32,7 +32,7 @@ #include "resources.h" /* - * mpc.c: Implementation of MPOA client kernel part + * mpc.c: Implementation of MPOA client kernel part */ #if 0 @@ -80,17 +80,17 @@ static struct llc_snap_hdr llc_snap_mpoa_ctrl = { 0xaa, 0xaa, 0x03, {0x00, 0x00, 0x5e}, {0x00, 0x03} /* For MPOA control PDUs */ -}; +}; static struct llc_snap_hdr llc_snap_mpoa_data = { 0xaa, 0xaa, 0x03, {0x00, 0x00, 0x00}, {0x08, 0x00} /* This is for IP PDUs only */ -}; +}; static struct llc_snap_hdr llc_snap_mpoa_data_tagged = { 0xaa, 0xaa, 0x03, {0x00, 0x00, 0x00}, {0x88, 0x4c} /* This is for tagged data PDUs */ -}; +}; static struct notifier_block mpoa_notifier = { mpoa_event_listener, @@ -106,12 +106,12 @@ static DEFINE_TIMER(mpc_timer, NULL, 0, 0); static struct mpoa_client *find_mpc_by_itfnum(int itf) { struct mpoa_client *mpc; - + mpc = mpcs; /* our global linked list */ while (mpc != NULL) { if (mpc->dev_num == itf) return mpc; - mpc = mpc->next; + mpc = mpc->next; } return NULL; /* not found */ @@ -120,7 +120,7 @@ static struct mpoa_client *find_mpc_by_itfnum(int itf) static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc) { struct mpoa_client *mpc; - + mpc = mpcs; /* our global linked list */ while (mpc != NULL) { if (mpc->mpoad_vcc == vcc) @@ -134,7 +134,7 @@ static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc) static struct mpoa_client *find_mpc_by_lec(struct net_device *dev) { struct mpoa_client *mpc; - + mpc = mpcs; /* our global linked list */ while (mpc != NULL) { if (mpc->dev == dev) @@ -190,7 +190,7 @@ struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip) } return qos; -} +} /* * Returns 0 for failure @@ -245,7 +245,7 @@ static struct net_device *find_lec_by_itfnum(int itf) sprintf(name, "lec%d", itf); dev = dev_get_by_name(name); - + return dev; } @@ -265,25 +265,25 @@ static struct mpoa_client *alloc_mpc(void) mpc->parameters.mpc_p2 = MPC_P2; memset(mpc->parameters.mpc_p3,0,sizeof(mpc->parameters.mpc_p3)); mpc->parameters.mpc_p4 = MPC_P4; - mpc->parameters.mpc_p5 = MPC_P5; + mpc->parameters.mpc_p5 = MPC_P5; mpc->parameters.mpc_p6 = MPC_P6; - + mpcs = mpc; - + return mpc; } /* * * start_mpc() puts the MPC on line. All the packets destined - * to the lec underneath us are now being monitored and + * to the lec underneath us are now being monitored and * shortcuts will be established. * */ static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) { - - dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); + + dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); if (dev->hard_start_xmit == NULL) { printk("mpoa: (%s) start_mpc: dev->hard_start_xmit == NULL, not starting\n", dev->name); @@ -297,8 +297,8 @@ static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) static void stop_mpc(struct mpoa_client *mpc) { - - dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name); + + dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name); /* Lets not nullify lec device's dev->hard_start_xmit */ if (mpc->dev->hard_start_xmit != mpc_send_packet) { @@ -309,7 +309,7 @@ static void stop_mpc(struct mpoa_client *mpc) mpc->dev->hard_start_xmit = mpc->old_hard_start_xmit; mpc->old_hard_start_xmit = NULL; /* close_shortcuts(mpc); ??? FIXME */ - + return; } @@ -358,7 +358,7 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr, uint8_t length, mpoa_device_type, number_of_mps_macs; uint8_t *end_of_tlvs; struct mpoa_client *mpc; - + mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */ dprintk("mpoa: (%s) lane2_assoc_ind: received TLV(s), ", dev->name); dprintk("total length of all TLVs %d\n", sizeoftlvs); @@ -377,7 +377,7 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr, printk("TLV value extends past its buffer, aborting parse\n"); return; } - + if (type == 0) { printk("mpoa: (%s) lane2_assoc_ind: TLV type was 0, returning\n", dev->name); return; @@ -412,10 +412,10 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr, continue; /* someone should read the spec */ } dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs); - + /* ok, now we can go and tell our daemon the control address of MPS */ send_set_mps_ctrl_addr(tlvs, mpc); - + tlvs = copy_macs(mpc, mac_addr, tlvs, number_of_mps_macs, mpoa_device_type); if (tlvs == NULL) return; } @@ -474,7 +474,7 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) iph = (struct iphdr *)buff; ipaddr = iph->daddr; - ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr); + ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr); entry = mpc->in_ops->get(ipaddr, mpc); if (entry == NULL) { @@ -483,15 +483,15 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) return 1; } if (mpc->in_ops->cache_hit(entry, mpc) != OPEN){ /* threshold not exceeded or VCC not ready */ - ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name); + ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name); mpc->in_ops->put(entry); return 1; } - ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name); + ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name); /* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */ if (iph->ttl <= 1) { - ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl); + ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl); mpc->in_ops->put(entry); return 1; } @@ -529,7 +529,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev) struct mpoa_client *mpc; struct ethhdr *eth; int i = 0; - + mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ if(mpc == NULL) { printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name); @@ -549,7 +549,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev) non_ip: retval = mpc->old_hard_start_xmit(skb,dev); - + return retval; } @@ -569,11 +569,11 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) ipaddr = ioc_data.ipaddr; if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF) return -EINVAL; - + mpc = find_mpc_by_itfnum(ioc_data.dev_num); if (mpc == NULL) return -EINVAL; - + if (ioc_data.type == MPC_SOCKET_INGRESS) { in_entry = mpc->in_ops->get(ipaddr, mpc); if (in_entry == NULL || in_entry->entry_state < INGRESS_RESOLVED) { @@ -604,7 +604,7 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) struct mpoa_client *mpc; in_cache_entry *in_entry; eg_cache_entry *eg_entry; - + mpc = find_mpc_by_lec(dev); if (mpc == NULL) { printk("mpoa: (%s) mpc_vcc_close: close for unknown MPC\n", dev->name); @@ -640,14 +640,14 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) struct mpoa_client *mpc; __be32 tag; char *tmp; - + ddprintk("mpoa: (%s) mpc_push:\n", dev->name); if (skb == NULL) { dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", dev->name); mpc_vcc_close(vcc, dev); return; } - + skb->dev = dev; if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) { struct sock *sk = sk_atm(vcc); @@ -693,11 +693,11 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) dev_kfree_skb_any(skb); return; } - + /* * See if ingress MPC is using shortcut we opened as a return channel. * This means we have a bi-directional vcc opened by us. - */ + */ if (eg->shortcut == NULL) { eg->shortcut = vcc; printk("mpoa: (%s) mpc_push: egress SVC in use\n", dev->name); @@ -743,7 +743,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) struct mpoa_client *mpc; struct lec_priv *priv; int err; - + if (mpcs == NULL) { init_timer(&mpc_timer); mpc_timer_refresh(); @@ -755,7 +755,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) return err; } } - + mpc = find_mpc_by_itfnum(arg); if (mpc == NULL) { dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg); @@ -776,7 +776,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) dev_put(mpc->dev); mpc->dev = NULL; } else - priv->lane2_ops->associate_indicator = lane2_assoc_ind; + priv->lane2_ops->associate_indicator = lane2_assoc_ind; } mpc->mpoad_vcc = vcc; @@ -788,7 +788,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) if (mpc->dev) { char empty[ATM_ESA_LEN]; memset(empty, 0, ATM_ESA_LEN); - + start_mpc(mpc, mpc->dev); /* set address if mpcd e.g. gets killed and restarted. * If we do not do it now we have to wait for the next LE_ARP @@ -806,7 +806,7 @@ static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc) struct k_message mesg; memcpy (mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); - + mesg.type = SET_MPS_CTRL_ADDR; memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN); msg_to_mpoad(&mesg, mpc); @@ -828,7 +828,7 @@ static void mpoad_close(struct atm_vcc *vcc) printk("mpoa: mpoad_close: close for non-present mpoad\n"); return; } - + mpc->mpoad_vcc = NULL; if (mpc->dev) { struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv; @@ -844,7 +844,7 @@ static void mpoad_close(struct atm_vcc *vcc) atm_return(vcc, skb->truesize); kfree_skb(skb); } - + printk("mpoa: (%s) going down\n", (mpc->dev) ? mpc->dev->name : "<unknown>"); module_put(THIS_MODULE); @@ -857,11 +857,11 @@ static void mpoad_close(struct atm_vcc *vcc) */ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) { - + struct mpoa_client *mpc = find_mpc_by_vcc(vcc); struct k_message *mesg = (struct k_message*)skb->data; atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); - + if (mpc == NULL) { printk("mpoa: msg_from_mpoad: no mpc found\n"); return 0; @@ -938,7 +938,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) skb_put(skb, sizeof(struct k_message)); memcpy(skb->data, mesg, sizeof(struct k_message)); atm_force_charge(mpc->mpoad_vcc, skb->truesize); - + sk = sk_atm(mpc->mpoad_vcc); skb_queue_tail(&sk->sk_receive_queue, skb); sk->sk_data_ready(sk, skb->len); @@ -955,7 +955,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo dev = (struct net_device *)dev_ptr; if (dev->name == NULL || strncmp(dev->name, "lec", 3)) return NOTIFY_DONE; /* we are only interested in lec:s */ - + switch (event) { case NETDEV_REGISTER: /* a new lec device was allocated */ priv = (struct lec_priv *)dev->priv; @@ -1043,7 +1043,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) mpc->in_ops->put(entry); return; } - + if(entry->entry_state == INGRESS_INVALID){ entry->entry_state = INGRESS_RESOLVING; msg->type = SND_MPOA_RES_RQST; @@ -1053,7 +1053,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) mpc->in_ops->put(entry); return; } - + printk("mpoa: (%s) MPOA_trigger_rcvd: entry already in resolving state\n", (mpc->dev) ? mpc->dev->name : "<unknown>"); mpc->in_ops->put(entry); @@ -1062,7 +1062,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) /* * Things get complicated because we have to check if there's an egress - * shortcut with suitable traffic parameters we could use. + * shortcut with suitable traffic parameters we could use. */ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) { @@ -1079,7 +1079,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien else if(eg_entry->shortcut->qos.txtp.max_pcr > 0) entry->shortcut = eg_entry->shortcut; } - if(entry->shortcut){ + if(entry->shortcut){ dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip)); client->eg_ops->put(eg_entry); return; @@ -1094,7 +1094,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien { msg->qos = qos->qos; printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name); - } + } else memset(&msg->qos,0,sizeof(struct atm_qos)); msg_to_mpoad(msg, client); return; @@ -1111,7 +1111,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); return; } - ddprintk(" entry_state = %d ", entry->entry_state); + ddprintk(" entry_state = %d ", entry->entry_state); if (entry->entry_state == INGRESS_RESOLVED) { printk("\nmpoa: (%s) MPOA_res_reply_rcvd for RESOLVED entry!\n", mpc->dev->name); @@ -1126,7 +1126,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) ddprintk("entry->shortcut = %p\n", entry->shortcut); if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL){ - entry->entry_state = INGRESS_RESOLVED; + entry->entry_state = INGRESS_RESOLVED; mpc->in_ops->put(entry); return; /* Shortcut already open... */ } @@ -1137,7 +1137,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) mpc->in_ops->put(entry); return; } - + check_qos_and_open_shortcut(msg, mpc, entry); entry->entry_state = INGRESS_RESOLVED; mpc->in_ops->put(entry); @@ -1169,13 +1169,13 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) } while (entry != NULL); return; -} +} static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) { __be32 cache_id = msg->content.eg_info.cache_id; eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); - + if (entry == NULL) { dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", mpc->dev->name); return; @@ -1188,7 +1188,7 @@ static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) mpc->eg_ops->put(entry); return; -} +} static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) { @@ -1259,7 +1259,7 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client * { uint16_t holding_time; eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); - + holding_time = msg->content.eg_info.holding_time; dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n", mpc->dev->name, entry, holding_time); @@ -1272,13 +1272,13 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client * mpc->eg_ops->update(entry, holding_time); return; } - + write_lock_irq(&mpc->egress_lock); mpc->eg_ops->remove_entry(entry, mpc); write_unlock_irq(&mpc->egress_lock); mpc->eg_ops->put(entry); - + return; } @@ -1328,7 +1328,7 @@ static void set_mps_mac_addr_rcvd(struct k_message *msg, struct mpoa_client *cli return; } client->number_of_mps_macs = 1; - + return; } @@ -1364,7 +1364,7 @@ static void mpc_timer_refresh(void) mpc_timer.data = mpc_timer.expires; mpc_timer.function = mpc_cache_check; add_timer(&mpc_timer); - + return; } @@ -1373,7 +1373,7 @@ static void mpc_cache_check( unsigned long checking_time ) struct mpoa_client *mpc = mpcs; static unsigned long previous_resolving_check_time; static unsigned long previous_refresh_time; - + while( mpc != NULL ){ mpc->in_ops->clear_count(mpc); mpc->eg_ops->clear_expired(mpc); @@ -1388,7 +1388,7 @@ static void mpc_cache_check( unsigned long checking_time ) mpc = mpc->next; } mpc_timer_refresh(); - + return; } diff --git a/net/atm/mpc.h b/net/atm/mpc.h index 51f460d..24c386c 100644 --- a/net/atm/mpc.h +++ b/net/atm/mpc.h @@ -12,32 +12,32 @@ int msg_to_mpoad(struct k_message *msg, struct mpoa_client *mpc); struct mpoa_client { - struct mpoa_client *next; - struct net_device *dev; /* lec in question */ - int dev_num; /* e.g. 2 for lec2 */ - int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev); - struct atm_vcc *mpoad_vcc; /* control channel to mpoad */ - uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */ - uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */ - - rwlock_t ingress_lock; - struct in_cache_ops *in_ops; /* ingress cache operations */ - in_cache_entry *in_cache; /* the ingress cache of this MPC */ - - rwlock_t egress_lock; - struct eg_cache_ops *eg_ops; /* egress cache operations */ - eg_cache_entry *eg_cache; /* the egress cache of this MPC */ - - uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */ - int number_of_mps_macs; /* number of the above MAC addresses */ - struct mpc_parameters parameters; /* parameters for this client */ + struct mpoa_client *next; + struct net_device *dev; /* lec in question */ + int dev_num; /* e.g. 2 for lec2 */ + int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev); + struct atm_vcc *mpoad_vcc; /* control channel to mpoad */ + uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */ + uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */ + + rwlock_t ingress_lock; + struct in_cache_ops *in_ops; /* ingress cache operations */ + in_cache_entry *in_cache; /* the ingress cache of this MPC */ + + rwlock_t egress_lock; + struct eg_cache_ops *eg_ops; /* egress cache operations */ + eg_cache_entry *eg_cache; /* the egress cache of this MPC */ + + uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */ + int number_of_mps_macs; /* number of the above MAC addresses */ + struct mpc_parameters parameters; /* parameters for this client */ }; struct atm_mpoa_qos { - struct atm_mpoa_qos *next; - __be32 ipaddr; - struct atm_qos qos; + struct atm_mpoa_qos *next; + __be32 ipaddr; + struct atm_qos qos; }; diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c index 697a081..24799e3 100644 --- a/net/atm/mpoa_caches.c +++ b/net/atm/mpoa_caches.c @@ -369,7 +369,7 @@ static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, struct mpoa_clie while (entry != NULL){ if (entry->shortcut == vcc) { atomic_inc(&entry->use); - read_unlock_irqrestore(&mpc->egress_lock, flags); + read_unlock_irqrestore(&mpc->egress_lock, flags); return entry; } entry = entry->next; @@ -388,7 +388,7 @@ static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, struct mpoa_client while(entry != NULL){ if(entry->latest_ip_addr == ipaddr) { atomic_inc(&entry->use); - read_unlock_irq(&mpc->egress_lock); + read_unlock_irq(&mpc->egress_lock); return entry; } entry = entry->next; diff --git a/net/atm/mpoa_caches.h b/net/atm/mpoa_caches.h index 84de977..8e5f78c 100644 --- a/net/atm/mpoa_caches.h +++ b/net/atm/mpoa_caches.h @@ -12,66 +12,66 @@ struct mpoa_client; void atm_mpoa_init_cache(struct mpoa_client *mpc); typedef struct in_cache_entry { - struct in_cache_entry *next; - struct in_cache_entry *prev; - struct timeval tv; - struct timeval reply_wait; - struct timeval hold_down; - uint32_t packets_fwded; - uint16_t entry_state; - uint32_t retry_time; - uint32_t refresh_time; - uint32_t count; - struct atm_vcc *shortcut; - uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; - struct in_ctrl_info ctrl_info; - atomic_t use; + struct in_cache_entry *next; + struct in_cache_entry *prev; + struct timeval tv; + struct timeval reply_wait; + struct timeval hold_down; + uint32_t packets_fwded; + uint16_t entry_state; + uint32_t retry_time; + uint32_t refresh_time; + uint32_t count; + struct atm_vcc *shortcut; + uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; + struct in_ctrl_info ctrl_info; + atomic_t use; } in_cache_entry; struct in_cache_ops{ - in_cache_entry *(*add_entry)(__be32 dst_ip, - struct mpoa_client *client); - in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client); - in_cache_entry *(*get_with_mask)(__be32 dst_ip, + in_cache_entry *(*add_entry)(__be32 dst_ip, + struct mpoa_client *client); + in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client); + in_cache_entry *(*get_with_mask)(__be32 dst_ip, struct mpoa_client *client, __be32 mask); - in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, - struct mpoa_client *client); - void (*put)(in_cache_entry *entry); - void (*remove_entry)(in_cache_entry *delEntry, + in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, + struct mpoa_client *client); + void (*put)(in_cache_entry *entry); + void (*remove_entry)(in_cache_entry *delEntry, struct mpoa_client *client ); - int (*cache_hit)(in_cache_entry *entry, - struct mpoa_client *client); - void (*clear_count)(struct mpoa_client *client); - void (*check_resolving)(struct mpoa_client *client); - void (*refresh)(struct mpoa_client *client); - void (*destroy_cache)(struct mpoa_client *mpc); + int (*cache_hit)(in_cache_entry *entry, + struct mpoa_client *client); + void (*clear_count)(struct mpoa_client *client); + void (*check_resolving)(struct mpoa_client *client); + void (*refresh)(struct mpoa_client *client); + void (*destroy_cache)(struct mpoa_client *mpc); }; typedef struct eg_cache_entry{ - struct eg_cache_entry *next; - struct eg_cache_entry *prev; - struct timeval tv; - uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; - struct atm_vcc *shortcut; - uint32_t packets_rcvd; - uint16_t entry_state; - __be32 latest_ip_addr; /* The src IP address of the last packet */ - struct eg_ctrl_info ctrl_info; - atomic_t use; + struct eg_cache_entry *next; + struct eg_cache_entry *prev; + struct timeval tv; + uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; + struct atm_vcc *shortcut; + uint32_t packets_rcvd; + uint16_t entry_state; + __be32 latest_ip_addr; /* The src IP address of the last packet */ + struct eg_ctrl_info ctrl_info; + atomic_t use; } eg_cache_entry; struct eg_cache_ops{ - eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client); - eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client); - eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client); - eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client); - eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client); - void (*put)(eg_cache_entry *entry); - void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client); - void (*update)(eg_cache_entry *entry, uint16_t holding_time); - void (*clear_expired)(struct mpoa_client *client); - void (*destroy_cache)(struct mpoa_client *mpc); + eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client); + eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client); + eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client); + eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client); + eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client); + void (*put)(eg_cache_entry *entry); + void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client); + void (*update)(eg_cache_entry *entry, uint16_t holding_time); + void (*clear_expired)(struct mpoa_client *client); + void (*destroy_cache)(struct mpoa_client *mpc); }; @@ -85,7 +85,7 @@ struct eg_cache_ops{ /* VCC states */ #define OPEN 1 -#define CLOSED 0 +#define CLOSED 0 /* Egress cache entry states */ diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c index 3844c85..43315af 100644 --- a/net/atm/mpoa_proc.c +++ b/net/atm/mpoa_proc.c @@ -2,7 +2,7 @@ #ifdef CONFIG_PROC_FS #include <linux/errno.h> #include <linux/kernel.h> -#include <linux/string.h> +#include <linux/string.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/proc_fs.h> @@ -16,7 +16,7 @@ /* * mpoa_proc.c: Implementation MPOA client's proc - * file system statistics + * file system statistics */ #if 1 @@ -32,7 +32,7 @@ extern struct proc_dir_entry *atm_proc_root; /* from proc.c. */ static int proc_mpc_open(struct inode *inode, struct file *file); static ssize_t proc_mpc_write(struct file *file, const char __user *buff, - size_t nbytes, loff_t *ppos); + size_t nbytes, loff_t *ppos); static int parse_qos(const char *buff); @@ -52,18 +52,18 @@ static struct file_operations mpc_file_operations = { * Returns the state of an ingress cache entry as a string */ static const char *ingress_state_string(int state){ - switch(state) { + switch(state) { case INGRESS_RESOLVING: - return "resolving "; + return "resolving "; break; case INGRESS_RESOLVED: - return "resolved "; + return "resolved "; break; case INGRESS_INVALID: - return "invalid "; + return "invalid "; break; case INGRESS_REFRESHING: - return "refreshing "; + return "refreshing "; break; default: return ""; @@ -74,15 +74,15 @@ static const char *ingress_state_string(int state){ * Returns the state of an egress cache entry as a string */ static const char *egress_state_string(int state){ - switch(state) { + switch(state) { case EGRESS_RESOLVED: - return "resolved "; + return "resolved "; break; case EGRESS_PURGE: - return "purge "; + return "purge "; break; case EGRESS_INVALID: - return "invalid "; + return "invalid "; break; default: return ""; @@ -135,7 +135,7 @@ static int mpc_show(struct seq_file *m, void *v) return 0; } - seq_printf(m, "\nInterface %d:\n\n", mpc->dev_num); + seq_printf(m, "\nInterface %d:\n\n", mpc->dev_num); seq_printf(m, "Ingress Entries:\nIP address State Holding time Packets fwded VPI VCI\n"); do_gettimeofday(&now); @@ -163,7 +163,7 @@ static int mpc_show(struct seq_file *m, void *v) egress_state_string(eg_entry->entry_state), (eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)), eg_entry->packets_rcvd); - + /* latest IP address */ temp = (unsigned char *)&eg_entry->latest_ip_addr; sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]); @@ -190,51 +190,51 @@ static int proc_mpc_open(struct inode *inode, struct file *file) } static ssize_t proc_mpc_write(struct file *file, const char __user *buff, - size_t nbytes, loff_t *ppos) + size_t nbytes, loff_t *ppos) { - char *page, *p; + char *page, *p; unsigned len; - if (nbytes == 0) + if (nbytes == 0) return 0; - if (nbytes >= PAGE_SIZE) + if (nbytes >= PAGE_SIZE) nbytes = PAGE_SIZE-1; - page = (char *)__get_free_page(GFP_KERNEL); - if (!page) + page = (char *)__get_free_page(GFP_KERNEL); + if (!page) return -ENOMEM; - for (p = page, len = 0; len < nbytes; p++, len++) { - if (get_user(*p, buff++)) { + for (p = page, len = 0; len < nbytes; p++, len++) { + if (get_user(*p, buff++)) { free_page((unsigned long)page); return -EFAULT; } - if (*p == '\0' || *p == '\n') - break; - } + if (*p == '\0' || *p == '\n') + break; + } - *p = '\0'; + *p = '\0'; if (!parse_qos(page)) - printk("mpoa: proc_mpc_write: could not parse '%s'\n", page); + printk("mpoa: proc_mpc_write: could not parse '%s'\n", page); + + free_page((unsigned long)page); - free_page((unsigned long)page); - - return len; + return len; } static int parse_qos(const char *buff) { - /* possible lines look like this - * add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu - */ - unsigned char ip[4]; + /* possible lines look like this + * add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu + */ + unsigned char ip[4]; int tx_pcr, tx_sdu, rx_pcr, rx_sdu; - __be32 ipaddr; - struct atm_qos qos; - - memset(&qos, 0, sizeof(struct atm_qos)); + __be32 ipaddr; + struct atm_qos qos; + + memset(&qos, 0, sizeof(struct atm_qos)); if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu", ip, ip+1, ip+2, ip+3) == 4) { @@ -250,14 +250,14 @@ static int parse_qos(const char *buff) ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8) return 0; - ipaddr = *(__be32 *)ip; + ipaddr = *(__be32 *)ip; qos.txtp.traffic_class = ATM_CBR; qos.txtp.max_pcr = tx_pcr; qos.txtp.max_sdu = tx_sdu; qos.rxtp.traffic_class = ATM_CBR; qos.rxtp.max_pcr = rx_pcr; qos.rxtp.max_sdu = rx_sdu; - qos.aal = ATM_AAL5; + qos.aal = ATM_AAL5; dprintk("mpoa: mpoa_proc.c: parse_qos(): setting qos paramameters to tx=%d,%d rx=%d,%d\n", qos.txtp.max_pcr, qos.txtp.max_sdu, @@ -276,11 +276,11 @@ int mpc_proc_init(void) { struct proc_dir_entry *p; - p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root); + p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root); if (!p) { - printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME); - return -ENOMEM; - } + printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME); + return -ENOMEM; + } p->proc_fops = &mpc_file_operations; p->owner = THIS_MODULE; return 0; diff --git a/net/atm/proc.c b/net/atm/proc.c index 739866b..190f49c 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c @@ -86,7 +86,7 @@ static int __vcc_walk(struct sock **sock, int family, int *bucket, loff_t l) break; } l--; - } + } try_again: for (; sk; sk = sk_next(sk)) { l -= compare_family(sk, family); @@ -205,7 +205,7 @@ static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc) seq_printf(seq, "%p ", vcc); if (!vcc->dev) seq_printf(seq, "Unassigned "); - else + else seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi, vcc->vci); switch (sk->sk_family) { @@ -249,7 +249,7 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v) static char atm_dev_banner[] = "Itf Type ESI/\"MAC\"addr " "AAL(TX,err,RX,err,drop) ... [refcnt]\n"; - + if (v == (void *)1) seq_puts(seq, atm_dev_banner); else { @@ -257,21 +257,21 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v) atm_dev_info(seq, dev); } - return 0; + return 0; } - + static struct seq_operations atm_dev_seq_ops = { .start = atm_dev_seq_start, .next = atm_dev_seq_next, .stop = atm_dev_seq_stop, .show = atm_dev_seq_show, }; - + static int atm_dev_seq_open(struct inode *inode, struct file *file) { return seq_open(file, &atm_dev_seq_ops); } - + static struct file_operations devices_seq_fops = { .open = atm_dev_seq_open, .read = seq_read, @@ -281,7 +281,7 @@ static struct file_operations devices_seq_fops = { static int pvc_seq_show(struct seq_file *seq, void *v) { - static char atm_pvc_banner[] = + static char atm_pvc_banner[] = "Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n"; if (v == (void *)1) @@ -316,31 +316,31 @@ static struct file_operations pvc_seq_fops = { static int vcc_seq_show(struct seq_file *seq, void *v) { - if (v == (void *)1) { - seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", - "Address ", "Itf VPI VCI Fam Flags Reply " - "Send buffer Recv buffer [refcnt]\n"); - } else { - struct vcc_state *state = seq->private; - struct atm_vcc *vcc = atm_sk(state->sk); - - vcc_info(seq, vcc); - } - return 0; + if (v == (void *)1) { + seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", + "Address ", "Itf VPI VCI Fam Flags Reply " + "Send buffer Recv buffer [refcnt]\n"); + } else { + struct vcc_state *state = seq->private; + struct atm_vcc *vcc = atm_sk(state->sk); + + vcc_info(seq, vcc); + } + return 0; } - + static struct seq_operations vcc_seq_ops = { - .start = vcc_seq_start, - .next = vcc_seq_next, - .stop = vcc_seq_stop, - .show = vcc_seq_show, + .start = vcc_seq_start, + .next = vcc_seq_next, + .stop = vcc_seq_stop, + .show = vcc_seq_show, }; - + static int vcc_seq_open(struct inode *inode, struct file *file) { - return __vcc_seq_open(inode, file, 0, &vcc_seq_ops); + return __vcc_seq_open(inode, file, 0, &vcc_seq_ops); } - + static struct file_operations vcc_seq_fops = { .open = vcc_seq_open, .read = seq_read, @@ -350,7 +350,7 @@ static struct file_operations vcc_seq_fops = { static int svc_seq_show(struct seq_file *seq, void *v) { - static char atm_svc_banner[] = + static char atm_svc_banner[] = "Itf VPI VCI State Remote\n"; if (v == (void *)1) @@ -472,7 +472,7 @@ static void atm_proc_dirs_remove(void) static struct atm_proc_entry *e; for (e = atm_proc_ents; e->name; e++) { - if (e->dirent) + if (e->dirent) remove_proc_entry(e->name, atm_proc_root); } remove_proc_entry("net/atm", NULL); diff --git a/net/atm/pvc.c b/net/atm/pvc.c index b2148b4..848e6e1 100644 --- a/net/atm/pvc.c +++ b/net/atm/pvc.c @@ -72,7 +72,7 @@ static int pvc_setsockopt(struct socket *sock, int level, int optname, static int pvc_getsockopt(struct socket *sock, int level, int optname, - char __user *optval, int __user *optlen) + char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; int error; @@ -91,7 +91,7 @@ static int pvc_getname(struct socket *sock,struct sockaddr *sockaddr, struct atm_vcc *vcc = ATM_SD(sock); if (!vcc->dev || !test_bit(ATM_VF_ADDR,&vcc->flags)) return -ENOTCONN; - *sockaddr_len = sizeof(struct sockaddr_atmpvc); + *sockaddr_len = sizeof(struct sockaddr_atmpvc); addr = (struct sockaddr_atmpvc *) sockaddr; addr->sap_family = AF_ATMPVC; addr->sap_addr.itf = vcc->dev->number; diff --git a/net/atm/raw.c b/net/atm/raw.c index 3e57b17..4df7cdd 100644 --- a/net/atm/raw.c +++ b/net/atm/raw.c @@ -56,12 +56,12 @@ static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb) * still work */ if (!capable(CAP_NET_ADMIN) && - (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) != - ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT))) + (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) != + ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT))) { kfree_skb(skb); return -EADDRNOTAVAIL; - } + } return vcc->dev->ops->send(vcc,skb); } diff --git a/net/atm/resources.c b/net/atm/resources.c index 529f7e6..1bcf6dc 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c @@ -142,8 +142,8 @@ void atm_dev_deregister(struct atm_dev *dev) set_bit(ATM_DF_REMOVED, &dev->flags); /* - * if we remove current device from atm_devs list, new device - * with same number can appear, such we need deregister proc, + * if we remove current device from atm_devs list, new device + * with same number can appear, such we need deregister proc, * release async all vccs and remove them from vccs list too */ mutex_lock(&atm_dev_mutex); @@ -228,7 +228,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) *tmp_p++ = dev->number; } mutex_unlock(&atm_dev_mutex); - error = ((copy_to_user(buf, tmp_buf, size)) || + error = ((copy_to_user(buf, tmp_buf, size)) || put_user(size, &iobuf->length)) ? -EFAULT : 0; kfree(tmp_buf); @@ -247,7 +247,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) if (!(dev = try_then_request_module(atm_dev_lookup(number), "atm-device-%d", number))) return -ENODEV; - + switch (cmd) { case ATM_GETTYPE: size = strlen(dev->type) + 1; @@ -390,7 +390,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) goto done; } } - + if (size) error = put_user(size, &sioc->length) ? -EFAULT : 0; @@ -414,15 +414,15 @@ static __inline__ void *dev_get_idx(loff_t left) void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) { - mutex_lock(&atm_dev_mutex); + mutex_lock(&atm_dev_mutex); return *pos ? dev_get_idx(*pos) : (void *) 1; } void atm_dev_seq_stop(struct seq_file *seq, void *v) { - mutex_unlock(&atm_dev_mutex); + mutex_unlock(&atm_dev_mutex); } - + void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; diff --git a/net/atm/signaling.h b/net/atm/signaling.h index 434ead4..08b2a69 100644 --- a/net/atm/signaling.h +++ b/net/atm/signaling.h @@ -1,7 +1,7 @@ /* net/atm/signaling.h - ATM signaling */ - + /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ - + #ifndef NET_ATM_SIGNALING_H #define NET_ATM_SIGNALING_H diff --git a/net/atm/svc.c b/net/atm/svc.c index 3a180cf..876ec7b 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c @@ -89,7 +89,7 @@ static int svc_release(struct socket *sock) clear_bit(ATM_VF_READY, &vcc->flags); /* VCC pointer is used as a reference, so we must not free it (thereby subjecting it to re-use) before all pending connections - are closed */ + are closed */ svc_disconnect(vcc); vcc_release(sock); } @@ -144,7 +144,7 @@ static int svc_bind(struct socket *sock,struct sockaddr *sockaddr, error = -EUNATCH; goto out; } - if (!sk->sk_err) + if (!sk->sk_err) set_bit(ATM_VF_BOUND,&vcc->flags); error = -sk->sk_err; out: @@ -229,7 +229,7 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr, * This is tricky: * Kernel ---close--> Demon * Kernel <--close--- Demon - * or + * or * Kernel ---close--> Demon * Kernel <--error--- Demon * or @@ -470,13 +470,13 @@ static int svc_setsockopt(struct socket *sock, int level, int optname, } set_bit(ATM_VF_HASSAP, &vcc->flags); break; - case SO_MULTIPOINT: + case SO_MULTIPOINT: if (level != SOL_ATM || optlen != sizeof(int)) { error = -EINVAL; goto out; } - if (get_user(value, (int __user *) optval)) { - error = -EFAULT; + if (get_user(value, (int __user *) optval)) { + error = -EFAULT; goto out; } if (value == 1) { @@ -486,7 +486,7 @@ static int svc_setsockopt(struct socket *sock, int level, int optname, } else { error = -EINVAL; } - break; + break; default: error = vcc_setsockopt(sock, level, optname, optval, optlen); @@ -539,7 +539,7 @@ static int svc_addparty(struct socket *sock, struct sockaddr *sockaddr, set_bit(ATM_VF_WAITING, &vcc->flags); prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); sigd_enq(vcc, as_addparty, NULL, NULL, - (struct sockaddr_atmsvc *) sockaddr); + (struct sockaddr_atmsvc *) sockaddr); if (flags & O_NONBLOCK) { finish_wait(sk->sk_sleep, &wait); error = -EINPROGRESS; @@ -587,26 +587,26 @@ out: static int svc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { - int error, ep_ref; - struct sockaddr_atmsvc sa; + int error, ep_ref; + struct sockaddr_atmsvc sa; struct atm_vcc *vcc = ATM_SD(sock); - + switch (cmd) { - case ATM_ADDPARTY: - if (!test_bit(ATM_VF_SESSION, &vcc->flags)) - return -EINVAL; - if (copy_from_user(&sa, (void __user *) arg, sizeof(sa))) + case ATM_ADDPARTY: + if (!test_bit(ATM_VF_SESSION, &vcc->flags)) + return -EINVAL; + if (copy_from_user(&sa, (void __user *) arg, sizeof(sa))) return -EFAULT; - error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0); - break; - case ATM_DROPPARTY: - if (!test_bit(ATM_VF_SESSION, &vcc->flags)) - return -EINVAL; - if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int))) + error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0); + break; + case ATM_DROPPARTY: + if (!test_bit(ATM_VF_SESSION, &vcc->flags)) + return -EINVAL; + if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int))) return -EFAULT; - error = svc_dropparty(sock, ep_ref); - break; - default: + error = svc_dropparty(sock, ep_ref); + break; + default: error = vcc_ioctl(sock, cmd, arg); } diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 42233df..9a0b677 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -263,9 +263,9 @@ static void ax25_destroy_timer(unsigned long data) { ax25_cb *ax25=(ax25_cb *)data; struct sock *sk; - + sk=ax25->sk; - + bh_lock_sock(sk); sock_hold(sk); ax25_destroy_socket(ax25); @@ -369,57 +369,57 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) ax25_disconnect(ax25, ENETRESET); break; - case AX25_WINDOW: - if (ax25->modulus == AX25_MODULUS) { - if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7) - return -EINVAL; - } else { - if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63) - return -EINVAL; - } - ax25->window = ax25_ctl.arg; - break; - - case AX25_T1: + case AX25_WINDOW: + if (ax25->modulus == AX25_MODULUS) { + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7) + return -EINVAL; + } else { + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63) + return -EINVAL; + } + ax25->window = ax25_ctl.arg; + break; + + case AX25_T1: if (ax25_ctl.arg < 1) - return -EINVAL; - ax25->rtt = (ax25_ctl.arg * HZ) / 2; - ax25->t1 = ax25_ctl.arg * HZ; - break; - - case AX25_T2: - if (ax25_ctl.arg < 1) - return -EINVAL; - ax25->t2 = ax25_ctl.arg * HZ; - break; - - case AX25_N2: - if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31) return -EINVAL; - ax25->n2count = 0; - ax25->n2 = ax25_ctl.arg; - break; - - case AX25_T3: - if (ax25_ctl.arg < 0) - return -EINVAL; - ax25->t3 = ax25_ctl.arg * HZ; - break; - - case AX25_IDLE: - if (ax25_ctl.arg < 0) - return -EINVAL; - ax25->idle = ax25_ctl.arg * 60 * HZ; - break; - - case AX25_PACLEN: - if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535) - return -EINVAL; - ax25->paclen = ax25_ctl.arg; - break; - - default: - return -EINVAL; + ax25->rtt = (ax25_ctl.arg * HZ) / 2; + ax25->t1 = ax25_ctl.arg * HZ; + break; + + case AX25_T2: + if (ax25_ctl.arg < 1) + return -EINVAL; + ax25->t2 = ax25_ctl.arg * HZ; + break; + + case AX25_N2: + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31) + return -EINVAL; + ax25->n2count = 0; + ax25->n2 = ax25_ctl.arg; + break; + + case AX25_T3: + if (ax25_ctl.arg < 0) + return -EINVAL; + ax25->t3 = ax25_ctl.arg * HZ; + break; + + case AX25_IDLE: + if (ax25_ctl.arg < 0) + return -EINVAL; + ax25->idle = ax25_ctl.arg * 60 * HZ; + break; + + case AX25_PACLEN: + if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535) + return -EINVAL; + ax25->paclen = ax25_ctl.arg; + break; + + default: + return -EINVAL; } return 0; @@ -1209,7 +1209,7 @@ static int __must_check ax25_connect(struct socket *sock, if (sk->sk_type == SOCK_SEQPACKET && (ax25t=ax25_find_cb(&ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi, - ax25->ax25_dev->dev))) { + ax25->ax25_dev->dev))) { kfree(digi); err = -EADDRINUSE; /* Already such a connection */ ax25_cb_put(ax25t); @@ -1456,7 +1456,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, err = -EMSGSIZE; goto out; } - + if (usax != NULL) { if (usax->sax25_family != AF_AX25) { err = -EINVAL; @@ -1470,8 +1470,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, else if (addr_len != sizeof(struct full_sockaddr_ax25)) { /* support for old structure may go away some time */ if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || - (addr_len > sizeof(struct full_sockaddr_ax25))) { - err = -EINVAL; + (addr_len > sizeof(struct full_sockaddr_ax25))) { + err = -EINVAL; goto out; } @@ -1624,7 +1624,7 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock, /* Now we can treat all alike */ skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &err); + flags & MSG_DONTWAIT, &err); if (skb == NULL) goto out; @@ -1869,7 +1869,7 @@ static void *ax25_info_next(struct seq_file *seq, void *v, loff_t *pos) return hlist_entry( ((struct ax25_cb *)v)->ax25_node.next, struct ax25_cb, ax25_node); } - + static void ax25_info_stop(struct seq_file *seq, void *v) { spin_unlock_bh(&ax25_list_lock); diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c index 97a49c7..419e718 100644 --- a/net/ax25/ax25_addr.c +++ b/net/ax25/ax25_addr.c @@ -126,10 +126,10 @@ int ax25cmp(const ax25_address *a, const ax25_address *b) ct++; } - if ((a->ax25_call[ct] & 0x1E) == (b->ax25_call[ct] & 0x1E)) /* SSID without control bit */ - return 0; + if ((a->ax25_call[ct] & 0x1E) == (b->ax25_call[ct] & 0x1E)) /* SSID without control bit */ + return 0; - return 2; /* Partial match */ + return 2; /* Partial match */ } EXPORT_SYMBOL(ax25cmp); diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c index 136c3ae..8d62d86 100644 --- a/net/ax25/ax25_ip.c +++ b/net/ax25/ax25_ip.c @@ -55,46 +55,46 @@ int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short if (type == ETH_P_AX25) return 0; - /* header is an AX.25 UI frame from us to them */ - buff = skb_push(skb, AX25_HEADER_LEN); - *buff++ = 0x00; /* KISS DATA */ + /* header is an AX.25 UI frame from us to them */ + buff = skb_push(skb, AX25_HEADER_LEN); + *buff++ = 0x00; /* KISS DATA */ if (daddr != NULL) memcpy(buff, daddr, dev->addr_len); /* Address specified */ - buff[6] &= ~AX25_CBIT; - buff[6] &= ~AX25_EBIT; - buff[6] |= AX25_SSSID_SPARE; - buff += AX25_ADDR_LEN; - - if (saddr != NULL) - memcpy(buff, saddr, dev->addr_len); - else - memcpy(buff, dev->dev_addr, dev->addr_len); - - buff[6] &= ~AX25_CBIT; - buff[6] |= AX25_EBIT; - buff[6] |= AX25_SSSID_SPARE; - buff += AX25_ADDR_LEN; - - *buff++ = AX25_UI; /* UI */ - - /* Append a suitable AX.25 PID */ - switch (type) { - case ETH_P_IP: - *buff++ = AX25_P_IP; - break; - case ETH_P_ARP: - *buff++ = AX25_P_ARP; - break; - default: - printk(KERN_ERR "AX.25: ax25_hard_header - wrong protocol type 0x%2.2x\n", type); - *buff++ = 0; - break; - } + buff[6] &= ~AX25_CBIT; + buff[6] &= ~AX25_EBIT; + buff[6] |= AX25_SSSID_SPARE; + buff += AX25_ADDR_LEN; + + if (saddr != NULL) + memcpy(buff, saddr, dev->addr_len); + else + memcpy(buff, dev->dev_addr, dev->addr_len); + + buff[6] &= ~AX25_CBIT; + buff[6] |= AX25_EBIT; + buff[6] |= AX25_SSSID_SPARE; + buff += AX25_ADDR_LEN; + + *buff++ = AX25_UI; /* UI */ + + /* Append a suitable AX.25 PID */ + switch (type) { + case ETH_P_IP: + *buff++ = AX25_P_IP; + break; + case ETH_P_ARP: + *buff++ = AX25_P_ARP; + break; + default: + printk(KERN_ERR "AX.25: ax25_hard_header - wrong protocol type 0x%2.2x\n", type); + *buff++ = 0; + break; + } if (daddr != NULL) - return AX25_HEADER_LEN; + return AX25_HEADER_LEN; return -AX25_HEADER_LEN; /* Unfinished header */ } @@ -114,8 +114,8 @@ int ax25_rebuild_header(struct sk_buff *skb) dst = (ax25_address *)(bp + 1); src = (ax25_address *)(bp + 8); - if (arp_find(bp + 1, skb)) - return 1; + if (arp_find(bp + 1, skb)) + return 1; route = ax25_get_route(dst, NULL); if (route) { @@ -127,8 +127,8 @@ int ax25_rebuild_header(struct sk_buff *skb) if (dev == NULL) dev = skb->dev; - if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { - goto put; + if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { + goto put; } if (bp[16] == AX25_P_IP) { @@ -175,8 +175,8 @@ int ax25_rebuild_header(struct sk_buff *skb) ourskb->nh.raw = ourskb->data; ax25=ax25_send_frame( - ourskb, - ax25_dev->values[AX25_VALUES_PACLEN], + ourskb, + ax25_dev->values[AX25_VALUES_PACLEN], &src_c, &dst_c, digipeat, dev); if (ax25) { @@ -186,13 +186,13 @@ int ax25_rebuild_header(struct sk_buff *skb) } } - bp[7] &= ~AX25_CBIT; - bp[7] &= ~AX25_EBIT; - bp[7] |= AX25_SSSID_SPARE; + bp[7] &= ~AX25_CBIT; + bp[7] &= ~AX25_EBIT; + bp[7] |= AX25_SSSID_SPARE; - bp[14] &= ~AX25_CBIT; - bp[14] |= AX25_EBIT; - bp[14] |= AX25_SSSID_SPARE; + bp[14] &= ~AX25_CBIT; + bp[14] |= AX25_EBIT; + bp[14] |= AX25_SSSID_SPARE; skb_pull(skb, AX25_KISS_HEADER_LEN); @@ -211,7 +211,7 @@ put: if (route) ax25_put_route(route); - return 1; + return 1; } #else /* INET */ diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c index 0a03816..7078861 100644 --- a/net/ax25/ax25_route.c +++ b/net/ax25/ax25_route.c @@ -87,7 +87,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) ax25_rt = ax25_route_list; while (ax25_rt != NULL) { if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 && - ax25_rt->dev == ax25_dev->dev) { + ax25_rt->dev == ax25_dev->dev) { kfree(ax25_rt->digipeat); ax25_rt->digipeat = NULL; if (route->digi_count != 0) { @@ -252,8 +252,8 @@ static void *ax25_rt_seq_start(struct seq_file *seq, loff_t *pos) { struct ax25_route *ax25_rt; int i = 1; - - read_lock(&ax25_route_lock); + + read_lock(&ax25_route_lock); if (*pos == 0) return SEQ_START_TOKEN; @@ -269,7 +269,7 @@ static void *ax25_rt_seq_start(struct seq_file *seq, loff_t *pos) static void *ax25_rt_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) ? ax25_route_list : + return (v == SEQ_START_TOKEN) ? ax25_route_list : ((struct ax25_route *) v)->next; } diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c index a29c480..e3528b1 100644 --- a/net/ax25/ax25_std_timer.c +++ b/net/ax25/ax25_std_timer.c @@ -34,7 +34,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25) { struct sock *sk=ax25->sk; - + if (sk) bh_lock_sock(sk); diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c index c41dbe5..85c58c4 100644 --- a/net/ax25/ax25_subr.c +++ b/net/ax25/ax25_subr.c @@ -56,7 +56,7 @@ void ax25_frames_acked(ax25_cb *ax25, unsigned short nr) */ if (ax25->va != nr) { while (skb_peek(&ax25->ack_queue) != NULL && ax25->va != nr) { - skb = skb_dequeue(&ax25->ack_queue); + skb = skb_dequeue(&ax25->ack_queue); kfree_skb(skb); ax25->va = (ax25->va + 1) % ax25->modulus; } @@ -65,7 +65,7 @@ void ax25_frames_acked(ax25_cb *ax25, unsigned short nr) void ax25_requeue_frames(ax25_cb *ax25) { - struct sk_buff *skb, *skb_prev = NULL; + struct sk_buff *skb, *skb_prev = NULL; /* * Requeue all the un-ack-ed frames on the output queue to be picked diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c index 5e9a81e..7f4c294 100644 --- a/net/ax25/ax25_uid.c +++ b/net/ax25/ax25_uid.c @@ -164,7 +164,7 @@ static void *ax25_uid_seq_next(struct seq_file *seq, void *v, loff_t *pos) ++*pos; return hlist_entry(((ax25_uid_assoc *)v)->uid_node.next, - ax25_uid_assoc, uid_node); + ax25_uid_assoc, uid_node); } static void ax25_uid_seq_stop(struct seq_file *seq, void *v) diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 67df99e..c7228cf 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -119,7 +119,7 @@ static int bt_sock_create(struct socket *sock, int proto) read_unlock(&bt_proto_lock); - return err; + return err; } void bt_sock_link(struct bt_sock_list *l, struct sock *sk) @@ -265,7 +265,7 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; - if (!skb_queue_empty(&sk->sk_receive_queue) || + if (!skb_queue_empty(&sk->sk_receive_queue) || (sk->sk_shutdown & RCV_SHUTDOWN)) mask |= POLLIN | POLLRDNORM; diff --git a/net/bluetooth/bnep/bnep.h b/net/bluetooth/bnep/bnep.h index 0b6cd0e..a299228 100644 --- a/net/bluetooth/bnep/bnep.h +++ b/net/bluetooth/bnep/bnep.h @@ -1,7 +1,7 @@ /* BNEP protocol definition for Linux Bluetooth stack (BlueZ). Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. @@ -60,7 +60,7 @@ // Extension types #define BNEP_EXT_CONTROL 0x00 -// Response messages +// Response messages #define BNEP_SUCCESS 0x00 #define BNEP_CONN_INVALID_DST 0x01 @@ -81,7 +81,7 @@ #define BNEP_CONNECT_TO 15 #define BNEP_FILTER_TO 15 -// Headers +// Headers #define BNEP_TYPE_MASK 0x7f #define BNEP_EXT_HEADER 0x80 @@ -132,7 +132,7 @@ struct bnep_conndel_req { struct bnep_conninfo { __u32 flags; __u16 role; - __u16 state; + __u16 state; __u8 dst[ETH_ALEN]; char device[16]; }; @@ -155,10 +155,10 @@ int bnep_get_conninfo(struct bnep_conninfo *ci); // BNEP sessions struct bnep_session { struct list_head list; - + unsigned int role; - unsigned long state; - unsigned long flags; + unsigned long state; + unsigned long flags; atomic_t killed; struct ethhdr eh; @@ -166,7 +166,7 @@ struct bnep_session { struct bnep_proto_filter proto_filter[BNEP_MAX_PROTO_FILTERS]; u64 mc_filter; - + struct socket *sock; struct net_device *dev; struct net_device_stats stats; @@ -178,7 +178,7 @@ int bnep_sock_cleanup(void); static inline int bnep_mc_hash(__u8 *addr) { - return (crc32_be(~0, addr, ETH_ALEN) >> 26); + return (crc32_be(~0, addr, ETH_ALEN) >> 26); } #endif diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 7ba6470..b85d149 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -1,4 +1,4 @@ -/* +/* BNEP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2001-2002 Inventel Systemes Written 2001-2002 by @@ -15,19 +15,19 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $ - */ + */ #include <linux/module.h> @@ -74,7 +74,7 @@ static struct bnep_session *__bnep_get_session(u8 *dst) BT_DBG(""); list_for_each(p, &bnep_session_list) { - s = list_entry(p, struct bnep_session, list); + s = list_entry(p, struct bnep_session, list); if (!compare_ether_addr(dst, s->eh.h_source)) return s; } @@ -87,7 +87,7 @@ static void __bnep_link_session(struct bnep_session *s) by the socket layer which has to hold the refference to this module. */ __module_get(THIS_MODULE); - list_add(&s->list, &bnep_session_list); + list_add(&s->list, &bnep_session_list); } static void __bnep_unlink_session(struct bnep_session *s) @@ -203,7 +203,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; a2 = data; data += ETH_ALEN; - + BT_DBG("mc filter %s -> %s", batostr((void *) a1), batostr((void *) a2)); @@ -277,7 +277,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb) } BT_DBG("type 0x%x len %d", h->type, h->len); - + switch (h->type & BNEP_TYPE_MASK) { case BNEP_EXT_CONTROL: bnep_rx_control(s, skb->data, skb->len); @@ -293,7 +293,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb) break; } } while (!err && (h->type & BNEP_EXT_HEADER)); - + return err; } @@ -319,7 +319,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) if ((type & BNEP_TYPE_MASK) > BNEP_RX_TYPES) goto badframe; - + if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) { bnep_rx_control(s, skb->data, skb->len); kfree_skb(skb); @@ -345,7 +345,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) goto badframe; s->eh.h_proto = get_unaligned((__be16 *) (skb->data - 2)); } - + /* We have to alloc new skb and copy data here :(. Because original skb * may not be modified and because of the alignment requirements. */ nskb = alloc_skb(2 + ETH_HLEN + skb->len, GFP_KERNEL); @@ -361,7 +361,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) case BNEP_COMPRESSED: memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN); break; - + case BNEP_COMPRESSED_SRC_ONLY: memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN); @@ -381,7 +381,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) memcpy(__skb_put(nskb, skb->len), skb->data, skb->len); kfree_skb(skb); - + s->stats.rx_packets++; nskb->dev = dev; nskb->ip_summed = CHECKSUM_NONE; @@ -435,7 +435,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb) iv[il++] = (struct kvec) { eh->h_source, ETH_ALEN }; len += ETH_ALEN; break; - + case BNEP_COMPRESSED_DST_ONLY: iv[il++] = (struct kvec) { eh->h_dest, ETH_ALEN }; len += ETH_ALEN; @@ -445,7 +445,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb) send: iv[il++] = (struct kvec) { skb->data, skb->len }; len += skb->len; - + /* FIXME: linearize skb */ { len = kernel_sendmsg(sock, &s->msg, iv, il, len); @@ -471,7 +471,7 @@ static int bnep_session(void *arg) BT_DBG(""); - daemonize("kbnepd %s", dev->name); + daemonize("kbnepd %s", dev->name); set_user_nice(current, -15); current->flags |= PF_NOFREEZE; @@ -488,13 +488,13 @@ static int bnep_session(void *arg) if (sk->sk_state != BT_CONNECTED) break; - + // TX while ((skb = skb_dequeue(&sk->sk_write_queue))) if (bnep_tx_frame(s, skb)) break; netif_wake_queue(dev); - + schedule(); } set_current_state(TASK_RUNNING); @@ -573,7 +573,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) s->sock = sock; s->role = req->role; s->state = BT_CONNECTED; - + s->msg.msg_flags = MSG_NOSIGNAL; #ifdef CONFIG_BT_BNEP_MC_FILTER @@ -594,7 +594,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) } __bnep_link_session(s); - + err = kernel_thread(bnep_session, s, CLONE_KERNEL); if (err < 0) { /* Session thread start failed, gotta cleanup. */ @@ -627,7 +627,7 @@ int bnep_del_connection(struct bnep_conndel_req *req) /* Wakeup user-space which is polling for socket errors. * This is temporary hack untill we have shutdown in L2CAP */ s->sock->sk->sk_err = EUNATCH; - + /* Kill session thread */ atomic_inc(&s->killed); wake_up_interruptible(s->sock->sk->sk_sleep); @@ -661,7 +661,7 @@ int bnep_get_connlist(struct bnep_connlist_req *req) s = list_entry(p, struct bnep_session, list); __bnep_copy_ci(&ci, s); - + if (copy_to_user(req->ci, &ci, sizeof(ci))) { err = -EFAULT; break; @@ -696,7 +696,7 @@ int bnep_get_conninfo(struct bnep_conninfo *ci) } static int __init bnep_init(void) -{ +{ char flt[50] = ""; l2cap_load(); diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c index 67a002a..9092816 100644 --- a/net/bluetooth/bnep/netdev.c +++ b/net/bluetooth/bnep/netdev.c @@ -1,4 +1,4 @@ -/* +/* BNEP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2001-2002 Inventel Systemes Written 2001-2002 by @@ -15,19 +15,19 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * $Id: netdev.c,v 1.8 2002/08/04 21:23:58 maxk Exp $ - */ + */ #include <linux/module.h> @@ -94,7 +94,7 @@ static void bnep_net_set_mc_list(struct net_device *dev) r->type = BNEP_CONTROL; r->ctrl = BNEP_FILTER_MULTI_ADDR_SET; - if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) { + if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) { u8 start[ETH_ALEN] = { 0x01 }; /* Request all addresses */ @@ -102,14 +102,14 @@ static void bnep_net_set_mc_list(struct net_device *dev) memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); r->len = htons(ETH_ALEN * 2); } else { - struct dev_mc_list *dmi = dev->mc_list; + struct dev_mc_list *dmi = dev->mc_list; int i, len = skb->len; if (dev->flags & IFF_BROADCAST) { memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); - } - + } + /* FIXME: We should group addresses here. */ for (i = 0; i < dev->mc_count && i < BNEP_MAX_MULTICAST_FILTERS; i++) { @@ -159,13 +159,13 @@ static inline u16 bnep_net_eth_proto(struct sk_buff *skb) { struct ethhdr *eh = (void *) skb->data; u16 proto = ntohs(eh->h_proto); - + if (proto >= 1536) return proto; - + if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF)) return ETH_P_802_3; - + return ETH_P_802_2; } @@ -174,7 +174,7 @@ static inline int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_session u16 proto = bnep_net_eth_proto(skb); struct bnep_proto_filter *f = s->proto_filter; int i; - + for (i = 0; i < BNEP_MAX_PROTO_FILTERS && f[i].end; i++) { if (proto >= f[i].start && proto <= f[i].end) return 0; @@ -198,14 +198,14 @@ static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev) return 0; } #endif - + #ifdef CONFIG_BT_BNEP_PROTO_FILTER if (bnep_net_proto_filter(skb, s)) { kfree_skb(skb); return 0; } #endif - + /* * We cannot send L2CAP packets from here as we are potentially in a bh. * So we have to queue them and wake up session thread which is sleeping diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index 5563db1..6d7311c 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c @@ -1,4 +1,4 @@ -/* +/* BNEP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2001-2002 Inventel Systemes Written 2001-2002 by @@ -14,19 +14,19 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * $Id: sock.c,v 1.4 2002/08/04 21:23:58 maxk Exp $ - */ + */ #include <linux/module.h> @@ -89,7 +89,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long if (copy_from_user(&ca, argp, sizeof(ca))) return -EFAULT; - + nsock = sockfd_lookup(ca.sock, &err); if (!nsock) return err; @@ -101,20 +101,20 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long err = bnep_add_connection(&ca, nsock); if (!err) { - if (copy_to_user(argp, &ca, sizeof(ca))) + if (copy_to_user(argp, &ca, sizeof(ca))) err = -EFAULT; } else fput(nsock->file); return err; - + case BNEPCONNDEL: if (!capable(CAP_NET_ADMIN)) return -EACCES; if (copy_from_user(&cd, argp, sizeof(cd))) return -EFAULT; - + return bnep_del_connection(&cd); case BNEPGETCONNLIST: @@ -123,7 +123,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long if (cl.cnum <= 0) return -EINVAL; - + err = bnep_get_connlist(&cl); if (!err && copy_to_user(argp, &cl, sizeof(cl))) return -EFAULT; @@ -163,7 +163,7 @@ static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne if (cl.cnum <= 0) return -EINVAL; - + err = bnep_get_connlist(&cl); if (!err && put_user(cl.cnum, (uint32_t __user *) arg)) diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c index ab166b4..3e9d5bb 100644 --- a/net/bluetooth/cmtp/capi.c +++ b/net/bluetooth/cmtp/capi.c @@ -1,4 +1,4 @@ -/* +/* CMTP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> @@ -10,13 +10,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -563,7 +563,7 @@ int cmtp_attach_device(struct cmtp_session *session) ret = wait_event_interruptible_timeout(session->wait, session->ncontroller, CMTP_INTEROP_TIMEOUT); - + BT_INFO("Found %d CAPI controller(s) on device %s", session->ncontroller, session->name); if (!ret) diff --git a/net/bluetooth/cmtp/cmtp.h b/net/bluetooth/cmtp/cmtp.h index 40e3dfe..e4663aa 100644 --- a/net/bluetooth/cmtp/cmtp.h +++ b/net/bluetooth/cmtp/cmtp.h @@ -1,4 +1,4 @@ -/* +/* CMTP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> @@ -10,13 +10,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index b81a01c..3933608 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -1,4 +1,4 @@ -/* +/* CMTP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> @@ -10,13 +10,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -336,7 +336,7 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) baswap(&dst, &bt_sk(sock->sk)->dst); session = kzalloc(sizeof(struct cmtp_session), GFP_KERNEL); - if (!session) + if (!session) return -ENOMEM; down_write(&cmtp_session_sem); diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index 53295d3..0c5ccd9 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c @@ -1,4 +1,4 @@ -/* +/* CMTP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> @@ -10,13 +10,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -154,7 +154,7 @@ static int cmtp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne if (cl.cnum <= 0) return -EINVAL; - + err = cmtp_get_connlist(&cl); if (!err && put_user(cl.cnum, (uint32_t __user *) arg)) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 6cd5711..67ee0bd 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -146,7 +146,7 @@ static void hci_conn_timeout(unsigned long arg) case BT_CONNECT: hci_acl_connect_cancel(conn); break; - case BT_CONNECTED: + case BT_CONNECTED: hci_acl_disconn(conn, 0x13); break; default: @@ -272,7 +272,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src) if (!test_bit(HCI_UP, &d->flags) || test_bit(HCI_RAW, &d->flags)) continue; - /* Simple routing: + /* Simple routing: * No source address - find interface with bdaddr != dst * Source address - find interface with bdaddr == src */ @@ -328,7 +328,7 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst) hci_conn_hold(sco); - if (acl->state == BT_CONNECTED && + if (acl->state == BT_CONNECTED && (sco->state == BT_OPEN || sco->state == BT_CLOSED)) hci_add_sco(sco, acl->handle); @@ -370,7 +370,7 @@ int hci_conn_encrypt(struct hci_conn *conn) if (hci_conn_auth(conn)) { struct hci_cp_set_conn_encrypt cp; cp.handle = __cpu_to_le16(conn->handle); - cp.encrypt = 1; + cp.encrypt = 1; hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp); } return 0; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 338ae97..4917919 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -116,7 +116,7 @@ static void hci_req_cancel(struct hci_dev *hdev, int err) } /* Execute request and wait for completion. */ -static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt), +static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt), unsigned long opt, __u32 timeout) { DECLARE_WAITQUEUE(wait, current); @@ -278,7 +278,7 @@ static void hci_encrypt_req(struct hci_dev *hdev, unsigned long opt) hci_send_cmd(hdev, OGF_HOST_CTL, OCF_WRITE_ENCRYPT_MODE, 1, &encrypt); } -/* Get HCI device by index. +/* Get HCI device by index. * Device is held on return. */ struct hci_dev *hci_dev_get(int index) { @@ -405,7 +405,7 @@ int hci_inquiry(void __user *arg) return -ENODEV; hci_dev_lock_bh(hdev); - if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || + if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) { inquiry_cache_flush(hdev); @@ -439,7 +439,7 @@ int hci_inquiry(void __user *arg) if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) * ir.num_rsp)) err = -EFAULT; - } else + } else err = -EFAULT; kfree(buf); @@ -491,7 +491,7 @@ int hci_dev_open(__u16 dev) hci_dev_hold(hdev); set_bit(HCI_UP, &hdev->flags); hci_notify(hdev, HCI_DEV_UP); - } else { + } else { /* Init failed, cleanup */ tasklet_kill(&hdev->rx_task); tasklet_kill(&hdev->tx_task); @@ -619,7 +619,7 @@ int hci_dev_reset(__u16 dev) if (hdev->flush) hdev->flush(hdev); - atomic_set(&hdev->cmd_cnt, 1); + atomic_set(&hdev->cmd_cnt, 1); hdev->acl_cnt = 0; hdev->sco_cnt = 0; if (!test_bit(HCI_RAW, &hdev->flags)) @@ -841,7 +841,7 @@ int hci_register_dev(struct hci_dev *hdev) break; head = p; id++; } - + sprintf(hdev->name, "hci%d", id); hdev->id = id; list_add(&hdev->list, head); @@ -1109,7 +1109,7 @@ int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags) __skb_queue_tail(&conn->data_q, skb); do { skb = list; list = list->next; - + skb->dev = (void *) hdev; bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT); @@ -1164,7 +1164,7 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int int num = 0, min = ~0; struct list_head *p; - /* We don't have to lock device here. Connections are always + /* We don't have to lock device here. Connections are always * added and removed with TX task disabled. */ list_for_each(p, &h->list) { struct hci_conn *c; @@ -1306,7 +1306,7 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) hci_dev_lock(hdev); conn = hci_conn_hash_lookup_handle(hdev, handle); hci_dev_unlock(hdev); - + if (conn) { register struct hci_proto *hp; @@ -1318,7 +1318,7 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) return; } } else { - BT_ERR("%s ACL packet for unknown connection handle %d", + BT_ERR("%s ACL packet for unknown connection handle %d", hdev->name, handle); } @@ -1353,7 +1353,7 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb) return; } } else { - BT_ERR("%s SCO packet for unknown connection handle %d", + BT_ERR("%s SCO packet for unknown connection handle %d", hdev->name, handle); } diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index bb94e6d..00d845e 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -100,7 +100,7 @@ static void hci_cc_link_policy(struct hci_dev *hdev, __u16 ocf, struct sk_buff * BT_DBG("%s ocf 0x%x", hdev->name, ocf); switch (ocf) { - case OCF_ROLE_DISCOVERY: + case OCF_ROLE_DISCOVERY: rd = (void *) skb->data; if (rd->status) @@ -141,7 +141,7 @@ static void hci_cc_link_policy(struct hci_dev *hdev, __u16 ocf, struct sk_buff * break; default: - BT_DBG("%s: Command complete: ogf LINK_POLICY ocf %x", + BT_DBG("%s: Command complete: ogf LINK_POLICY ocf %x", hdev->name, ocf); break; } @@ -237,10 +237,10 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb if (!status) { clear_bit(HCI_PSCAN, &hdev->flags); clear_bit(HCI_ISCAN, &hdev->flags); - if (param & SCAN_INQUIRY) + if (param & SCAN_INQUIRY) set_bit(HCI_ISCAN, &hdev->flags); - if (param & SCAN_PAGE) + if (param & SCAN_PAGE) set_bit(HCI_PSCAN, &hdev->flags); } hci_req_complete(hdev, status); @@ -343,7 +343,7 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s memcpy(hdev->features, lf->features, sizeof(hdev->features)); - /* Adjust default settings according to features + /* Adjust default settings according to features * supported by device. */ if (hdev->features[0] & LMP_3SLOT) hdev->pkt_type |= (HCI_DM3 | HCI_DH3); @@ -491,7 +491,7 @@ static void hci_cs_link_ctl(struct hci_dev *hdev, __u16 ocf, __u8 status) break; default: - BT_DBG("%s Command status: ogf LINK_CTL ocf %x status %d", + BT_DBG("%s Command status: ogf LINK_CTL ocf %x status %d", hdev->name, ocf, status); break; } @@ -793,7 +793,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s if (!conn->out) { struct hci_cp_change_conn_ptype cp; cp.handle = ev->handle; - cp.pkt_type = (conn->type == ACL_LINK) ? + cp.pkt_type = (conn->type == ACL_LINK) ? __cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK): __cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK); diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index dbf98c4..dc3ecb1 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -170,7 +170,7 @@ static int hci_sock_release(struct socket *sock) return 0; } -/* Ioctls that require bound socket */ +/* Ioctls that require bound socket */ static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) { struct hci_dev *hdev = hci_pi(sk)->hdev; @@ -348,8 +348,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv); } } - -static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, + +static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) { int noblock = flags & MSG_DONTWAIT; @@ -386,7 +386,7 @@ static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, return err ? : copied; } -static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, +static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; @@ -520,7 +520,7 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char *((u32 *) f->event_mask + 0) = uf.event_mask[0]; *((u32 *) f->event_mask + 1) = uf.event_mask[1]; } - break; + break; default: err = -ENOPROTOOPT; @@ -535,7 +535,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char { struct hci_ufilter uf; struct sock *sk = sock->sk; - int len, opt; + int len, opt; if (get_user(len, optlen)) return -EFAULT; @@ -544,7 +544,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char case HCI_DATA_DIR: if (hci_pi(sk)->cmsg_mask & HCI_CMSG_DIR) opt = 1; - else + else opt = 0; if (put_user(opt, optval)) @@ -554,7 +554,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char case HCI_TIME_STAMP: if (hci_pi(sk)->cmsg_mask & HCI_CMSG_TSTAMP) opt = 1; - else + else opt = 0; if (put_user(opt, optval)) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 6678201..4b99c5e 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -1,4 +1,4 @@ -/* +/* HIDP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> @@ -10,13 +10,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -293,7 +293,7 @@ static inline void hidp_process_handshake(struct hidp_session *session, unsigned case HIDP_HSHK_ERR_FATAL: /* Device requests a reboot, as this is the only way this error - * can be recovered. */ + * can be recovered. */ __hidp_send_ctrl_message(session, HIDP_TRANS_HID_CONTROL | HIDP_CTRL_SOFT_RESET, NULL, 0); break; diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h index c8dfacd..a326601 100644 --- a/net/bluetooth/hidp/hidp.h +++ b/net/bluetooth/hidp/hidp.h @@ -1,4 +1,4 @@ -/* +/* HIDP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> @@ -10,13 +10,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index 93cf9e5..33bda40 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c @@ -1,4 +1,4 @@ -/* +/* HIDP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> @@ -10,13 +10,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -206,7 +206,7 @@ static int hidp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne put_user(ca.idle_to, &uca->idle_to) || copy_to_user(&uca->name[0], &ca.name[0], 128)) return -EFAULT; - + arg = (unsigned long) uca; /* Fall through. We don't actually write back any _changes_ diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index f8c25d5..e83ee82 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -227,7 +227,7 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so bt_accept_enqueue(parent, sk); } -/* Delete channel. +/* Delete channel. * Must be called on the locked socket. */ static void l2cap_chan_del(struct sock *sk, int err) { @@ -238,7 +238,7 @@ static void l2cap_chan_del(struct sock *sk, int err) BT_DBG("sk %p, conn %p, err %d", sk, conn, err); - if (conn) { + if (conn) { /* Unlink from channel list */ l2cap_chan_unlink(&conn->chan_list, sk); l2cap_pi(sk)->conn = NULL; @@ -590,7 +590,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ err = -EACCES; goto done; } - + write_lock_bh(&l2cap_sk_list.lock); if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { @@ -890,7 +890,7 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len) *frag = bt_skb_send_alloc(sk, count, msg->msg_flags & MSG_DONTWAIT, &err); if (!*frag) goto fail; - + if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count)) { err = -EFAULT; goto fail; @@ -1267,7 +1267,7 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned static inline void l2cap_parse_conf_req(struct sock *sk, void *data, int len) { - int type, hint, olen; + int type, hint, olen; unsigned long val; void *ptr = data; @@ -1414,7 +1414,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd /* Check for backlog size */ if (sk_acceptq_is_full(parent)) { - BT_DBG("backlog full %d", parent->sk_ack_backlog); + BT_DBG("backlog full %d", parent->sk_ack_backlog); goto response; } @@ -1607,7 +1607,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr goto done; } - default: + default: sk->sk_state = BT_DISCONN; sk->sk_err = ECONNRESET; l2cap_sock_set_timer(sk, HZ * 5); diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c index e5fd0cb..ad2af58 100644 --- a/net/bluetooth/lib.c +++ b/net/bluetooth/lib.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 278c867..94f4573 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -1,4 +1,4 @@ -/* +/* RFCOMM implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> @@ -11,13 +11,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -134,7 +134,7 @@ static inline void rfcomm_session_put(struct rfcomm_session *s) /* ---- RFCOMM FCS computation ---- */ /* reversed, 8-bit, poly=0x07 */ -static unsigned char rfcomm_crc_table[256] = { +static unsigned char rfcomm_crc_table[256] = { 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, @@ -179,13 +179,13 @@ static unsigned char rfcomm_crc_table[256] = { /* CRC on 2 bytes */ #define __crc(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]]) -/* FCS on 2 bytes */ +/* FCS on 2 bytes */ static inline u8 __fcs(u8 *data) { return (0xff - __crc(data)); } -/* FCS on 3 bytes */ +/* FCS on 3 bytes */ static inline u8 __fcs2(u8 *data) { return (0xff - rfcomm_crc_table[__crc(data) ^ data[2]]); @@ -288,7 +288,7 @@ struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio) atomic_set(&d->refcnt, 1); rfcomm_dlc_clear_state(d); - + BT_DBG("%p", d); return d; @@ -345,7 +345,7 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, int err = 0; u8 dlci; - BT_DBG("dlc %p state %ld %s %s channel %d", + BT_DBG("dlc %p state %ld %s %s channel %d", d, d->state, batostr(src), batostr(dst), channel); if (channel < 1 || channel > 30) @@ -489,21 +489,21 @@ void fastcall __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) rfcomm_schedule(RFCOMM_SCHED_TX); } -/* +/* Set/get modem status functions use _local_ status i.e. what we report to the other side. Remote status is provided by dlc->modem_status() callback. */ int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig) { - BT_DBG("dlc %p state %ld v24_sig 0x%x", + BT_DBG("dlc %p state %ld v24_sig 0x%x", d, d->state, v24_sig); if (test_bit(RFCOMM_RX_THROTTLED, &d->flags)) v24_sig |= RFCOMM_V24_FC; else v24_sig &= ~RFCOMM_V24_FC; - + d->v24_sig = v24_sig; if (!test_and_set_bit(RFCOMM_MSC_PENDING, &d->flags)) @@ -514,7 +514,7 @@ int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig) int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig) { - BT_DBG("dlc %p state %ld v24_sig 0x%x", + BT_DBG("dlc %p state %ld v24_sig 0x%x", d, d->state, d->v24_sig); *v24_sig = d->v24_sig; @@ -576,7 +576,7 @@ static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst) struct bt_sock *sk; list_for_each_safe(p, n, &session_list) { s = list_entry(p, struct rfcomm_session, list); - sk = bt_sk(s->sock->sk); + sk = bt_sk(s->sock->sk); if ((!bacmp(src, BDADDR_ANY) || !bacmp(&sk->src, src)) && !bacmp(&sk->dst, dst)) @@ -825,7 +825,7 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, u8 bit_rate, u8 data_bits, u8 stop_bits, - u8 parity, u8 flow_ctrl_settings, + u8 parity, u8 flow_ctrl_settings, u8 xon_char, u8 xoff_char, u16 param_mask) { struct rfcomm_hdr *hdr; @@ -834,8 +834,8 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, u8 buf[16], *ptr = buf; BT_DBG("%p cr %d dlci %d bit_r 0x%x data_b 0x%x stop_b 0x%x parity 0x%x" - " flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x", - s, cr, dlci, bit_rate, data_bits, stop_bits, parity, + " flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x", + s, cr, dlci, bit_rate, data_bits, stop_bits, parity, flow_ctrl_settings, xon_char, xoff_char, param_mask); hdr = (void *) ptr; ptr += sizeof(*hdr); @@ -1120,9 +1120,9 @@ static int rfcomm_recv_disc(struct rfcomm_session *s, u8 dlci) d->state = BT_CLOSED; __rfcomm_dlc_close(d, err); - } else + } else rfcomm_send_dm(s, dlci); - + } else { rfcomm_send_ua(s, 0); @@ -1230,7 +1230,7 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn) { struct rfcomm_session *s = d->session; - BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d", + BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d", d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits); if ((pn->flow_ctrl == 0xf0 && s->cfc != RFCOMM_CFC_DISABLED) || @@ -1454,7 +1454,7 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb if (d->modem_status) d->modem_status(d, msc->v24_sig); rfcomm_dlc_unlock(d); - + rfcomm_send_msc(s, 0, dlci, msc->v24_sig); d->mscex |= RFCOMM_MSCEX_RX; @@ -1641,18 +1641,18 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d) struct sk_buff *skb; int err; - BT_DBG("dlc %p state %ld cfc %d rx_credits %d tx_credits %d", + BT_DBG("dlc %p state %ld cfc %d rx_credits %d tx_credits %d", d, d->state, d->cfc, d->rx_credits, d->tx_credits); /* Send pending MSC */ if (test_and_clear_bit(RFCOMM_MSC_PENDING, &d->flags)) - rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig); + rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig); if (d->cfc) { - /* CFC enabled. + /* CFC enabled. * Give them some credits */ if (!test_bit(RFCOMM_RX_THROTTLED, &d->flags) && - d->rx_credits <= (d->cfc >> 2)) { + d->rx_credits <= (d->cfc >> 2)) { rfcomm_send_credits(d->session, d->addr, d->cfc - d->rx_credits); d->rx_credits = d->cfc; } @@ -1876,7 +1876,7 @@ static int rfcomm_add_listener(bdaddr_t *ba) /* Create socket */ err = rfcomm_l2sock_create(&sock); - if (err < 0) { + if (err < 0) { BT_ERR("Create socket failed %d", err); return err; } diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index cb7e855..30586ab 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -1,4 +1,4 @@ -/* +/* RFCOMM implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> @@ -11,13 +11,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -130,7 +130,7 @@ static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src) struct hlist_node *node; sk_for_each(sk, node, &rfcomm_sk_list.head) { - if (rfcomm_pi(sk)->channel == channel && + if (rfcomm_pi(sk)->channel == channel && !bacmp(&bt_sk(sk)->src, src)) break; } @@ -572,7 +572,7 @@ static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock, while (len) { size_t size = min_t(size_t, len, d->mtu); int err; - + skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) @@ -843,7 +843,7 @@ static int rfcomm_sock_release(struct socket *sock) return err; } -/* ---- RFCOMM core layer callbacks ---- +/* ---- RFCOMM core layer callbacks ---- * * called under rfcomm_lock() */ @@ -864,7 +864,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * /* Check for backlog size */ if (sk_acceptq_is_full(parent)) { - BT_DBG("backlog full %d", parent->sk_ack_backlog); + BT_DBG("backlog full %d", parent->sk_ack_backlog); goto done; } diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index eb2b524..8cd82dc 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -1,4 +1,4 @@ -/* +/* RFCOMM implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> @@ -11,13 +11,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -110,7 +110,7 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev) kfree(dev); - /* It's safe to call module_put() here because socket still + /* It's safe to call module_put() here because socket still holds reference to this module. */ module_put(THIS_MODULE); } @@ -185,7 +185,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) int err = 0; BT_DBG("id %d channel %d", req->dev_id, req->channel); - + dev = kzalloc(sizeof(struct rfcomm_dev), GFP_KERNEL); if (!dev) return -ENOMEM; @@ -234,7 +234,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) bacpy(&dev->dst, &req->dst); dev->channel = req->channel; - dev->flags = req->flags & + dev->flags = req->flags & ((1 << RFCOMM_RELEASE_ONHUP) | (1 << RFCOMM_REUSE_DLC)); init_waitqueue_head(&dev->wait); @@ -249,7 +249,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) dev->dlc = dlc; rfcomm_dlc_unlock(dlc); - /* It's safe to call __module_get() here because socket already + /* It's safe to call __module_get() here because socket already holds reference to this module. */ __module_get(THIS_MODULE); @@ -487,7 +487,7 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb) { struct rfcomm_dev *dev = dlc->owner; struct tty_struct *tty; - + if (!dev || !(tty = dev->tty)) { kfree_skb(skb); return; @@ -506,7 +506,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) struct rfcomm_dev *dev = dlc->owner; if (!dev) return; - + BT_DBG("dlc %p dev %p err %d", dlc, dev, err); dev->err = err; @@ -525,7 +525,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) rfcomm_dev_put(dev); rfcomm_dlc_lock(dlc); } - } else + } else tty_hangup(dev->tty); } } @@ -543,7 +543,7 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig) tty_hangup(dev->tty); } - dev->modem_status = + dev->modem_status = ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) | ((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) | ((v24_sig & RFCOMM_V24_IC) ? TIOCM_RI : 0) | @@ -561,7 +561,7 @@ static void rfcomm_tty_wakeup(unsigned long arg) BT_DBG("dev %p tty %p", dev, tty); if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && tty->ldisc.write_wakeup) - (tty->ldisc.write_wakeup)(tty); + (tty->ldisc.write_wakeup)(tty); wake_up_interruptible(&tty->write_wait); #ifdef SERIAL_HAVE_POLL_WAIT @@ -576,7 +576,7 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) struct rfcomm_dlc *dlc; int err, id; - id = tty->index; + id = tty->index; BT_DBG("tty %p id %d", tty, id); @@ -670,7 +670,7 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in size = min_t(uint, count, dlc->mtu); skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_ATOMIC); - + if (!skb) break; @@ -773,7 +773,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old) return; /* Handle turning off CRTSCTS */ - if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS)) + if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS)) BT_DBG("Turning off CRTSCTS unsupported"); /* Parity on/off and when on, odd/even */ @@ -830,7 +830,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old) } /* Handle number of data bits [5-8] */ - if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE)) + if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE)) changes |= RFCOMM_RPN_PM_DATA; switch (new->c_cflag & CSIZE) { @@ -868,7 +868,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old) case 9600: baud = RFCOMM_RPN_BR_9600; break; - case 19200: + case 19200: baud = RFCOMM_RPN_BR_19200; break; case 38400: @@ -887,7 +887,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old) /* 9600 is standard accordinag to the RFCOMM specification */ baud = RFCOMM_RPN_BR_9600; break; - + } if (changes) @@ -978,11 +978,11 @@ static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len, static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp) { - struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; + struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); - return dev->modem_status; + return dev->modem_status; } static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear) diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 5d13d4f..ae43914 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -1,4 +1,4 @@ -/* +/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated @@ -12,13 +12,13 @@ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ @@ -149,7 +149,7 @@ static int sco_conn_del(struct hci_conn *hcon, int err) struct sco_conn *conn; struct sock *sk; - if (!(conn = hcon->sco_data)) + if (!(conn = hcon->sco_data)) return 0; BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); @@ -404,7 +404,7 @@ static void sco_sock_init(struct sock *sk, struct sock *parent) { BT_DBG("sk %p", sk); - if (parent) + if (parent) sk->sk_type = parent->sk_type; } @@ -522,7 +522,7 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen if ((err = sco_connect(sk))) goto done; - err = bt_sock_wait_state(sk, BT_CONNECTED, + err = bt_sock_wait_state(sk, BT_CONNECTED, sock_sndtimeo(sk, flags & O_NONBLOCK)); done: @@ -627,7 +627,7 @@ static int sco_sock_getname(struct socket *sock, struct sockaddr *addr, int *len return 0; } -static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, +static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; @@ -677,7 +677,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char struct sock *sk = sock->sk; struct sco_options opts; struct sco_conninfo cinfo; - int len, err = 0; + int len, err = 0; BT_DBG("sk %p", sk); @@ -761,7 +761,7 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, struct sock * bt_accept_enqueue(parent, sk); } -/* Delete channel. +/* Delete channel. * Must be called on the locked socket. */ static void sco_chan_del(struct sock *sk, int err) { @@ -771,7 +771,7 @@ static void sco_chan_del(struct sock *sk, int err) BT_DBG("sk %p, conn %p, err %d", sk, conn, err); - if (conn) { + if (conn) { sco_conn_lock(conn); conn->sk = NULL; sco_pi(sk)->conn = NULL; @@ -855,7 +855,7 @@ static int sco_connect_cfm(struct hci_conn *hcon, __u8 status) conn = sco_conn_add(hcon, status); if (conn) sco_conn_ready(conn); - } else + } else sco_conn_del(hcon, bt_err(status)); return 0; @@ -887,7 +887,7 @@ static int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb) } drop: - kfree_skb(skb); + kfree_skb(skb); return 0; } diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index f8dbcee..905a39c 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -40,7 +40,7 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev) skb->mac.raw = skb->data; skb_pull(skb, ETH_HLEN); - if (dest[0] & 1) + if (dest[0] & 1) br_flood_deliver(br, skb, 0); else if ((dst = __br_fdb_get(br, dest)) != NULL) br_deliver(dst->dst, skb); @@ -178,12 +178,12 @@ void br_dev_setup(struct net_device *dev) dev->change_mtu = br_change_mtu; dev->destructor = free_netdev; SET_MODULE_OWNER(dev); - SET_ETHTOOL_OPS(dev, &br_ethtool_ops); + SET_ETHTOOL_OPS(dev, &br_ethtool_ops); dev->stop = br_dev_stop; dev->tx_queue_len = 0; dev->set_mac_address = br_set_mac_address; dev->priv_flags = IFF_EBRIDGE; - dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | - NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST; + dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | + NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST; } diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 8ca448d..def2e40 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -52,7 +52,7 @@ static __inline__ unsigned long hold_time(const struct net_bridge *br) static __inline__ int has_expired(const struct net_bridge *br, const struct net_bridge_fdb_entry *fdb) { - return !fdb->is_static + return !fdb->is_static && time_before_eq(fdb->ageing_timer + hold_time(br), jiffies); } @@ -71,7 +71,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr) { struct net_bridge *br = p->br; int i; - + spin_lock_bh(&br->hash_lock); /* Search all chains since old address/hash is unknown */ @@ -85,7 +85,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr) /* maybe another port has same hw addr? */ struct net_bridge_port *op; list_for_each_entry(op, &br->port_list, list) { - if (op != p && + if (op != p && !compare_ether_addr(op->dev->dev_addr, f->addr.addr)) { f->dst = op; @@ -118,8 +118,8 @@ void br_fdb_cleanup(unsigned long _data) struct hlist_node *h, *n; hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { - if (!f->is_static && - time_before_eq(f->ageing_timer + delay, jiffies)) + if (!f->is_static && + time_before_eq(f->ageing_timer + delay, jiffies)) fdb_delete(f); } } @@ -138,11 +138,11 @@ void br_fdb_delete_by_port(struct net_bridge *br, spin_lock_bh(&br->hash_lock); for (i = 0; i < BR_HASH_SIZE; i++) { struct hlist_node *h, *g; - + hlist_for_each_safe(h, g, &br->hash[i]) { struct net_bridge_fdb_entry *f = hlist_entry(h, struct net_bridge_fdb_entry, hlist); - if (f->dst != p) + if (f->dst != p) continue; if (f->is_static && !do_all) @@ -155,7 +155,7 @@ void br_fdb_delete_by_port(struct net_bridge *br, if (f->is_local) { struct net_bridge_port *op; list_for_each_entry(op, &br->port_list, list) { - if (op != p && + if (op != p && !compare_ether_addr(op->dev->dev_addr, f->addr.addr)) { f->dst = op; @@ -190,14 +190,14 @@ struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br, } /* Interface used by ATM hook that keeps a ref count */ -struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, +struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, unsigned char *addr) { struct net_bridge_fdb_entry *fdb; rcu_read_lock(); fdb = __br_fdb_get(br, addr); - if (fdb) + if (fdb) atomic_inc(&fdb->use_count); rcu_read_unlock(); return fdb; @@ -218,7 +218,7 @@ void br_fdb_put(struct net_bridge_fdb_entry *ent) } /* - * Fill buffer with forwarding table records in + * Fill buffer with forwarding table records in * the API format. */ int br_fdb_fillbuf(struct net_bridge *br, void *buf, @@ -237,7 +237,7 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf, if (num >= maxnum) goto out; - if (has_expired(br, f)) + if (has_expired(br, f)) continue; if (skip) { @@ -277,7 +277,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head, static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head, struct net_bridge_port *source, - const unsigned char *addr, + const unsigned char *addr, int is_local) { struct net_bridge_fdb_entry *fdb; @@ -307,17 +307,17 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source, fdb = fdb_find(head, addr); if (fdb) { - /* it is okay to have multiple ports with same + /* it is okay to have multiple ports with same * address, just use the first one. */ - if (fdb->is_local) + if (fdb->is_local) return 0; printk(KERN_WARNING "%s adding interface with same address " "as a received packet\n", source->dev->name); fdb_delete(fdb); - } + } if (!fdb_create(head, source, addr, 1)) return -ENOMEM; @@ -350,7 +350,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, if (likely(fdb)) { /* attempt to update an entry for a local interface */ if (unlikely(fdb->is_local)) { - if (net_ratelimit()) + if (net_ratelimit()) printk(KERN_WARNING "%s: received packet with " " own address as source address\n", source->dev->name); diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 191b861..3e45c1a 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -21,7 +21,7 @@ #include "br_private.h" /* Don't forward packets to originating port or forwarding diasabled */ -static inline int should_deliver(const struct net_bridge_port *p, +static inline int should_deliver(const struct net_bridge_port *p, const struct sk_buff *skb) { return (skb->dev != p->dev && p->state == BR_STATE_FORWARDING); @@ -101,7 +101,7 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb) /* called under bridge lock */ static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone, - void (*__packet_hook)(const struct net_bridge_port *p, + void (*__packet_hook)(const struct net_bridge_port *p, struct sk_buff *skb)) { struct net_bridge_port *p; diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 2b7c2c7..f35c1a3 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -47,7 +47,7 @@ static int port_cost(struct net_device *dev) set_fs(KERNEL_DS); err = dev_ethtool(&ifr); set_fs(old_fs); - + if (!err) { switch(ecmd.speed) { case SPEED_100: @@ -191,7 +191,7 @@ static void del_br(struct net_bridge *br) del_timer_sync(&br->gc_timer); br_sysfs_delbr(br->dev); - unregister_netdevice(br->dev); + unregister_netdevice(br->dev); } static struct net_device *new_bridge_dev(const char *name) @@ -201,7 +201,7 @@ static struct net_device *new_bridge_dev(const char *name) dev = alloc_netdev(sizeof(struct net_bridge), name, br_dev_setup); - + if (!dev) return NULL; @@ -258,12 +258,12 @@ static int find_portno(struct net_bridge *br) } /* called with RTNL but without bridge lock */ -static struct net_bridge_port *new_nbp(struct net_bridge *br, +static struct net_bridge_port *new_nbp(struct net_bridge *br, struct net_device *dev) { int index; struct net_bridge_port *p; - + index = find_portno(br); if (index < 0) return ERR_PTR(index); @@ -276,7 +276,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br, dev_hold(dev); p->dev = dev; p->path_cost = port_cost(dev); - p->priority = 0x8000 >> BR_PORT_BITS; + p->priority = 0x8000 >> BR_PORT_BITS; p->port_no = index; br_init_port(p); p->state = BR_STATE_DISABLED; @@ -298,7 +298,7 @@ int br_add_bridge(const char *name) int ret; dev = new_bridge_dev(name); - if (!dev) + if (!dev) return -ENOMEM; rtnl_lock(); @@ -329,7 +329,7 @@ int br_del_bridge(const char *name) rtnl_lock(); dev = __dev_get_by_name(name); - if (dev == NULL) + if (dev == NULL) ret = -ENXIO; /* Could not find device */ else if (!(dev->priv_flags & IFF_EBRIDGE)) { @@ -340,9 +340,9 @@ int br_del_bridge(const char *name) else if (dev->flags & IFF_UP) { /* Not shutdown yet. */ ret = -EBUSY; - } + } - else + else del_br(netdev_priv(dev)); rtnl_unlock(); @@ -428,7 +428,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) if (err) goto err0; - err = br_fdb_insert(br, p, dev->dev_addr); + err = br_fdb_insert(br, p, dev->dev_addr); if (err) goto err1; @@ -464,8 +464,8 @@ err0: int br_del_if(struct net_bridge *br, struct net_device *dev) { struct net_bridge_port *p = dev->br_port; - - if (!p || p->br != br) + + if (!p || p->br != br) return -EINVAL; del_nbp(p); diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index bfa4d8c..35b94f9 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -119,7 +119,7 @@ static inline int is_link_local(const unsigned char *dest) * Called via br_handle_frame_hook. * Return 0 if *pskb should be processed furthur * 1 if *pskb is handled - * note: already called with rcu_read_lock (preempt_disabled) + * note: already called with rcu_read_lock (preempt_disabled) */ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) { @@ -137,7 +137,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) { if (br_should_route_hook) { - if (br_should_route_hook(pskb)) + if (br_should_route_hook(pskb)) return 0; skb = *pskb; dest = eth_hdr(skb)->h_dest; diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c index 4c61a7e..3ab153d 100644 --- a/net/bridge/br_ioctl.c +++ b/net/bridge/br_ioctl.c @@ -28,7 +28,7 @@ static int get_bridge_ifindices(int *indices, int num) int i = 0; for (dev = dev_base; dev && i < num; dev = dev->next) { - if (dev->priv_flags & IFF_EBRIDGE) + if (dev->priv_flags & IFF_EBRIDGE) indices[i++] = dev->ifindex; } @@ -53,7 +53,7 @@ static void get_port_ifindices(struct net_bridge *br, int *ifindices, int num) * (limited to a page for sanity) * offset -- number of records to skip */ -static int get_fdb_entries(struct net_bridge *br, void __user *userbuf, +static int get_fdb_entries(struct net_bridge *br, void __user *userbuf, unsigned long maxnum, unsigned long offset) { int num; @@ -69,7 +69,7 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf, buf = kmalloc(size, GFP_USER); if (!buf) return -ENOMEM; - + num = br_fdb_fillbuf(br, buf, maxnum, offset); if (num > 0) { if (copy_to_user(userbuf, buf, num*sizeof(struct __fdb_entry))) @@ -91,7 +91,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd) dev = dev_get_by_index(ifindex); if (dev == NULL) return -EINVAL; - + if (isadd) ret = br_add_if(br, dev); else @@ -110,7 +110,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct net_bridge *br = netdev_priv(dev); unsigned long args[4]; - + if (copy_from_user(args, rq->ifr_data, sizeof(args))) return -EFAULT; @@ -143,7 +143,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) b.tcn_timer_value = br_timer_value(&br->tcn_timer); b.topology_change_timer_value = br_timer_value(&br->topology_change_timer); b.gc_timer_value = br_timer_value(&br->gc_timer); - rcu_read_unlock(); + rcu_read_unlock(); if (copy_to_user((void __user *)args[1], &b, sizeof(b))) return -EFAULT; @@ -275,7 +275,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return -ERANGE; spin_lock_bh(&br->lock); - if ((p = br_get_port(br, args[1])) == NULL) + if ((p = br_get_port(br, args[1])) == NULL) ret = -EINVAL; else br_stp_set_port_priority(p, args[2]); @@ -301,7 +301,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } case BRCTL_GET_FDB_ENTRIES: - return get_fdb_entries(br, (void __user *)args[1], + return get_fdb_entries(br, (void __user *)args[1], args[2], args[3]); } @@ -368,7 +368,7 @@ int br_ioctl_deviceless_stub(unsigned int cmd, void __user *uarg) case SIOCGIFBR: case SIOCSIFBR: return old_deviceless(uarg); - + case SIOCBRADDBR: case SIOCBRDELBR: { diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index a25fa8c..a0744e6 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c @@ -68,7 +68,7 @@ static __be16 inline vlan_proto(const struct sk_buff *skb) #define IS_VLAN_IP(skb) \ (skb->protocol == htons(ETH_P_8021Q) && \ - vlan_proto(skb) == htons(ETH_P_IP) && \ + vlan_proto(skb) == htons(ETH_P_IP) && \ brnf_filter_vlan_tagged) #define IS_VLAN_IPV6(skb) \ @@ -124,7 +124,7 @@ static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb) static inline void nf_bridge_save_header(struct sk_buff *skb) { - int header_size = ETH_HLEN; + int header_size = ETH_HLEN; if (skb->protocol == htons(ETH_P_8021Q)) header_size += VLAN_HLEN; @@ -139,7 +139,7 @@ static inline void nf_bridge_save_header(struct sk_buff *skb) int nf_bridge_copy_header(struct sk_buff *skb) { int err; - int header_size = ETH_HLEN; + int header_size = ETH_HLEN; if (skb->protocol == htons(ETH_P_8021Q)) header_size += VLAN_HLEN; @@ -836,10 +836,10 @@ static unsigned int ip_sabotage_in(unsigned int hook, struct sk_buff **pskb, * For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because * ip_refrag() can return NF_STOLEN. */ static struct nf_hook_ops br_nf_ops[] = { - { .hook = br_nf_pre_routing, - .owner = THIS_MODULE, - .pf = PF_BRIDGE, - .hooknum = NF_BR_PRE_ROUTING, + { .hook = br_nf_pre_routing, + .owner = THIS_MODULE, + .pf = PF_BRIDGE, + .hooknum = NF_BR_PRE_ROUTING, .priority = NF_BR_PRI_BRNF, }, { .hook = br_nf_local_in, .owner = THIS_MODULE, diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c index 2027849..8cd3e422 100644 --- a/net/bridge/br_notify.c +++ b/net/bridge/br_notify.c @@ -26,7 +26,7 @@ struct notifier_block br_device_notifier = { /* * Handle changes in state of network devices enslaved to a bridge. - * + * * Note: don't care about up/down if bridge itself is down, because * port state is checked when bridge is brought up. */ @@ -60,11 +60,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v break; case NETDEV_FEAT_CHANGE: - if (br->dev->flags & IFF_UP) + if (br->dev->flags & IFF_UP) br_features_recompute(br); /* could do recursive feature change notification - * but who would care?? + * but who would care?? */ break; @@ -74,7 +74,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v break; case NETDEV_UP: - if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) + if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) br_stp_enable_port(p); break; @@ -82,7 +82,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v spin_unlock_bh(&br->lock); br_del_if(br, dev); goto done; - } + } spin_unlock_bh(&br->lock); done: diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 3a534e9..6a0540e0 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -149,7 +149,7 @@ extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br, extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, unsigned char *addr); extern void br_fdb_put(struct net_bridge_fdb_entry *ent); -extern int br_fdb_fillbuf(struct net_bridge *br, void *buf, +extern int br_fdb_fillbuf(struct net_bridge *br, void *buf, unsigned long count, unsigned long off); extern int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source, @@ -203,7 +203,7 @@ extern void br_netfilter_fini(void); /* br_stp.c */ extern void br_log_state(const struct net_bridge_port *p); extern struct net_bridge_port *br_get_port(struct net_bridge *br, - u16 port_no); + u16 port_no); extern void br_init_port(struct net_bridge_port *p); extern void br_become_designated_port(struct net_bridge_port *p); diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index 04ca0639..f9ff4d5 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c @@ -24,17 +24,17 @@ #define MESSAGE_AGE_INCR ((HZ < 256) ? 1 : (HZ/256)) static const char *br_port_state_names[] = { - [BR_STATE_DISABLED] = "disabled", + [BR_STATE_DISABLED] = "disabled", [BR_STATE_LISTENING] = "listening", - [BR_STATE_LEARNING] = "learning", - [BR_STATE_FORWARDING] = "forwarding", + [BR_STATE_LEARNING] = "learning", + [BR_STATE_FORWARDING] = "forwarding", [BR_STATE_BLOCKING] = "blocking", }; void br_log_state(const struct net_bridge_port *p) { pr_info("%s: port %d(%s) entering %s state\n", - p->br->dev->name, p->port_no, p->dev->name, + p->br->dev->name, p->port_no, p->dev->name, br_port_state_names[p->state]); } @@ -53,7 +53,7 @@ struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no) } /* called under bridge lock */ -static int br_should_become_root_port(const struct net_bridge_port *p, +static int br_should_become_root_port(const struct net_bridge_port *p, u16 root_port) { struct net_bridge *br; @@ -184,7 +184,7 @@ void br_transmit_config(struct net_bridge_port *p) } /* called under bridge lock */ -static inline void br_record_config_information(struct net_bridge_port *p, +static inline void br_record_config_information(struct net_bridge_port *p, const struct br_config_bpdu *bpdu) { p->designated_root = bpdu->root; @@ -192,12 +192,12 @@ static inline void br_record_config_information(struct net_bridge_port *p, p->designated_bridge = bpdu->bridge_id; p->designated_port = bpdu->port_id; - mod_timer(&p->message_age_timer, jiffies + mod_timer(&p->message_age_timer, jiffies + (p->br->max_age - bpdu->message_age)); } /* called under bridge lock */ -static inline void br_record_config_timeout_values(struct net_bridge *br, +static inline void br_record_config_timeout_values(struct net_bridge *br, const struct br_config_bpdu *bpdu) { br->max_age = bpdu->max_age; @@ -415,7 +415,7 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b { struct net_bridge *br; int was_root; - + br = p->br; was_root = br_is_root_bridge(br); @@ -430,7 +430,7 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b del_timer(&br->topology_change_timer); br_transmit_tcn(br); - mod_timer(&br->tcn_timer, + mod_timer(&br->tcn_timer, jiffies + br->bridge_hello_time); } } @@ -441,8 +441,8 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b if (bpdu->topology_change_ack) br_topology_change_acknowledged(br); } - } else if (br_is_designated_port(p)) { - br_reply(p); + } else if (br_is_designated_port(p)) { + br_reply(p); } } diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 068d8af..b9fb0dc 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c @@ -29,7 +29,7 @@ #define LLC_RESERVE sizeof(struct llc_pdu_un) static void br_send_bpdu(struct net_bridge_port *p, - const unsigned char *data, int length) + const unsigned char *data, int length) { struct sk_buff *skb; diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index d294224..58d13f2 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c @@ -28,7 +28,7 @@ */ static inline port_id br_make_port_id(__u8 priority, __u16 port_no) { - return ((u16)priority << BR_PORT_BITS) + return ((u16)priority << BR_PORT_BITS) | (port_no & ((1<<BR_PORT_BITS)-1)); } @@ -50,7 +50,7 @@ void br_stp_enable_bridge(struct net_bridge *br) spin_lock_bh(&br->lock); mod_timer(&br->hello_timer, jiffies + br->hello_time); mod_timer(&br->gc_timer, jiffies + HZ/10); - + br_config_bpdu_generation(br); list_for_each_entry(p, &br->port_list, list) { diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c index d0fcde8..030aa79 100644 --- a/net/bridge/br_stp_timer.c +++ b/net/bridge/br_stp_timer.c @@ -27,7 +27,7 @@ static int br_is_designated_for_some_port(const struct net_bridge *br) list_for_each_entry(p, &br->port_list, list) { if (p->state != BR_STATE_DISABLED && - !memcmp(&p->designated_bridge, &br->bridge_id, 8)) + !memcmp(&p->designated_bridge, &br->bridge_id, 8)) return 1; } @@ -37,7 +37,7 @@ static int br_is_designated_for_some_port(const struct net_bridge *br) static void br_hello_timer_expired(unsigned long arg) { struct net_bridge *br = (struct net_bridge *)arg; - + pr_debug("%s: hello timer expired\n", br->dev->name); spin_lock(&br->lock); if (br->dev->flags & IFF_UP) { @@ -58,11 +58,11 @@ static void br_message_age_timer_expired(unsigned long arg) if (p->state == BR_STATE_DISABLED) return; - + pr_info("%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)\n", - br->dev->name, - id->prio[0], id->prio[1], - id->addr[0], id->addr[1], id->addr[2], + br->dev->name, + id->prio[0], id->prio[1], + id->addr[0], id->addr[1], id->addr[2], id->addr[3], id->addr[4], id->addr[5], p->port_no, p->dev->name); @@ -114,7 +114,7 @@ static void br_tcn_timer_expired(unsigned long arg) spin_lock(&br->lock); if (br->dev->flags & IFF_UP) { br_transmit_tcn(br); - + mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time); } spin_unlock(&br->lock); @@ -135,7 +135,7 @@ static void br_hold_timer_expired(unsigned long arg) { struct net_bridge_port *p = (struct net_bridge_port *) arg; - pr_debug("%s: %d(%s) hold timer expired\n", + pr_debug("%s: %d(%s) hold timer expired\n", p->br->dev->name, p->port_no, p->dev->name); spin_lock(&p->br->lock); @@ -166,10 +166,10 @@ void br_stp_port_timer_init(struct net_bridge_port *p) setup_timer(&p->forward_delay_timer, br_forward_delay_timer_expired, (unsigned long) p); - + setup_timer(&p->hold_timer, br_hold_timer_expired, (unsigned long) p); -} +} /* Report ticks left (in USER_HZ) used for API */ unsigned long br_timer_value(const struct timer_list *timer) diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index ce10464..01a22ad 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c @@ -353,19 +353,19 @@ static ssize_t brforward_read(struct kobject *kobj, char *buf, if (off % sizeof(struct __fdb_entry) != 0) return -EINVAL; - n = br_fdb_fillbuf(br, buf, + n = br_fdb_fillbuf(br, buf, count / sizeof(struct __fdb_entry), off / sizeof(struct __fdb_entry)); if (n > 0) n *= sizeof(struct __fdb_entry); - + return n; } static struct bin_attribute bridge_forward = { .attr = { .name = SYSFS_BRIDGE_FDB, - .mode = S_IRUGO, + .mode = S_IRUGO, .owner = THIS_MODULE, }, .read = brforward_read, }; @@ -401,7 +401,7 @@ int br_sysfs_addbr(struct net_device *dev) goto out2; } - + kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR); br->ifobj.ktype = NULL; br->ifobj.kset = NULL; diff --git a/net/bridge/netfilter/ebt_802_3.c b/net/bridge/netfilter/ebt_802_3.c index 9abbc09..41a7807 100644 --- a/net/bridge/netfilter/ebt_802_3.c +++ b/net/bridge/netfilter/ebt_802_3.c @@ -5,7 +5,7 @@ * Chris Vitale csv@bluetail.com * * May 2003 - * + * */ #include <linux/netfilter_bridge/ebtables.h> @@ -20,7 +20,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device * __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type; if (info->bitmask & EBT_802_3_SAP) { - if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP)) + if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP)) return EBT_NOMATCH; if (FWINV(info->sap != hdr->llc.ui.dsap, EBT_802_3_SAP)) return EBT_NOMATCH; @@ -29,7 +29,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device * if (info->bitmask & EBT_802_3_TYPE) { if (!(hdr->llc.ui.dsap == CHECK_TYPE && hdr->llc.ui.ssap == CHECK_TYPE)) return EBT_NOMATCH; - if (FWINV(info->type != type, EBT_802_3_TYPE)) + if (FWINV(info->type != type, EBT_802_3_TYPE)) return EBT_NOMATCH; } diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c index ce97c42..392d877 100644 --- a/net/bridge/netfilter/ebt_among.c +++ b/net/bridge/netfilter/ebt_among.c @@ -18,7 +18,7 @@ static int ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh, const char *mac, __be32 ip) { /* You may be puzzled as to how this code works. - * Some tricks were used, refer to + * Some tricks were used, refer to * include/linux/netfilter_bridge/ebt_among.h * as there you can find a solution of this mystery. */ @@ -207,8 +207,8 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask, } static struct ebt_match filter_among = { - .name = EBT_AMONG_MATCH, - .match = ebt_filter_among, + .name = EBT_AMONG_MATCH, + .match = ebt_filter_among, .check = ebt_among_check, .me = THIS_MODULE, }; diff --git a/net/bridge/netfilter/ebt_arpreply.c b/net/bridge/netfilter/ebt_arpreply.c index 0aa7b99..ffe468a 100644 --- a/net/bridge/netfilter/ebt_arpreply.c +++ b/net/bridge/netfilter/ebt_arpreply.c @@ -51,7 +51,7 @@ static int ebt_target_reply(struct sk_buff **pskb, unsigned int hooknr, return EBT_DROP; arp_send(ARPOP_REPLY, ETH_P_ARP, *siptr, (struct net_device *)in, - *diptr, shp, info->mac, shp); + *diptr, shp, info->mac, shp); return info->target; } diff --git a/net/bridge/netfilter/ebt_ip.c b/net/bridge/netfilter/ebt_ip.c index 6afa4d0..69f7f0a 100644 --- a/net/bridge/netfilter/ebt_ip.c +++ b/net/bridge/netfilter/ebt_ip.c @@ -61,15 +61,15 @@ static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in, if (info->bitmask & EBT_IP_DPORT) { u32 dst = ntohs(pptr->dst); if (FWINV(dst < info->dport[0] || - dst > info->dport[1], - EBT_IP_DPORT)) + dst > info->dport[1], + EBT_IP_DPORT)) return EBT_NOMATCH; } if (info->bitmask & EBT_IP_SPORT) { u32 src = ntohs(pptr->src); if (FWINV(src < info->sport[0] || - src > info->sport[1], - EBT_IP_SPORT)) + src > info->sport[1], + EBT_IP_SPORT)) return EBT_NOMATCH; } } diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index 985df82..f9a5ae9 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c @@ -169,10 +169,10 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr, if (info->bitmask & EBT_LOG_NFLOG) nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, - "%s", info->prefix); + "%s", info->prefix); else ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, - info->prefix); + info->prefix); } static struct ebt_watcher log = @@ -199,7 +199,7 @@ static int __init ebt_log_init(void) if (nf_log_register(PF_BRIDGE, &ebt_log_logger) < 0) { printk(KERN_WARNING "ebt_log: not logging via system console " "since somebody else already registered for PF_INET\n"); - /* we cannot make module load fail here, since otherwise + /* we cannot make module load fail here, since otherwise * ebtables userspace would abort */ } diff --git a/net/bridge/netfilter/ebt_mark_m.c b/net/bridge/netfilter/ebt_mark_m.c index 025869e..6b0d216 100644 --- a/net/bridge/netfilter/ebt_mark_m.c +++ b/net/bridge/netfilter/ebt_mark_m.c @@ -26,7 +26,7 @@ static int ebt_filter_mark(const struct sk_buff *skb, static int ebt_mark_check(const char *tablename, unsigned int hookmask, const struct ebt_entry *e, void *data, unsigned int datalen) { - struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; + struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info))) return -EINVAL; diff --git a/net/bridge/netfilter/ebt_stp.c b/net/bridge/netfilter/ebt_stp.c index a0bed82..31b7736 100644 --- a/net/bridge/netfilter/ebt_stp.c +++ b/net/bridge/netfilter/ebt_stp.c @@ -62,7 +62,7 @@ static int ebt_filter_config(struct ebt_stp_info *info, verdict = 0; for (i = 0; i < 6; i++) verdict |= (stpc->root[2+i] ^ c->root_addr[i]) & - c->root_addrmsk[i]; + c->root_addrmsk[i]; if (FWINV(verdict != 0, EBT_STP_ROOTADDR)) return EBT_NOMATCH; } @@ -82,7 +82,7 @@ static int ebt_filter_config(struct ebt_stp_info *info, verdict = 0; for (i = 0; i < 6; i++) verdict |= (stpc->sender[2+i] ^ c->sender_addr[i]) & - c->sender_addrmsk[i]; + c->sender_addrmsk[i]; if (FWINV(verdict != 0, EBT_STP_SENDERADDR)) return EBT_NOMATCH; } diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index c1af68b..2e4cb24 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c @@ -10,8 +10,8 @@ * Based on ipt_ULOG.c, which is * (C) 2000-2002 by Harald Welte <laforge@netfilter.org> * - * This module accepts two parameters: - * + * This module accepts two parameters: + * * nlbufsiz: * The parameter specifies how big the buffer for each netlink multicast * group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will @@ -43,17 +43,17 @@ #include "../br_private.h" #define PRINTR(format, args...) do { if (net_ratelimit()) \ - printk(format , ## args); } while (0) + printk(format , ## args); } while (0) static unsigned int nlbufsiz = NLMSG_GOODSIZE; module_param(nlbufsiz, uint, 0600); MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) " - "(defaults to 4096)"); + "(defaults to 4096)"); static unsigned int flushtimeout = 10; module_param(flushtimeout, uint, 0600); MODULE_PARM_DESC(flushtimeout, "buffer flush timeout (hundredths ofa second) " - "(defaults to 10)"); + "(defaults to 10)"); typedef struct { unsigned int qlen; /* number of nlmsgs' in the skb */ @@ -157,7 +157,7 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb, } nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, 0, - size - NLMSG_ALIGN(sizeof(*nlh))); + size - NLMSG_ALIGN(sizeof(*nlh))); ub->qlen++; pm = NLMSG_DATA(nlh); @@ -302,7 +302,7 @@ static int __init ebt_ulog_init(void) } ebtulognl = netlink_kernel_create(NETLINK_NFLOG, EBT_ULOG_MAXNLGROUPS, - NULL, THIS_MODULE); + NULL, THIS_MODULE); if (!ebtulognl) ret = -ENOMEM; else if ((ret = ebt_register_watcher(&ulog))) @@ -344,4 +344,4 @@ module_exit(ebt_ulog_fini); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet" - " frames"); + " frames"); diff --git a/net/bridge/netfilter/ebt_vlan.c b/net/bridge/netfilter/ebt_vlan.c index 7ee3776..a43c697 100644 --- a/net/bridge/netfilter/ebt_vlan.c +++ b/net/bridge/netfilter/ebt_vlan.c @@ -128,9 +128,9 @@ ebt_check_vlan(const char *tablename, /* Reserved VLAN ID (VID) values * ----------------------------- - * 0 - The null VLAN ID. + * 0 - The null VLAN ID. * 1 - The default Port VID (PVID) - * 0x0FFF - Reserved for implementation use. + * 0x0FFF - Reserved for implementation use. * if_vlan.h: VLAN_GROUP_ARRAY_LEN 4096. */ if (GET_BITMASK(EBT_VLAN_ID)) { if (!!info->id) { /* if id!=0 => check vid range */ @@ -141,7 +141,7 @@ ebt_check_vlan(const char *tablename, return -EINVAL; } /* Note: This is valid VLAN-tagged frame point. - * Any value of user_priority are acceptable, + * Any value of user_priority are acceptable, * but should be ignored according to 802.1Q Std. * So we just drop the prio flag. */ info->bitmask &= ~EBT_VLAN_PRIO; diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c index 127135e..81d8414 100644 --- a/net/bridge/netfilter/ebtable_filter.c +++ b/net/bridge/netfilter/ebtable_filter.c @@ -51,10 +51,10 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks) } static struct ebt_table frame_filter = -{ +{ .name = "filter", .table = &initial_table, - .valid_hooks = FILTER_VALID_HOOKS, + .valid_hooks = FILTER_VALID_HOOKS, .lock = RW_LOCK_UNLOCKED, .check = check, .me = THIS_MODULE, diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 6c84ccb..5818d70 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -33,10 +33,10 @@ #include "../br_private.h" #define BUGPRINT(format, args...) printk("kernel msg: ebtables bug: please "\ - "report to author: "format, ## args) + "report to author: "format, ## args) /* #define BUGPRINT(format, args...) */ #define MEMPRINT(format, args...) printk("kernel msg: ebtables "\ - ": out of memory: "format, ## args) + ": out of memory: "format, ## args) /* #define MEMPRINT(format, args...) */ @@ -482,7 +482,7 @@ ebt_check_entry_size_and_hooks(struct ebt_entry *e, as it said it has */ if (*n != *cnt) { BUGPRINT("nentries does not equal the nr of entries " - "in the chain\n"); + "in the chain\n"); return -EINVAL; } if (((struct ebt_entries *)e)->policy != EBT_DROP && @@ -809,7 +809,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo) i = 0; /* holds the expected nr. of entries for the chain */ j = 0; /* holds the up to now counted entries for the chain */ k = 0; /* holds the total nr. of entries, should equal - newinfo->nentries afterwards */ + newinfo->nentries afterwards */ udc_cnt = 0; /* will hold the nr. of user defined chains (udc) */ ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ebt_check_entry_size_and_hooks, newinfo, @@ -820,7 +820,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo) if (i != j) { BUGPRINT("nentries does not equal the nr of entries in the " - "(last) chain\n"); + "(last) chain\n"); return -EINVAL; } if (k != newinfo->nentries) { @@ -835,7 +835,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo) if an error occurs */ newinfo->chainstack = vmalloc((highest_possible_processor_id()+1) - * sizeof(*(newinfo->chainstack))); + * sizeof(*(newinfo->chainstack))); if (!newinfo->chainstack) return -ENOMEM; for_each_possible_cpu(i) { @@ -948,7 +948,7 @@ static int do_replace(void __user *user, unsigned int len) if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) return -ENOMEM; - countersize = COUNTER_OFFSET(tmp.nentries) * + countersize = COUNTER_OFFSET(tmp.nentries) * (highest_possible_processor_id()+1); newinfo = vmalloc(sizeof(*newinfo) + countersize); if (!newinfo) @@ -1350,7 +1350,7 @@ static inline int ebt_make_names(struct ebt_entry *e, char *base, char __user *u hlp = ubase + (((char *)e + e->target_offset) - base); t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); - + ret = EBT_MATCH_ITERATE(e, ebt_make_matchname, base, ubase); if (ret != 0) return ret; diff --git a/net/compat.c b/net/compat.c index 52d32f1..9c97074 100644 --- a/net/compat.c +++ b/net/compat.c @@ -1,4 +1,4 @@ -/* +/* * 32bit Socket syscall emulation. Based on arch/sparc64/kernel/sys_sparc32.c. * * Copyright (C) 2000 VA Linux Co @@ -8,7 +8,7 @@ * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 2000 Hewlett-Packard Co. * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com> - * Copyright (C) 2000,2001 Andi Kleen, SuSE Labs + * Copyright (C) 2000,2001 Andi Kleen, SuSE Labs */ #include <linux/kernel.h> @@ -225,14 +225,14 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat return 0; /* XXX: return error? check spec. */ } - if (level == SOL_SOCKET && type == SO_TIMESTAMP) { + if (level == SOL_SOCKET && type == SO_TIMESTAMP) { struct timeval *tv = (struct timeval *)data; ctv.tv_sec = tv->tv_sec; ctv.tv_usec = tv->tv_usec; data = &ctv; len = sizeof(struct compat_timeval); - } - + } + cmlen = CMSG_COMPAT_LEN(len); if(kmsg->msg_controllen < cmlen) { kmsg->msg_flags |= MSG_CTRUNC; @@ -419,7 +419,7 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname, char __user *optval, int optlen) { struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval; - struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); + struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); compat_uptr_t ptr; u16 len; @@ -610,14 +610,14 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args) int ret; u32 a[6]; u32 a0, a1; - + if (call < SYS_SOCKET || call > SYS_RECVMSG) return -EINVAL; if (copy_from_user(a, args, nas[call])) return -EFAULT; a0 = a[0]; a1 = a[1]; - + switch(call) { case SYS_SOCKET: ret = sys_socket(a0, a1, a[2]); diff --git a/net/core/datagram.c b/net/core/datagram.c index 797fdd4..186212b 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -430,7 +430,7 @@ EXPORT_SYMBOL(__skb_checksum_complete); * @skb: skbuff * @hlen: hardware length * @iov: io vector - * + * * Caller _must_ check that skb will fit to this iovec. * * Returns: 0 - success. diff --git a/net/core/dev.c b/net/core/dev.c index 1e94a1b..85d58d7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -255,7 +255,7 @@ static int netdev_nit; * is linked into kernel lists and may not be freed until it has been * removed from the kernel lists. * - * This call does not sleep therefore it can not + * This call does not sleep therefore it can not * guarantee all CPU's that are in middle of receiving packets * will see the new packet type (until the next received packet). */ @@ -282,7 +282,7 @@ void dev_add_pack(struct packet_type *pt) * Remove a protocol handler that was previously added to the kernel * protocol handlers by dev_add_pack(). The passed &packet_type is removed * from the kernel lists and can be freed or reused once this function - * returns. + * returns. * * The packet type might still be in use by receivers * and must not be freed until after all the CPU's have gone @@ -327,7 +327,7 @@ out: void dev_remove_pack(struct packet_type *pt) { __dev_remove_pack(pt); - + synchronize_net(); } @@ -607,7 +607,7 @@ EXPORT_SYMBOL(dev_getfirstbyhwtype); * @mask: bitmask of bits in if_flags to check * * Search for any interface with the given flags. Returns NULL if a device - * is not found or a pointer to the device. The device returned has + * is not found or a pointer to the device. The device returned has * had a reference added and the pointer is safe until the user calls * dev_put to indicate they have finished with it. */ @@ -802,7 +802,7 @@ void netdev_state_change(struct net_device *dev) void dev_load(const char *name) { - struct net_device *dev; + struct net_device *dev; read_lock(&dev_base_lock); dev = __dev_get_by_name(name); @@ -860,7 +860,7 @@ int dev_open(struct net_device *dev) clear_bit(__LINK_STATE_START, &dev->state); } - /* + /* * If it went open OK then: */ @@ -964,7 +964,7 @@ int dev_close(struct net_device *dev) * is returned on a failure. * * When registered all registration and up events are replayed - * to the new notifier to allow device to have a race free + * to the new notifier to allow device to have a race free * view of the network device list. */ @@ -979,7 +979,7 @@ int register_netdevice_notifier(struct notifier_block *nb) for (dev = dev_base; dev; dev = dev->next) { nb->notifier_call(nb, NETDEV_REGISTER, dev); - if (dev->flags & IFF_UP) + if (dev->flags & IFF_UP) nb->notifier_call(nb, NETDEV_UP, dev); } } @@ -1157,7 +1157,7 @@ void netif_device_attach(struct net_device *dev) if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && netif_running(dev)) { netif_wake_queue(dev); - __netdev_watchdog_up(dev); + __netdev_watchdog_up(dev); } } EXPORT_SYMBOL(netif_device_attach); @@ -1197,7 +1197,7 @@ int skb_checksum_help(struct sk_buff *skb) out_set_summed: skb->ip_summed = CHECKSUM_NONE; -out: +out: return ret; } @@ -1258,7 +1258,7 @@ EXPORT_SYMBOL(skb_gso_segment); void netdev_rx_csum_fault(struct net_device *dev) { if (net_ratelimit()) { - printk(KERN_ERR "%s: hw csum failure.\n", + printk(KERN_ERR "%s: hw csum failure.\n", dev ? dev->name : "<unknown>"); dump_stack(); } @@ -1372,7 +1372,7 @@ gso: if (unlikely(netif_queue_stopped(dev) && skb->next)) return NETDEV_TX_BUSY; } while (skb->next); - + skb->destructor = DEV_GSO_CB(skb)->destructor; out_kfree_skb: @@ -1449,25 +1449,25 @@ int dev_queue_xmit(struct sk_buff *skb) (!(dev->features & NETIF_F_GEN_CSUM) && (!(dev->features & NETIF_F_IP_CSUM) || skb->protocol != htons(ETH_P_IP)))) - if (skb_checksum_help(skb)) - goto out_kfree_skb; + if (skb_checksum_help(skb)) + goto out_kfree_skb; gso: spin_lock_prefetch(&dev->queue_lock); - /* Disable soft irqs for various locks below. Also - * stops preemption for RCU. + /* Disable soft irqs for various locks below. Also + * stops preemption for RCU. */ - rcu_read_lock_bh(); + rcu_read_lock_bh(); - /* Updates of qdisc are serialized by queue_lock. - * The struct Qdisc which is pointed to by qdisc is now a - * rcu structure - it may be accessed without acquiring + /* Updates of qdisc are serialized by queue_lock. + * The struct Qdisc which is pointed to by qdisc is now a + * rcu structure - it may be accessed without acquiring * a lock (but the structure may be stale.) The freeing of the - * qdisc will be deferred until it's known that there are no + * qdisc will be deferred until it's known that there are no * more references to it. - * - * If the qdisc has an enqueue function, we still need to + * + * If the qdisc has an enqueue function, we still need to * hold the queue_lock before calling it, since queue_lock * also serializes access to the device queue. */ @@ -1715,8 +1715,8 @@ static __inline__ int handle_bridge(struct sk_buff **pskb, if (*pt_prev) { *ret = deliver_skb(*pskb, *pt_prev, orig_dev); *pt_prev = NULL; - } - + } + return br_handle_frame_hook(port, pskb); } #else @@ -1728,16 +1728,16 @@ static __inline__ int handle_bridge(struct sk_buff **pskb, * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions * a compare and 2 stores extra right now if we dont have it on * but have CONFIG_NET_CLS_ACT - * NOTE: This doesnt stop any functionality; if you dont have + * NOTE: This doesnt stop any functionality; if you dont have * the ingress scheduler, you just cant add policies on ingress. * */ -static int ing_filter(struct sk_buff *skb) +static int ing_filter(struct sk_buff *skb) { struct Qdisc *q; struct net_device *dev = skb->dev; int result = TC_ACT_OK; - + if (dev->qdisc_ingress) { __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); if (MAX_RED_LOOP < ttl++) { @@ -1801,7 +1801,7 @@ int netif_receive_skb(struct sk_buff *skb) list_for_each_entry_rcu(ptype, &ptype_all, list) { if (!ptype->dev || ptype->dev == skb->dev) { - if (pt_prev) + if (pt_prev) ret = deliver_skb(skb, pt_prev, orig_dev); pt_prev = ptype; } @@ -1833,7 +1833,7 @@ ncls: list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { if (ptype->type == type && (!ptype->dev || ptype->dev == skb->dev)) { - if (pt_prev) + if (pt_prev) ret = deliver_skb(skb, pt_prev, orig_dev); pt_prev = ptype; } @@ -2061,7 +2061,7 @@ static int dev_ifconf(char __user *arg) total += done; } } - } + } /* * All done. Write the updated control block back to the caller. @@ -2154,7 +2154,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos) struct netif_rx_stats *rc = NULL; while (*pos < NR_CPUS) - if (cpu_online(*pos)) { + if (cpu_online(*pos)) { rc = &per_cpu(netdev_rx_stat, *pos); break; } else @@ -2282,7 +2282,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master) } slave->master = master; - + synchronize_net(); if (old) @@ -2319,13 +2319,13 @@ void dev_set_promiscuity(struct net_device *dev, int inc) dev_mc_upload(dev); printk(KERN_INFO "device %s %s promiscuous mode\n", dev->name, (dev->flags & IFF_PROMISC) ? "entered" : - "left"); + "left"); audit_log(current->audit_context, GFP_ATOMIC, AUDIT_ANOM_PROMISCUOUS, "dev=%s prom=%d old_prom=%d auid=%u", dev->name, (dev->flags & IFF_PROMISC), (old_flags & IFF_PROMISC), - audit_get_loginuid(current->audit_context)); + audit_get_loginuid(current->audit_context)); } } @@ -2816,7 +2816,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg) rtnl_unlock(); if (IW_IS_GET(cmd) && copy_to_user(arg, &ifr, - sizeof(struct ifreq))) + sizeof(struct ifreq))) ret = -EFAULT; return ret; } @@ -2906,7 +2906,7 @@ int register_netdevice(struct net_device *dev) goto out; } } - + if (!dev_valid_name(dev->name)) { ret = -EINVAL; goto out; @@ -2923,9 +2923,9 @@ int register_netdevice(struct net_device *dev) = hlist_entry(p, struct net_device, name_hlist); if (!strncmp(d->name, dev->name, IFNAMSIZ)) { ret = -EEXIST; - goto out; + goto out; } - } + } /* Fix illegal SG+CSUM combinations. */ if ((dev->features & NETIF_F_SG) && @@ -3024,7 +3024,7 @@ int register_netdev(struct net_device *dev) if (err < 0) goto out; } - + err = register_netdevice(dev); out: rtnl_unlock(); @@ -3041,7 +3041,7 @@ EXPORT_SYMBOL(register_netdev); * for netdevice notification, and cleanup and put back the * reference if they receive an UNREGISTER event. * We can get stuck here if buggy protocols don't correctly - * call dev_put. + * call dev_put. */ static void netdev_wait_allrefs(struct net_device *dev) { @@ -3205,8 +3205,8 @@ EXPORT_SYMBOL(alloc_netdev); * free_netdev - free network device * @dev: device * - * This function does the last stage of destroying an allocated device - * interface. The reference to the device object is released. + * This function does the last stage of destroying an allocated device + * interface. The reference to the device object is released. * If this is the last reference then it will be freed. */ void free_netdev(struct net_device *dev) @@ -3227,9 +3227,9 @@ void free_netdev(struct net_device *dev) kfree((char *)dev - dev->padded); #endif } - + /* Synchronize with packet receive processing. */ -void synchronize_net(void) +void synchronize_net(void) { might_sleep(); synchronize_rcu(); @@ -3291,12 +3291,12 @@ void unregister_netdevice(struct net_device *dev) /* Shutdown queueing discipline. */ dev_shutdown(dev); - + /* Notify protocols, that we are about to destroy this device. They should clean all the things. */ raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); - + /* * Flush the multicast chain */ @@ -3483,7 +3483,7 @@ static int __init net_dev_init(void) goto out; INIT_LIST_HEAD(&ptype_all); - for (i = 0; i < 16; i++) + for (i = 0; i < 16; i++) INIT_LIST_HEAD(&ptype_base[i]); for (i = 0; i < ARRAY_SIZE(dev_name_head); i++) diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index b22648d..bfcbdf73a 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c @@ -1,12 +1,12 @@ /* - * Linux NET3: Multicast List maintenance. + * Linux NET3: Multicast List maintenance. * * Authors: - * Tim Kordas <tjk@nostromo.eeap.cwru.edu> + * Tim Kordas <tjk@nostromo.eeap.cwru.edu> * Richard Underwood <richard@wuzz.demon.co.uk> * * Stir fried together from the IP multicast and CAP patches above - * Alan Cox <Alan.Cox@linux.org> + * Alan Cox <Alan.Cox@linux.org> * * Fixes: * Alan Cox : Update the device on a real delete @@ -50,11 +50,11 @@ /* - * Device multicast list maintenance. + * Device multicast list maintenance. * - * This is used both by IP and by the user level maintenance functions. - * Unlike BSD we maintain a usage count on a given multicast address so - * that a casual user application can add/delete multicasts used by + * This is used both by IP and by the user level maintenance functions. + * Unlike BSD we maintain a usage count on a given multicast address so + * that a casual user application can add/delete multicasts used by * protocols without doing damage to the protocols when it deletes the * entries. It also helps IP as it tracks overlapping maps. * @@ -67,7 +67,7 @@ /* * Update the multicast list into the physical NIC controller. */ - + static void __dev_mc_upload(struct net_device *dev) { /* Don't do anything till we up the interface @@ -100,7 +100,7 @@ void dev_mc_upload(struct net_device *dev) /* * Delete a device level multicast */ - + int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) { int err = 0; @@ -137,7 +137,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) * loaded filter is now wrong. Fix it */ __dev_mc_upload(dev); - + netif_tx_unlock_bh(dev); return 0; } @@ -151,7 +151,7 @@ done: /* * Add a device level multicast */ - + int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) { int err = 0; @@ -187,7 +187,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) dev->mc_count++; __dev_mc_upload(dev); - + netif_tx_unlock_bh(dev); return 0; @@ -204,7 +204,7 @@ done: void dev_mc_discard(struct net_device *dev) { netif_tx_lock_bh(dev); - + while (dev->mc_list != NULL) { struct dev_mc_list *tmp = dev->mc_list; dev->mc_list = tmp->next; @@ -225,7 +225,7 @@ static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos) read_lock(&dev_base_lock); for (dev = dev_base; dev; dev = dev->next) { - if (off++ == *pos) + if (off++ == *pos) return dev; } return NULL; diff --git a/net/core/dst.c b/net/core/dst.c index f9eace7..61dd9d3 100644 --- a/net/core/dst.c +++ b/net/core/dst.c @@ -29,7 +29,7 @@ * 4) All operations modify state, so a spinlock is used. */ static struct dst_entry *dst_garbage_list; -#if RT_CACHE_DEBUG >= 2 +#if RT_CACHE_DEBUG >= 2 static atomic_t dst_total = ATOMIC_INIT(0); #endif static DEFINE_SPINLOCK(dst_lock); @@ -141,7 +141,7 @@ void * dst_alloc(struct dst_ops * ops) dst->path = dst; dst->input = dst_discard_in; dst->output = dst_discard_out; -#if RT_CACHE_DEBUG >= 2 +#if RT_CACHE_DEBUG >= 2 atomic_inc(&dst_total); #endif atomic_inc(&ops->entries); @@ -202,7 +202,7 @@ again: dst->ops->destroy(dst); if (dst->dev) dev_put(dst->dev); -#if RT_CACHE_DEBUG >= 2 +#if RT_CACHE_DEBUG >= 2 atomic_dec(&dst_total); #endif kmem_cache_free(dst->ops->kmem_cachep, dst); diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 87dc556..6168edd 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -17,7 +17,7 @@ #include <linux/netdevice.h> #include <asm/uaccess.h> -/* +/* * Some useful ethtool_ops methods that're device independent. * If we find that all drivers want to do the same thing here, * we can turn these into dev_() function calls. @@ -87,12 +87,12 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *a unsigned char len = dev->addr_len; if ( addr->size < len ) return -ETOOSMALL; - + addr->size = len; memcpy(data, dev->perm_addr, len); return 0; } - + u32 ethtool_op_get_ufo(struct net_device *dev) { @@ -550,7 +550,7 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr) if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT; - if (edata.data && + if (edata.data && !(dev->features & NETIF_F_ALL_CSUM)) return -EINVAL; @@ -951,7 +951,7 @@ int dev_ethtool(struct ifreq *ifr) default: rc = -EOPNOTSUPP; } - + if(dev->ethtool_ops->complete) dev->ethtool_ops->complete(dev); diff --git a/net/core/filter.c b/net/core/filter.c index 0df843b..8123a31 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -53,7 +53,7 @@ static void *__load_pointer(struct sk_buff *skb, int k) } static inline void *load_pointer(struct sk_buff *skb, int k, - unsigned int size, void *buffer) + unsigned int size, void *buffer) { if (k >= 0) return skb_header_pointer(skb, k, size, buffer); @@ -91,7 +91,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int */ for (pc = 0; pc < flen; pc++) { fentry = &filter[pc]; - + switch (fentry->code) { case BPF_ALU|BPF_ADD|BPF_X: A += X; @@ -399,7 +399,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen) */ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) { - struct sk_filter *fp; + struct sk_filter *fp; unsigned int fsize = sizeof(struct sock_filter) * fprog->len; int err; @@ -411,7 +411,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) if (!fp) return -ENOMEM; if (copy_from_user(fp->insns, fprog->filter, fsize)) { - sock_kfree_s(sk, fp, fsize+sizeof(*fp)); + sock_kfree_s(sk, fp, fsize+sizeof(*fp)); return -EFAULT; } diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 3cad026..17daf4c 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c @@ -144,7 +144,7 @@ static void est_timer(unsigned long arg) * configuration TLV is created. Upon each interval, the latest statistics * will be read from &bstats and the estimated rate will be stored in * &rate_est with the statistics lock grabed during this period. - * + * * Returns 0 on success or a negative error code. */ int gen_new_estimator(struct gnet_stats_basic *bstats, @@ -231,7 +231,7 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats, * * Replaces the configuration of a rate estimator by calling * gen_kill_estimator() and gen_new_estimator(). - * + * * Returns 0 on success or a negative error code. */ int @@ -242,7 +242,7 @@ gen_replace_estimator(struct gnet_stats_basic *bstats, gen_kill_estimator(bstats, rate_est); return gen_new_estimator(bstats, rate_est, stats_lock, opt); } - + EXPORT_SYMBOL(gen_kill_estimator); EXPORT_SYMBOL(gen_new_estimator); diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index 8f214903..259473d 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c @@ -57,7 +57,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type, int xstats_type, spinlock_t *lock, struct gnet_dump *d) { memset(d, 0, sizeof(*d)); - + spin_lock_bh(lock); d->lock = lock; if (type) diff --git a/net/core/iovec.c b/net/core/iovec.c index 04b249c..4fb1cb9 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c @@ -40,7 +40,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode) { int size, err, ct; - + if (m->msg_namelen) { if (mode == VERIFY_READ) { err = move_addr_to_kernel(m->msg_name, m->msg_namelen, @@ -79,7 +79,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode) * * Note: this modifies the original iovec. */ - + int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) { while (len > 0) { @@ -103,7 +103,7 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) * * Note: this modifies the original iovec. */ - + int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len) { while (len > 0) { @@ -209,7 +209,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, if (partial_cnt) { copy -= partial_cnt; if (copy_from_user(kdata + copy, base + copy, - partial_cnt)) + partial_cnt)) goto out_fault; } } @@ -224,7 +224,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, kdata += copy + partial_cnt; iov++; } - *csump = csum; + *csump = csum; out: return err; diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 549a2ce..8b45c9d 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c @@ -124,7 +124,7 @@ void linkwatch_run_queue(void) dev_put(dev); } -} +} static void linkwatch_event(struct work_struct *dummy) @@ -133,7 +133,7 @@ static void linkwatch_event(struct work_struct *dummy) * per second so that a runaway driver does not * cause a storm of messages on the netlink * socket - */ + */ linkwatch_nextevent = jiffies + HZ; clear_bit(LW_RUNNING, &linkwatch_flags); diff --git a/net/core/neighbour.c b/net/core/neighbour.c index efb673a..c08d696 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -343,7 +343,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, struct neighbour *n; int key_len = tbl->key_len; u32 hash_val = tbl->hash(pkey, dev); - + NEIGH_CACHE_STAT_INC(tbl, lookups); read_lock_bh(&tbl->lock); @@ -685,9 +685,9 @@ next_elt: np = &n->next; } - /* Cycle through all hash buckets every base_reachable_time/2 ticks. - * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 - * base_reachable_time. + /* Cycle through all hash buckets every base_reachable_time/2 ticks. + * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 + * base_reachable_time. */ expire = tbl->parms.base_reachable_time >> 1; expire /= (tbl->hash_mask + 1); @@ -742,7 +742,7 @@ static void neigh_timer_handler(unsigned long arg) } if (state & NUD_REACHABLE) { - if (time_before_eq(now, + if (time_before_eq(now, neigh->confirmed + neigh->parms->reachable_time)) { NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); next = neigh->confirmed + neigh->parms->reachable_time; @@ -761,7 +761,7 @@ static void neigh_timer_handler(unsigned long arg) notify = 1; } } else if (state & NUD_DELAY) { - if (time_before_eq(now, + if (time_before_eq(now, neigh->confirmed + neigh->parms->delay_probe_time)) { NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); neigh->nud_state = NUD_REACHABLE; @@ -847,7 +847,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) goto out_unlock_bh; now = jiffies; - + if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) { if (neigh->parms->mcast_probes + neigh->parms->app_probes) { atomic_set(&neigh->probes, neigh->parms->ucast_probes); @@ -915,13 +915,13 @@ static void neigh_update_hhs(struct neighbour *neigh) NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr, if it is different. NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected" - lladdr instead of overriding it + lladdr instead of overriding it if it is different. It also allows to retain current state if lladdr is unchanged. NEIGH_UPDATE_F_ADMIN means that the change is administrative. - NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing + NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing NTF_ROUTER flag. NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as a router. @@ -944,7 +944,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, old = neigh->nud_state; err = -EPERM; - if (!(flags & NEIGH_UPDATE_F_ADMIN) && + if (!(flags & NEIGH_UPDATE_F_ADMIN) && (old & (NUD_NOARP | NUD_PERMANENT))) goto out; @@ -968,7 +968,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, - compare new & old - if they are different, check override flag */ - if ((old & NUD_VALID) && + if ((old & NUD_VALID) && !memcmp(lladdr, neigh->ha, dev->addr_len)) lladdr = neigh->ha; } else { @@ -1012,8 +1012,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, neigh_del_timer(neigh); if (new & NUD_IN_TIMER) { neigh_hold(neigh); - neigh_add_timer(neigh, (jiffies + - ((new & NUD_REACHABLE) ? + neigh_add_timer(neigh, (jiffies + + ((new & NUD_REACHABLE) ? neigh->parms->reachable_time : 0))); } @@ -1075,7 +1075,7 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl, struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, lladdr || !dev->addr_len); if (neigh) - neigh_update(neigh, lladdr, NUD_STALE, + neigh_update(neigh, lladdr, NUD_STALE, NEIGH_UPDATE_F_OVERRIDE); return neigh; } @@ -1127,7 +1127,7 @@ int neigh_compat_output(struct sk_buff *skb) if (dev->hard_header && dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, - skb->len) < 0 && + skb->len) < 0 && dev->rebuild_header(skb)) return 0; @@ -1347,10 +1347,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl) tbl->stats = alloc_percpu(struct neigh_statistics); if (!tbl->stats) panic("cannot create neighbour cache statistics"); - + #ifdef CONFIG_PROC_FS tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat); - if (!tbl->pde) + if (!tbl->pde) panic("cannot create neighbour proc dir entry"); tbl->pde->proc_fops = &neigh_stat_seq_fops; tbl->pde->data = tbl; @@ -1565,7 +1565,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) err = -ENOENT; goto out_dev_put; } - + neigh = __neigh_lookup_errno(tbl, dst, dev); if (IS_ERR(neigh)) { err = PTR_ERR(neigh); @@ -1742,12 +1742,12 @@ errout: nlmsg_cancel(skb, nlh); return -EMSGSIZE; } - + static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl, int ifindex) { struct neigh_parms *p; - + for (p = &tbl->parms; p; p = p->next) if ((p->dev && p->dev->ifindex == ifindex) || (!p->dev && !ifindex)) @@ -1813,7 +1813,7 @@ int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) goto errout_locked; } - /* + /* * We acquire tbl->lock to be nice to the periodic timers and * make sure they always see a consistent set of values. */ @@ -2321,7 +2321,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) if (*pos == 0) return SEQ_START_TOKEN; - + for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) { if (!cpu_possible(cpu)) continue; @@ -2629,7 +2629,7 @@ static struct neigh_sysctl_table { }; int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, - int p_id, int pdev_id, char *p_name, + int p_id, int pdev_id, char *p_name, proc_handler *handler, ctl_handler *strategy) { struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template, @@ -2661,7 +2661,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, t->neigh_vars[14].procname = NULL; t->neigh_vars[15].procname = NULL; } else { - dev_name_source = t->neigh_dev[0].procname; + dev_name_source = t->neigh_dev[0].procname; t->neigh_vars[12].data = (int *)(p + 1); t->neigh_vars[13].data = (int *)(p + 1) + 1; t->neigh_vars[14].data = (int *)(p + 1) + 2; @@ -2696,7 +2696,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, goto free; } - t->neigh_dev[0].procname = dev_name; + t->neigh_dev[0].procname = dev_name; t->neigh_neigh_dir[0].ctl_name = pdev_id; diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 44db095..6189dc0 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -2,7 +2,7 @@ * net-sysfs.c - network device class and attributes * * Copyright (c) 2003 Stephen Hemminger <shemminger@osdl.org> - * + * * 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 @@ -23,7 +23,7 @@ static const char fmt_long_hex[] = "%#lx\n"; static const char fmt_dec[] = "%d\n"; static const char fmt_ulong[] = "%lu\n"; -static inline int dev_isalive(const struct net_device *dev) +static inline int dev_isalive(const struct net_device *dev) { return dev->reg_state <= NETREG_REGISTERED; } @@ -265,7 +265,7 @@ static ssize_t netstat_show(const struct device *d, read_lock(&dev_base_lock); if (dev_isalive(dev) && dev->get_stats && - (stats = (*dev->get_stats)(dev))) + (stats = (*dev->get_stats)(dev))) ret = sprintf(buf, fmt_ulong, *(unsigned long *)(((u8 *) stats) + offset)); @@ -349,7 +349,7 @@ static ssize_t wireless_show(struct device *d, char *buf, struct net_device *dev = to_net_dev(d); const struct iw_statistics *iw = NULL; ssize_t ret = -EINVAL; - + read_lock(&dev_base_lock); if (dev_isalive(dev)) { if(dev->wireless_handlers && @@ -430,7 +430,7 @@ static int netdev_uevent(struct device *d, char **envp, #endif /* - * netdev_release -- destroy and free a dead device. + * netdev_release -- destroy and free a dead device. * Called when last reference to device kobject is gone. */ static void netdev_release(struct device *d) diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 823215d..da10194 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -237,13 +237,13 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) { int status = NETDEV_TX_BUSY; unsigned long tries; - struct net_device *dev = np->dev; - struct netpoll_info *npinfo = np->dev->npinfo; + struct net_device *dev = np->dev; + struct netpoll_info *npinfo = np->dev->npinfo; - if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { - __kfree_skb(skb); - return; - } + if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { + __kfree_skb(skb); + return; + } /* don't get messages out of order, and no recursion */ if (skb_queue_len(&npinfo->txq) == 0 && @@ -676,7 +676,7 @@ int netpoll_setup(struct netpoll *np) } atleast = jiffies + HZ/10; - atmost = jiffies + 4*HZ; + atmost = jiffies + 4*HZ; while (!netif_carrier_ok(ndev)) { if (time_after(jiffies, atmost)) { printk(KERN_NOTICE @@ -772,9 +772,9 @@ void netpoll_cleanup(struct netpoll *np) np->dev->npinfo = NULL; if (atomic_dec_and_test(&npinfo->refcnt)) { skb_queue_purge(&npinfo->arp_tx); - skb_queue_purge(&npinfo->txq); + skb_queue_purge(&npinfo->txq); cancel_rearming_delayed_work(&npinfo->tx_work); - flush_scheduled_work(); + flush_scheduled_work(); kfree(npinfo); } diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 04d4b93..c2818e0 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -15,7 +15,7 @@ * * * A tool for loading the network with preconfigurated packets. - * The tool is implemented as a linux module. Parameters are output + * The tool is implemented as a linux module. Parameters are output * device, delay (to hard_xmit), number of packets, and whether * to use multiple SKBs or just the same one. * pktgen uses the installed interface's output routine. @@ -44,14 +44,14 @@ * * Add IOCTL interface to easily get counters & configuration. * --Ben Greear <greearb@candelatech.com> * - * Renamed multiskb to clone_skb and cleaned up sending core for two distinct - * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0 + * Renamed multiskb to clone_skb and cleaned up sending core for two distinct + * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0 * as a "fastpath" with a configurable number of clones after alloc's. - * clone_skb=0 means all packets are allocated this also means ranges time - * stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100 + * clone_skb=0 means all packets are allocated this also means ranges time + * stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100 * clones. * - * Also moved to /proc/net/pktgen/ + * Also moved to /proc/net/pktgen/ * --ro * * Sept 10: Fixed threading/locking. Lots of bone-headed and more clever @@ -60,28 +60,28 @@ * * Integrated to 2.5.x 021029 --Lucio Maciel (luciomaciel@zipmail.com.br) * - * + * * 021124 Finished major redesign and rewrite for new functionality. * See Documentation/networking/pktgen.txt for how to use this. * * The new operation: - * For each CPU one thread/process is created at start. This process checks - * for running devices in the if_list and sends packets until count is 0 it - * also the thread checks the thread->control which is used for inter-process - * communication. controlling process "posts" operations to the threads this + * For each CPU one thread/process is created at start. This process checks + * for running devices in the if_list and sends packets until count is 0 it + * also the thread checks the thread->control which is used for inter-process + * communication. controlling process "posts" operations to the threads this * way. The if_lock should be possible to remove when add/rem_device is merged * into this too. * - * By design there should only be *one* "controlling" process. In practice - * multiple write accesses gives unpredictable result. Understood by "write" + * By design there should only be *one* "controlling" process. In practice + * multiple write accesses gives unpredictable result. Understood by "write" * to /proc gives result code thats should be read be the "writer". * For practical use this should be no problem. * - * Note when adding devices to a specific CPU there good idea to also assign - * /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU. + * Note when adding devices to a specific CPU there good idea to also assign + * /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU. * --ro * - * Fix refcount off by one if first packet fails, potential null deref, + * Fix refcount off by one if first packet fails, potential null deref, * memleak 030710- KJP * * First "ranges" functionality for ipv6 030726 --ro @@ -89,22 +89,22 @@ * Included flow support. 030802 ANK. * * Fixed unaligned access on IA-64 Grant Grundler <grundler@parisc-linux.org> - * + * * Remove if fix from added Harald Welte <laforge@netfilter.org> 040419 * ia64 compilation fix from Aron Griffis <aron@hp.com> 040604 * - * New xmit() return, do_div and misc clean up by Stephen Hemminger + * New xmit() return, do_div and misc clean up by Stephen Hemminger * <shemminger@osdl.org> 040923 * - * Randy Dunlap fixed u64 printk compiler waring + * Randy Dunlap fixed u64 printk compiler waring * * Remove FCS from BW calculation. Lennert Buytenhek <buytenh@wantstofly.org> * New time handling. Lennert Buytenhek <buytenh@wantstofly.org> 041213 * - * Corrections from Nikolai Malykh (nmalykh@bilim.com) + * Corrections from Nikolai Malykh (nmalykh@bilim.com) * Removed unused flags F_SET_SRCMAC & F_SET_SRCIP 041230 * - * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com> + * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com> * 050103 * * MPLS support by Steven Whitehouse <steve@chygwyn.com> @@ -456,7 +456,7 @@ static inline __u64 pg_div64(__u64 n, __u64 base) /* * How do we know if the architecture we are running on * supports division with 64 bit base? - * + * */ #if defined(__sparc_v9__) || defined(__powerpc64__) || defined(__alpha__) || defined(__x86_64__) || defined(__ia64__) @@ -529,7 +529,7 @@ static struct notifier_block pktgen_notifier_block = { }; /* - * /proc handling functions + * /proc handling functions * */ @@ -1979,7 +1979,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) if (pkt_dev->flags & F_IPV6) { /* - * Skip this automatic address setting until locks or functions + * Skip this automatic address setting until locks or functions * gets exported */ @@ -2477,10 +2477,10 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, } /* - * scan_ip6, fmt_ip taken from dietlibc-0.21 + * scan_ip6, fmt_ip taken from dietlibc-0.21 * Author Felix von Leitner <felix-dietlibc@fefe.de> * - * Slightly modified for kernel. + * Slightly modified for kernel. * Should be candidate for net/ipv4/utils.c * --ro */ @@ -3256,7 +3256,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev) out:; } -/* +/* * Main loop of the thread goes here */ @@ -3365,8 +3365,8 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, return pkt_dev; } -/* - * Adds a dev at front of if_list. +/* + * Adds a dev at front of if_list. */ static int add_dev_to_thread(struct pktgen_thread *t, @@ -3510,8 +3510,8 @@ static int __init pktgen_create_thread(int cpu) return 0; } -/* - * Removes a device from the thread if_list. +/* + * Removes a device from the thread if_list. */ static void _rem_dev_from_if_list(struct pktgen_thread *t, struct pktgen_dev *pkt_dev) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 9bf9ae0..ee5a787 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -874,7 +874,7 @@ void __init rtnetlink_init(void) panic("rtnetlink_init: cannot allocate rta_buf\n"); rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv, - THIS_MODULE); + THIS_MODULE); if (rtnl == NULL) panic("rtnetlink_init: cannot initialize rtnetlink\n"); netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); diff --git a/net/core/scm.c b/net/core/scm.c index 271cf06..292ad8d 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -36,7 +36,7 @@ /* - * Only allow a user to send credentials, that they could set with + * Only allow a user to send credentials, that they could set with * setu(g)id. */ @@ -79,11 +79,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) if (fpl->count + num > SCM_MAX_FD) return -EINVAL; - + /* * Verify the descriptors and increment the usage count. */ - + for (i=0; i< num; i++) { int fd = fdp[i]; @@ -123,7 +123,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) /* The first check was omitted in <= 2.2.5. The reasoning was that parser checks cmsg_len in any case, so that additional check would be work duplication. - But if cmsg_level is not SOL_SOCKET, we do not check + But if cmsg_level is not SOL_SOCKET, we do not check for too short ancillary data object at all! Oops. OK, let's add it... */ @@ -159,7 +159,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) p->fp = NULL; } return 0; - + error: scm_destroy(p); return err; @@ -189,7 +189,7 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data) err = -EFAULT; if (copy_to_user(cm, &cmhdr, sizeof cmhdr)) - goto out; + goto out; if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr))) goto out; cmlen = CMSG_SPACE(len); diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f3404ae..3d56468 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -88,7 +88,7 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly; void skb_over_panic(struct sk_buff *skb, int sz, void *here) { printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " - "data:%p tail:%p end:%p dev:%s\n", + "data:%p tail:%p end:%p dev:%s\n", here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, skb->dev ? skb->dev->name : "<NULL>"); BUG(); @@ -106,7 +106,7 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here) void skb_under_panic(struct sk_buff *skb, int sz, void *here) { printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " - "data:%p tail:%p end:%p dev:%s\n", + "data:%p tail:%p end:%p dev:%s\n", here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, skb->dev ? skb->dev->name : "<NULL>"); BUG(); @@ -271,7 +271,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; struct sk_buff *skb; - skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); + skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); if (likely(skb)) { skb_reserve(skb, NET_SKB_PAD); skb->dev = dev; @@ -819,12 +819,12 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, * * May return error in out of memory cases. The skb is freed on error. */ - + int skb_pad(struct sk_buff *skb, int pad) { int err; int ntail; - + /* If the skbuff is non linear tailroom is always zero.. */ if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) { memset(skb->data+skb->len, 0, pad); @@ -851,8 +851,8 @@ int skb_pad(struct sk_buff *skb, int pad) free_skb: kfree_skb(skb); return err; -} - +} + /* Trims skb to length len. It can change skb pointers. */ diff --git a/net/core/sock.c b/net/core/sock.c index 0ed5b4f..1e35d99 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -34,7 +34,7 @@ * Alan Cox : TCP ack handling is buggy, the DESTROY timer * was buggy. Put a remove_sock() in the handler * for memory when we hit 0. Also altered the timer - * code. The ACK stuff can wait and needs major + * code. The ACK stuff can wait and needs major * TCP layer surgery. * Alan Cox : Fixed TCP ack bug, removed remove sock * and fixed timer/inet_bh race. @@ -217,8 +217,8 @@ static void sock_warn_obsolete_bsdism(const char *name) { static int warned; static char warncomm[TASK_COMM_LEN]; - if (strcmp(warncomm, current->comm) && warned < 5) { - strcpy(warncomm, current->comm); + if (strcmp(warncomm, current->comm) && warned < 5) { + strcpy(warncomm, current->comm); printk(KERN_WARNING "process `%s' is using obsolete " "%s SO_BSDCOMPAT\n", warncomm, name); warned++; @@ -226,8 +226,8 @@ static void sock_warn_obsolete_bsdism(const char *name) } static void sock_disable_timestamp(struct sock *sk) -{ - if (sock_flag(sk, SOCK_TIMESTAMP)) { +{ + if (sock_flag(sk, SOCK_TIMESTAMP)) { sock_reset_flag(sk, SOCK_TIMESTAMP); net_disable_timestamp(); } @@ -347,7 +347,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, int valbool; struct linger ling; int ret = 0; - + /* * Options without arguments */ @@ -360,20 +360,20 @@ int sock_setsockopt(struct socket *sock, int level, int optname, return 0; } #endif - - if(optlen<sizeof(int)) - return(-EINVAL); - + + if(optlen<sizeof(int)) + return(-EINVAL); + if (get_user(val, (int __user *)optval)) return -EFAULT; - - valbool = val?1:0; + + valbool = val?1:0; lock_sock(sk); - switch(optname) - { - case SO_DEBUG: + switch(optname) + { + case SO_DEBUG: if(val && !capable(CAP_NET_ADMIN)) { ret = -EACCES; @@ -389,7 +389,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, case SO_TYPE: case SO_ERROR: ret = -ENOPROTOOPT; - break; + break; case SO_DONTROUTE: if (valbool) sock_set_flag(sk, SOCK_LOCALROUTE); @@ -404,7 +404,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, about it this is right. Otherwise apps have to play 'guess the biggest size' games. RCVBUF/SNDBUF are treated in BSD as hints */ - + if (val > sysctl_wmem_max) val = sysctl_wmem_max; set_sndbuf: @@ -433,7 +433,7 @@ set_sndbuf: about it this is right. Otherwise apps have to play 'guess the biggest size' games. RCVBUF/SNDBUF are treated in BSD as hints */ - + if (val > sysctl_rmem_max) val = sysctl_rmem_max; set_rcvbuf: @@ -474,16 +474,16 @@ set_rcvbuf: sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); break; - case SO_OOBINLINE: + case SO_OOBINLINE: sock_valbool_flag(sk, SOCK_URGINLINE, valbool); break; - case SO_NO_CHECK: + case SO_NO_CHECK: sk->sk_no_check = valbool; break; case SO_PRIORITY: - if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) + if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) sk->sk_priority = val; else ret = -EPERM; @@ -547,9 +547,9 @@ set_rcvbuf: #ifdef CONFIG_NETDEVICES case SO_BINDTODEVICE: { - char devname[IFNAMSIZ]; + char devname[IFNAMSIZ]; - /* Sorry... */ + /* Sorry... */ if (!capable(CAP_NET_RAW)) { ret = -EPERM; break; @@ -557,9 +557,9 @@ set_rcvbuf: /* Bind this socket to a particular device like "eth0", * as specified in the passed interface name. If the - * name is "" or the option length is zero the socket - * is not bound. - */ + * name is "" or the option length is zero the socket + * is not bound. + */ if (!valbool) { sk->sk_bound_dev_if = 0; @@ -608,7 +608,7 @@ set_rcvbuf: case SO_DETACH_FILTER: rcu_read_lock_bh(); filter = rcu_dereference(sk->sk_filter); - if (filter) { + if (filter) { rcu_assign_pointer(sk->sk_filter, NULL); sk_filter_release(sk, filter); rcu_read_unlock_bh(); @@ -628,9 +628,9 @@ set_rcvbuf: /* We implement the SO_SNDLOWAT etc to not be settable (1003.1g 5.3) */ default: - ret = -ENOPROTOOPT; + ret = -ENOPROTOOPT; break; - } + } release_sock(sk); return ret; } @@ -640,32 +640,32 @@ int sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; - + union { - int val; - struct linger ling; + int val; + struct linger ling; struct timeval tm; } v; - + unsigned int lv = sizeof(int); int len; - - if(get_user(len,optlen)) - return -EFAULT; + + if(get_user(len,optlen)) + return -EFAULT; if(len < 0) return -EINVAL; - - switch(optname) - { - case SO_DEBUG: + + switch(optname) + { + case SO_DEBUG: v.val = sock_flag(sk, SOCK_DBG); break; - + case SO_DONTROUTE: v.val = sock_flag(sk, SOCK_LOCALROUTE); break; - + case SO_BROADCAST: v.val = !!sock_flag(sk, SOCK_BROADCAST); break; @@ -673,7 +673,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_SNDBUF: v.val = sk->sk_sndbuf; break; - + case SO_RCVBUF: v.val = sk->sk_rcvbuf; break; @@ -687,7 +687,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, break; case SO_TYPE: - v.val = sk->sk_type; + v.val = sk->sk_type; break; case SO_ERROR: @@ -699,7 +699,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_OOBINLINE: v.val = !!sock_flag(sk, SOCK_URGINLINE); break; - + case SO_NO_CHECK: v.val = sk->sk_no_check; break; @@ -707,13 +707,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_PRIORITY: v.val = sk->sk_priority; break; - - case SO_LINGER: + + case SO_LINGER: lv = sizeof(v.ling); v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER); - v.ling.l_linger = sk->sk_lingertime / HZ; + v.ling.l_linger = sk->sk_lingertime / HZ; break; - + case SO_BSDCOMPAT: sock_warn_obsolete_bsdism("getsockopt"); break; @@ -750,7 +750,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_SNDLOWAT: v.val=1; - break; + break; case SO_PASSCRED: v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0; @@ -798,9 +798,9 @@ int sock_getsockopt(struct socket *sock, int level, int optname, if (copy_to_user(optval, &v, len)) return -EFAULT; lenout: - if (put_user(len, optlen)) - return -EFAULT; - return 0; + if (put_user(len, optlen)) + return -EFAULT; + return 0; } /* @@ -846,7 +846,7 @@ struct sock *sk_alloc(int family, gfp_t priority, sk->sk_prot = sk->sk_prot_creator = prot; sock_lock_init(sk); } - + if (security_sk_alloc(sk, family, priority)) goto out_free; @@ -988,8 +988,8 @@ void __init sk_init(void) */ -/* - * Write buffer destructor automatically called from kfree_skb. +/* + * Write buffer destructor automatically called from kfree_skb. */ void sock_wfree(struct sk_buff *skb) { @@ -1002,8 +1002,8 @@ void sock_wfree(struct sk_buff *skb) sock_put(sk); } -/* - * Read buffer destructor automatically called from kfree_skb. +/* + * Read buffer destructor automatically called from kfree_skb. */ void sock_rfree(struct sk_buff *skb) { @@ -1051,7 +1051,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, /* * Allocate a skb from the socket's receive buffer. - */ + */ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, gfp_t priority) { @@ -1065,16 +1065,16 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, return NULL; } -/* +/* * Allocate a memory block from the socket's option memory buffer. - */ + */ void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) { if ((unsigned)size <= sysctl_optmem_max && atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { void *mem; /* First do the add, to avoid the race if kmalloc - * might sleep. + * might sleep. */ atomic_add(size, &sk->sk_omem_alloc); mem = kmalloc(size, priority); @@ -1210,7 +1210,7 @@ failure: return NULL; } -struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, +struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, int noblock, int *errcode) { return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); @@ -1298,7 +1298,7 @@ int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len) return -EOPNOTSUPP; } -int sock_no_connect(struct socket *sock, struct sockaddr *saddr, +int sock_no_connect(struct socket *sock, struct sockaddr *saddr, int len, int flags) { return -EOPNOTSUPP; @@ -1314,7 +1314,7 @@ int sock_no_accept(struct socket *sock, struct socket *newsock, int flags) return -EOPNOTSUPP; } -int sock_no_getname(struct socket *sock, struct sockaddr *saddr, +int sock_no_getname(struct socket *sock, struct sockaddr *saddr, int *len, int peer) { return -EOPNOTSUPP; @@ -1400,7 +1400,7 @@ static void sock_def_error_report(struct sock *sk) read_lock(&sk->sk_callback_lock); if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) wake_up_interruptible(sk->sk_sleep); - sk_wake_async(sk,0,POLL_ERR); + sk_wake_async(sk,0,POLL_ERR); read_unlock(&sk->sk_callback_lock); } @@ -1473,7 +1473,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) sk->sk_send_head = NULL; init_timer(&sk->sk_timer); - + sk->sk_allocation = GFP_KERNEL; sk->sk_rcvbuf = sysctl_rmem_default; sk->sk_sndbuf = sysctl_wmem_default; @@ -1553,26 +1553,26 @@ void fastcall release_sock(struct sock *sk) EXPORT_SYMBOL(release_sock); int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) -{ +{ if (!sock_flag(sk, SOCK_TIMESTAMP)) sock_enable_timestamp(sk); - if (sk->sk_stamp.tv_sec == -1) + if (sk->sk_stamp.tv_sec == -1) return -ENOENT; if (sk->sk_stamp.tv_sec == 0) do_gettimeofday(&sk->sk_stamp); return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ? - -EFAULT : 0; -} + -EFAULT : 0; +} EXPORT_SYMBOL(sock_get_timestamp); void sock_enable_timestamp(struct sock *sk) -{ - if (!sock_flag(sk, SOCK_TIMESTAMP)) { +{ + if (!sock_flag(sk, SOCK_TIMESTAMP)) { sock_set_flag(sk, SOCK_TIMESTAMP); net_enable_timestamp(); } } -EXPORT_SYMBOL(sock_enable_timestamp); +EXPORT_SYMBOL(sock_enable_timestamp); /* * Get a socket option on an socket. diff --git a/net/core/stream.c b/net/core/stream.c index d1d7dec..755bacb 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -69,7 +69,7 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p) sk->sk_write_pending++; done = sk_wait_event(sk, timeo_p, !sk->sk_err && - !((1 << sk->sk_state) & + !((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT))); finish_wait(sk->sk_sleep, &wait); sk->sk_write_pending--; @@ -139,7 +139,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); sk->sk_write_pending++; - sk_wait_event(sk, ¤t_timeo, !sk->sk_err && + sk_wait_event(sk, ¤t_timeo, !sk->sk_err && !(sk->sk_shutdown & SEND_SHUTDOWN) && sk_stream_memory_free(sk) && vm_wait); diff --git a/net/core/user_dma.c b/net/core/user_dma.c index 248a6b6..0ad1cd5 100644 --- a/net/core/user_dma.c +++ b/net/core/user_dma.c @@ -58,7 +58,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan, if (copy > len) copy = len; cookie = dma_memcpy_to_iovec(chan, to, pinned_list, - skb->data + offset, copy); + skb->data + offset, copy); if (cookie < 0) goto fault; len -= copy; @@ -108,8 +108,8 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan, if (copy > len) copy = len; cookie = dma_skb_copy_datagram_iovec(chan, list, - offset - start, to, copy, - pinned_list); + offset - start, to, copy, + pinned_list); if (cookie < 0) goto fault; len -= copy; @@ -128,5 +128,5 @@ end: } fault: - return -EFAULT; + return -EFAULT; } diff --git a/net/core/utils.c b/net/core/utils.c index 6155606..07236c1 100644 --- a/net/core/utils.c +++ b/net/core/utils.c @@ -33,9 +33,9 @@ int net_msg_cost = 5*HZ; int net_msg_burst = 10; -/* +/* * All net warning printk()s should be guarded by this function. - */ + */ int net_ratelimit(void) { return __printk_ratelimit(net_msg_cost, net_msg_burst); diff --git a/net/core/wireless.c b/net/core/wireless.c index f69ab7b..64017d4 100644 --- a/net/core/wireless.c +++ b/net/core/wireless.c @@ -369,7 +369,7 @@ static const struct iw_ioctl_description standard_event[] = { .header_type = IW_HEADER_TYPE_ADDR, }, [IWEVEXPIRED - IWEVFIRST] = { - .header_type = IW_HEADER_TYPE_ADDR, + .header_type = IW_HEADER_TYPE_ADDR, }, [IWEVGENIE - IWEVFIRST] = { .header_type = IW_HEADER_TYPE_POINT, @@ -377,7 +377,7 @@ static const struct iw_ioctl_description standard_event[] = { .max_tokens = IW_GENERIC_IE_MAX, }, [IWEVMICHAELMICFAILURE - IWEVFIRST] = { - .header_type = IW_HEADER_TYPE_POINT, + .header_type = IW_HEADER_TYPE_POINT, .token_size = 1, .max_tokens = sizeof(struct iw_michaelmicfailure), }, @@ -630,11 +630,11 @@ static __inline__ void wireless_seq_printf_stats(struct seq_file *seq, dev->name, stats->status, stats->qual.qual, stats->qual.updated & IW_QUAL_QUAL_UPDATED ? '.' : ' ', - ((__s32) stats->qual.level) - + ((__s32) stats->qual.level) - ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), stats->qual.updated & IW_QUAL_LEVEL_UPDATED ? '.' : ' ', - ((__s32) stats->qual.noise) - + ((__s32) stats->qual.noise) - ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), stats->qual.updated & IW_QUAL_NOISE_UPDATED ? '.' : ' ', @@ -862,7 +862,7 @@ static int ioctl_standard_call(struct net_device * dev, iwr->u.data.length * descr->token_size); if (err) - ret = -EFAULT; + ret = -EFAULT; #ifdef WE_IOCTL_DEBUG printk(KERN_DEBUG "%s (WE) : Wrote %d bytes\n", dev->name, @@ -1040,7 +1040,7 @@ static inline int ioctl_private_call(struct net_device * dev, err = copy_to_user(iwr->u.data.pointer, extra, extra_size); if (err) - ret = -EFAULT; + ret = -EFAULT; #ifdef WE_IOCTL_DEBUG printk(KERN_DEBUG "%s (WE) : Wrote %d elem\n", dev->name, iwr->u.data.length); @@ -1080,7 +1080,7 @@ int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) /* A bunch of special cases, then the generic case... * Note that 'cmd' is already filtered in dev_ioctl() with * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ - switch(cmd) + switch(cmd) { case SIOCGIWSTATS: /* Get Wireless Stats */ @@ -2015,7 +2015,7 @@ void wireless_send_event(struct net_device * dev, * The best the driver could do is to log an error message. * We will do it ourselves instead... */ - printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n", + printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n", dev->name, cmd); return; } @@ -2029,11 +2029,11 @@ void wireless_send_event(struct net_device * dev, if(descr->header_type == IW_HEADER_TYPE_POINT) { /* Check if number of token fits within bounds */ if(wrqu->data.length > descr->max_tokens) { - printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length); + printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length); return; } if(wrqu->data.length < descr->min_tokens) { - printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length); + printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length); return; } /* Calculate extra_len - extra is NULL for restricted events */ diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index fd38b05..248d20f 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c @@ -139,7 +139,7 @@ static int ccid2_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) return 0; } - hctx = ccid2_hc_tx_sk(sk); + hctx = ccid2_hc_tx_sk(sk); ccid2_pr_debug("pipe=%d cwnd=%d\n", hctx->ccid2hctx_pipe, hctx->ccid2hctx_cwnd); @@ -368,13 +368,13 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) static int ccid2_ackvector(struct sock *sk, struct sk_buff *skb, int offset, unsigned char **vec, unsigned char *veclen) { - const struct dccp_hdr *dh = dccp_hdr(skb); - unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb); - unsigned char *opt_ptr; - const unsigned char *opt_end = (unsigned char *)dh + - (dh->dccph_doff * 4); - unsigned char opt, len; - unsigned char *value; + const struct dccp_hdr *dh = dccp_hdr(skb); + unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb); + unsigned char *opt_ptr; + const unsigned char *opt_end = (unsigned char *)dh + + (dh->dccph_doff * 4); + unsigned char opt, len; + unsigned char *value; BUG_ON(offset < 0); options += offset; @@ -383,29 +383,29 @@ static int ccid2_ackvector(struct sock *sk, struct sk_buff *skb, int offset, return -1; while (opt_ptr != opt_end) { - opt = *opt_ptr++; - len = 0; - value = NULL; - - /* Check if this isn't a single byte option */ - if (opt > DCCPO_MAX_RESERVED) { - if (opt_ptr == opt_end) - goto out_invalid_option; - - len = *opt_ptr++; - if (len < 3) - goto out_invalid_option; - /* - * Remove the type and len fields, leaving - * just the value size - */ - len -= 2; - value = opt_ptr; - opt_ptr += len; - - if (opt_ptr > opt_end) - goto out_invalid_option; - } + opt = *opt_ptr++; + len = 0; + value = NULL; + + /* Check if this isn't a single byte option */ + if (opt > DCCPO_MAX_RESERVED) { + if (opt_ptr == opt_end) + goto out_invalid_option; + + len = *opt_ptr++; + if (len < 3) + goto out_invalid_option; + /* + * Remove the type and len fields, leaving + * just the value size + */ + len -= 2; + value = opt_ptr; + opt_ptr += len; + + if (opt_ptr > opt_end) + goto out_invalid_option; + } switch (opt) { case DCCPO_ACK_VECTOR_0: @@ -432,7 +432,7 @@ static void ccid2_hc_tx_kill_rto_timer(struct sock *sk) } static inline void ccid2_new_ack(struct sock *sk, - struct ccid2_seq *seqp, + struct ccid2_seq *seqp, unsigned int *maxincr) { struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); @@ -759,7 +759,7 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) { - struct ccid2_hc_tx_sock *hctx = ccid_priv(ccid); + struct ccid2_hc_tx_sock *hctx = ccid_priv(ccid); ccid2_change_cwnd(hctx, 1); /* Initialize ssthresh to infinity. This means that we will exit the @@ -793,7 +793,7 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) static void ccid2_hc_tx_exit(struct sock *sk) { - struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); + struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); int i; ccid2_hc_tx_kill_rto_timer(sk); diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 5c452a3..5361a4d 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c @@ -284,7 +284,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) restart_timer: sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, - jiffies + usecs_to_jiffies(t_nfb)); + jiffies + usecs_to_jiffies(t_nfb)); out: bh_unlock_sock(sk); sock_put(sk); @@ -319,7 +319,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) case TFRC_SSTATE_NO_SENT: sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, (jiffies + - usecs_to_jiffies(TFRC_INITIAL_TIMEOUT))); + usecs_to_jiffies(TFRC_INITIAL_TIMEOUT))); hctx->ccid3hctx_last_win_count = 0; hctx->ccid3hctx_t_last_win_count = now; ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); @@ -487,7 +487,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK); } else { hctx->ccid3hctx_rtt = (9 * hctx->ccid3hctx_rtt + - (u32)r_sample) / 10; + (u32)r_sample) / 10; /* Update sending rate (step 4 of [RFC 3448, 4.3]) */ if (hctx->ccid3hctx_p > 0) @@ -924,7 +924,7 @@ static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss) } static int ccid3_hc_rx_detect_loss(struct sock *sk, - struct dccp_rx_hist_entry *packet) + struct dccp_rx_hist_entry *packet) { struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); struct dccp_rx_hist_entry *rx_hist = @@ -1074,7 +1074,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) dccp_role(sk), sk, dccp_state_name(sk->sk_state)); p_prev = hcrx->ccid3hcrx_p; - + /* Calculate loss event rate */ if (!list_empty(&hcrx->ccid3hcrx_li_hist)) { u32 i_mean = dccp_li_hist_calc_i_mean(&hcrx->ccid3hcrx_li_hist); @@ -1156,7 +1156,7 @@ static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len, { const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); const void *val; - + /* Listen socks doesn't have a private CCID block */ if (sk->sk_state == DCCP_LISTEN) return -EINVAL; @@ -1183,7 +1183,7 @@ static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len, { const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); const void *val; - + /* Listen socks doesn't have a private CCID block */ if (sk->sk_state == DCCP_LISTEN) return -EINVAL; diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h index 1f960c1..60d00f0 100644 --- a/net/dccp/ccids/lib/packet_history.h +++ b/net/dccp/ccids/lib/packet_history.h @@ -137,7 +137,7 @@ extern void dccp_rx_hist_delete(struct dccp_rx_hist *hist); static inline struct dccp_rx_hist_entry * dccp_rx_hist_entry_new(struct dccp_rx_hist *hist, const struct sock *sk, - const u32 ndp, + const u32 ndp, const struct sk_buff *skb, const gfp_t prio) { @@ -169,7 +169,7 @@ static inline struct dccp_rx_hist_entry * } extern int dccp_rx_hist_find_entry(const struct list_head *list, const u64 seq, - u8 *ccval); + u8 *ccval); extern struct dccp_rx_hist_entry * dccp_rx_hist_find_data_packet(const struct list_head *list); diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c index 90009fd..e4e64b7 100644 --- a/net/dccp/ccids/lib/tfrc_equation.c +++ b/net/dccp/ccids/lib/tfrc_equation.c @@ -26,7 +26,7 @@ The following two-column lookup table implements a part of the TCP throughput equation from [RFC 3448, sec. 3.1]: - s + s X_calc = -------------------------------------------------------------- R * sqrt(2*b*p/3) + (3 * t_RTO * sqrt(3*b*p/8) * (p + 32*p^3)) @@ -35,7 +35,7 @@ s is the packet size in bytes R is the round trip time in seconds p is the loss event rate, between 0 and 1.0, of the number of loss - events as a fraction of the number of packets transmitted + events as a fraction of the number of packets transmitted t_RTO is the TCP retransmission timeout value in seconds b is the number of packets acknowledged by a single TCP ACK @@ -47,9 +47,9 @@ which we can break down into: - s + s X_calc = --------- - R * f(p) + R * f(p) where f(p) is given for 0 < p <= 1 by: @@ -62,7 +62,7 @@ * the return result f(p) The lookup table therefore actually tabulates the following function g(q): - g(q) = 1000000 * f(q/1000000) + g(q) = 1000000 * f(q/1000000) Hence, when p <= 1, q must be less than or equal to 1000000. To achieve finer granularity for the practically more relevant case of small values of p (up to @@ -628,7 +628,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p) if (R == 0) { /* possible divide by zero */ DCCP_CRIT("WARNING: RTT is 0, returning maximum X_calc."); return ~0U; - } + } if (p <= TFRC_CALC_X_SPLIT) { /* 0.0000 < p <= 0.05 */ if (p < TFRC_SMALLEST_P) { /* 0.0000 < p < 0.0001 */ @@ -638,7 +638,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p) } else /* 0.0001 <= p <= 0.05 */ index = p/TFRC_SMALLEST_P - 1; - f = tfrc_calc_x_lookup[index][1]; + f = tfrc_calc_x_lookup[index][1]; } else { /* 0.05 < p <= 1.00 */ index = p/(1000000/TFRC_CALC_X_ARRSIZE) - 1; @@ -687,8 +687,8 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue) if (fvalue <= tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][1]) { index = tfrc_binsearch(fvalue, 1); return (index + 1) * TFRC_CALC_X_SPLIT / TFRC_CALC_X_ARRSIZE; - } - + } + /* else ... it must be in the coarse-grained column */ index = tfrc_binsearch(fvalue, 0); return (index + 1) * 1000000 / TFRC_CALC_X_ARRSIZE; diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index a0900bf..e33a9ed 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h @@ -22,7 +22,7 @@ * DCCP - specific warning and debugging macros. */ #define DCCP_WARN(fmt, a...) LIMIT_NETDEBUG(KERN_WARNING "%s: " fmt, \ - __FUNCTION__, ##a) + __FUNCTION__, ##a) #define DCCP_CRIT(fmt, a...) printk(KERN_CRIT fmt " at %s:%d/%s()\n", ##a, \ __FILE__, __LINE__, __FUNCTION__) #define DCCP_BUG(a...) do { DCCP_CRIT("BUG: " a); dump_stack(); } while(0) @@ -34,7 +34,7 @@ #ifdef MODULE #define DCCP_PRINTK(enable, fmt, args...) do { if (enable) \ printk(fmt, ##args); \ - } while(0) + } while(0) #else #define DCCP_PRINTK(enable, fmt, args...) printk(fmt, ##args) #endif @@ -128,7 +128,7 @@ enum { DCCP_MIB_ACTIVEOPENS, /* ActiveOpens */ DCCP_MIB_ESTABRESETS, /* EstabResets */ DCCP_MIB_CURRESTAB, /* CurrEstab */ - DCCP_MIB_OUTSEGS, /* OutSegs */ + DCCP_MIB_OUTSEGS, /* OutSegs */ DCCP_MIB_OUTRSTS, DCCP_MIB_ABORTONTIMEOUT, DCCP_MIB_TIMEOUTS, @@ -372,7 +372,7 @@ static inline void dccp_update_gss(struct sock *sk, u64 seq) (dp->dccps_gss - dccp_msk(sk)->dccpms_sequence_window + 1)); } - + static inline int dccp_ack_pending(const struct sock *sk) { const struct dccp_sock *dp = dccp_sk(sk); diff --git a/net/dccp/feat.c b/net/dccp/feat.c index 95b6927..cd845df 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c @@ -480,8 +480,8 @@ void dccp_feat_clean(struct dccp_minisock *dmsk) list_for_each_entry_safe(opt, next, &dmsk->dccpms_pending, dccpop_node) { - BUG_ON(opt->dccpop_val == NULL); - kfree(opt->dccpop_val); + BUG_ON(opt->dccpop_val == NULL); + kfree(opt->dccpop_val); if (opt->dccpop_sc != NULL) { BUG_ON(opt->dccpop_sc->dccpoc_val == NULL); @@ -489,8 +489,8 @@ void dccp_feat_clean(struct dccp_minisock *dmsk) kfree(opt->dccpop_sc); } - kfree(opt); - } + kfree(opt); + } INIT_LIST_HEAD(&dmsk->dccpms_pending); list_for_each_entry_safe(opt, next, &dmsk->dccpms_conf, dccpop_node) { diff --git a/net/dccp/feat.h b/net/dccp/feat.h index 2c373ad..177f7de 100644 --- a/net/dccp/feat.h +++ b/net/dccp/feat.h @@ -30,7 +30,7 @@ static inline int dccp_feat_is_reserved(const u8 feat) { return (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC) || - feat == DCCPF_RESERVED; + feat == DCCPF_RESERVED; } /* feature negotiation knows only these four option types (RFC 4340, sec. 6) */ diff --git a/net/dccp/input.c b/net/dccp/input.c index 565bc80..4dee462 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c @@ -91,7 +91,7 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb) else return -1; } - + /* * Step 6: Check sequence numbers * Let LSWL = S.SWL and LAWL = S.AWL @@ -136,7 +136,7 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb) (unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq, (unsigned long long) dp->dccps_swh, (DCCP_SKB_CB(skb)->dccpd_ack_seq == - DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist" : "exists", + DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist" : "exists", (unsigned long long) lawl, (unsigned long long) DCCP_SKB_CB(skb)->dccpd_ack_seq, (unsigned long long) dp->dccps_awh); @@ -308,11 +308,11 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, if (dccp_parse_options(sk, skb)) goto out_invalid_packet; - if (dccp_msk(sk)->dccpms_send_ack_vector && - dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, - DCCP_SKB_CB(skb)->dccpd_seq, - DCCP_ACKVEC_STATE_RECEIVED)) - goto out_invalid_packet; /* FIXME: change error code */ + if (dccp_msk(sk)->dccpms_send_ack_vector && + dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, + DCCP_SKB_CB(skb)->dccpd_seq, + DCCP_ACKVEC_STATE_RECEIVED)) + goto out_invalid_packet; /* FIXME: change error code */ dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq; dccp_update_gsr(sk, dp->dccps_isr); diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index fa2c982..4a83978 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c @@ -106,7 +106,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) goto failure; err = ip_route_newports(&rt, IPPROTO_DCCP, inet->sport, inet->dport, - sk); + sk); if (err != 0) goto failure; @@ -157,7 +157,7 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk, /* We don't check in the destentry if pmtu discovery is forbidden * on this route. We just assume that no packet_to_big packets * are send back when pmtu discovery is not active. - * There is a small race when the user changes this flag in the + * There is a small race when the user changes this flag in the * route, but I think that's acceptable. */ if ((dst = __sk_dst_check(sk, 0)) == NULL) @@ -486,7 +486,7 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req, struct sk_buff *skb; /* First, grab a route. */ - + if (dst == NULL && (dst = inet_csk_route_req(sk, req)) == NULL) goto out; diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 79140b3..7f51e8d 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c @@ -734,7 +734,7 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) looks not very well thought. For now we latch options, received in the last packet, enqueued by tcp. Feel free to propose better solution. - --ANK (980728) + --ANK (980728) */ if (np->rxopt.all) /* diff --git a/net/dccp/options.c b/net/dccp/options.c index c03ba61..ca13f77 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c @@ -242,7 +242,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) DCCP_CRIT("DCCP(%p): option %d(len=%d) not " "implemented, ignoring", sk, opt, len); break; - } + } if (opt != DCCPO_MANDATORY) mandatory = 0; @@ -442,7 +442,7 @@ static int dccp_insert_option_timestamp_echo(struct sock *sk, } static int dccp_insert_feat_opt(struct sk_buff *skb, u8 type, u8 feat, - u8 *val, u8 len) + u8 *val, u8 len) { u8 *to; diff --git a/net/dccp/output.c b/net/dccp/output.c index 3435542..f5c6aca 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c @@ -87,7 +87,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) kfree_skb(skb); return -EPROTO; } - + /* Build DCCP header and checksum it. */ dh = dccp_zeroed_hdr(skb, dccp_header_size); @@ -415,7 +415,7 @@ static inline void dccp_connect_init(struct sock *sk) sk->sk_err = 0; sock_reset_flag(sk, SOCK_DONE); - + dccp_sync_mss(sk, dst_mtu(dst)); /* diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 4843856..cf28c53 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -478,7 +478,7 @@ static int do_dccp_setsockopt(struct sock *sk, int level, int optname, err = -EINVAL; else err = dccp_setsockopt_change(sk, DCCPO_CHANGE_L, - (struct dccp_so_feat __user *) + (struct dccp_so_feat __user *) optval); break; case DCCP_SOCKOPT_CHANGE_R: diff --git a/net/dccp/timer.c b/net/dccp/timer.c index e5348f3..41ea0f6 100644 --- a/net/dccp/timer.c +++ b/net/dccp/timer.c @@ -60,7 +60,7 @@ static int dccp_write_timeout(struct sock *sk) be far nicer to have all of the black holes fixed rather than fixing all of the TCP implementations." - Golden words :-). + Golden words :-). */ dst_negative_advice(&sk->sk_dst_cache); diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 21f20f2..7006164 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 90b3dfd..c5e2811 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 1cf0101..3cbfddc 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 7322bb3..11d692d 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 39a6cf7..0f244e8 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 b342e4e..23d5ca8 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 9881933..efccc42 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 720501e..780a141 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 8b99bd3..0e62def 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 a4065eb..a6c067b 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} diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 4d66aac..f2ce414 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c @@ -139,7 +139,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, skb=skb_recv_datagram(sk,flags,flags&MSG_DONTWAIT,&err); /* - * An error occurred so return it. Because skb_recv_datagram() + * An error occurred so return it. Because skb_recv_datagram() * handles the blocking we don't see and worry about blocking * retries. */ @@ -190,15 +190,15 @@ static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; struct sock *sk; struct econet_sock *eo; - + /* * Check legality */ - + if (addr_len < sizeof(struct sockaddr_ec) || sec->sec_family != AF_ECONET) return -EINVAL; - + mutex_lock(&econet_mutex); sk = sock->sk; @@ -283,18 +283,18 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, int i; mm_segment_t oldfs; #endif - + /* - * Check the flags. + * Check the flags. */ - if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; /* - * Get and verify the address. + * Get and verify the address. */ - + mutex_lock(&econet_mutex); if (saddr == NULL) { @@ -339,17 +339,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, unsigned short proto = 0; dev_hold(dev); - - skb = sock_alloc_send_skb(sk, len+LL_RESERVED_SPACE(dev), + + skb = sock_alloc_send_skb(sk, len+LL_RESERVED_SPACE(dev), msg->msg_flags & MSG_DONTWAIT, &err); if (skb==NULL) goto out_unlock; - + skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb->nh.raw = skb->data; - + eb = (struct ec_cb *)&skb->cb; - + /* BUG: saddr may be NULL */ eb->cookie = saddr->cookie; eb->sec = *saddr; @@ -359,7 +359,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, int res; struct ec_framehdr *fh; err = -EINVAL; - res = dev->hard_header(skb, dev, ntohs(proto), + res = dev->hard_header(skb, dev, ntohs(proto), &addr, NULL, len); /* Poke in our control byte and port number. Hack, hack. */ @@ -372,7 +372,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, } else if (res < 0) goto out_free; } - + /* Copy the data. Returns -EFAULT on error */ err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); skb->protocol = proto; @@ -380,15 +380,15 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, skb->priority = sk->sk_priority; if (err) goto out_free; - + err = -ENETDOWN; if (!(dev->flags & IFF_UP)) goto out_free; - + /* * Now send it */ - + dev_queue_xmit(skb); dev_put(dev); mutex_unlock(&econet_mutex); @@ -414,7 +414,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, mutex_unlock(&econet_mutex); return -ENETDOWN; /* No socket - can't send */ } - + /* Make up a UDP datagram and hand it off to some higher intellect. */ memset(&udpdest, 0, sizeof(udpdest)); @@ -432,7 +432,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, idev = __in_dev_get_rcu(dev); if (idev) { if (idev->ifa_list) - network = ntohl(idev->ifa_list->ifa_address) & + network = ntohl(idev->ifa_list->ifa_address) & 0xffffff00; /* !!! */ } rcu_read_unlock(); @@ -470,7 +470,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, } /* Get a skbuff (no data, just holds our cb information) */ - if ((skb = sock_alloc_send_skb(sk, 0, + if ((skb = sock_alloc_send_skb(sk, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) { mutex_unlock(&econet_mutex); @@ -660,7 +660,7 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) return -EFAULT; - if ((dev = dev_get_by_name(ifr.ifr_name)) == NULL) + if ((dev = dev_get_by_name(ifr.ifr_name)) == NULL) return -ENODEV; sec = (struct sockaddr_ec *)&ifr.ifr_addr; @@ -754,7 +754,7 @@ static const struct proto_ops econet_ops = { .connect = sock_no_connect, .socketpair = sock_no_socketpair, .accept = sock_no_accept, - .getname = econet_getname, + .getname = econet_getname, .poll = datagram_poll, .ioctl = econet_ioctl, .listen = sock_no_listen, @@ -780,7 +780,7 @@ static struct sock *ec_listening_socket(unsigned char port, unsigned char sk_for_each(sk, node, &econet_sklist) { struct econet_sock *opt = ec_sk(sk); - if ((opt->port == port || opt->port == 0) && + if ((opt->port == port || opt->port == 0) && (opt->station == station || opt->station == 0) && (opt->net == net || opt->net == 0)) goto found; @@ -815,7 +815,7 @@ static int ec_queue_packet(struct sock *sk, struct sk_buff *skb, #ifdef CONFIG_ECONET_AUNUDP /* - * Send an AUN protocol response. + * Send an AUN protocol response. */ static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb) @@ -828,7 +828,7 @@ static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb) struct aunhdr ah = {.code = code, .cb = cb, .handle = seq}; struct kvec iov = {.iov_base = (void *)&ah, .iov_len = sizeof(ah)}; struct msghdr udpmsg; - + udpmsg.msg_name = (void *)&sin; udpmsg.msg_namelen = sizeof(sin); udpmsg.msg_control = NULL; @@ -858,7 +858,7 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) if ((sk = ec_listening_socket(ah->port, stn, edev->net)) == NULL) goto bad; /* Nobody wants it */ - newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15, + newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15, GFP_ATOMIC); if (newskb == NULL) { @@ -867,7 +867,7 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) goto bad; } - memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah+1), + memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah+1), len - sizeof(struct aunhdr)); if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port)) @@ -990,7 +990,7 @@ static void ab_cleanup(unsigned long h) struct ec_cb *eb = (struct ec_cb *)&skb->cb; if ((jiffies - eb->start) > eb->timeout) { - tx_result(skb->sk, eb->cookie, + tx_result(skb->sk, eb->cookie, ECTYPE_TRANSMIT_NOT_PRESENT); skb_unlink(skb, &aun_queue); kfree_skb(skb); @@ -1024,11 +1024,11 @@ static int __init aun_udp_initialise(void) printk("AUN: socket error %d\n", -error); return error; } - + udpsock->sk->sk_reuse = 1; udpsock->sk->sk_allocation = GFP_ATOMIC; /* we're going to call it from interrupts */ - + error = udpsock->ops->bind(udpsock, (struct sockaddr *)&sin, sizeof(sin)); if (error < 0) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 2d31bf3..766a0b5 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -12,14 +12,14 @@ * Mark Evans, <evansmp@uhura.aston.ac.uk> * Florian La Roche, <rzsfl@rz.uni-sb.de> * Alan Cox, <gw4pts@gw4pts.ampr.org> - * + * * Fixes: * Mr Linux : Arp problems * Alan Cox : Generic queue tidyup (very tiny here) * Alan Cox : eth_header ntohs should be htons * Alan Cox : eth_rebuild_header missing an htons and * minor other things. - * Tegge : Arp bug fixes. + * Tegge : Arp bug fixes. * Florian : Removed many unnecessary functions, code cleanup * and changes for new arp and skbuff. * Alan Cox : Redid header building to reflect new format. @@ -307,9 +307,9 @@ void ether_setup(struct net_device *dev) dev->hard_header_len = ETH_HLEN; dev->mtu = ETH_DATA_LEN; dev->addr_len = ETH_ALEN; - dev->tx_queue_len = 1000; /* Ethernet wants good queues */ + dev->tx_queue_len = 1000; /* Ethernet wants good queues */ dev->flags = IFF_BROADCAST|IFF_MULTICAST; - + memset(dev->broadcast, 0xFF, ETH_ALEN); } diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index 7a95c3d..ec6d885 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c @@ -97,7 +97,7 @@ static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len, struct prism2_wep_data *wep = priv; u32 klen, len; u8 *pos; - + if (skb_headroom(skb) < 4 || skb->len < hdr_len) return -1; @@ -146,17 +146,17 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) /* other checks are in prism2_wep_build_iv */ if (skb_tailroom(skb) < 4) return -1; - + /* add the IV to the frame */ if (prism2_wep_build_iv(skb, hdr_len, NULL, 0, priv)) return -1; - + /* Copy the IV into the first 3 bytes of the key */ memcpy(key, skb->data + hdr_len, 3); /* Copy rest of the WEP key (the secret part) */ memcpy(key + 3, wep->key, wep->key_len); - + len = skb->len - hdr_len - 4; pos = skb->data + hdr_len + 4; klen = 3 + wep->key_len; diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index d97e541..4084909 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c @@ -663,7 +663,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, * any security data (IV, ICV, etc) that was left behind */ if (!can_be_decrypted && (fc & IEEE80211_FCTL_PROTECTED) && ieee->host_strip_iv_icv) { - int trimlen = 0; + int trimlen = 0; /* Top two-bits of byte 3 are the key index */ if (skb->len >= hdrlen + 3) @@ -852,7 +852,7 @@ void ieee80211_rx_any(struct ieee80211_device *ieee, if ((fc & IEEE80211_FCTL_VERS) != 0) goto drop_free; - + switch (fc & IEEE80211_FCTL_FTYPE) { case IEEE80211_FTYPE_MGMT: if (skb->len < sizeof(struct ieee80211_hdr_3addr)) @@ -1489,7 +1489,7 @@ static void update_network(struct ieee80211_network *dst, /* We only update the statistics if they were created by receiving * the network information on the actual channel the network is on. - * + * * This keeps beacons received on neighbor channels from bringing * down the signal level of an AP. */ if (dst->channel == src->stats.received_channel) diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 854fc13..c55949e 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c @@ -54,7 +54,7 @@ Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | | | tion | (BSSID) | | | ence | data | | `--------------------------------------------------| |------' Total: 28 non-data bytes `----.----' - | + | .- 'Frame data' expands, if WEP enabled, to <----------' | V @@ -64,8 +64,8 @@ Bytes | 4 | 0-2296 | 4 | Desc. | IV | Encrypted | ICV | | | Packet | | `-----| |-----' - `-----.-----' - | + `-----.-----' + | .- 'Encrypted Packet' expands to | V diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 5cb9cfd..40d7a55 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c @@ -754,7 +754,7 @@ int ieee80211_wx_set_auth(struct net_device *dev, int err = 0; spin_lock_irqsave(&ieee->lock, flags); - + switch (wrqu->param.flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: case IW_AUTH_CIPHER_PAIRWISE: @@ -799,7 +799,7 @@ int ieee80211_wx_get_auth(struct net_device *dev, int err = 0; spin_lock_irqsave(&ieee->lock, flags); - + switch (wrqu->param.flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: case IW_AUTH_CIPHER_PAIRWISE: diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index a824852..cc8110b 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c @@ -30,7 +30,7 @@ * Overview * * Before you can associate, you have to authenticate. - * + * */ /* Sends out an association request to the desired AP */ @@ -41,10 +41,10 @@ ieee80211softmac_assoc(struct ieee80211softmac_device *mac, struct ieee80211soft /* Switch to correct channel for this network */ mac->set_channel(mac->dev, net->channel); - + /* Send association request */ ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_ASSOC_REQ, 0); - + dprintk(KERN_INFO PFX "sent association request!\n"); spin_lock_irqsave(&mac->lock, flags); @@ -153,7 +153,7 @@ network_matches_request(struct ieee80211softmac_device *mac, struct ieee80211_ne } /* if 'ANY' network requested, take any that doesn't have privacy enabled */ - if (mac->associnfo.req_essid.len == 0 + if (mac->associnfo.req_essid.len == 0 && !(net->capability & WLAN_CAPABILITY_PRIVACY)) return 1; if (net->ssid_len != mac->associnfo.req_essid.len) @@ -212,8 +212,8 @@ ieee80211softmac_assoc_work(struct work_struct *work) /* try to find the requested network in our list, if we found one already */ if (bssvalid || mac->associnfo.bssfixed) - found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); - + found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); + /* Search the ieee80211 networks for this network if we didn't find it by bssid, * but only if we've scanned at least once (to get a better list of networks to * select from). If we have not scanned before, the !found logic below will be @@ -265,7 +265,7 @@ ieee80211softmac_assoc_work(struct work_struct *work) if (mac->associnfo.scan_retry > 0) { mac->associnfo.scan_retry--; - /* We know of no such network. Let's scan. + /* We know of no such network. Let's scan. * NB: this also happens if we had no memory to copy the network info... * Maybe we can hope to have more memory after scanning finishes ;) */ @@ -353,7 +353,7 @@ ieee80211softmac_associated(struct ieee80211softmac_device *mac, mac->set_bssid_filter(mac->dev, net->bssid); memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN); netif_carrier_on(mac->dev); - + mac->association_id = le16_to_cpup(&resp->aid); } @@ -374,7 +374,7 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev, if (unlikely(!mac->running)) return -ENODEV; - + spin_lock_irqsave(&mac->lock, flags); if (!mac->associnfo.associating) { @@ -426,7 +426,7 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev, mac->associnfo.associated = 0; ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, network); } - + spin_unlock_irqrestore(&mac->lock, flags); return 0; } diff --git a/net/ieee80211/softmac/ieee80211softmac_auth.c b/net/ieee80211/softmac/ieee80211softmac_auth.c index 8ed3e59..826c32d 100644 --- a/net/ieee80211/softmac/ieee80211softmac_auth.c +++ b/net/ieee80211/softmac/ieee80211softmac_auth.c @@ -30,12 +30,12 @@ static void ieee80211softmac_auth_queue(struct work_struct *work); /* Queues an auth request to the desired AP */ int -ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, +ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net) { struct ieee80211softmac_auth_queue_item *auth; unsigned long flags; - + if (net->authenticating || net->authenticated) return 0; net->authenticating = 1; @@ -55,7 +55,7 @@ ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, auth->retry = IEEE80211SOFTMAC_AUTH_RETRY_LIMIT; auth->state = IEEE80211SOFTMAC_AUTH_OPEN_REQUEST; INIT_DELAYED_WORK(&auth->work, ieee80211softmac_auth_queue); - + /* Lock (for list) */ spin_lock_irqsave(&mac->lock, flags); @@ -63,7 +63,7 @@ ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, list_add_tail(&auth->list, &mac->auth_queue); schedule_delayed_work(&auth->work, 0); spin_unlock_irqrestore(&mac->lock, flags); - + return 0; } @@ -85,7 +85,7 @@ ieee80211softmac_auth_queue(struct work_struct *work) if(auth->retry > 0) { /* Switch to correct channel for this network */ mac->set_channel(mac->dev, net->channel); - + /* Lock and set flags */ spin_lock_irqsave(&mac->lock, flags); if (unlikely(!mac->running)) { @@ -130,11 +130,11 @@ ieee80211softmac_auth_challenge_response(struct work_struct *work) } /* Handle the auth response from the AP - * This should be registered with ieee80211 as handle_auth + * This should be registered with ieee80211 as handle_auth */ -int +int ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) -{ +{ struct list_head *list_ptr; struct ieee80211softmac_device *mac = ieee80211_priv(dev); @@ -142,7 +142,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) struct ieee80211softmac_network *net = NULL; unsigned long flags; u8 * data; - + if (unlikely(!mac->running)) return -ENODEV; @@ -157,15 +157,15 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) aq = NULL; } spin_unlock_irqrestore(&mac->lock, flags); - + /* Make sure that we've got an auth queue item for this request */ if(aq == NULL) { dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2)); /* Error #? */ return -1; - } - + } + /* Check for out of order authentication */ if(!net->authenticating) { @@ -182,10 +182,10 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) case WLAN_STATUS_SUCCESS: /* Update the status to Authenticated */ spin_lock_irqsave(&mac->lock, flags); - net->authenticating = 0; + net->authenticating = 0; net->authenticated = 1; spin_unlock_irqrestore(&mac->lock, flags); - + /* Send event */ printkl(KERN_NOTICE PFX "Open Authentication completed with "MAC_FMT"\n", MAC_ARG(net->bssid)); ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net); @@ -196,8 +196,8 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) net->authenticated = 0; net->authenticating = 0; spin_unlock_irqrestore(&mac->lock, flags); - - printkl(KERN_NOTICE PFX "Open Authentication with "MAC_FMT" failed, error code: %i\n", + + printkl(KERN_NOTICE PFX "Open Authentication with "MAC_FMT" failed, error code: %i\n", MAC_ARG(net->bssid), le16_to_cpup(&auth->status)); /* Count the error? */ break; @@ -212,11 +212,11 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) data = (u8 *)auth->info_element; if (*data++ != MFIE_TYPE_CHALLENGE) { printkl(KERN_NOTICE PFX "Shared Key Authentication failed due to a missing challenge.\n"); - break; + break; } /* Save the challenge */ spin_lock_irqsave(&mac->lock, flags); - net->challenge_len = *data++; + net->challenge_len = *data++; if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN) net->challenge_len = WLAN_AUTH_CHALLENGE_LEN; kfree(net->challenge); @@ -229,7 +229,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) spin_unlock_irqrestore(&mac->lock, flags); break; } - aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; + aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; /* We reuse the work struct from the auth request here. * It is safe to do so as each one is per-request, and @@ -248,22 +248,22 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) /* Check the status code of the response */ switch(auth->status) { case WLAN_STATUS_SUCCESS: - /* Update the status to Authenticated */ + /* Update the status to Authenticated */ spin_lock_irqsave(&mac->lock, flags); net->authenticating = 0; net->authenticated = 1; spin_unlock_irqrestore(&mac->lock, flags); - printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n", + printkl(KERN_NOTICE PFX "Shared Key Authentication completed with "MAC_FMT"\n", MAC_ARG(net->bssid)); ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_AUTHENTICATED, net); break; default: - printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n", + printkl(KERN_NOTICE PFX "Shared Key Authentication with "MAC_FMT" failed, error code: %i\n", MAC_ARG(net->bssid), le16_to_cpup(&auth->status)); /* Lock and reset flags */ spin_lock_irqsave(&mac->lock, flags); - net->authenticating = 0; - net->authenticated = 0; + net->authenticating = 0; + net->authenticated = 0; spin_unlock_irqrestore(&mac->lock, flags); /* Count the error? */ break; @@ -277,7 +277,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) goto free_aq; break; default: - /* ERROR */ + /* ERROR */ goto free_aq; break; } @@ -313,7 +313,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac, spin_lock_irqsave(&mac->lock, flags); net->authenticating = 0; net->authenticated = 0; - + /* Find correct auth queue item, if it exists */ list_for_each(list_ptr, &mac->auth_queue) { aq = list_entry(list_ptr, struct ieee80211softmac_auth_queue_item, list); @@ -322,7 +322,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac, else aq = NULL; } - + /* Cancel pending work */ if(aq != NULL) /* Not entirely safe? What about running work? */ @@ -333,7 +333,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac, if(net->challenge != NULL) kfree(net->challenge); kfree(net); - + /* can't transmit data right now... */ netif_carrier_off(mac->dev); spin_unlock_irqrestore(&mac->lock, flags); @@ -341,15 +341,15 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac, ieee80211softmac_try_reassoc(mac); } -/* +/* * Sends a deauth request to the desired AP */ -int -ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, +int +ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, int reason) { int ret; - + /* Make sure the network is authenticated */ if (!net->authenticated) { @@ -357,25 +357,25 @@ ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, /* Error okay? */ return -EPERM; } - + /* Send the de-auth packet */ if((ret = ieee80211softmac_send_mgt_frame(mac, net, IEEE80211_STYPE_DEAUTH, reason))) return ret; - + ieee80211softmac_deauth_from_net(mac, net); return 0; } - + /* * This should be registered with ieee80211 as handle_deauth */ -int +int ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *deauth) { - + struct ieee80211softmac_network *net = NULL; struct ieee80211softmac_device *mac = ieee80211_priv(dev); - + if (unlikely(!mac->running)) return -ENODEV; @@ -385,7 +385,7 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de } net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2); - + if (net == NULL) { dprintkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n", MAC_ARG(deauth->header.addr2)); diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c index b901565..b3e33a4 100644 --- a/net/ieee80211/softmac/ieee80211softmac_event.c +++ b/net/ieee80211/softmac/ieee80211softmac_event.c @@ -79,7 +79,7 @@ ieee80211softmac_notify_callback(struct work_struct *work) container_of(work, struct ieee80211softmac_event, work.work); struct ieee80211softmac_event event = *pevent; kfree(pevent); - + event.fun(event.mac->dev, event.event_type, event.context); } @@ -92,14 +92,14 @@ ieee80211softmac_notify_internal(struct ieee80211softmac_device *mac, if (event < -1 || event > IEEE80211SOFTMAC_EVENT_LAST) return -ENOSYS; - + if (!fun) return -EINVAL; - + eventptr = kmalloc(sizeof(struct ieee80211softmac_event), gfp_mask); if (!eventptr) return -ENOMEM; - + eventptr->event_type = event; INIT_DELAYED_WORK(&eventptr->work, ieee80211softmac_notify_callback); eventptr->fun = fun; @@ -122,7 +122,7 @@ ieee80211softmac_notify_gfp(struct net_device *dev, if (event < 0 || event > IEEE80211SOFTMAC_EVENT_LAST) return -ENOSYS; - + return ieee80211softmac_notify_internal(mac, event, NULL, fun, context, gfp_mask); } EXPORT_SYMBOL_GPL(ieee80211softmac_notify_gfp); @@ -133,7 +133,7 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int eve { struct ieee80211softmac_event *eventptr, *tmp; struct ieee80211softmac_network *network; - + if (event >= 0) { union iwreq_data wrqu; int we_event; diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c index b969310..26c3525 100644 --- a/net/ieee80211/softmac/ieee80211softmac_io.c +++ b/net/ieee80211/softmac/ieee80211softmac_io.c @@ -1,4 +1,4 @@ -/* +/* * Some parts based on code from net80211 * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -29,14 +29,14 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * */ #include "ieee80211softmac_priv.h" /* Helper functions for inserting data into the frames */ -/* +/* * Adds an ESSID element to the frame * */ @@ -53,7 +53,7 @@ ieee80211softmac_add_essid(u8 *dst, struct ieee80211softmac_essid *essid) *dst++ = 0; return dst; } -} +} /* Adds Supported Rates and if required Extended Rates Information Element * to the frame, ASSUMES WE HAVE A SORTED LIST OF RATES */ @@ -81,18 +81,18 @@ ieee80211softmac_frame_add_rates(u8 *dst, const struct ieee80211softmac_ratesinf memcpy(dst, r->rates + cck_len, ofdm_len); dst += ofdm_len; } - } + } return dst; } /* Allocate a management frame */ -static u8 * +static u8 * ieee80211softmac_alloc_mgt(u32 size) { u8 * data; - + /* Add the header and FCS to the size */ - size = size + IEEE80211_3ADDR_LEN; + size = size + IEEE80211_3ADDR_LEN; if(size > IEEE80211_DATA_LEN) return NULL; /* Allocate the frame */ @@ -103,13 +103,13 @@ ieee80211softmac_alloc_mgt(u32 size) /* * Add a 2 Address Header */ -static void +static void ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac, struct ieee80211_hdr_2addr *header, u32 type, u8 *dest) { /* Fill in the frame control flags */ header->frame_ctl = cpu_to_le16(type); - /* Control packets always have WEP turned off */ + /* Control packets always have WEP turned off */ if(type > IEEE80211_STYPE_CFENDACK && type < IEEE80211_STYPE_PSPOLL) header->frame_ctl |= mac->ieee->sec.level ? cpu_to_le16(IEEE80211_FCTL_PROTECTED) : 0; @@ -130,13 +130,13 @@ ieee80211softmac_hdr_2addr(struct ieee80211softmac_device *mac, /* Add a 3 Address Header */ -static void +static void ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac, struct ieee80211_hdr_3addr *header, u32 type, u8 *dest, u8 *bssid) { /* This is common with 2addr, so use that instead */ - ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest); - + ieee80211softmac_hdr_2addr(mac, (struct ieee80211_hdr_2addr *)header, type, dest); + /* Fill in the BSS ID */ if(bssid == NULL) memset(header->addr3, 0xFF, ETH_ALEN); @@ -201,11 +201,11 @@ ieee80211softmac_capabilities(struct ieee80211softmac_device *mac, /***************************************************************************** * Create Management packets - *****************************************************************************/ + *****************************************************************************/ /* Creates an association request packet */ static u32 -ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, +ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net) { u8 *data; @@ -233,7 +233,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, /* Fill in Listen Interval (?) */ (*pkt)->listen_interval = cpu_to_le16(10); - + data = (u8 *)(*pkt)->info_element; /* Add SSID */ data = ieee80211softmac_add_essid(data, &net->essid); @@ -250,7 +250,7 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, /* Create a reassociation request packet */ static u32 -ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, +ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net) { u8 *data; @@ -263,9 +263,9 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, /* Rates IE */ 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN + /* Extended Rates IE */ - 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN + 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN /* Other IE's? */ - ); + ); if (unlikely((*pkt) == NULL)) return 0; ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid); @@ -277,10 +277,10 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, (*pkt)->listen_interval = cpu_to_le16(10); /* Fill in the current AP MAC */ memcpy((*pkt)->current_ap, mac->ieee->bssid, ETH_ALEN); - + data = (u8 *)(*pkt)->info_element; /* Add SSID */ - data = ieee80211softmac_add_essid(data, &net->essid); + data = ieee80211softmac_add_essid(data, &net->essid); /* Add Rates */ data = ieee80211softmac_frame_add_rates(data, &mac->ratesinfo); /* Return packet size */ @@ -289,7 +289,7 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, /* Create an authentication packet */ static u32 -ieee80211softmac_auth(struct ieee80211_auth **pkt, +ieee80211softmac_auth(struct ieee80211_auth **pkt, struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, u16 transaction, u16 status, int *encrypt_mpdu) { @@ -309,20 +309,20 @@ ieee80211softmac_auth(struct ieee80211_auth **pkt, if (unlikely((*pkt) == NULL)) return 0; ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid); - + /* Algorithm */ (*pkt)->algorithm = cpu_to_le16(auth_mode); /* Transaction */ (*pkt)->transaction = cpu_to_le16(transaction); /* Status */ (*pkt)->status = cpu_to_le16(status); - + data = (u8 *)(*pkt)->info_element; /* Challenge Text */ if (is_shared_response) { *data = MFIE_TYPE_CHALLENGE; data++; - + /* Copy the challenge in */ *data = net->challenge_len; data++; @@ -360,7 +360,7 @@ static u32 ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt, struct ieee80211softmac_device *mac, struct ieee80211softmac_essid *essid) { - u8 *data; + u8 *data; /* Allocate Packet */ (*pkt) = (struct ieee80211_probe_request *)ieee80211softmac_alloc_mgt( /* SSID of requested network */ @@ -368,12 +368,12 @@ ieee80211softmac_probe_req(struct ieee80211_probe_request **pkt, /* Rates IE */ 1 + 1 + IEEE80211SOFTMAC_MAX_RATES_LEN + /* Extended Rates IE */ - 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN + 1 + 1 + IEEE80211SOFTMAC_MAX_EX_RATES_LEN ); if (unlikely((*pkt) == NULL)) return 0; ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_REQ, NULL, NULL); - + data = (u8 *)(*pkt)->info_element; /* Add ESSID (can be NULL) */ data = ieee80211softmac_add_essid(data, essid); @@ -401,7 +401,7 @@ ieee80211softmac_probe_resp(struct ieee80211_probe_response **pkt, 2 + /* DS Parameter Set */ 8 + /* CF Parameter Set */ 4 /* IBSS Parameter Set */ - ); + ); if (unlikely((*pkt) == NULL)) return 0; ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_PROBE_RESP, net->bssid, net->bssid); @@ -445,15 +445,15 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, pkt_size = ieee80211softmac_probe_resp((struct ieee80211_probe_response **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg); break; default: - printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type); - return -EINVAL; + printkl(KERN_DEBUG PFX "Unsupported Management Frame type: %i\n", type); + return -EINVAL; }; if(pkt_size == 0 || pkt == NULL) { printkl(KERN_DEBUG PFX "Error, packet is nonexistant or 0 length\n"); return -ENOMEM; } - + /* Send the packet to the ieee80211 layer for tx */ /* we defined softmac->mgmt_xmit for this. Should we keep it * as it is (that means we'd need to wrap this into a txb), diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index 256207b..4f8c3ef 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c @@ -32,19 +32,19 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv) { struct ieee80211softmac_device *softmac; struct net_device *dev; - + dev = alloc_ieee80211(sizeof(struct ieee80211softmac_device) + sizeof_priv); softmac = ieee80211_priv(dev); softmac->dev = dev; softmac->ieee = netdev_priv(dev); spin_lock_init(&softmac->lock); - + softmac->ieee->handle_auth = ieee80211softmac_auth_resp; softmac->ieee->handle_deauth = ieee80211softmac_deauth_resp; softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response; softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req; softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; - softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon; + softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon; softmac->scaninfo = NULL; softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; @@ -66,37 +66,37 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv) /* to start with, we can't send anything ... */ netif_carrier_off(dev); - + return dev; } EXPORT_SYMBOL_GPL(alloc_ieee80211softmac); /* Clears the pending work queue items, stops all scans, etc. */ -void +void ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm) { unsigned long flags; struct ieee80211softmac_event *eventptr, *eventtmp; struct ieee80211softmac_auth_queue_item *authptr, *authtmp; struct ieee80211softmac_network *netptr, *nettmp; - + ieee80211softmac_stop_scan(sm); ieee80211softmac_wait_for_scan(sm); - + spin_lock_irqsave(&sm->lock, flags); sm->running = 0; /* Free all pending assoc work items */ cancel_delayed_work(&sm->associnfo.work); - + /* Free all pending scan work items */ if(sm->scaninfo != NULL) - cancel_delayed_work(&sm->scaninfo->softmac_scan); - + cancel_delayed_work(&sm->scaninfo->softmac_scan); + /* Free all pending auth work items */ list_for_each_entry(authptr, &sm->auth_queue, list) cancel_delayed_work(&authptr->work); - + /* delete all pending event calls and work items */ list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list) cancel_delayed_work(&eventptr->work); @@ -111,13 +111,13 @@ ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm) list_del(&authptr->list); kfree(authptr); } - + /* delete all pending event calls and work items */ list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list) { list_del(&eventptr->list); kfree(eventptr); } - + /* Free all networks */ list_for_each_entry_safe(netptr, nettmp, &sm->network_list, list) { ieee80211softmac_del_network_locked(sm, netptr); @@ -133,7 +133,7 @@ EXPORT_SYMBOL_GPL(ieee80211softmac_clear_pending_work); void free_ieee80211softmac(struct net_device *dev) { struct ieee80211softmac_device *sm = ieee80211_priv(dev); - ieee80211softmac_clear_pending_work(sm); + ieee80211softmac_clear_pending_work(sm); kfree(sm->scaninfo); kfree(sm->wpa.IE); free_ieee80211(dev); @@ -208,9 +208,9 @@ EXPORT_SYMBOL_GPL(ieee80211softmac_highest_supported_rate); void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, u8 erp_value) { - int use_protection; + int use_protection; int short_preamble; - u32 changes = 0; + u32 changes = 0; /* Barker preamble mode */ short_preamble = ((erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0 @@ -269,7 +269,7 @@ void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac) rates, so 801.11g devices start off at 11M for now. People can manually change it if they really need to, but 11M is more reliable. Note similar logic in - ieee80211softmac_wx_set_rate() */ + ieee80211softmac_wx_set_rate() */ if (ieee->modulation & IEEE80211_CCK_MODULATION) { txrates->user_rate = IEEE80211_CCK_RATE_11MB; } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) { @@ -332,7 +332,7 @@ void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates) { struct ieee80211softmac_device *mac = ieee80211_priv(dev); unsigned long flags; - + spin_lock_irqsave(&mac->lock, flags); memcpy(mac->ratesinfo.rates, rates, count); mac->ratesinfo.count = count; @@ -344,7 +344,7 @@ static u8 raise_rate(struct ieee80211softmac_device *mac, u8 rate) { int i; struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo; - + for (i=0; i<ri->count-1; i++) { if (ri->rates[i] == rate) return ri->rates[i+1]; @@ -357,7 +357,7 @@ u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rat { int i; struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo; - + for (i=delta; i<ri->count; i++) { if (ri->rates[i] == rate) return ri->rates[i-delta]; @@ -438,7 +438,7 @@ ieee80211softmac_create_network(struct ieee80211softmac_device *mac, softnet->channel = net->channel; softnet->essid.len = net->ssid_len; memcpy(softnet->essid.data, net->ssid, softnet->essid.len); - + /* copy rates over */ softnet->supported_rates.count = net->rates_len; memcpy(&softnet->supported_rates.rates[0], net->rates, net->rates_len); @@ -529,7 +529,7 @@ ieee80211softmac_get_network_by_bssid(struct ieee80211softmac_device *mac, { unsigned long flags; struct ieee80211softmac_network *softmac_net; - + spin_lock_irqsave(&mac->lock, flags); softmac_net = ieee80211softmac_get_network_by_bssid_locked(mac, bssid); spin_unlock_irqrestore(&mac->lock, flags); @@ -556,13 +556,13 @@ ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac /* Get a network from the list by ESSID with locking */ struct ieee80211softmac_network * ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac, - struct ieee80211softmac_essid *essid) + struct ieee80211softmac_essid *essid) { unsigned long flags; struct ieee80211softmac_network *softmac_net = NULL; spin_lock_irqsave(&mac->lock, flags); - softmac_net = ieee80211softmac_get_network_by_essid_locked(mac, essid); + softmac_net = ieee80211softmac_get_network_by_essid_locked(mac, essid); spin_unlock_irqrestore(&mac->lock, flags); return softmac_net; } diff --git a/net/ieee80211/softmac/ieee80211softmac_priv.h b/net/ieee80211/softmac/ieee80211softmac_priv.h index 4c2bba3..c43b189 100644 --- a/net/ieee80211/softmac/ieee80211softmac_priv.h +++ b/net/ieee80211/softmac/ieee80211softmac_priv.h @@ -130,7 +130,7 @@ static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate) { return ieee80211softmac_lower_rate_delta(mac, rate, 2); } - + /*** prototypes from _io.c */ int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, @@ -156,7 +156,7 @@ int ieee80211softmac_handle_assoc_response(struct net_device * dev, int ieee80211softmac_handle_disassoc(struct net_device * dev, struct ieee80211_disassoc * disassoc); int ieee80211softmac_handle_reassoc_req(struct net_device * dev, - struct ieee80211_reassoc_request * reassoc); + struct ieee80211_reassoc_request * reassoc); void ieee80211softmac_assoc_timeout(struct work_struct *work); void ieee80211softmac_send_disassoc_req(struct ieee80211softmac_device *mac, u16 reason); void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac); @@ -164,15 +164,15 @@ void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac); /* some helper functions */ static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm) { - return (sm->start_scan == ieee80211softmac_start_scan_implementation) && - (sm->stop_scan == ieee80211softmac_stop_scan_implementation) && + return (sm->start_scan == ieee80211softmac_start_scan_implementation) && + (sm->stop_scan == ieee80211softmac_stop_scan_implementation) && (sm->wait_for_scan == ieee80211softmac_wait_for_scan_implementation); } static inline int ieee80211softmac_scan_sanity_check(struct ieee80211softmac_device *sm) { - return ((sm->start_scan != ieee80211softmac_start_scan_implementation) && - (sm->stop_scan != ieee80211softmac_stop_scan_implementation) && + return ((sm->start_scan != ieee80211softmac_start_scan_implementation) && + (sm->stop_scan != ieee80211softmac_stop_scan_implementation) && (sm->wait_for_scan != ieee80211softmac_wait_for_scan_implementation) ) || ieee80211softmac_scan_handlers_check_self(sm); } diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c index 0c85d6c..abea364 100644 --- a/net/ieee80211/softmac/ieee80211softmac_scan.c +++ b/net/ieee80211/softmac/ieee80211softmac_scan.c @@ -62,12 +62,12 @@ ieee80211softmac_stop_scan(struct ieee80211softmac_device *sm) unsigned long flags; spin_lock_irqsave(&sm->lock, flags); - + if (!sm->scanning) { spin_unlock_irqrestore(&sm->lock, flags); return; } - + spin_unlock_irqrestore(&sm->lock, flags); sm->stop_scan(sm->dev); } @@ -78,12 +78,12 @@ ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *sm) unsigned long flags; spin_lock_irqsave(&sm->lock, flags); - + if (!sm->scanning) { spin_unlock_irqrestore(&sm->lock, flags); return; } - + spin_unlock_irqrestore(&sm->lock, flags); sm->wait_for_scan(sm->dev); } @@ -158,14 +158,14 @@ int ieee80211softmac_start_scan_implementation(struct net_device *dev) { struct ieee80211softmac_device *sm = ieee80211_priv(dev); unsigned long flags; - + if (!(dev->flags & IFF_UP)) return -ENODEV; assert(ieee80211softmac_scan_handlers_check_self(sm)); if (!ieee80211softmac_scan_handlers_check_self(sm)) return -EINVAL; - + spin_lock_irqsave(&sm->lock, flags); /* it looks like we need to hold the lock here * to make sure we don't allocate two of these... */ @@ -241,7 +241,7 @@ void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm) spin_lock_irqsave(&sm->lock, flags); sm->scanning = 0; spin_unlock_irqrestore(&sm->lock, flags); - + if (sm->associnfo.bssvalid) { struct ieee80211softmac_network *net; diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c index fb58e03..c306d52 100644 --- a/net/ieee80211/softmac/ieee80211softmac_wx.c +++ b/net/ieee80211/softmac/ieee80211softmac_wx.c @@ -142,14 +142,14 @@ ieee80211softmac_wx_get_essid(struct net_device *net_dev, /* If all fails, return ANY (empty) */ data->essid.length = 0; data->essid.flags = 0; /* active */ - + /* If we have a statically configured ESSID then return it */ if (sm->associnfo.static_essid) { data->essid.length = sm->associnfo.req_essid.len; data->essid.flags = 1; /* active */ memcpy(extra, sm->associnfo.req_essid.data, sm->associnfo.req_essid.len); } - + /* If we're associating/associated, return that */ if (sm->associnfo.associated || sm->associnfo.associating) { data->essid.length = sm->associnfo.associate_essid.len; @@ -181,7 +181,7 @@ ieee80211softmac_wx_set_rate(struct net_device *net_dev, rates, so 801.11g devices start off at 11M for now. People can manually change it if they really need to, but 11M is more reliable. Note similar logic in - ieee80211softmac_wx_set_rate() */ + ieee80211softmac_wx_set_rate() */ if (ieee->modulation & IEEE80211_CCK_MODULATION) in_rate = 11000000; else @@ -247,7 +247,7 @@ ieee80211softmac_wx_set_rate(struct net_device *net_dev, ieee80211softmac_recalc_txrates(mac); err = 0; -out_unlock: +out_unlock: spin_unlock_irqrestore(&mac->lock, flags); out: return err; @@ -366,7 +366,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev, } else if (is_zero_ether_addr(data->ap_addr.sa_data)) { /* the bssid we have is no longer fixed */ mac->associnfo.bssfixed = 0; - } else { + } else { if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) { if (mac->associnfo.associating || mac->associnfo.associated) { /* bssid unchanged and associated or associating - just return */ @@ -380,7 +380,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev, mac->associnfo.bssfixed = 1; /* queue associate if new bssid or (old one again and not associated) */ schedule_delayed_work(&mac->associnfo.work, 0); - } + } out: mutex_unlock(&mac->associnfo.mutex); @@ -437,7 +437,7 @@ ieee80211softmac_wx_set_genie(struct net_device *dev, mac->wpa.IEbuflen = 0; } - out: + out: spin_unlock_irqrestore(&mac->lock, flags); mutex_unlock(&mac->associnfo.mutex); @@ -458,9 +458,9 @@ ieee80211softmac_wx_get_genie(struct net_device *dev, mutex_lock(&mac->associnfo.mutex); spin_lock_irqsave(&mac->lock, flags); - + wrqu->data.length = 0; - + if (mac->wpa.IE && mac->wpa.IElen) { wrqu->data.length = mac->wpa.IElen; if (mac->wpa.IElen <= space) diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 5750a2b..cf358c8 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -550,7 +550,7 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, if (err < 0) goto out; - sock->state = SS_CONNECTING; + sock->state = SS_CONNECTING; /* Just entered SS_CONNECTING state; the only * difference is that return value in non-blocking @@ -878,36 +878,36 @@ static struct net_proto_family inet_family_ops = { */ static struct inet_protosw inetsw_array[] = { - { - .type = SOCK_STREAM, - .protocol = IPPROTO_TCP, - .prot = &tcp_prot, - .ops = &inet_stream_ops, - .capability = -1, - .no_check = 0, - .flags = INET_PROTOSW_PERMANENT | + { + .type = SOCK_STREAM, + .protocol = IPPROTO_TCP, + .prot = &tcp_prot, + .ops = &inet_stream_ops, + .capability = -1, + .no_check = 0, + .flags = INET_PROTOSW_PERMANENT | INET_PROTOSW_ICSK, - }, - - { - .type = SOCK_DGRAM, - .protocol = IPPROTO_UDP, - .prot = &udp_prot, - .ops = &inet_dgram_ops, - .capability = -1, - .no_check = UDP_CSUM_DEFAULT, - .flags = INET_PROTOSW_PERMANENT, + }, + + { + .type = SOCK_DGRAM, + .protocol = IPPROTO_UDP, + .prot = &udp_prot, + .ops = &inet_dgram_ops, + .capability = -1, + .no_check = UDP_CSUM_DEFAULT, + .flags = INET_PROTOSW_PERMANENT, }, - + { - .type = SOCK_RAW, - .protocol = IPPROTO_IP, /* wild card */ - .prot = &raw_prot, - .ops = &inet_sockraw_ops, - .capability = CAP_NET_RAW, - .no_check = UDP_CSUM_DEFAULT, - .flags = INET_PROTOSW_REUSE, + .type = SOCK_RAW, + .protocol = IPPROTO_IP, /* wild card */ + .prot = &raw_prot, + .ops = &inet_sockraw_ops, + .capability = CAP_NET_RAW, + .no_check = UDP_CSUM_DEFAULT, + .flags = INET_PROTOSW_REUSE, } }; @@ -946,7 +946,7 @@ void inet_register_protosw(struct inet_protosw *p) /* Add the new entry after the last permanent entry if any, so that * the new entry does not override a permanent entry when matched with * a wild-card protocol. But it is allowed to override any existing - * non-permanent entry. This means that when we remove this entry, the + * non-permanent entry. This means that when we remove this entry, the * system automatically returns to the old behavior. */ list_add_rcu(&p->list, last_perm); @@ -1073,7 +1073,7 @@ int inet_sk_rebuild_header(struct sock *sk) }, }, }; - + security_sk_classify_flow(sk, &fl); err = ip_route_output_flow(&rt, &fl, sk, 0); } @@ -1273,10 +1273,10 @@ static int __init inet_init(void) goto out_unregister_udp_proto; /* - * Tell SOCKET that we are alive... + * Tell SOCKET that we are alive... */ - (void)sock_register(&inet_family_ops); + (void)sock_register(&inet_family_ops); /* * Add all the base protocols. @@ -1306,9 +1306,9 @@ static int __init inet_init(void) arp_init(); - /* - * Set the IP module up - */ + /* + * Set the IP module up + */ ip_init(); @@ -1334,11 +1334,11 @@ static int __init inet_init(void) #endif /* * Initialise per-cpu ipv4 mibs - */ + */ if(init_ipv4_mibs()) printk(KERN_CRIT "inet_init: Cannot init ipv4 mibs\n"); ; - + ipv4_proc_init(); ipfrag_init(); diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 67a5509..7194eb4 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c @@ -91,7 +91,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb) top_iph->check = 0; ahp = x->data; - ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + + ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len) >> 2) - 2; ah->reserved = 0; @@ -135,9 +135,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) ah = (struct ip_auth_hdr*)skb->data; ahp = x->data; ah_hlen = (ah->hdrlen + 2) << 2; - + if (ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_full_len) && - ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len)) + ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len)) goto out; if (!pskb_may_pull(skb, ah_hlen)) @@ -166,9 +166,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) if (ip_clear_mutable_options(iph, &dummy)) goto out; } - { + { u8 auth_data[MAX_AH_AUTH_LEN]; - + memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); skb_push(skb, ihl); err = ah_mac_digest(ahp, skb, ah->auth_data); @@ -237,7 +237,7 @@ static int ah_init_state(struct xfrm_state *x) ahp->tfm = tfm; if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len)) goto error; - + /* * Lookup the algorithm description maintained by xfrm_algo, * verify crypto transform properties, and store information @@ -254,16 +254,16 @@ static int ah_init_state(struct xfrm_state *x) aalg_desc->uinfo.auth.icv_fullbits/8); goto error; } - + ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; - + BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); - + ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL); if (!ahp->work_icv) goto error; - + x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len); if (x->props.mode == XFRM_MODE_TUNNEL) x->props.header_len += sizeof(struct iphdr); diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 3981e8b..a58afde 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -15,9 +15,9 @@ * 2 of the License, or (at your option) any later version. * * Fixes: - * Alan Cox : Removed the Ethernet assumptions in + * Alan Cox : Removed the Ethernet assumptions in * Florian's code - * Alan Cox : Fixed some small errors in the ARP + * Alan Cox : Fixed some small errors in the ARP * logic * Alan Cox : Allow >4K in /proc * Alan Cox : Make ARP add its own protocol entry @@ -39,18 +39,18 @@ * Jonathan Naylor : Only lookup the hardware address for * the correct hardware type. * Germano Caronni : Assorted subtle races. - * Craig Schlenter : Don't modify permanent entry + * Craig Schlenter : Don't modify permanent entry * during arp_rcv. * Russ Nelson : Tidied up a few bits. * Alexey Kuznetsov: Major changes to caching and behaviour, - * eg intelligent arp probing and + * eg intelligent arp probing and * generation * of host down events. * Alan Cox : Missing unlock in device events. * Eckes : ARP ioctl control errors. * Alexey Kuznetsov: Arp free fix. * Manuel Rodriguez: Gratuitous ARP. - * Jonathan Layes : Added arpd support through kerneld + * Jonathan Layes : Added arpd support through kerneld * message queue (960314) * Mike Shaver : /proc/sys/net/ipv4/arp_* support * Mike McLagan : Routing by source @@ -210,7 +210,7 @@ int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir) case ARPHRD_FDDI: case ARPHRD_IEEE802: ip_eth_mc_map(addr, haddr); - return 0; + return 0; case ARPHRD_IEEE802_TR: ip_tr_mc_map(addr, haddr); return 0; @@ -288,7 +288,7 @@ static int arp_constructor(struct neighbour *neigh) switch (dev->type) { default: break; - case ARPHRD_ROSE: + case ARPHRD_ROSE: #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) case ARPHRD_AX25: #if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) @@ -425,18 +425,18 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, .saddr = tip } } }; struct rtable *rt; - int flag = 0; + int flag = 0; /*unsigned long now; */ - if (ip_route_output_key(&rt, &fl) < 0) + if (ip_route_output_key(&rt, &fl) < 0) return 1; - if (rt->u.dst.dev != dev) { + if (rt->u.dst.dev != dev) { NET_INC_STATS_BH(LINUX_MIB_ARPFILTER); flag = 1; - } - ip_rt_put(rt); - return flag; -} + } + ip_rt_put(rt); + return flag; +} /* OBSOLETE FUNCTIONS */ @@ -490,7 +490,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb) n->used = jiffies; if (n->nud_state&NUD_VALID || neigh_event_send(n, skb) == 0) { read_lock_bh(&n->lock); - memcpy(haddr, n->ha, dev->addr_len); + memcpy(haddr, n->ha, dev->addr_len); read_unlock_bh(&n->lock); neigh_release(n); return 0; @@ -572,7 +572,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, /* * Allocate a buffer */ - + skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4) + LL_RESERVED_SPACE(dev), GFP_ATOMIC); if (skb == NULL) @@ -685,7 +685,7 @@ void arp_send(int type, int ptype, __be32 dest_ip, /* * No arp on this interface. */ - + if (dev->flags&IFF_NOARP) return; @@ -725,7 +725,7 @@ static int arp_process(struct sk_buff *skb) arp = skb->nh.arph; switch (dev_type) { - default: + default: if (arp->ar_pro != htons(ETH_P_IP) || htons(dev_type) != arp->ar_hrd) goto out; @@ -792,7 +792,7 @@ static int arp_process(struct sk_buff *skb) tha = arp_ptr; arp_ptr += dev->addr_len; memcpy(&tip, arp_ptr, 4); -/* +/* * Check for bad requests for 127.x.x.x and requests for multicast * addresses. If this is one such, delete it. */ @@ -809,16 +809,16 @@ static int arp_process(struct sk_buff *skb) * Process entry. The idea here is we want to send a reply if it is a * request for us or if it is a request for someone else that we hold * a proxy for. We want to add an entry to our cache if it is a reply - * to us or if it is a request for our address. - * (The assumption for this last is that if someone is requesting our - * address, they are probably intending to talk to us, so it saves time - * if we cache their address. Their address is also probably not in + * to us or if it is a request for our address. + * (The assumption for this last is that if someone is requesting our + * address, they are probably intending to talk to us, so it saves time + * if we cache their address. Their address is also probably not in * our cache, since ours is not in their cache.) - * + * * Putting this another way, we only care about replies if they are to * us, in which case we add them to the cache. For requests, we care * about those for us and those for our proxies. We reply to both, - * and in the case of requests for us we add the requester to the arp + * and in the case of requests for us we add the requester to the arp * cache. */ @@ -845,7 +845,7 @@ static int arp_process(struct sk_buff *skb) if (!dont_send) dont_send |= arp_ignore(in_dev,dev,sip,tip); if (!dont_send && IN_DEV_ARPFILTER(in_dev)) - dont_send |= arp_filter(sip,tip,dev); + dont_send |= arp_filter(sip,tip,dev); if (!dont_send) arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); @@ -860,7 +860,7 @@ static int arp_process(struct sk_buff *skb) if (n) neigh_release(n); - if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED || + if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED || skb->pkt_type == PACKET_HOST || in_dev->arp_parms->proxy_delay == 0) { arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); @@ -1039,7 +1039,7 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev) if (r->arp_flags & ATF_PERM) state = NUD_PERMANENT; err = neigh_update(neigh, (r->arp_flags&ATF_COM) ? - r->arp_ha.sa_data : NULL, state, + r->arp_ha.sa_data : NULL, state, NEIGH_UPDATE_F_OVERRIDE| NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); @@ -1121,7 +1121,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev) neigh = neigh_lookup(&arp_tbl, &ip, dev); if (neigh) { if (neigh->nud_state&~NUD_NOARP) - err = neigh_update(neigh, NULL, NUD_FAILED, + err = neigh_update(neigh, NULL, NUD_FAILED, NEIGH_UPDATE_F_OVERRIDE| NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); @@ -1181,7 +1181,7 @@ int arp_ioctl(unsigned int cmd, void __user *arg) switch(cmd) { case SIOCDARP: - err = arp_req_delete(&r, dev); + err = arp_req_delete(&r, dev); break; case SIOCSARP: err = arp_req_set(&r, dev); @@ -1268,14 +1268,14 @@ static char *ax2asc2(ax25_address *a, char *buf) if (c != ' ') *s++ = c; } - + *s++ = '-'; if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { *s++ = '1'; n -= 10; } - + *s++ = n + '0'; *s++ = '\0'; @@ -1373,7 +1373,7 @@ static int arp_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index 0072d79..dd02a45 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c @@ -29,12 +29,12 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) int oif; int err; - - if (addr_len < sizeof(*usin)) - return -EINVAL; - if (usin->sin_family != AF_INET) - return -EAFNOSUPPORT; + if (addr_len < sizeof(*usin)) + return -EINVAL; + + if (usin->sin_family != AF_INET) + return -EAFNOSUPPORT; sk_dst_reset(sk); @@ -56,8 +56,8 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ip_rt_put(rt); return -EACCES; } - if (!inet->saddr) - inet->saddr = rt->rt_src; /* Update source address */ + if (!inet->saddr) + inet->saddr = rt->rt_src; /* Update source address */ if (!inet->rcv_saddr) inet->rcv_saddr = rt->rt_src; inet->daddr = rt->rt_dst; diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index c402036..ba5e7f4 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -252,7 +252,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, ASSERT_RTNL(); - /* 1. Deleting primary ifaddr forces deletion all secondaries + /* 1. Deleting primary ifaddr forces deletion all secondaries * unless alias promotion is set **/ @@ -260,7 +260,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, struct in_ifaddr **ifap1 = &ifa1->ifa_next; while ((ifa = *ifap1) != NULL) { - if (!(ifa->ifa_flags & IFA_F_SECONDARY) && + if (!(ifa->ifa_flags & IFA_F_SECONDARY) && ifa1->ifa_scope <= ifa->ifa_scope) last_prim = ifa; @@ -583,8 +583,8 @@ static __inline__ int inet_abc_len(__be32 addr) { int rc = -1; /* Something else, probably a multicast. */ - if (ZERONET(addr)) - rc = 0; + if (ZERONET(addr)) + rc = 0; else { __u32 haddr = ntohl(addr); @@ -596,7 +596,7 @@ static __inline__ int inet_abc_len(__be32 addr) rc = 24; } - return rc; + return rc; } @@ -1020,29 +1020,29 @@ int unregister_inetaddr_notifier(struct notifier_block *nb) * alias numbering and to create unique labels if possible. */ static void inetdev_changename(struct net_device *dev, struct in_device *in_dev) -{ +{ struct in_ifaddr *ifa; int named = 0; - for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { - char old[IFNAMSIZ], *dot; + for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { + char old[IFNAMSIZ], *dot; memcpy(old, ifa->ifa_label, IFNAMSIZ); - memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); + memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); if (named++ == 0) continue; dot = strchr(ifa->ifa_label, ':'); - if (dot == NULL) { - sprintf(old, ":%d", named); + if (dot == NULL) { + sprintf(old, ":%d", named); dot = old; } - if (strlen(dot) + strlen(dev->name) < IFNAMSIZ) { - strcat(ifa->ifa_label, dot); - } else { - strcpy(ifa->ifa_label + (IFNAMSIZ - strlen(dot) - 1), dot); - } - } -} + if (strlen(dot) + strlen(dev->name) < IFNAMSIZ) { + strcat(ifa->ifa_label, dot); + } else { + strcpy(ifa->ifa_label + (IFNAMSIZ - strlen(dot) - 1), dot); + } + } +} /* Called only under RTNL semaphore */ @@ -1539,7 +1539,7 @@ static struct devinet_sysctl_table { }, }, .devinet_conf_dir = { - { + { .ctl_name = NET_IPV4_CONF, .procname = "conf", .mode = 0555, @@ -1581,18 +1581,18 @@ static void devinet_sysctl_register(struct in_device *in_dev, } if (dev) { - dev_name = dev->name; + dev_name = dev->name; t->devinet_dev[0].ctl_name = dev->ifindex; } else { dev_name = "default"; t->devinet_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT; } - /* - * Make a copy of dev_name, because '.procname' is regarded as const + /* + * Make a copy of dev_name, because '.procname' is regarded as const * by sysctl and we wouldn't want anyone to change it under our feet * (see SIOCSIFNAME). - */ + */ dev_name = kstrdup(dev_name, GFP_KERNEL); if (!dev_name) goto free; diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index f2c6776..3104112 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -215,7 +215,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) if (padlen+2 >= elen) goto out; - /* ... check padding bits here. Silly. :-) */ + /* ... check padding bits here. Silly. :-) */ iph = skb->nh.iph; ihl = iph->ihl * 4; @@ -236,7 +236,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) ipaddr.a4 = iph->saddr; km_new_mapping(x, &ipaddr, uh->source); - + /* XXX: perhaps add an extra * policy check here, to see * if we should allow or @@ -245,7 +245,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) * address/port. */ } - + /* * 2) ignore UDP/TCP checksums in case * of NAT-T in Transport Mode, or @@ -284,7 +284,7 @@ static u32 esp4_get_max_size(struct xfrm_state *x, int mtu) mtu = ALIGN(mtu + 2, 4) + blksize - 4; break; case XFRM_MODE_BEET: - /* The worst case. */ + /* The worst case. */ enclen = IPV4_BEET_PHMAXLEN; mtu = ALIGN(mtu + enclen + 2, blksize); break; diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index d47b72a..64f31e6 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -160,7 +160,7 @@ unsigned inet_addr_type(__be32 addr) #ifdef CONFIG_IP_MULTIPLE_TABLES res.r = NULL; #endif - + if (ip_fib_local_table) { ret = RTN_UNICAST; if (!ip_fib_local_table->tb_lookup(ip_fib_local_table, @@ -378,7 +378,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, int len = 0; mx = kzalloc(3 * nla_total_size(4), GFP_KERNEL); - if (mx == NULL) + if (mx == NULL) return -ENOMEM; if (rt->rt_flags & RTF_MTU) @@ -400,7 +400,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, /* * Handle IP routing ioctl calls. These are used to manipulate the routing tables */ - + int ip_rt_ioctl(unsigned int cmd, void __user *arg) { struct fib_config cfg; @@ -600,7 +600,7 @@ int inet_dump_fib(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->tb_dump(tb, skb, cb) < 0) goto out; dumped = 1; @@ -766,7 +766,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa) static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb ) { - + struct fib_result res; struct flowi fl = { .mark = frn->fl_mark, .nl_u = { .ip4_u = { .daddr = frn->fl_addr, @@ -791,11 +791,11 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb ) static void nl_fib_input(struct sock *sk, int len) { struct sk_buff *skb = NULL; - struct nlmsghdr *nlh = NULL; + struct nlmsghdr *nlh = NULL; struct fib_result_nl *frn; - u32 pid; + u32 pid; struct fib_table *tb; - + skb = skb_dequeue(&sk->sk_receive_queue); nlh = (struct nlmsghdr *)skb->data; if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || @@ -803,17 +803,17 @@ static void nl_fib_input(struct sock *sk, int len) kfree_skb(skb); return; } - + frn = (struct fib_result_nl *) NLMSG_DATA(nlh); tb = fib_get_table(frn->tb_id_in); nl_fib_lookup(frn, tb); - + pid = nlh->nlmsg_pid; /*pid of sending process */ NETLINK_CB(skb).pid = 0; /* from kernel */ NETLINK_CB(skb).dst_group = 0; /* unicast */ netlink_unicast(sk, skb, pid, MSG_DONTWAIT); -} +} static void nl_fib_lookup_init(void) { diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 648f47c..dea04d7 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c @@ -146,7 +146,7 @@ static void fn_rehash_zone(struct fn_zone *fz) struct hlist_head *ht, *old_ht; int old_divisor, new_divisor; u32 new_hashmask; - + old_divisor = fz->fz_divisor; switch (old_divisor) { @@ -911,7 +911,7 @@ static struct fib_alias *fib_get_next(struct seq_file *seq) if (!iter->zone) goto out; - + iter->bucket = 0; iter->hash_head = iter->zone->fz_hash; @@ -932,7 +932,7 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos) { struct fib_iter_state *iter = seq->private; struct fib_alias *fa; - + if (iter->valid && pos >= iter->pos && iter->genid == fib_hash_genid) { fa = iter->fa; pos -= iter->pos; @@ -981,7 +981,7 @@ static unsigned fib_flag_trans(int type, __be32 mask, struct fib_info *fi) return flags; } -/* +/* * This outputs /proc/net/route. * * It always works in backward compatibility mode. @@ -1040,7 +1040,7 @@ static int fib_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct fib_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index be1028c..2f1fdae 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -85,12 +85,12 @@ for (nhsel=0; nhsel < 1; nhsel++) #define endfor_nexthops(fi) } -static const struct +static const struct { int error; u8 scope; } fib_props[RTA_MAX + 1] = { - { + { .error = 0, .scope = RT_SCOPE_NOWHERE, }, /* RTN_UNSPEC */ @@ -439,7 +439,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) rtnh = cfg->fc_mp; remaining = cfg->fc_mp_len; - + for_nexthops(fi) { int attrlen; @@ -508,9 +508,9 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) Normally it looks as following. {universe prefix} -> (gw, oif) [scope link] - | + | |-> {link prefix} -> (gw, oif) [scope local] - | + | |-> {local prefix} (terminal node) */ @@ -864,7 +864,7 @@ err_inval: err = -EINVAL; failure: - if (fi) { + if (fi) { fi->fib_dead = 1; free_fib_info(fi); } @@ -1049,7 +1049,7 @@ int fib_sync_down(__be32 local, struct net_device *dev, int force) { int ret = 0; int scope = RT_SCOPE_NOWHERE; - + if (force) scope = -1; diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 1e589b9..004a437 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -7,13 +7,13 @@ * Robert Olsson <robert.olsson@its.uu.se> Uppsala Universitet * & Swedish University of Agricultural Sciences. * - * Jens Laas <jens.laas@data.slu.se> Swedish University of + * Jens Laas <jens.laas@data.slu.se> Swedish University of * Agricultural Sciences. - * + * * Hans Liss <hans.liss@its.uu.se> Uppsala Universitet * * This work is based on the LPC-trie which is originally descibed in: - * + * * An experimental study of compression methods for dynamic tries * Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002. * http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/ @@ -224,34 +224,34 @@ static inline int tkey_mismatch(t_key a, int offset, t_key b) } /* - To understand this stuff, an understanding of keys and all their bits is - necessary. Every node in the trie has a key associated with it, but not + To understand this stuff, an understanding of keys and all their bits is + necessary. Every node in the trie has a key associated with it, but not all of the bits in that key are significant. Consider a node 'n' and its parent 'tp'. - If n is a leaf, every bit in its key is significant. Its presence is - necessitated by path compression, since during a tree traversal (when - searching for a leaf - unless we are doing an insertion) we will completely - ignore all skipped bits we encounter. Thus we need to verify, at the end of - a potentially successful search, that we have indeed been walking the + If n is a leaf, every bit in its key is significant. Its presence is + necessitated by path compression, since during a tree traversal (when + searching for a leaf - unless we are doing an insertion) we will completely + ignore all skipped bits we encounter. Thus we need to verify, at the end of + a potentially successful search, that we have indeed been walking the correct key path. - Note that we can never "miss" the correct key in the tree if present by - following the wrong path. Path compression ensures that segments of the key - that are the same for all keys with a given prefix are skipped, but the - skipped part *is* identical for each node in the subtrie below the skipped - bit! trie_insert() in this implementation takes care of that - note the + Note that we can never "miss" the correct key in the tree if present by + following the wrong path. Path compression ensures that segments of the key + that are the same for all keys with a given prefix are skipped, but the + skipped part *is* identical for each node in the subtrie below the skipped + bit! trie_insert() in this implementation takes care of that - note the call to tkey_sub_equals() in trie_insert(). - if n is an internal node - a 'tnode' here, the various parts of its key + if n is an internal node - a 'tnode' here, the various parts of its key have many different meanings. - Example: + Example: _________________________________________________________________ | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | ----------------------------------------------------------------- - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 _________________________________________________________________ | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | @@ -263,23 +263,23 @@ static inline int tkey_mismatch(t_key a, int offset, t_key b) n->pos = 15 n->bits = 4 - First, let's just ignore the bits that come before the parent tp, that is - the bits from 0 to (tp->pos-1). They are *known* but at this point we do + First, let's just ignore the bits that come before the parent tp, that is + the bits from 0 to (tp->pos-1). They are *known* but at this point we do not use them for anything. The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the - index into the parent's child array. That is, they will be used to find + index into the parent's child array. That is, they will be used to find 'n' among tp's children. The bits from (tp->pos + tp->bits) to (n->pos - 1) - "S" - are skipped bits for the node n. - All the bits we have seen so far are significant to the node n. The rest + All the bits we have seen so far are significant to the node n. The rest of the bits are really not needed or indeed known in n->key. - The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into + The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into n's child array, and will of course be different for each child. - + The rest of the bits, from (n->pos + n->bits) onward, are completely unknown at this point. @@ -294,7 +294,7 @@ static inline void check_tnode(const struct tnode *tn) static int halve_threshold = 25; static int inflate_threshold = 50; static int halve_threshold_root = 15; -static int inflate_threshold_root = 25; +static int inflate_threshold_root = 25; static void __alias_free_mem(struct rcu_head *head) @@ -355,7 +355,7 @@ static inline void tnode_free(struct tnode *tn) struct leaf *l = (struct leaf *) tn; call_rcu_bh(&l->rcu, __leaf_free_rcu); } - else + else call_rcu(&tn->rcu, __tnode_free_rcu); } @@ -461,7 +461,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) int inflate_threshold_use; int halve_threshold_use; - if (!tn) + if (!tn) return NULL; pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", @@ -556,7 +556,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) if(!tn->parent) inflate_threshold_use = inflate_threshold_root; - else + else inflate_threshold_use = inflate_threshold; err = 0; @@ -587,7 +587,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) if(!tn->parent) halve_threshold_use = halve_threshold_root; - else + else halve_threshold_use = halve_threshold; err = 0; @@ -665,10 +665,10 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn) right = tnode_new(inode->key|m, inode->pos + 1, inode->bits - 1); - if (!right) { + if (!right) { tnode_free(left); goto nomem; - } + } put_child(t, tn, 2*i, (struct node *) left); put_child(t, tn, 2*i+1, (struct node *) right); @@ -890,23 +890,23 @@ static inline struct list_head * get_fa_head(struct leaf *l, int plen) static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new) { - struct leaf_info *li = NULL, *last = NULL; - struct hlist_node *node; + struct leaf_info *li = NULL, *last = NULL; + struct hlist_node *node; - if (hlist_empty(head)) { - hlist_add_head_rcu(&new->hlist, head); - } else { - hlist_for_each_entry(li, node, head, hlist) { - if (new->plen > li->plen) - break; + if (hlist_empty(head)) { + hlist_add_head_rcu(&new->hlist, head); + } else { + hlist_for_each_entry(li, node, head, hlist) { + if (new->plen > li->plen) + break; - last = li; - } - if (last) - hlist_add_after_rcu(&last->hlist, &new->hlist); - else - hlist_add_before_rcu(&new->hlist, &li->hlist); - } + last = li; + } + if (last) + hlist_add_after_rcu(&last->hlist, &new->hlist); + else + hlist_add_before_rcu(&new->hlist, &li->hlist); + } } /* rcu_read_lock needs to be hold by caller from readside */ @@ -1700,7 +1700,7 @@ static struct leaf *nextleaf(struct trie *t, struct leaf *thisleaf) /* Decend if tnode */ while (IS_TNODE(c)) { p = (struct tnode *) c; - idx = 0; + idx = 0; /* Rightmost non-NULL branch */ if (p && IS_TNODE(p)) @@ -2303,9 +2303,9 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) seq_indent(seq, iter->depth-1); seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n", - NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, + NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, tn->empty_children); - + } else { struct leaf *l = (struct leaf *) n; int i; diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 40cf0d0..4b7a0d9 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -304,7 +304,7 @@ static inline int icmpv4_xrlim_allow(struct rtable *rt, int type, int code) /* No rate limit on loopback */ if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) - goto out; + goto out; /* Limit if icmp type is enabled in ratemask. */ if ((1 << type) & sysctl_icmp_ratemask) @@ -350,9 +350,9 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb; if (ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param, - icmp_param->data_len+icmp_param->head_len, - icmp_param->head_len, - ipc, rt, MSG_DONTWAIT) < 0) + icmp_param->data_len+icmp_param->head_len, + icmp_param->head_len, + ipc, rt, MSG_DONTWAIT) < 0) ip_flush_pending_frames(icmp_socket->sk); else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) { struct icmphdr *icmph = skb->h.icmph; @@ -755,7 +755,7 @@ static void icmp_redirect(struct sk_buff *skb) skb->h.icmph->un.gateway, iph->saddr, skb->dev); break; - } + } out: return; out_err: @@ -959,7 +959,7 @@ int icmp_rcv(struct sk_buff *skb) * Parse the ICMP message */ - if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { + if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { /* * RFC 1122: 3.2.2.6 An ICMP_ECHO to broadcast MAY be * silently ignored (we let user decide with a sysctl). @@ -976,7 +976,7 @@ int icmp_rcv(struct sk_buff *skb) icmph->type != ICMP_ADDRESS && icmph->type != ICMP_ADDRESSREPLY) { goto error; - } + } } ICMP_INC_STATS_BH(icmp_pointers[icmph->type].input_entry); @@ -1085,7 +1085,7 @@ static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = { .input_entry = ICMP_MIB_DUMMY, .handler = icmp_discard, }, - [ICMP_INFO_REPLY] = { + [ICMP_INFO_REPLY] = { .output_entry = ICMP_MIB_DUMMY, .input_entry = ICMP_MIB_DUMMY, .handler = icmp_discard, diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 024ae56..b8e1625 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -35,7 +35,7 @@ * * Chih-Jen Chang : Tried to revise IGMP to Version 2 * Tsu-Sheng Tsao E-mail: chihjenc@scf.usc.edu and tsusheng@scf.usc.edu - * The enhancements are mainly based on Steve Deering's + * The enhancements are mainly based on Steve Deering's * ipmulti-3.5 source code. * Chih-Jen Chang : Added the igmp_get_mrouter_info and * Tsu-Sheng Tsao igmp_set_mrouter_info to keep track of @@ -49,11 +49,11 @@ * Alan Cox : Stop IGMP from 0.0.0.0 being accepted. * Alan Cox : Use GFP_ATOMIC in the right places. * Christian Daudt : igmp timer wasn't set for local group - * memberships but was being deleted, - * which caused a "del_timer() called + * memberships but was being deleted, + * which caused a "del_timer() called * from %p with timer not initialized\n" * message (960131). - * Christian Daudt : removed del_timer from + * Christian Daudt : removed del_timer from * igmp_timer_expire function (960205). * Christian Daudt : igmp_heard_report now only calls * igmp_timer_expire if tm->running is @@ -718,7 +718,7 @@ static void igmp_ifc_event(struct in_device *in_dev) { if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) return; - in_dev->mr_ifc_count = in_dev->mr_qrv ? in_dev->mr_qrv : + in_dev->mr_ifc_count = in_dev->mr_qrv ? in_dev->mr_qrv : IGMP_Unsolicited_Report_Count; igmp_ifc_start_timer(in_dev, 1); } @@ -838,7 +838,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, if (len == 8) { if (ih->code == 0) { /* Alas, old v1 router presents here. */ - + max_delay = IGMP_Query_Response_Interval; in_dev->mr_v1_seen = jiffies + IGMP_V1_Router_Present_Timeout; @@ -860,10 +860,10 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, } else { /* v3 */ if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) return; - + ih3 = (struct igmpv3_query *) skb->h.raw; if (ih3->nsrcs) { - if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) + if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) + ntohs(ih3->nsrcs)*sizeof(__be32))) return; ih3 = (struct igmpv3_query *) skb->h.raw; @@ -909,7 +909,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, else im->gsquery = mark; changed = !im->gsquery || - igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); + igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); spin_unlock_bh(&im->lock); if (changed) igmp_mod_timer(im, max_delay); @@ -1257,9 +1257,9 @@ out: void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) { struct ip_mc_list *i, **ip; - + ASSERT_RTNL(); - + for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { if (i->multiaddr==addr) { if (--i->users == 0) { @@ -1436,7 +1436,7 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, #ifdef CONFIG_IP_MULTICAST if (psf->sf_oldin && !IGMP_V1_SEEN(in_dev) && !IGMP_V2_SEEN(in_dev)) { - psf->sf_crcount = in_dev->mr_qrv ? in_dev->mr_qrv : + psf->sf_crcount = in_dev->mr_qrv ? in_dev->mr_qrv : IGMP_Unsolicited_Report_Count; psf->sf_next = pmc->tomb; pmc->tomb = psf; @@ -1500,7 +1500,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode, /* filter mode change */ pmc->sfmode = MCAST_INCLUDE; #ifdef CONFIG_IP_MULTICAST - pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : + pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : IGMP_Unsolicited_Report_Count; in_dev->mr_ifc_count = pmc->crcount; for (psf=pmc->sources; psf; psf = psf->sf_next) @@ -1679,7 +1679,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, #ifdef CONFIG_IP_MULTICAST /* else no filters; keep old mode for reports */ - pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : + pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : IGMP_Unsolicited_Report_Count; in_dev->mr_ifc_count = pmc->crcount; for (psf=pmc->sources; psf; psf = psf->sf_next) @@ -1873,7 +1873,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct } else if (pmc->sfmode != omode) { /* allow mode switches for empty-set filters */ ip_mc_add_src(in_dev, &mreqs->imr_multiaddr, omode, 0, NULL, 0); - ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, pmc->sfmode, 0, + ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, pmc->sfmode, 0, NULL, 0); pmc->sfmode = omode; } @@ -1899,7 +1899,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct } /* update the interface filter */ - ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, omode, 1, + ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, omode, 1, &mreqs->imr_sourceaddr, 1); for (j=i+1; j<psl->sl_count; j++) @@ -1949,7 +1949,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct psl->sl_count++; err = 0; /* update the interface list */ - ip_mc_add_src(in_dev, &mreqs->imr_multiaddr, omode, 1, + ip_mc_add_src(in_dev, &mreqs->imr_multiaddr, omode, 1, &mreqs->imr_sourceaddr, 1); done: rtnl_unlock(); @@ -2264,7 +2264,7 @@ static inline struct ip_mc_list *igmp_mc_get_first(struct seq_file *seq) struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq); for (state->dev = dev_base, state->in_dev = NULL; - state->dev; + state->dev; state->dev = state->dev->next) { struct in_device *in_dev; in_dev = in_dev_get(state->dev); @@ -2346,7 +2346,7 @@ static void igmp_mc_seq_stop(struct seq_file *seq, void *v) static int igmp_mc_seq_show(struct seq_file *seq, void *v) { if (v == SEQ_START_TOKEN) - seq_puts(seq, + seq_puts(seq, "Idx\tDevice : Count Querier\tGroup Users Timer\tReporter\n"); else { struct ip_mc_list *im = (struct ip_mc_list *)v; @@ -2426,7 +2426,7 @@ static inline struct ip_sf_list *igmp_mcf_get_first(struct seq_file *seq) struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); for (state->dev = dev_base, state->idev = NULL, state->im = NULL; - state->dev; + state->dev; state->dev = state->dev->next) { struct in_device *idev; idev = in_dev_get(state->dev); @@ -2531,7 +2531,7 @@ static int igmp_mcf_seq_show(struct seq_file *seq, void *v) struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); if (v == SEQ_START_TOKEN) { - seq_printf(seq, + seq_printf(seq, "%3s %6s " "%10s %10s %6s %6s\n", "Idx", "Device", "MCA", @@ -2539,8 +2539,8 @@ static int igmp_mcf_seq_show(struct seq_file *seq, void *v) } else { seq_printf(seq, "%3d %6.6s 0x%08x " - "0x%08x %6lu %6lu\n", - state->dev->ifindex, state->dev->name, + "0x%08x %6lu %6lu\n", + state->dev->ifindex, state->dev->name, ntohl(state->im->multiaddr), ntohl(psf->sf_inaddr), psf->sf_count[MCAST_INCLUDE], diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 9d68837..43fb160 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -149,7 +149,7 @@ success: if (!inet_csk(sk)->icsk_bind_hash) inet_bind_hash(sk, tb, snum); BUG_TRAP(inet_csk(sk)->icsk_bind_hash == tb); - ret = 0; + ret = 0; fail_unlock: spin_unlock(&head->lock); @@ -255,7 +255,7 @@ EXPORT_SYMBOL(inet_csk_accept); /* * Using different timers for retransmit, delayed acks and probes - * We may wish use just one timer maintaining a list of expire jiffies + * We may wish use just one timer maintaining a list of expire jiffies * to optimize. */ void inet_csk_init_xmit_timers(struct sock *sk, @@ -273,7 +273,7 @@ void inet_csk_init_xmit_timers(struct sock *sk, icsk->icsk_delack_timer.function = delack_handler; sk->sk_timer.function = keepalive_handler; - icsk->icsk_retransmit_timer.data = + icsk->icsk_retransmit_timer.data = icsk->icsk_delack_timer.data = sk->sk_timer.data = (unsigned long)sk; diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 8aa7d51..5df71cd 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -381,7 +381,7 @@ static int inet_diag_bc_run(const void *bc, int len, if (addr[0] == 0 && addr[1] == 0 && addr[2] == htonl(0xffff) && bitstring_match(addr + 3, cond->addr, - cond->prefix_len)) + cond->prefix_len)) break; } yes = 0; @@ -518,7 +518,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, } entry.sport = tw->tw_num; entry.dport = ntohs(tw->tw_dport); - entry.userlocks = 0; + entry.userlocks = 0; if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) return 0; diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 150ace1..fb66262 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -262,7 +262,7 @@ not_unique: static inline u32 inet_sk_port_offset(const struct sock *sk) { const struct inet_sock *inet = inet_sk(sk); - return secure_ipv4_port_ephemeral(inet->rcv_saddr, inet->daddr, + return secure_ipv4_port_ephemeral(inet->rcv_saddr, inet->daddr, inet->dport); } @@ -274,81 +274,81 @@ int inet_hash_connect(struct inet_timewait_death_row *death_row, { struct inet_hashinfo *hinfo = death_row->hashinfo; const unsigned short snum = inet_sk(sk)->num; - struct inet_bind_hashbucket *head; - struct inet_bind_bucket *tb; + struct inet_bind_hashbucket *head; + struct inet_bind_bucket *tb; int ret; - if (!snum) { - int low = sysctl_local_port_range[0]; - int high = sysctl_local_port_range[1]; + if (!snum) { + int low = sysctl_local_port_range[0]; + int high = sysctl_local_port_range[1]; int range = high - low; - int i; + int i; int port; static u32 hint; u32 offset = hint + inet_sk_port_offset(sk); struct hlist_node *node; - struct inet_timewait_sock *tw = NULL; + struct inet_timewait_sock *tw = NULL; - local_bh_disable(); + local_bh_disable(); for (i = 1; i <= range; i++) { port = low + (i + offset) % range; - head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; - spin_lock(&head->lock); + head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; + spin_lock(&head->lock); - /* Does not bother with rcv_saddr checks, - * because the established check is already - * unique enough. - */ + /* Does not bother with rcv_saddr checks, + * because the established check is already + * unique enough. + */ inet_bind_bucket_for_each(tb, node, &head->chain) { - if (tb->port == port) { - BUG_TRAP(!hlist_empty(&tb->owners)); - if (tb->fastreuse >= 0) - goto next_port; - if (!__inet_check_established(death_row, + if (tb->port == port) { + BUG_TRAP(!hlist_empty(&tb->owners)); + if (tb->fastreuse >= 0) + goto next_port; + if (!__inet_check_established(death_row, sk, port, &tw)) - goto ok; - goto next_port; - } - } - - tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, head, port); - if (!tb) { - spin_unlock(&head->lock); - break; - } - tb->fastreuse = -1; - goto ok; - - next_port: - spin_unlock(&head->lock); - } - local_bh_enable(); - - return -EADDRNOTAVAIL; + goto ok; + goto next_port; + } + } + + tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, head, port); + if (!tb) { + spin_unlock(&head->lock); + break; + } + tb->fastreuse = -1; + goto ok; + + next_port: + spin_unlock(&head->lock); + } + local_bh_enable(); + + return -EADDRNOTAVAIL; ok: hint += i; - /* Head lock still held and bh's disabled */ - inet_bind_hash(sk, tb, port); + /* Head lock still held and bh's disabled */ + inet_bind_hash(sk, tb, port); if (sk_unhashed(sk)) { - inet_sk(sk)->sport = htons(port); - __inet_hash(hinfo, sk, 0); - } - spin_unlock(&head->lock); + inet_sk(sk)->sport = htons(port); + __inet_hash(hinfo, sk, 0); + } + spin_unlock(&head->lock); - if (tw) { - inet_twsk_deschedule(tw, death_row); - inet_twsk_put(tw); - } + if (tw) { + inet_twsk_deschedule(tw, death_row); + inet_twsk_put(tw); + } ret = 0; goto out; - } + } - head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; - tb = inet_csk(sk)->icsk_bind_hash; + head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; + tb = inet_csk(sk)->icsk_bind_hash; spin_lock_bh(&head->lock); if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { __inet_hash(hinfo, sk, 0); diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index a22d11d..c3ea0cd 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c @@ -4,15 +4,15 @@ * interface as the means of communication with the user level. * * The IP forwarding functionality. - * + * * Version: $Id: ip_forward.c,v 1.48 2000/12/13 18:31:48 davem Exp $ * * Authors: see ip.c * * Fixes: - * Many : Split from ip.c , see ip_input.c for + * Many : Split from ip.c , see ip_input.c for * history. - * Dave Gregorich : NULL ip_rt_put fix for multicast + * Dave Gregorich : NULL ip_rt_put fix for multicast * routing. * Jos Vos : Add call_out_firewall before sending, * use output device for accounting. @@ -69,14 +69,14 @@ int ip_forward(struct sk_buff *skb) goto drop; skb->ip_summed = CHECKSUM_NONE; - + /* * According to the RFC, we must first decrease the TTL field. If * that reaches zero, we must reply an ICMP control message telling * that the packet's lifetime expired. */ if (skb->nh.iph->ttl <= 1) - goto too_many_hops; + goto too_many_hops; if (!xfrm4_route_forward(skb)) goto drop; @@ -107,16 +107,16 @@ int ip_forward(struct sk_buff *skb) ip_forward_finish); sr_failed: - /* + /* * Strict routing permits no gatewaying */ - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_SR_FAILED, 0); - goto drop; + icmp_send(skb, ICMP_DEST_UNREACH, ICMP_SR_FAILED, 0); + goto drop; too_many_hops: - /* Tell the sender its packet died... */ - IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); - icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); + /* Tell the sender its packet died... */ + IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); + icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); drop: kfree_skb(skb); return NET_RX_DROP; diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 8ce00d3..b6f0553 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -4,7 +4,7 @@ * interface as the means of communication with the user level. * * The IP fragmentation functionality. - * + * * Version: $Id: ip_fragment.c,v 1.59 2002/01/12 07:54:56 davem Exp $ * * Authors: Fred N. van Kempen <waltje@uWalt.NL.Mugnet.ORG> @@ -238,7 +238,7 @@ static void ipq_kill(struct ipq *ipq) } } -/* Memory limiting on fragments. Evictor trashes the oldest +/* Memory limiting on fragments. Evictor trashes the oldest * fragment queue until we are back under the threshold. */ static void ip_evictor(void) @@ -479,14 +479,14 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb) goto err; } - offset = ntohs(skb->nh.iph->frag_off); + offset = ntohs(skb->nh.iph->frag_off); flags = offset & ~IP_OFFSET; offset &= IP_OFFSET; offset <<= 3; /* offset is in 8-byte chunks */ - ihl = skb->nh.iph->ihl * 4; + ihl = skb->nh.iph->ihl * 4; /* Determine the position of this fragment. */ - end = offset + skb->len - ihl; + end = offset + skb->len - ihl; /* Is this the final fragment? */ if ((flags & IP_MF) == 0) { @@ -589,8 +589,8 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb) else qp->fragments = skb; - if (skb->dev) - qp->iif = skb->dev->ifindex; + if (skb->dev) + qp->iif = skb->dev->ifindex; skb->dev = NULL; skb_get_timestamp(skb, &qp->stamp); qp->meat += skb->len; @@ -684,7 +684,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev) return head; out_nomem: - LIMIT_NETDEBUG(KERN_ERR "IP: queue_glue: no memory for gluing " + LIMIT_NETDEBUG(KERN_ERR "IP: queue_glue: no memory for gluing " "queue %p\n", qp); goto out_fail; out_oversize: @@ -703,7 +703,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user) struct iphdr *iph = skb->nh.iph; struct ipq *qp; struct net_device *dev; - + IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS); /* Start by cleaning up the memory. */ diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 51c8350..f12c0d6 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -1,5 +1,5 @@ /* - * Linux NET3: GRE over IP protocol decoder. + * Linux NET3: GRE over IP protocol decoder. * * Authors: Alexey Kuznetsov (kuznet@ms2.inr.ac.ru) * @@ -63,7 +63,7 @@ solution, but it supposes maintaing new variable in ALL skb, even if no tunneling is used. - Current solution: t->recursion lock breaks dead loops. It looks + Current solution: t->recursion lock breaks dead loops. It looks like dev->tbusy flag, but I preferred new variable, because the semantics is different. One day, when hard_start_xmit will be multithreaded we will have to use skb->encapsulation. @@ -613,7 +613,7 @@ static int ipgre_rcv(struct sk_buff *skb) if (flags == 0 && skb->protocol == htons(ETH_P_WCCP)) { skb->protocol = htons(ETH_P_IP); - if ((*(h + offset) & 0xF0) != 0x40) + if ((*(h + offset) & 0xF0) != 0x40) offset += 4; } @@ -816,7 +816,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); if (!new_skb) { ip_rt_put(rt); - stats->tx_dropped++; + stats->tx_dropped++; dev_kfree_skb(skb); tunnel->recursion--; return 0; @@ -1044,7 +1044,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) so that I had to set ARPHRD_IPGRE to a random value. I have an impression, that Cisco could make something similar, but this feature is apparently missing in IOS<=11.2(8). - + I set up 10.66.66/24 and fec0:6666:6666::0/96 as virtual networks with broadcast 224.66.66.66. If you have access to mbone, play with me :-) @@ -1076,9 +1076,9 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh p[1] = htons(type); /* - * Set the source hardware address. + * Set the source hardware address. */ - + if (saddr) memcpy(&iph->saddr, saddr, 4); @@ -1088,7 +1088,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh } if (iph->daddr && !MULTICAST(iph->daddr)) return t->hlen; - + return -t->hlen; } diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 212734c..f38e976 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -15,7 +15,7 @@ * Stefan Becker, <stefanb@yello.ping.de> * Jorge Cwik, <jorge@laser.satlink.net> * Arnt Gulbrandsen, <agulbra@nvg.unit.no> - * + * * * Fixes: * Alan Cox : Commented a couple of minor bits of surplus code @@ -98,13 +98,13 @@ * Jos Vos : Do accounting *before* call_in_firewall * Willy Konynenberg : Transparent proxying support * - * + * * * To Fix: * IP fragmentation wants rewriting cleanly. The RFC815 algorithm is much more efficient * and could be made very efficient with the addition of some virtual memory hacks to permit * the allocation of a buffer that can then be 'grown' by twiddling page tables. - * Output fragmentation wants updating along with the buffer management to use a single + * Output fragmentation wants updating along with the buffer management to use a single * interleaved copy algorithm so that fragmenting has a one copy overhead. Actual packet * output should probably do its own fragmentation at the UDP/RAW layer. TCP shouldn't cause * fragmentation anyway. @@ -154,7 +154,7 @@ DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics) __read_mostly; /* * Process Router Attention IP option - */ + */ int ip_call_ra_chain(struct sk_buff *skb) { struct ip_ra_chain *ra; @@ -202,8 +202,8 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb) __skb_pull(skb, ihl); - /* Point into the IP datagram, just past the header. */ - skb->h.raw = skb->data; + /* Point into the IP datagram, just past the header. */ + skb->h.raw = skb->data; rcu_read_lock(); { @@ -259,7 +259,7 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb) /* * Deliver IP Packets to the higher protocol layers. - */ + */ int ip_local_deliver(struct sk_buff *skb) { /* @@ -335,14 +335,14 @@ static inline int ip_rcv_finish(struct sk_buff *skb) /* * Initialise the virtual path cache for the packet. It describes * how the packet travels inside Linux networking. - */ + */ if (skb->dst == NULL) { int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, skb->dev); if (unlikely(err)) { if (err == -EHOSTUNREACH) IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS); - goto drop; + goto drop; } } @@ -363,13 +363,13 @@ static inline int ip_rcv_finish(struct sk_buff *skb) return dst_input(skb); drop: - kfree_skb(skb); - return NET_RX_DROP; + kfree_skb(skb); + return NET_RX_DROP; } /* * Main IP Receive routine. - */ + */ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct iphdr *iph; @@ -437,9 +437,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, inhdr_error: IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); drop: - kfree_skb(skb); + kfree_skb(skb); out: - return NET_RX_DROP; + return NET_RX_DROP; } EXPORT_SYMBOL(ip_statistics); diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 9f02917..f906a80 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -8,7 +8,7 @@ * Version: $Id: ip_options.c,v 1.21 2001/09/01 00:31:50 davem Exp $ * * Authors: A.N.Kuznetsov - * + * */ #include <linux/capability.h> @@ -26,7 +26,7 @@ #include <net/route.h> #include <net/cipso_ipv4.h> -/* +/* * Write options to IP header, record destination address to * source route option, address of outgoing interface * (we should already know it, so that this function is allowed be @@ -76,7 +76,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, } } -/* +/* * Provided (sopt, skb) points to received options, * build in dopt compiled option set appropriate for answering. * i.e. invert SRR option, copy anothers, @@ -85,7 +85,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, * NOTE: dopt cannot point to skb. */ -int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) +int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) { struct ip_options *sopt; unsigned char *sptr, *dptr; @@ -215,7 +215,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) * Simple and stupid 8), but the most efficient way. */ -void ip_options_fragment(struct sk_buff * skb) +void ip_options_fragment(struct sk_buff * skb) { unsigned char * optptr = skb->nh.raw + sizeof(struct iphdr); struct ip_options * opt = &(IPCB(skb)->opt); @@ -370,7 +370,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) switch (optptr[3]&0xF) { case IPOPT_TS_TSONLY: opt->ts = optptr - iph; - if (skb) + if (skb) timeptr = (__be32*)&optptr[optptr[2]-1]; opt->ts_needtime = 1; optptr[2] += 4; @@ -448,7 +448,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) goto error; } opt->cipso = optptr - iph; - if (cipso_v4_validate(&optptr)) { + if (cipso_v4_validate(&optptr)) { pp_ptr = optptr; goto error; } diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index a0f2008..bb0bb8f 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -22,7 +22,7 @@ * Fixes: * Alan Cox : Missing nonblock feature in ip_build_xmit. * Mike Kilburn : htons() missing in ip_build_xmit. - * Bradford Johnson: Fix faulty handling of some frames when + * Bradford Johnson: Fix faulty handling of some frames when * no route is found. * Alexander Demenshin: Missing sk/skb free in ip_queue_xmit * (in case if packet not accepted by @@ -33,9 +33,9 @@ * some redundant tests. * Vitaly E. Lavrov : Transparent proxy revived after year coma. * Andi Kleen : Replace ip_reply with ip_send_reply. - * Andi Kleen : Split fast and slow ip_build_xmit path - * for decreased register pressure on x86 - * and more readibility. + * Andi Kleen : Split fast and slow ip_build_xmit path + * for decreased register pressure on x86 + * and more readibility. * Marc Boucher : When call_out_firewall returns FW_QUEUE, * silently drop skb instead of failing with -EPERM. * Detlev Wengorz : Copy protocol for fragments. @@ -114,7 +114,7 @@ static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) return ttl; } -/* +/* * Add an ip header to a skbuff and send it out. * */ @@ -243,7 +243,7 @@ int ip_mc_output(struct sk_buff *skb) struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); if (newskb) NF_HOOK(PF_INET, NF_IP_POST_ROUTING, newskb, NULL, - newskb->dev, + newskb->dev, ip_dev_loopback_xmit); } @@ -277,7 +277,7 @@ int ip_output(struct sk_buff *skb) skb->protocol = htons(ETH_P_IP); return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev, - ip_finish_output, + ip_finish_output, !(IPCB(skb)->flags & IPSKB_REROUTED)); } @@ -660,7 +660,7 @@ slow_path: return err; fail: - kfree_skb(skb); + kfree_skb(skb); IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); return err; } @@ -755,7 +755,7 @@ static inline int ip_ufo_append_data(struct sock *sk, * from many pieces of data. Each pieces will be holded on the socket * until ip_push_pending_frames() is called. Each piece can be a page * or non-page data. - * + * * Not only UDP, other transport protocols - e.g. raw sockets - can use * this interface potentially. * @@ -888,7 +888,7 @@ alloc_new_skb: datalen = maxfraglen - fragheaderlen; fraglen = datalen + fragheaderlen; - if ((flags & MSG_MORE) && + if ((flags & MSG_MORE) && !(rt->u.dst.dev->features&NETIF_F_SG)) alloclen = mtu; else @@ -903,14 +903,14 @@ alloc_new_skb: alloclen += rt->u.dst.trailer_len; if (transhdrlen) { - skb = sock_alloc_send_skb(sk, + skb = sock_alloc_send_skb(sk, alloclen + hh_len + 15, (flags & MSG_DONTWAIT), &err); } else { skb = NULL; if (atomic_read(&sk->sk_wmem_alloc) <= 2 * sk->sk_sndbuf) - skb = sock_wmalloc(sk, + skb = sock_wmalloc(sk, alloclen + hh_len + 15, 1, sk->sk_allocation); if (unlikely(skb == NULL)) @@ -971,7 +971,7 @@ alloc_new_skb: unsigned int off; off = skb->len; - if (getfrag(from, skb_put(skb, copy), + if (getfrag(from, skb_put(skb, copy), offset, copy, off, skb) < 0) { __skb_trim(skb, off); err = -EFAULT; @@ -993,7 +993,7 @@ alloc_new_skb: goto error; } get_page(page); - skb_fill_page_desc(skb, i, page, sk->sk_sndmsg_off, 0); + skb_fill_page_desc(skb, i, page, sk->sk_sndmsg_off, 0); frag = &skb_shinfo(skb)->frags[i]; } } else if (i < MAX_SKB_FRAGS) { @@ -1033,7 +1033,7 @@ alloc_new_skb: error: inet->cork.length -= length; IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS); - return err; + return err; } ssize_t ip_append_page(struct sock *sk, struct page *page, @@ -1257,7 +1257,7 @@ int ip_push_pending_frames(struct sock *sk) skb->dst = dst_clone(&rt->u.dst); /* Netfilter gets whole the not fragmented skb. */ - err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, + err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output); if (err) { if (err > 0) @@ -1305,21 +1305,21 @@ void ip_flush_pending_frames(struct sock *sk) /* * Fetch data from kernel space and fill in checksum if needed. */ -static int ip_reply_glue_bits(void *dptr, char *to, int offset, +static int ip_reply_glue_bits(void *dptr, char *to, int offset, int len, int odd, struct sk_buff *skb) { __wsum csum; csum = csum_partial_copy_nocheck(dptr+offset, to, len, 0); skb->csum = csum_block_add(skb->csum, csum, odd); - return 0; + return 0; } -/* +/* * Generic function to send a packet as reply to another packet. * Used to send TCP resets so far. ICMP should use this function too. * - * Should run single threaded per socket because it uses the sock + * Should run single threaded per socket because it uses the sock * structure to pass arguments. * * LATER: switch from ip_build_xmit to ip_append_* @@ -1357,7 +1357,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar /* Not quite clean, but right. */ .uli_u = { .ports = { .sport = skb->h.th->dest, - .dport = skb->h.th->source } }, + .dport = skb->h.th->source } }, .proto = sk->sk_protocol }; security_skb_classify_flow(skb, &fl); if (ip_route_output_key(&rt, &fl)) diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 57d4bae..e120686 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -4,7 +4,7 @@ * interface as the means of communication with the user level. * * The IP to API glue. - * + * * Version: $Id: ip_sockglue.c,v 1.62 2002/02/01 22:01:04 davem Exp $ * * Authors: see ip.c @@ -12,7 +12,7 @@ * Fixes: * Many : Split from ip.c , see ip.c for history. * Martin Mares : TOS setting fixed. - * Alan Cox : Fixed a couple of oopses in Martin's + * Alan Cox : Fixed a couple of oopses in Martin's * TOS tweaks. * Mike McLagan : Routing by source */ @@ -253,7 +253,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s return 0; } -void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, +void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, u32 info, u8 *payload) { struct inet_sock *inet = inet_sk(sk); @@ -266,10 +266,10 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, if (!skb) return; - serr = SKB_EXT_ERR(skb); + serr = SKB_EXT_ERR(skb); serr->ee.ee_errno = err; serr->ee.ee_origin = SO_EE_ORIGIN_ICMP; - serr->ee.ee_type = skb->h.icmph->type; + serr->ee.ee_type = skb->h.icmph->type; serr->ee.ee_code = skb->h.icmph->code; serr->ee.ee_pad = 0; serr->ee.ee_info = info; @@ -301,10 +301,10 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf skb->nh.iph = iph; iph->daddr = daddr; - serr = SKB_EXT_ERR(skb); + serr = SKB_EXT_ERR(skb); serr->ee.ee_errno = err; serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL; - serr->ee.ee_type = 0; + serr->ee.ee_type = 0; serr->ee.ee_code = 0; serr->ee.ee_pad = 0; serr->ee.ee_info = info; @@ -319,7 +319,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf kfree_skb(skb); } -/* +/* * Handle MSG_ERRQUEUE */ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len) @@ -391,7 +391,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len) } else spin_unlock_bh(&sk->sk_error_queue.lock); -out_free_skb: +out_free_skb: kfree_skb(skb); out: return err; @@ -409,15 +409,15 @@ static int do_ip_setsockopt(struct sock *sk, int level, struct inet_sock *inet = inet_sk(sk); int val=0,err; - if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) | - (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) | - (1<<IP_RETOPTS) | (1<<IP_TOS) | - (1<<IP_TTL) | (1<<IP_HDRINCL) | - (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) | + if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) | + (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) | + (1<<IP_RETOPTS) | (1<<IP_TOS) | + (1<<IP_TTL) | (1<<IP_HDRINCL) | + (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) | (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | (1<<IP_PASSSEC))) || - optname == IP_MULTICAST_TTL || - optname == IP_MULTICAST_LOOP) { + optname == IP_MULTICAST_TTL || + optname == IP_MULTICAST_LOOP) { if (optlen >= sizeof(int)) { if (get_user(val, (int __user *) optval)) return -EFAULT; @@ -511,7 +511,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, val &= ~3; val |= inet->tos & 3; } - if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP && + if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP && !capable(CAP_NET_ADMIN)) { err = -EPERM; break; @@ -519,7 +519,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, if (inet->tos != val) { inet->tos = val; sk->sk_priority = rt_tos2priority(val); - sk_dst_reset(sk); + sk_dst_reset(sk); } break; case IP_TTL: @@ -556,13 +556,13 @@ static int do_ip_setsockopt(struct sock *sk, int level, if (val < 0 || val > 255) goto e_inval; inet->mc_ttl = val; - break; - case IP_MULTICAST_LOOP: + break; + case IP_MULTICAST_LOOP: if (optlen<1) goto e_inval; inet->mc_loop = !!val; - break; - case IP_MULTICAST_IF: + break; + case IP_MULTICAST_IF: { struct ip_mreqn mreq; struct net_device *dev = NULL; @@ -616,7 +616,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, } case IP_ADD_MEMBERSHIP: - case IP_DROP_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: { struct ip_mreqn mreq; @@ -629,7 +629,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, } else { memset(&mreq, 0, sizeof(mreq)); if (copy_from_user(&mreq,optval,sizeof(struct ip_mreq))) - break; + break; } if (optname == IP_ADD_MEMBERSHIP) @@ -714,7 +714,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, break; } case MCAST_JOIN_GROUP: - case MCAST_LEAVE_GROUP: + case MCAST_LEAVE_GROUP: { struct group_req greq; struct sockaddr_in *psin; @@ -858,16 +858,16 @@ mc_msf_out: kfree(gsf); break; } - case IP_ROUTER_ALERT: + case IP_ROUTER_ALERT: err = ip_ra_control(sk, val ? 1 : 0, NULL); break; case IP_FREEBIND: if (optlen<1) goto e_inval; - inet->freebind = !!val; - break; - + inet->freebind = !!val; + break; + case IP_IPSEC_POLICY: case IP_XFRM_POLICY: err = -EPERM; @@ -954,7 +954,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, struct inet_sock *inet = inet_sk(sk); int val; int len; - + if(level!=SOL_IP) return -EOPNOTSUPP; @@ -969,7 +969,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, return -EFAULT; if(len < 0) return -EINVAL; - + lock_sock(sk); switch(optname) { @@ -984,7 +984,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, inet->opt->optlen); release_sock(sk); - if (opt->optlen == 0) + if (opt->optlen == 0) return put_user(0, optlen); ip_options_undo(opt); @@ -1059,8 +1059,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, addr.s_addr = inet->mc_addr; release_sock(sk); - if(put_user(len, optlen)) - return -EFAULT; + if(put_user(len, optlen)) + return -EFAULT; if(copy_to_user(optval, &addr, len)) return -EFAULT; return 0; @@ -1101,7 +1101,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, release_sock(sk); return err; } - case IP_PKTOPTIONS: + case IP_PKTOPTIONS: { struct msghdr msg; @@ -1129,15 +1129,15 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, len -= msg.msg_controllen; return put_user(len, optlen); } - case IP_FREEBIND: - val = inet->freebind; - break; + case IP_FREEBIND: + val = inet->freebind; + break; default: release_sock(sk); return -ENOPROTOOPT; } release_sock(sk); - + if (len < sizeof(int) && len > 0 && val>=0 && val<255) { unsigned char ucval = (unsigned char)val; len = 1; @@ -1168,7 +1168,7 @@ int ip_getsockopt(struct sock *sk, int level, && (optname < MRT_BASE || optname > MRT_BASE+10) #endif ) { - int len; + int len; if(get_user(len,optlen)) return -EFAULT; @@ -1197,7 +1197,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname, && (optname < MRT_BASE || optname > MRT_BASE+10) #endif ) { - int len; + int len; if (get_user(len, optlen)) return -EFAULT; diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 3839b70..aa704b8 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c @@ -5,7 +5,7 @@ * * 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 (at your option) + * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * Todo: @@ -48,7 +48,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) u8 *start, *scratch; struct crypto_comp *tfm; int cpu; - + plen = skb->len; dlen = IPCOMP_SCRATCH_SIZE; start = skb->data; @@ -69,11 +69,11 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC); if (err) goto out; - + skb->truesize += dlen - plen; __skb_put(skb, dlen - plen); memcpy(skb->data, scratch, dlen); -out: +out: put_cpu(); return err; } @@ -85,11 +85,11 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) struct ip_comp_hdr *ipch; if (skb_linearize_cow(skb)) - goto out; + goto out; skb->ip_summed = CHECKSUM_NONE; - /* Remove ipcomp header and decompress original payload */ + /* Remove ipcomp header and decompress original payload */ iph = skb->nh.iph; ipch = (void *)skb->data; iph->protocol = ipch->nexthdr; @@ -97,7 +97,7 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) __skb_pull(skb, sizeof(*ipch)); err = ipcomp_decompress(x, skb); -out: +out: return err; } @@ -109,7 +109,7 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) u8 *start, *scratch; struct crypto_comp *tfm; int cpu; - + ihlen = iph->ihl * 4; plen = skb->len - ihlen; dlen = IPCOMP_SCRATCH_SIZE; @@ -127,14 +127,14 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) err = -EMSGSIZE; goto out; } - + memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); put_cpu(); pskb_trim(skb, ihlen + dlen + sizeof(struct ip_comp_hdr)); return 0; - -out: + +out: put_cpu(); return err; } @@ -157,7 +157,7 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb) if (skb_linearize_cow(skb)) goto out_ok; - + err = ipcomp_compress(x, skb); iph = skb->nh.iph; @@ -194,7 +194,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) spi = htonl(ntohs(ipch->cpi)); x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, - spi, IPPROTO_COMP, AF_INET); + spi, IPPROTO_COMP, AF_INET); if (!x) return; NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%u.%u.%u.%u\n", @@ -202,12 +202,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) xfrm_state_put(x); } -/* We always hold one tunnel user reference to indicate a tunnel */ +/* We always hold one tunnel user reference to indicate a tunnel */ static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x) { struct xfrm_state *t; u8 mode = XFRM_MODE_TUNNEL; - + t = xfrm_state_alloc(); if (t == NULL) goto out; @@ -247,7 +247,7 @@ static int ipcomp_tunnel_attach(struct xfrm_state *x) struct xfrm_state *t; t = xfrm_state_lookup((xfrm_address_t *)&x->id.daddr.a4, - x->props.saddr.a4, IPPROTO_IPIP, AF_INET); + x->props.saddr.a4, IPPROTO_IPIP, AF_INET); if (!t) { t = ipcomp_tunnel_create(x); if (!t) { diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index afa60b9..ba882be 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -12,7 +12,7 @@ * BOOTP rewritten to construct and analyse packets itself instead * of misusing the IP layer. num_bugs_causing_wrong_arp_replies--; * -- MJ, December 1998 - * + * * Fixed ip_auto_config_setup calling at startup in the new "Linker Magic" * initialization scheme. * - Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 08/11/1999 @@ -98,8 +98,8 @@ #define CONF_TIMEOUT_RANDOM (HZ) /* Maximum amount of randomization */ #define CONF_TIMEOUT_MULT *7/4 /* Rate of timeout growth */ #define CONF_TIMEOUT_MAX (HZ*30) /* Maximum allowed timeout */ -#define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers - - '3' from resolv.h */ +#define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers + - '3' from resolv.h */ #define NONE __constant_htonl(INADDR_NONE) @@ -365,7 +365,7 @@ static int __init ic_defaults(void) * At this point we have no userspace running so need not * claim locks on system_utsname */ - + if (!ic_host_name_set) sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); @@ -650,9 +650,9 @@ static void __init ic_bootp_init_ext(u8 *e) *e++ = 40; e += 40; - *e++ = 57; /* set extension buffer size for reply */ + *e++ = 57; /* set extension buffer size for reply */ *e++ = 2; - *e++ = 1; /* 128+236+8+20+14, see dhcpd sources */ + *e++ = 1; /* 128+236+8+20+14, see dhcpd sources */ *e++ = 150; *e++ = 255; /* End of the list */ @@ -913,7 +913,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str /* Parse extensions */ if (ext_len >= 4 && !memcmp(b->exten, ic_bootp_cookie, 4)) { /* Check magic cookie */ - u8 *end = (u8 *) b + ntohs(b->iph.tot_len); + u8 *end = (u8 *) b + ntohs(b->iph.tot_len); u8 *ext; #ifdef IPCONFIG_DHCP @@ -1020,7 +1020,7 @@ drop: kfree_skb(skb); return 0; -} +} #endif @@ -1080,7 +1080,7 @@ static int __init ic_dynamic(void) * seems to be a terrible waste of CPU time, but actually there is * only one process running at all, so we don't need to use any * scheduler functions. - * [Actually we could now, but the nothing else running note still + * [Actually we could now, but the nothing else running note still * applies.. - AC] */ printk(KERN_NOTICE "Sending %s%s%s requests .", @@ -1156,7 +1156,7 @@ static int __init ic_dynamic(void) } printk("IP-Config: Got %s answer from %u.%u.%u.%u, ", - ((ic_got_reply & IC_RARP) ? "RARP" + ((ic_got_reply & IC_RARP) ? "RARP" : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), NIPQUAD(ic_servaddr)); printk("my address is %u.%u.%u.%u\n", NIPQUAD(ic_myaddr)); @@ -1286,7 +1286,7 @@ static int __init ip_auto_config(void) #endif ic_first_dev->next) { #ifdef IPCONFIG_DYNAMIC - + int retries = CONF_OPEN_RETRIES; if (ic_dynamic() < 0) { @@ -1308,14 +1308,14 @@ static int __init ip_auto_config(void) */ #ifdef CONFIG_ROOT_NFS if (ROOT_DEV == Root_NFS) { - printk(KERN_ERR + printk(KERN_ERR "IP-Config: Retrying forever (NFS root)...\n"); goto try_try_again; } #endif if (--retries) { - printk(KERN_ERR + printk(KERN_ERR "IP-Config: Reopening network devices...\n"); goto try_try_again; } @@ -1443,8 +1443,8 @@ static int __init ip_auto_config_setup(char *addrs) ic_set_manually = 1; - ic_enable = (*addrs && - (strcmp(addrs, "off") != 0) && + ic_enable = (*addrs && + (strcmp(addrs, "off") != 0) && (strcmp(addrs, "none") != 0)); if (!ic_enable) return 1; diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index da8bbd2..475bcd1 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -1,5 +1,5 @@ /* - * Linux NET3: IP/IP protocol decoder. + * Linux NET3: IP/IP protocol decoder. * * Version: $Id: ipip.c,v 1.50 2001/10/02 02:22:36 davem Exp $ * @@ -35,14 +35,14 @@ Thanks for the great code! -Sam Lantinga (slouken@cs.ucdavis.edu) 02/01/95 - + Minor tweaks: Cleaned up the code a little and added some pre-1.3.0 tweaks. dev->hard_header/hard_header_len changed to use no headers. Comments/bracketing tweaked. Made the tunnels use dev->name not tunnel: when error reporting. Added tx_dropped stat - + -Alan Cox (Alan.Cox@linux.org) 21 March 95 Reworked: @@ -52,7 +52,7 @@ Note: There is currently no firewall or ICMP handling done. -Sam Lantinga (slouken@cs.ucdavis.edu) 02/13/96 - + */ /* Things I wish I had known when writing the tunnel driver: @@ -75,7 +75,7 @@ "allocated" with skb_put(). You can then write up to skb->len bytes to that buffer. If you need more, you can call skb_put() again with the additional amount of space you need. You can - find out how much more space you can allocate by calling + find out how much more space you can allocate by calling "skb_tailroom(skb)". Now, to add header space, call "skb_push(skb, header_len)". This creates space at the beginning of the buffer and returns @@ -92,7 +92,7 @@ For comments look at net/ipv4/ip_gre.c --ANK */ - + #include <linux/capability.h> #include <linux/module.h> #include <linux/types.h> @@ -607,7 +607,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); if (!new_skb) { ip_rt_put(rt); - stats->tx_dropped++; + stats->tx_dropped++; dev_kfree_skb(skb); tunnel->recursion--; return 0; diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index d7e1e60..604f5b5 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -241,7 +241,7 @@ failure: /* * Delete a VIF entry */ - + static int vif_delete(int vifi) { struct vif_device *v; @@ -409,7 +409,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) return -ENOBUFS; break; #endif - case VIFF_TUNNEL: + case VIFF_TUNNEL: dev = ipmr_new_tunnel(vifc); if (!dev) return -ENOBUFS; @@ -499,7 +499,7 @@ static struct mfc_cache *ipmr_cache_alloc_unres(void) /* * A cache entry has gone into a resolved state from queued */ - + static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) { struct sk_buff *skb; @@ -536,7 +536,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) * * Called under mrt_lock. */ - + static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) { struct sk_buff *skb; @@ -567,13 +567,13 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) memcpy(msg, pkt->nh.raw, sizeof(struct iphdr)); msg->im_msgtype = IGMPMSG_WHOLEPKT; msg->im_mbz = 0; - msg->im_vif = reg_vif_num; + msg->im_vif = reg_vif_num; skb->nh.iph->ihl = sizeof(struct iphdr) >> 2; skb->nh.iph->tot_len = htons(ntohs(pkt->nh.iph->tot_len) + sizeof(struct iphdr)); - } else + } else #endif - { - + { + /* * Copy the IP header */ @@ -595,7 +595,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) igmp->code = 0; skb->nh.iph->tot_len=htons(skb->len); /* Fix the length */ skb->h.raw = skb->nh.raw; - } + } if (mroute_socket == NULL) { kfree_skb(skb); @@ -617,7 +617,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) /* * Queue a packet for resolution. It gets locked cache entry! */ - + static int ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) { @@ -655,7 +655,7 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) * Reflect first query at mrouted. */ if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) { - /* If the report failed throw the cache entry + /* If the report failed throw the cache entry out - Brad Parker */ spin_unlock_bh(&mfc_unres_lock); @@ -781,11 +781,11 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock) /* * Close the multicast socket, and clear the vif tables etc */ - + static void mroute_clean_tables(struct sock *sk) { int i; - + /* * Shut down all active vif entries */ @@ -852,13 +852,13 @@ static void mrtsock_destruct(struct sock *sk) * that's how BSD mrouted happens to think. Maybe one day with a proper * MOSPF/PIM router set up we can clean this up. */ - + int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen) { int ret; struct vifctl vif; struct mfcctl mfc; - + if(optname!=MRT_INIT) { if(sk!=mroute_socket && !capable(CAP_NET_ADMIN)) @@ -899,7 +899,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt if(optlen!=sizeof(vif)) return -EINVAL; if (copy_from_user(&vif,optval,sizeof(vif))) - return -EFAULT; + return -EFAULT; if(vif.vifc_vifi >= MAXVIFS) return -ENFILE; rtnl_lock(); @@ -978,13 +978,13 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt /* * Getsock opt support for the multicast routing system. */ - + int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen) { int olr; int val; - if(optname!=MRT_VERSION && + if(optname!=MRT_VERSION && #ifdef CONFIG_IP_PIMSM optname!=MRT_PIM && #endif @@ -997,7 +997,7 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u olr = min_t(unsigned int, olr, sizeof(int)); if (olr < 0) return -EINVAL; - + if(put_user(olr,optlen)) return -EFAULT; if(optname==MRT_VERSION) @@ -1016,19 +1016,19 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u /* * The IP multicast ioctl support routines. */ - + int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) { struct sioc_sg_req sr; struct sioc_vif_req vr; struct vif_device *vif; struct mfc_cache *c; - + switch(cmd) { case SIOCGETVIFCNT: if (copy_from_user(&vr,arg,sizeof(vr))) - return -EFAULT; + return -EFAULT; if(vr.vifi>=maxvif) return -EINVAL; read_lock(&mrt_lock); @@ -1094,7 +1094,7 @@ static struct notifier_block ip_mr_notifier={ * This avoids tunnel drivers and other mess and gives us the speed so * important for multicast video. */ - + static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) { struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); @@ -1192,7 +1192,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) encap += LL_RESERVED_SPACE(dev) + rt->u.dst.header_len; if (skb_cow(skb, encap)) { - ip_rt_put(rt); + ip_rt_put(rt); goto out_free; } @@ -1226,7 +1226,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) * not mrouter) cannot join to more than one interface - it will * result in receiving multiple packets. */ - NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev, + NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev, ipmr_forward_finish); return; @@ -1287,7 +1287,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local large chunk of pimd to kernel. Ough... --ANK */ (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) && - time_after(jiffies, + time_after(jiffies, cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { cache->mfc_un.res.last_assert = jiffies; ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF); @@ -1424,14 +1424,14 @@ int pim_rcv_v1(struct sk_buff * skb) struct iphdr *encap; struct net_device *reg_dev = NULL; - if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) + if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) goto drop; pim = (struct igmphdr*)skb->h.raw; - if (!mroute_do_pim || + if (!mroute_do_pim || skb->len < sizeof(*pim) + sizeof(*encap) || - pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) + pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) goto drop; encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr)); @@ -1443,7 +1443,7 @@ int pim_rcv_v1(struct sk_buff * skb) */ if (!MULTICAST(encap->daddr) || encap->tot_len == 0 || - ntohs(encap->tot_len) + sizeof(*pim) > skb->len) + ntohs(encap->tot_len) + sizeof(*pim) > skb->len) goto drop; read_lock(&mrt_lock); @@ -1453,7 +1453,7 @@ int pim_rcv_v1(struct sk_buff * skb) dev_hold(reg_dev); read_unlock(&mrt_lock); - if (reg_dev == NULL) + if (reg_dev == NULL) goto drop; skb->mac.raw = skb->nh.raw; @@ -1484,13 +1484,13 @@ static int pim_rcv(struct sk_buff * skb) struct iphdr *encap; struct net_device *reg_dev = NULL; - if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) + if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) goto drop; pim = (struct pimreghdr*)skb->h.raw; - if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || + if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || (pim->flags&PIM_NULL_REGISTER) || - (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && + (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && csum_fold(skb_checksum(skb, 0, skb->len, 0)))) goto drop; @@ -1498,7 +1498,7 @@ static int pim_rcv(struct sk_buff * skb) encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr)); if (!MULTICAST(encap->daddr) || encap->tot_len == 0 || - ntohs(encap->tot_len) + sizeof(*pim) > skb->len) + ntohs(encap->tot_len) + sizeof(*pim) > skb->len) goto drop; read_lock(&mrt_lock); @@ -1508,7 +1508,7 @@ static int pim_rcv(struct sk_buff * skb) dev_hold(reg_dev); read_unlock(&mrt_lock); - if (reg_dev == NULL) + if (reg_dev == NULL) goto drop; skb->mac.raw = skb->nh.raw; @@ -1614,7 +1614,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait) return err; } -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS /* * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif */ @@ -1628,7 +1628,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter, for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) { if(!VIF_EXISTS(iter->ct)) continue; - if (pos-- == 0) + if (pos-- == 0) return &vif_table[iter->ct]; } return NULL; @@ -1637,7 +1637,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter, static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos) { read_lock(&mrt_lock); - return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1) + return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1) : SEQ_START_TOKEN; } @@ -1648,7 +1648,7 @@ static void *ipmr_vif_seq_next(struct seq_file *seq, void *v, loff_t *pos) ++*pos; if (v == SEQ_START_TOKEN) return ipmr_vif_seq_idx(iter, 0); - + while (++iter->ct < maxvif) { if(!VIF_EXISTS(iter->ct)) continue; @@ -1665,7 +1665,7 @@ static void ipmr_vif_seq_stop(struct seq_file *seq, void *v) static int ipmr_vif_seq_show(struct seq_file *seq, void *v) { if (v == SEQ_START_TOKEN) { - seq_puts(seq, + seq_puts(seq, "Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote\n"); } else { const struct vif_device *vif = v; @@ -1674,7 +1674,7 @@ static int ipmr_vif_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "%2Zd %-10s %8ld %7ld %8ld %7ld %05X %08X %08X\n", vif - vif_table, - name, vif->bytes_in, vif->pkt_in, + name, vif->bytes_in, vif->pkt_in, vif->bytes_out, vif->pkt_out, vif->flags, vif->local, vif->remote); } @@ -1693,7 +1693,7 @@ static int ipmr_vif_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; @@ -1732,15 +1732,15 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos) it->cache = mfc_cache_array; read_lock(&mrt_lock); - for (it->ct = 0; it->ct < MFC_LINES; it->ct++) - for(mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next) - if (pos-- == 0) + for (it->ct = 0; it->ct < MFC_LINES; it->ct++) + for(mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next) + if (pos-- == 0) return mfc; read_unlock(&mrt_lock); it->cache = &mfc_unres_queue; spin_lock_bh(&mfc_unres_lock); - for(mfc = mfc_unres_queue; mfc; mfc = mfc->next) + for(mfc = mfc_unres_queue; mfc; mfc = mfc->next) if (pos-- == 0) return mfc; spin_unlock_bh(&mfc_unres_lock); @@ -1755,7 +1755,7 @@ static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos) struct ipmr_mfc_iter *it = seq->private; it->cache = NULL; it->ct = 0; - return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1) + return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1) : SEQ_START_TOKEN; } @@ -1771,8 +1771,8 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos) if (mfc->next) return mfc->next; - - if (it->cache == &mfc_unres_queue) + + if (it->cache == &mfc_unres_queue) goto end_of_list; BUG_ON(it->cache != mfc_cache_array); @@ -1787,10 +1787,10 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos) read_unlock(&mrt_lock); it->cache = &mfc_unres_queue; it->ct = 0; - + spin_lock_bh(&mfc_unres_lock); mfc = mfc_unres_queue; - if (mfc) + if (mfc) return mfc; end_of_list: @@ -1815,12 +1815,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v) int n; if (v == SEQ_START_TOKEN) { - seq_puts(seq, + seq_puts(seq, "Group Origin Iif Pkts Bytes Wrong Oifs\n"); } else { const struct mfc_cache *mfc = v; const struct ipmr_mfc_iter *it = seq->private; - + seq_printf(seq, "%08lX %08lX %-3d %8ld %8ld %8ld", (unsigned long) mfc->mfc_mcastgrp, (unsigned long) mfc->mfc_origin, @@ -1830,12 +1830,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v) mfc->mfc_un.res.wrong_if); if (it->cache != &mfc_unres_queue) { - for(n = mfc->mfc_un.res.minvif; + for(n = mfc->mfc_un.res.minvif; n < mfc->mfc_un.res.maxvif; n++ ) { - if(VIF_EXISTS(n) + if(VIF_EXISTS(n) && mfc->mfc_un.res.ttls[n] < 255) - seq_printf(seq, - " %2d:%-3d", + seq_printf(seq, + " %2d:%-3d", n, mfc->mfc_un.res.ttls[n]); } } @@ -1856,7 +1856,7 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; @@ -1881,7 +1881,7 @@ static struct file_operations ipmr_mfc_fops = { .llseek = seq_lseek, .release = seq_release_private, }; -#endif +#endif #ifdef CONFIG_IP_PIMSM_V2 static struct net_protocol pim_protocol = { @@ -1893,7 +1893,7 @@ static struct net_protocol pim_protocol = { /* * Setup for IP multicast routing */ - + void __init ip_mr_init(void) { mrt_cachep = kmem_cache_create("ip_mrt_cache", @@ -1903,8 +1903,8 @@ void __init ip_mr_init(void) init_timer(&ipmr_expire_timer); ipmr_expire_timer.function=ipmr_expire_process; register_netdevice_notifier(&ip_mr_notifier); -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops); proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops); -#endif +#endif } diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index 3aec4ac..0b5e034 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c @@ -494,8 +494,8 @@ int ip_vs_check_template(struct ip_vs_conn *ct) * Checking the dest server status. */ if ((dest == NULL) || - !(dest->flags & IP_VS_DEST_F_AVAILABLE) || - (sysctl_ip_vs_expire_quiescent_template && + !(dest->flags & IP_VS_DEST_F_AVAILABLE) || + (sysctl_ip_vs_expire_quiescent_template && (atomic_read(&dest->weight) == 0))) { IP_VS_DBG(9, "check_template: dest not available for " "protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " @@ -666,7 +666,7 @@ static void *ip_vs_conn_array(struct seq_file *seq, loff_t pos) { int idx; struct ip_vs_conn *cp; - + for(idx = 0; idx < IP_VS_CONN_TAB_SIZE; idx++) { ct_read_lock_bh(idx); list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) { @@ -694,7 +694,7 @@ static void *ip_vs_conn_seq_next(struct seq_file *seq, void *v, loff_t *pos) int idx; ++*pos; - if (v == SEQ_START_TOKEN) + if (v == SEQ_START_TOKEN) return ip_vs_conn_array(seq, 0); /* more on same hash chain? */ @@ -709,7 +709,7 @@ static void *ip_vs_conn_seq_next(struct seq_file *seq, void *v, loff_t *pos) list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) { seq->private = &ip_vs_conn_tab[idx]; return cp; - } + } ct_read_unlock_bh(idx); } seq->private = NULL; diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index 3425752..24d7b66 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c @@ -813,14 +813,14 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb, skb->nh.iph->saddr = cp->vaddr; ip_send_check(skb->nh.iph); - /* For policy routing, packets originating from this - * machine itself may be routed differently to packets - * passing through. We want this packet to be routed as - * if it came from this machine itself. So re-compute - * the routing information. - */ - if (ip_route_me_harder(pskb, RTN_LOCAL) != 0) - goto drop; + /* For policy routing, packets originating from this + * machine itself may be routed differently to packets + * passing through. We want this packet to be routed as + * if it came from this machine itself. So re-compute + * the routing information. + */ + if (ip_route_me_harder(pskb, RTN_LOCAL) != 0) + goto drop; skb = *pskb; IP_VS_DBG_PKT(10, pp, skb, 0, "After SNAT"); @@ -847,7 +847,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb, * forward to the right destination host if relevant. * Currently handles error types - unreachable, quench, ttl exceeded. */ -static int +static int ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum) { struct sk_buff *skb = *pskb; @@ -863,7 +863,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum) /* reassemble IP fragments */ if (skb->nh.iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) { skb = ip_vs_gather_frags(skb, - hooknum == NF_IP_LOCAL_IN ? + hooknum == NF_IP_LOCAL_IN ? IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD); if (!skb) return NF_STOLEN; diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c index 687c1de..847c47a 100644 --- a/net/ipv4/ipvs/ip_vs_ftp.c +++ b/net/ipv4/ipvs/ip_vs_ftp.c @@ -370,7 +370,7 @@ static int __init ip_vs_ftp_init(void) if (ret) break; IP_VS_INFO("%s: loaded support on port[%d] = %d\n", - app->name, i, ports[i]); + app->name, i, ports[i]); } if (ret) diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c index a4385a2..76fd1fb 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/ipv4/ipvs/ip_vs_lblc.c @@ -118,7 +118,7 @@ static ctl_table vs_vars_table[] = { .procname = "lblc_expiration", .data = &sysctl_ip_vs_lblc_expiration, .maxlen = sizeof(int), - .mode = 0644, + .mode = 0644, .proc_handler = &proc_dointvec_jiffies, }, { .ctl_name = 0 } @@ -128,7 +128,7 @@ static ctl_table vs_table[] = { { .ctl_name = NET_IPV4_VS, .procname = "vs", - .mode = 0555, + .mode = 0555, .child = vs_vars_table }, { .ctl_name = 0 } @@ -137,7 +137,7 @@ static ctl_table vs_table[] = { static ctl_table ipvs_ipv4_table[] = { { .ctl_name = NET_IPV4, - .procname = "ipv4", + .procname = "ipv4", .mode = 0555, .child = vs_table }, @@ -147,8 +147,8 @@ static ctl_table ipvs_ipv4_table[] = { static ctl_table lblc_root_table[] = { { .ctl_name = CTL_NET, - .procname = "net", - .mode = 0555, + .procname = "net", + .mode = 0555, .child = ipvs_ipv4_table }, { .ctl_name = 0 } @@ -288,7 +288,7 @@ static inline void ip_vs_lblc_full_check(struct ip_vs_lblc_table *tbl) write_lock(&tbl->lock); list_for_each_entry_safe(en, nxt, &tbl->bucket[j], list) { - if (time_before(now, + if (time_before(now, en->lastuse + sysctl_ip_vs_lblc_expiration)) continue; diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index fe1af5d..bf1e7f2 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c @@ -307,7 +307,7 @@ static ctl_table vs_vars_table[] = { .procname = "lblcr_expiration", .data = &sysctl_ip_vs_lblcr_expiration, .maxlen = sizeof(int), - .mode = 0644, + .mode = 0644, .proc_handler = &proc_dointvec_jiffies, }, { .ctl_name = 0 } @@ -326,7 +326,7 @@ static ctl_table vs_table[] = { static ctl_table ipvs_ipv4_table[] = { { .ctl_name = NET_IPV4, - .procname = "ipv4", + .procname = "ipv4", .mode = 0555, .child = vs_table }, @@ -336,8 +336,8 @@ static ctl_table ipvs_ipv4_table[] = { static ctl_table lblcr_root_table[] = { { .ctl_name = CTL_NET, - .procname = "net", - .mode = 0555, + .procname = "net", + .mode = 0555, .child = ipvs_ipv4_table }, { .ctl_name = 0 } diff --git a/net/ipv4/ipvs/ip_vs_rr.c b/net/ipv4/ipvs/ip_vs_rr.c index b23bab2..433f8a9 100644 --- a/net/ipv4/ipvs/ip_vs_rr.c +++ b/net/ipv4/ipvs/ip_vs_rr.c @@ -68,7 +68,7 @@ ip_vs_rr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) q = q->next; continue; } - + dest = list_entry(q, struct ip_vs_dest, n_list); if (!(dest->flags & IP_VS_DEST_F_OVERLOAD) && atomic_read(&dest->weight) > 0) diff --git a/net/ipv4/multipath_drr.c b/net/ipv4/multipath_drr.c index 252e837..cb8fce4 100644 --- a/net/ipv4/multipath_drr.c +++ b/net/ipv4/multipath_drr.c @@ -134,7 +134,7 @@ static void drr_select_route(const struct flowi *flp, struct rtable *first, struct rtable **rp) { struct rtable *nh, *result, *cur_min; - int min_usecount = -1; + int min_usecount = -1; int devidx = -1; int cur_min_devidx = -1; @@ -143,7 +143,7 @@ static void drr_select_route(const struct flowi *flp, result = NULL; cur_min = NULL; for (nh = rcu_dereference(first); nh; - nh = rcu_dereference(nh->u.rt_next)) { + nh = rcu_dereference(nh->u.dst.rt_next)) { if ((nh->u.dst.flags & DST_BALANCED) != 0 && multipath_comparekeys(&nh->fl, flp)) { int nh_ifidx = nh->u.dst.dev->ifindex; @@ -161,7 +161,7 @@ static void drr_select_route(const struct flowi *flp, */ devidx = __multipath_finddev(nh_ifidx); if (devidx == -1) { - /* add the interface to the array + /* add the interface to the array * SMP safe */ spin_lock_bh(&state_lock); diff --git a/net/ipv4/multipath_random.c b/net/ipv4/multipath_random.c index b8c289f..047e861 100644 --- a/net/ipv4/multipath_random.c +++ b/net/ipv4/multipath_random.c @@ -74,7 +74,7 @@ static void random_select_route(const struct flowi *flp, /* count all candidate */ for (rt = rcu_dereference(first); rt; - rt = rcu_dereference(rt->u.rt_next)) { + rt = rcu_dereference(rt->u.dst.rt_next)) { if ((rt->u.dst.flags & DST_BALANCED) != 0 && multipath_comparekeys(&rt->fl, flp)) ++candidate_count; @@ -90,7 +90,7 @@ static void random_select_route(const struct flowi *flp, /* find chosen candidate and adjust GC data for all candidates * to ensure they stay in cache */ - for (rt = first; rt; rt = rt->u.rt_next) { + for (rt = first; rt; rt = rt->u.dst.rt_next) { if ((rt->u.dst.flags & DST_BALANCED) != 0 && multipath_comparekeys(&rt->fl, flp)) { rt->u.dst.lastuse = jiffies; diff --git a/net/ipv4/multipath_rr.c b/net/ipv4/multipath_rr.c index bba5abe..896246d 100644 --- a/net/ipv4/multipath_rr.c +++ b/net/ipv4/multipath_rr.c @@ -58,7 +58,7 @@ static void rr_select_route(const struct flowi *flp, */ result = NULL; for (nh = rcu_dereference(first); nh; - nh = rcu_dereference(nh->u.rt_next)) { + nh = rcu_dereference(nh->u.dst.rt_next)) { if ((nh->u.dst.flags & DST_BALANCED) != 0 && multipath_comparekeys(&nh->fl, flp)) { nh->u.dst.lastuse = jiffies; diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c index 92b0482..7e22f15 100644 --- a/net/ipv4/multipath_wrandom.c +++ b/net/ipv4/multipath_wrandom.c @@ -142,7 +142,7 @@ out: return weight; } -static void wrandom_init_state(void) +static void wrandom_init_state(void) { int i; @@ -167,7 +167,7 @@ static void wrandom_select_route(const struct flowi *flp, /* collect all candidates and identify their weights */ for (rt = rcu_dereference(first); rt; - rt = rcu_dereference(rt->u.rt_next)) { + rt = rcu_dereference(rt->u.dst.rt_next)) { if ((rt->u.dst.flags & DST_BALANCED) != 0 && multipath_comparekeys(&rt->fl, flp)) { struct multipath_candidate* mpc = @@ -287,7 +287,7 @@ static void __multipath_free(struct rcu_head *head) static void __multipath_free_dst(struct rcu_head *head) { - struct multipath_dest *dst = container_of(head, + struct multipath_dest *dst = container_of(head, struct multipath_dest, rcu); kfree(dst); diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index c47ce70..6069a11 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c @@ -53,7 +53,7 @@ int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type) dst_release(&rt->u.dst); dst_release(odst); } - + if ((*pskb)->dst->error) return -1; @@ -70,7 +70,7 @@ int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type) struct sk_buff *nskb; nskb = skb_realloc_headroom(*pskb, hh_len); - if (!nskb) + if (!nskb) return -1; if ((*pskb)->sk) skb_set_owner_w(nskb, (*pskb)->sk); @@ -177,7 +177,7 @@ __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, break; if ((protocol == 0 && !csum_fold(skb->csum)) || !csum_tcpudp_magic(iph->saddr, iph->daddr, - skb->len - dataoff, protocol, + skb->len - dataoff, protocol, skb->csum)) { skb->ip_summed = CHECKSUM_UNNECESSARY; break; diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 9aa2239..5170f5c 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c @@ -544,7 +544,7 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, } /* FIXME: underflows must be unconditional, standard verdicts - < 0 (not ARPT_RETURN). --RR */ + < 0 (not ARPT_RETURN). --RR */ /* Clear counters and comefrom */ e->counters = ((struct xt_counters) { 0, 0 }); @@ -869,8 +869,8 @@ static int do_replace(void __user *user, unsigned int len) /* Update module usage count based on number of rules */ duprintf("do_replace: oldnum=%u, initnum=%u, newnum=%u\n", oldinfo->number, oldinfo->initial_entries, newinfo->number); - if ((oldinfo->number > oldinfo->initial_entries) || - (newinfo->number <= oldinfo->initial_entries)) + if ((oldinfo->number > oldinfo->initial_entries) || + (newinfo->number <= oldinfo->initial_entries)) module_put(t->me); if ((oldinfo->number > oldinfo->initial_entries) && (newinfo->number <= oldinfo->initial_entries)) diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c index d12b1df..709db4d 100644 --- a/net/ipv4/netfilter/arpt_mangle.c +++ b/net/ipv4/netfilter/arpt_mangle.c @@ -67,7 +67,7 @@ target(struct sk_buff **pskb, static int checkentry(const char *tablename, const void *e, const struct xt_target *target, - void *targinfo, unsigned int hook_mask) + void *targinfo, unsigned int hook_mask) { const struct arpt_mangle *mangle = targinfo; diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c index ad246ba..4f561f5 100644 --- a/net/ipv4/netfilter/ip_conntrack_amanda.c +++ b/net/ipv4/netfilter/ip_conntrack_amanda.c @@ -9,7 +9,7 @@ * * Module load syntax: * insmod ip_conntrack_amanda.o [master_timeout=n] - * + * * Where master_timeout is the timeout (in seconds) of the master * connection (port 10080). This defaults to 5 minutes but if * your clients take longer than 5 minutes to do their work @@ -84,7 +84,7 @@ static struct { }; static int help(struct sk_buff **pskb, - struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) + struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) { struct ts_state ts; struct ip_conntrack_expect *exp; diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 62be2eb..04e466d 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c @@ -2,7 +2,7 @@ but required by, the NAT layer; it can also be used by an iptables extension. */ -/* (C) 1999-2001 Paul `Rusty' Russell +/* (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> * * This program is free software; you can redistribute it and/or modify @@ -99,7 +99,7 @@ __ip_ct_deliver_cached_events(struct ip_conntrack_ecache *ecache) void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) { struct ip_conntrack_ecache *ecache; - + local_bh_disable(); ecache = &__get_cpu_var(ip_conntrack_ecache); if (ecache->ct == ct) @@ -147,9 +147,9 @@ static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple, unsigned int size, unsigned int rnd) { return (jhash_3words((__force u32)tuple->src.ip, - ((__force u32)tuple->dst.ip ^ tuple->dst.protonum), - (tuple->src.u.all | (tuple->dst.u.all << 16)), - rnd) % size); + ((__force u32)tuple->dst.ip ^ tuple->dst.protonum), + (tuple->src.u.all | (tuple->dst.u.all << 16)), + rnd) % size); } static u_int32_t @@ -219,7 +219,7 @@ struct ip_conntrack_expect * __ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple) { struct ip_conntrack_expect *i; - + list_for_each_entry(i, &ip_conntrack_expect_list, list) { if (ip_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask)) return i; @@ -232,7 +232,7 @@ struct ip_conntrack_expect * ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple) { struct ip_conntrack_expect *i; - + read_lock_bh(&ip_conntrack_lock); i = __ip_conntrack_expect_find(tuple); if (i) @@ -398,7 +398,7 @@ ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple, static void __ip_conntrack_hash_insert(struct ip_conntrack *ct, unsigned int hash, - unsigned int repl_hash) + unsigned int repl_hash) { ct->id = ++ip_conntrack_next_id; list_add(&ct->tuplehash[IP_CT_DIR_ORIGINAL].list, @@ -446,15 +446,15 @@ __ip_conntrack_confirm(struct sk_buff **pskb) /* IP_NF_ASSERT(atomic_read(&ct->ct_general.use) == 1); */ /* No external references means noone else could have - confirmed us. */ + confirmed us. */ IP_NF_ASSERT(!is_confirmed(ct)); DEBUGP("Confirming conntrack %p\n", ct); write_lock_bh(&ip_conntrack_lock); /* See if there's one in the list already, including reverse: - NAT could have grabbed it without realizing, since we're - not in the hash. If there is, we lost race. */ + NAT could have grabbed it without realizing, since we're + not in the hash. If there is, we lost race. */ list_for_each_entry(h, &ip_conntrack_hash[hash], list) if (ip_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, &h->tuple)) @@ -602,7 +602,7 @@ ip_conntrack_proto_find_get(u_int8_t protocol) p = &ip_conntrack_generic_protocol; } preempt_enable(); - + return p; } @@ -745,7 +745,7 @@ resolve_normal_ct(struct sk_buff *skb, IP_NF_ASSERT((skb->nh.iph->frag_off & htons(IP_OFFSET)) == 0); - if (!ip_ct_get_tuple(skb->nh.iph, skb, skb->nh.iph->ihl*4, + if (!ip_ct_get_tuple(skb->nh.iph, skb, skb->nh.iph->ihl*4, &tuple,proto)) return NULL; @@ -770,7 +770,7 @@ resolve_normal_ct(struct sk_buff *skb, if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { DEBUGP("ip_conntrack_in: normal packet for %p\n", ct); - *ctinfo = IP_CT_ESTABLISHED; + *ctinfo = IP_CT_ESTABLISHED; } else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) { DEBUGP("ip_conntrack_in: related packet for %p\n", ct); @@ -821,7 +821,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum, if ((*pskb)->pkt_type == PACKET_BROADCAST) { printk("Broadcast packet!\n"); return NF_ACCEPT; - } else if (((*pskb)->nh.iph->daddr & htonl(0x000000FF)) + } else if (((*pskb)->nh.iph->daddr & htonl(0x000000FF)) == htonl(0x000000FF)) { printk("Should bcast: %u.%u.%u.%u->%u.%u.%u.%u (sk=%p, ptype=%u)\n", NIPQUAD((*pskb)->nh.iph->saddr), @@ -835,7 +835,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum, /* It may be an special packet, error, unclean... * inverse of the return code tells to the netfilter * core what to do with the packet. */ - if (proto->error != NULL + if (proto->error != NULL && (ret = proto->error(*pskb, &ctinfo, hooknum)) <= 0) { CONNTRACK_STAT_INC(error); CONNTRACK_STAT_INC(invalid); @@ -875,7 +875,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum, int invert_tuplepr(struct ip_conntrack_tuple *inverse, const struct ip_conntrack_tuple *orig) { - return ip_ct_invert_tuple(inverse, orig, + return ip_ct_invert_tuple(inverse, orig, __ip_conntrack_proto_find(orig->dst.protonum)); } @@ -884,7 +884,7 @@ static inline int expect_clash(const struct ip_conntrack_expect *a, const struct ip_conntrack_expect *b) { /* Part covered by intersection of masks must be unequal, - otherwise they clash */ + otherwise they clash */ struct ip_conntrack_tuple intersect_mask = { { a->mask.src.ip & b->mask.src.ip, { a->mask.src.u.all & b->mask.src.u.all } }, @@ -922,7 +922,7 @@ void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp) } /* We don't increase the master conntrack refcount for non-fulfilled - * conntracks. During the conntrack destruction, the expectations are + * conntracks. During the conntrack destruction, the expectations are * always killed before the conntrack itself */ struct ip_conntrack_expect *ip_conntrack_expect_alloc(struct ip_conntrack *me) { @@ -1011,7 +1011,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect) } /* Will be over limit? */ - if (expect->master->helper->max_expected && + if (expect->master->helper->max_expected && expect->master->expecting >= expect->master->helper->max_expected) evict_oldest_expect(expect->master); @@ -1020,7 +1020,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect) ret = 0; out: write_unlock_bh(&ip_conntrack_lock); - return ret; + return ret; } /* Alter reply tuple (maybe alter helper). This is for NAT, and is @@ -1068,7 +1068,7 @@ static inline void unhelp(struct ip_conntrack_tuple_hash *i, const struct ip_conntrack_helper *me) { if (tuplehash_to_ctrack(i)->helper == me) { - ip_conntrack_event(IPCT_HELPER, tuplehash_to_ctrack(i)); + ip_conntrack_event(IPCT_HELPER, tuplehash_to_ctrack(i)); tuplehash_to_ctrack(i)->helper = NULL; } } @@ -1104,8 +1104,8 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me) } /* Refresh conntrack for this many jiffies and do accounting if do_acct is 1 */ -void __ip_ct_refresh_acct(struct ip_conntrack *ct, - enum ip_conntrack_info ctinfo, +void __ip_ct_refresh_acct(struct ip_conntrack *ct, + enum ip_conntrack_info ctinfo, const struct sk_buff *skb, unsigned long extra_jiffies, int do_acct) @@ -1139,7 +1139,7 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct, #ifdef CONFIG_IP_NF_CT_ACCT if (do_acct) { ct->counters[CTINFO2DIR(ctinfo)].packets++; - ct->counters[CTINFO2DIR(ctinfo)].bytes += + ct->counters[CTINFO2DIR(ctinfo)].bytes += ntohs(skb->nh.iph->tot_len); if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000) || (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000)) @@ -1193,7 +1193,7 @@ ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user) { skb_orphan(skb); - local_bh_disable(); + local_bh_disable(); skb = ip_defrag(skb, user); local_bh_enable(); @@ -1210,7 +1210,7 @@ static void ip_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb) /* This ICMP is in reverse direction to the packet which caused it */ ct = ip_conntrack_get(skb, &ctinfo); - + if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) ctinfo = IP_CT_RELATED + IP_CT_IS_REPLY; else @@ -1278,7 +1278,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) struct inet_sock *inet = inet_sk(sk); struct ip_conntrack_tuple_hash *h; struct ip_conntrack_tuple tuple; - + IP_CT_TUPLE_U_BLANK(&tuple); tuple.src.ip = inet->rcv_saddr; tuple.src.u.tcp.port = inet->sport; @@ -1346,7 +1346,7 @@ static void free_conntrack_hash(struct list_head *hash, int vmalloced,int size) if (vmalloced) vfree(hash); else - free_pages((unsigned long)hash, + free_pages((unsigned long)hash, get_order(sizeof(struct list_head) * size)); } @@ -1357,8 +1357,8 @@ void ip_conntrack_cleanup(void) ip_ct_attach = NULL; /* This makes sure all current packets have passed through - netfilter framework. Roll on, two-stage module - delete... */ + netfilter framework. Roll on, two-stage module + delete... */ synchronize_net(); ip_ct_event_cache_flush(); @@ -1384,11 +1384,11 @@ static struct list_head *alloc_hashtable(int size, int *vmalloced) struct list_head *hash; unsigned int i; - *vmalloced = 0; - hash = (void*)__get_free_pages(GFP_KERNEL, + *vmalloced = 0; + hash = (void*)__get_free_pages(GFP_KERNEL, get_order(sizeof(struct list_head) * size)); - if (!hash) { + if (!hash) { *vmalloced = 1; printk(KERN_WARNING"ip_conntrack: falling back to vmalloc.\n"); hash = vmalloc(sizeof(struct list_head) * size); @@ -1421,7 +1421,7 @@ static int set_hashsize(const char *val, struct kernel_param *kp) if (!hash) return -ENOMEM; - /* We have to rehash for the new table anyway, so we also can + /* We have to rehash for the new table anyway, so we also can * use a new random seed */ get_random_bytes(&rnd, 4); @@ -1459,7 +1459,7 @@ int __init ip_conntrack_init(void) /* Idea from tcp.c: use 1/16384 of memory. On i386: 32MB * machine has 256 buckets. >= 1GB machines have 8192 buckets. */ - if (!ip_conntrack_htable_size) { + if (!ip_conntrack_htable_size) { ip_conntrack_htable_size = (((num_physpages << PAGE_SHIFT) / 16384) / sizeof(struct list_head)); @@ -1489,8 +1489,8 @@ int __init ip_conntrack_init(void) } ip_conntrack_cachep = kmem_cache_create("ip_conntrack", - sizeof(struct ip_conntrack), 0, - 0, NULL, NULL); + sizeof(struct ip_conntrack), 0, + 0, NULL, NULL); if (!ip_conntrack_cachep) { printk(KERN_ERR "Unable to create ip_conntrack slab cache\n"); goto err_free_hash; diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c index 0410c99..1faa68a 100644 --- a/net/ipv4/netfilter/ip_conntrack_ftp.c +++ b/net/ipv4/netfilter/ip_conntrack_ftp.c @@ -1,6 +1,6 @@ /* FTP extension for IP connection tracking. */ -/* (C) 1999-2001 Paul `Rusty' Russell +/* (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> * * This program is free software; you can redistribute it and/or modify @@ -169,7 +169,7 @@ static int try_eprt(const char *data, size_t dlen, u_int32_t array[6], int length; /* First character is delimiter, then "1" for IPv4, then - delimiter again. */ + delimiter again. */ if (dlen <= 3) return 0; delim = data[0]; if (isdigit(delim) || delim < 33 || delim > 126 @@ -344,14 +344,14 @@ static int help(struct sk_buff **pskb, if (!find_nl_seq(ntohl(th->seq), ct_ftp_info, dir)) { /* Now if this ends in \n, update ftp info. */ DEBUGP("ip_conntrack_ftp_help: wrong seq pos %s(%u) or %s(%u)\n", - ct_ftp_info->seq_aft_nl[0][dir] + ct_ftp_info->seq_aft_nl[0][dir] old_seq_aft_nl_set ? "":"(UNSET) ", old_seq_aft_nl); ret = NF_ACCEPT; goto out_update_nl; } /* Initialize IP array to expected address (it's not mentioned - in EPSV responses) */ + in EPSV responses) */ array[0] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 24) & 0xFF; array[1] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 16) & 0xFF; array[2] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 8) & 0xFF; @@ -386,7 +386,7 @@ static int help(struct sk_buff **pskb, DEBUGP("conntrack_ftp: match `%s' (%u bytes at %u)\n", fb_ptr + matchoff, matchlen, ntohl(th->seq) + matchoff); - + /* Allocate expectation which will be inserted */ exp = ip_conntrack_expect_alloc(ct); if (exp == NULL) { @@ -504,7 +504,7 @@ static int __init ip_conntrack_ftp_init(void) sprintf(tmpname, "ftp-%d", ports[i]); ftp[i].name = tmpname; - DEBUGP("ip_ct_ftp: registering helper for port %d\n", + DEBUGP("ip_ct_ftp: registering helper for port %d\n", ports[i]); ret = ip_conntrack_helper_register(&ftp[i]); diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323.c b/net/ipv4/netfilter/ip_conntrack_helper_h323.c index aabfe1c..53eb365 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_h323.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_h323.c @@ -42,7 +42,7 @@ MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper"); static int callforward_filter = 1; module_param(callforward_filter, bool, 0600); MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations " - "if both endpoints are on different sides " + "if both endpoints are on different sides " "(determined by routing information)"); /* Hooks for NAT */ diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c index 4d19373..2b760c5 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c @@ -560,7 +560,7 @@ conntrack_pptp_help(struct sk_buff **pskb, tcph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_tcph), &_tcph); BUG_ON(!tcph); nexthdr_off += tcph->doff * 4; - datalen = tcplen - tcph->doff * 4; + datalen = tcplen - tcph->doff * 4; pptph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_pptph), &_pptph); if (!pptph) { @@ -624,7 +624,7 @@ static struct ip_conntrack_helper pptp = { .max_expected = 2, .timeout = 5 * 60, .tuple = { .src = { .ip = 0, - .u = { .tcp = { .port = + .u = { .tcp = { .port = __constant_htons(PPTP_CONTROL_PORT) } } }, .dst = { .ip = 0, @@ -638,7 +638,7 @@ static struct ip_conntrack_helper pptp = { .dst = { .ip = 0, .u = { .all = 0 }, .protonum = 0xff - } + } }, .help = conntrack_pptp_help, .destroy = pptp_destroy_siblings, diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c index 91832ec..053e591 100644 --- a/net/ipv4/netfilter/ip_conntrack_irc.c +++ b/net/ipv4/netfilter/ip_conntrack_irc.c @@ -1,6 +1,6 @@ /* IRC extension for IP connection tracking, Version 1.21 * (C) 2000-2002 by Harald Welte <laforge@gnumonks.org> - * based on RR's ip_conntrack_ftp.c + * based on RR's ip_conntrack_ftp.c * * ip_conntrack_irc.c,v 1.21 2002/02/05 14:49:26 laforge Exp * @@ -12,12 +12,12 @@ * Module load syntax: * insmod ip_conntrack_irc.o ports=port1,port2,...port<MAX_PORTS> * max_dcc_channels=n dcc_timeout=secs - * + * * please give the ports of all IRC servers You wish to connect to. * If You don't specify ports, the default will be port 6667. * With max_dcc_channels you can define the maximum number of not * yet answered DCC channels per IRC session (default 8). - * With dcc_timeout you can specify how long the system waits for + * With dcc_timeout you can specify how long the system waits for * an expected DCC channel (default 300 seconds). * */ @@ -63,7 +63,7 @@ static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " #if 0 #define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s:" format, \ - __FILE__, __FUNCTION__ , ## args) + __FILE__, __FUNCTION__ , ## args) #else #define DEBUGP(format, args...) #endif @@ -71,7 +71,7 @@ static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " static int parse_dcc(char *data, char *data_end, u_int32_t *ip, u_int16_t *port, char **ad_beg_p, char **ad_end_p) /* tries to get the ip_addr and port out of a dcc command - return value: -1 on failure, 0 on success + return value: -1 on failure, 0 on success data pointer to first byte of DCC command data data_end pointer to last byte of dcc command data ip returns parsed ip of dcc command @@ -90,7 +90,7 @@ static int parse_dcc(char *data, char *data_end, u_int32_t *ip, /* skip blanks between ip and port */ while (*data == ' ') { - if (data >= data_end) + if (data >= data_end) return -1; data++; } @@ -171,7 +171,7 @@ static int help(struct sk_buff **pskb, DEBUGP("DCC %s detected\n", dccprotos[i]); data += strlen(dccprotos[i]); - /* we have at least + /* we have at least * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid * data left (== 14/13 bytes) */ if (parse_dcc((char *)data, data_limit, &dcc_ip, @@ -260,7 +260,7 @@ static int __init ip_conntrack_irc_init(void) irc_buffer = kmalloc(65536, GFP_KERNEL); if (!irc_buffer) return -ENOMEM; - + /* If no port given, default to standard irc port */ if (ports_c == 0) ports[ports_c++] = IRC_PORT; @@ -297,7 +297,7 @@ static int __init ip_conntrack_irc_init(void) return 0; } -/* This function is intentionally _NOT_ defined as __exit, because +/* This function is intentionally _NOT_ defined as __exit, because * it is needed by the init function */ static void ip_conntrack_irc_fini(void) { diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index a1d6a89..cc6dd49 100644 --- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c @@ -42,7 +42,7 @@ module_param(timeout, uint, 0400); MODULE_PARM_DESC(timeout, "timeout for master connection/replies in seconds"); static int help(struct sk_buff **pskb, - struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) + struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) { struct ip_conntrack_expect *exp; struct iphdr *iph = (*pskb)->nh.iph; diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c index 7f70b08..9228b76 100644 --- a/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/net/ipv4/netfilter/ip_conntrack_netlink.c @@ -6,10 +6,10 @@ * (C) 2003 by Patrick Mchardy <kaber@trash.net> * (C) 2005-2006 by Pablo Neira Ayuso <pablo@eurodev.net> * - * I've reworked this stuff to use attributes instead of conntrack + * I've reworked this stuff to use attributes instead of conntrack * structures. 5.44 am. I need more tea. --pablo 05/07/11. * - * Initial connection tracking via netlink development funded and + * Initial connection tracking via netlink development funded and * generally made possible by Network Robots, Inc. (www.networkrobots.com) * * Further development of this code funded by Astaro AG (http://www.astaro.com) @@ -45,7 +45,7 @@ MODULE_LICENSE("GPL"); static char __initdata version[] = "0.90"; static inline int -ctnetlink_dump_tuples_proto(struct sk_buff *skb, +ctnetlink_dump_tuples_proto(struct sk_buff *skb, const struct ip_conntrack_tuple *tuple, struct ip_conntrack_protocol *proto) { @@ -56,7 +56,7 @@ ctnetlink_dump_tuples_proto(struct sk_buff *skb, if (likely(proto->tuple_to_nfattr)) ret = proto->tuple_to_nfattr(skb, tuple); - + NFA_NEST_END(skb, nest_parms); return ret; @@ -70,7 +70,7 @@ ctnetlink_dump_tuples_ip(struct sk_buff *skb, const struct ip_conntrack_tuple *tuple) { struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP); - + NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(__be32), &tuple->src.ip); NFA_PUT(skb, CTA_IP_V4_DST, sizeof(__be32), &tuple->dst.ip); @@ -121,7 +121,7 @@ ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct) timeout = 0; else timeout = htonl(timeout_l / HZ); - + NFA_PUT(skb, CTA_TIMEOUT, sizeof(timeout), &timeout); return 0; @@ -141,7 +141,7 @@ ctnetlink_dump_protoinfo(struct sk_buff *skb, const struct ip_conntrack *ct) ip_conntrack_proto_put(proto); return 0; } - + nest_proto = NFA_NEST(skb, CTA_PROTOINFO); ret = proto->to_nfattr(skb, nest_proto, ct); @@ -164,7 +164,7 @@ ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct ip_conntrack *ct) if (!ct->helper) return 0; - + nest_helper = NFA_NEST(skb, CTA_HELP); NFA_PUT(skb, CTA_HELP_NAME, strlen(ct->helper->name), ct->helper->name); @@ -236,7 +236,7 @@ static inline int ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct) { __be32 use = htonl(atomic_read(&ct->ct_general.use)); - + NFA_PUT(skb, CTA_USE, sizeof(__be32), &use); return 0; @@ -248,7 +248,7 @@ nfattr_failure: static int ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, - int event, int nowait, + int event, int nowait, const struct ip_conntrack *ct) { struct nlmsghdr *nlh; @@ -271,7 +271,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_ORIGINAL)) < 0) goto nfattr_failure; NFA_NEST_END(skb, nest_parms); - + nest_parms = NFA_NEST(skb, CTA_TUPLE_REPLY); if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_REPLY)) < 0) goto nfattr_failure; @@ -299,7 +299,7 @@ nfattr_failure: #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS static int ctnetlink_conntrack_event(struct notifier_block *this, - unsigned long events, void *ptr) + unsigned long events, void *ptr) { struct nlmsghdr *nlh; struct nfgenmsg *nfmsg; @@ -324,7 +324,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, } else if (events & (IPCT_STATUS | IPCT_PROTOINFO)) { type = IPCTNL_MSG_CT_NEW; group = NFNLGRP_CONNTRACK_UPDATE; - } else + } else return NOTIFY_DONE; if (!nfnetlink_has_listeners(group)) @@ -349,7 +349,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_ORIGINAL)) < 0) goto nfattr_failure; NFA_NEST_END(skb, nest_parms); - + nest_parms = NFA_NEST(skb, CTA_TUPLE_REPLY); if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_REPLY)) < 0) goto nfattr_failure; @@ -368,16 +368,16 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, if (events & IPCT_PROTOINFO && ctnetlink_dump_protoinfo(skb, ct) < 0) - goto nfattr_failure; + goto nfattr_failure; if ((events & IPCT_HELPER || ct->helper) && ctnetlink_dump_helpinfo(skb, ct) < 0) - goto nfattr_failure; + goto nfattr_failure; #ifdef CONFIG_IP_NF_CONNTRACK_MARK if ((events & IPCT_MARK || ct->mark) && ctnetlink_dump_mark(skb, ct) < 0) - goto nfattr_failure; + goto nfattr_failure; #endif if (events & IPCT_COUNTER_FILLING && @@ -426,7 +426,7 @@ restart: cb->args[1] = 0; } if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, - cb->nlh->nlmsg_seq, + cb->nlh->nlmsg_seq, IPCTNL_MSG_CT_NEW, 1, ct) < 0) { nf_conntrack_get(&ct->ct_general); @@ -488,7 +488,7 @@ static const size_t cta_min_proto[CTA_PROTO_MAX] = { }; static inline int -ctnetlink_parse_tuple_proto(struct nfattr *attr, +ctnetlink_parse_tuple_proto(struct nfattr *attr, struct ip_conntrack_tuple *tuple) { struct nfattr *tb[CTA_PROTO_MAX]; @@ -508,9 +508,9 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr, if (likely(proto->nfattr_to_tuple)) ret = proto->nfattr_to_tuple(tb, tuple); - + ip_conntrack_proto_put(proto); - + return ret; } @@ -595,7 +595,7 @@ ctnetlink_parse_nat(struct nfattr *nat, int err; memset(range, 0, sizeof(*range)); - + nfattr_parse_nested(tb, CTA_NAT_MAX, nat); if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat)) @@ -647,7 +647,7 @@ static const size_t cta_min[CTA_MAX] = { }; static int -ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, +ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) { struct ip_conntrack_tuple_hash *h; @@ -676,14 +676,14 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, return -ENOENT; ct = tuplehash_to_ctrack(h); - + if (cda[CTA_ID-1]) { u_int32_t id = ntohl(*(__be32 *)NFA_DATA(cda[CTA_ID-1])); if (ct->id != id) { ip_conntrack_put(ct); return -ENOENT; } - } + } if (del_timer(&ct->timeout)) ct->timeout.function((unsigned long)ct); @@ -693,7 +693,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, } static int -ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, +ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) { struct ip_conntrack_tuple_hash *h; @@ -714,8 +714,8 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, return -ENOTSUPP; #endif if ((*errp = netlink_dump_start(ctnl, skb, nlh, - ctnetlink_dump_table, - ctnetlink_done)) != 0) + ctnetlink_dump_table, + ctnetlink_done)) != 0) return -EINVAL; rlen = NLMSG_ALIGN(nlh->nlmsg_len); @@ -751,7 +751,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, return -ENOMEM; } - err = ctnetlink_fill_info(skb2, NETLINK_CB(skb).pid, nlh->nlmsg_seq, + err = ctnetlink_fill_info(skb2, NETLINK_CB(skb).pid, nlh->nlmsg_seq, IPCTNL_MSG_CT_NEW, 1, ct); ip_conntrack_put(ct); if (err <= 0) @@ -779,12 +779,12 @@ ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING)) /* unchangeable */ return -EINVAL; - + if (d & IPS_SEEN_REPLY && !(status & IPS_SEEN_REPLY)) /* SEEN_REPLY bit can only be set */ return -EINVAL; - + if (d & IPS_ASSURED && !(status & IPS_ASSURED)) /* ASSURED bit can only be set */ return -EINVAL; @@ -857,7 +857,7 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[]) memset(&ct->help, 0, sizeof(ct->help)); } } - + ct->helper = helper; return 0; @@ -867,7 +867,7 @@ static inline int ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[]) { u_int32_t timeout = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1])); - + if (!del_timer(&ct->timeout)) return -ETIME; @@ -891,7 +891,7 @@ ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[]) if (proto->from_nfattr) err = proto->from_nfattr(tb, ct); - ip_conntrack_proto_put(proto); + ip_conntrack_proto_put(proto); return err; } @@ -934,7 +934,7 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) } static int -ctnetlink_create_conntrack(struct nfattr *cda[], +ctnetlink_create_conntrack(struct nfattr *cda[], struct ip_conntrack_tuple *otuple, struct ip_conntrack_tuple *rtuple) { @@ -943,7 +943,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], ct = ip_conntrack_alloc(otuple, rtuple); if (ct == NULL || IS_ERR(ct)) - return -ENOMEM; + return -ENOMEM; if (!cda[CTA_TIMEOUT-1]) goto err; @@ -979,13 +979,13 @@ ctnetlink_create_conntrack(struct nfattr *cda[], return 0; -err: +err: ip_conntrack_free(ct); return err; } -static int -ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, +static int +ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) { struct ip_conntrack_tuple otuple, rtuple; @@ -1039,9 +1039,9 @@ out_unlock: return err; } -/*********************************************************************** - * EXPECT - ***********************************************************************/ +/*********************************************************************** + * EXPECT + ***********************************************************************/ static inline int ctnetlink_exp_dump_tuple(struct sk_buff *skb, @@ -1049,7 +1049,7 @@ ctnetlink_exp_dump_tuple(struct sk_buff *skb, enum ctattr_expect type) { struct nfattr *nest_parms = NFA_NEST(skb, type); - + if (ctnetlink_dump_tuples(skb, tuple) < 0) goto nfattr_failure; @@ -1059,7 +1059,7 @@ ctnetlink_exp_dump_tuple(struct sk_buff *skb, nfattr_failure: return -1; -} +} static inline int ctnetlink_exp_dump_mask(struct sk_buff *skb, @@ -1090,7 +1090,7 @@ nfattr_failure: static inline int ctnetlink_exp_dump_expect(struct sk_buff *skb, - const struct ip_conntrack_expect *exp) + const struct ip_conntrack_expect *exp) { struct ip_conntrack *master = exp->master; __be32 timeout = htonl((exp->timeout.expires - jiffies) / HZ); @@ -1104,20 +1104,20 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb, &master->tuplehash[IP_CT_DIR_ORIGINAL].tuple, CTA_EXPECT_MASTER) < 0) goto nfattr_failure; - + NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(__be32), &timeout); NFA_PUT(skb, CTA_EXPECT_ID, sizeof(__be32), &id); return 0; - + nfattr_failure: return -1; } static int ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq, - int event, - int nowait, + int event, + int nowait, const struct ip_conntrack_expect *exp) { struct nlmsghdr *nlh; @@ -1216,7 +1216,7 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) goto out; *id = exp->id; } -out: +out: read_unlock_bh(&ip_conntrack_lock); return skb->len; @@ -1228,7 +1228,7 @@ static const size_t cta_min_exp[CTA_EXPECT_MAX] = { }; static int -ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, +ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) { struct ip_conntrack_tuple tuple; @@ -1247,7 +1247,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, return -EAFNOSUPPORT; if ((*errp = netlink_dump_start(ctnl, skb, nlh, - ctnetlink_exp_dump_table, + ctnetlink_exp_dump_table, ctnetlink_done)) != 0) return -EINVAL; rlen = NLMSG_ALIGN(nlh->nlmsg_len); @@ -1275,14 +1275,14 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, ip_conntrack_expect_put(exp); return -ENOENT; } - } + } err = -ENOMEM; skb2 = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); if (!skb2) goto out; - err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid, + err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid, nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW, 1, exp); if (err <= 0) @@ -1300,7 +1300,7 @@ out: } static int -ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, +ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) { struct ip_conntrack_expect *exp, *tmp; @@ -1333,7 +1333,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, /* after list removal, usage count == 1 */ ip_conntrack_unexpect_related(exp); - /* have to put what we 'get' above. + /* have to put what we 'get' above. * after this line usage count == 0 */ ip_conntrack_expect_put(exp); } else if (cda[CTA_EXPECT_HELP_NAME-1]) { @@ -1348,7 +1348,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, } list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list) { - if (exp->master->helper == h + if (exp->master->helper == h && del_timer(&exp->timeout)) { ip_ct_unlink_expect(exp); ip_conntrack_expect_put(exp); @@ -1413,7 +1413,7 @@ ctnetlink_create_expect(struct nfattr *cda[]) err = -ENOMEM; goto out; } - + exp->expectfn = NULL; exp->flags = 0; exp->master = ct; @@ -1423,7 +1423,7 @@ ctnetlink_create_expect(struct nfattr *cda[]) err = ip_conntrack_expect_related(exp); ip_conntrack_expect_put(exp); -out: +out: ip_conntrack_put(tuplehash_to_ctrack(h)); return err; } diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c index 295b6fa..ec71abe 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c @@ -94,9 +94,9 @@ static int icmp_packet(struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) { /* Try to delete connection immediately after all replies: - won't actually vanish as we still have skb, and del_timer - means this will only run once even if count hits zero twice - (theoretically possible with SMP) */ + won't actually vanish as we still have skb, and del_timer + means this will only run once even if count hits zero twice + (theoretically possible with SMP) */ if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) { if (atomic_dec_and_test(&ct->proto.icmp.count) && del_timer(&ct->timeout)) @@ -114,11 +114,11 @@ static int icmp_packet(struct ip_conntrack *ct, static int icmp_new(struct ip_conntrack *conntrack, const struct sk_buff *skb) { - static const u_int8_t valid_new[] = { + static const u_int8_t valid_new[] = { [ICMP_ECHO] = 1, [ICMP_TIMESTAMP] = 1, [ICMP_INFO_REQUEST] = 1, - [ICMP_ADDRESS] = 1 + [ICMP_ADDRESS] = 1 }; if (conntrack->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new) @@ -282,7 +282,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[], || !tb[CTA_PROTO_ICMP_ID-1]) return -EINVAL; - tuple->dst.u.icmp.type = + tuple->dst.u.icmp.type = *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_TYPE-1]); tuple->dst.u.icmp.code = *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]); diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index 2443322..9d5b917 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c @@ -1,9 +1,9 @@ /* * Connection tracking protocol helper module for SCTP. - * - * SCTP is defined in RFC 2960. References to various sections in this code + * + * SCTP is defined in RFC 2960. References to various sections in this code * are to this RFC. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. @@ -38,7 +38,7 @@ static DEFINE_RWLOCK(sctp_lock); /* FIXME: Examine ipfilter's timeouts and conntrack transitions more - closely. They're more complex. --RR + closely. They're more complex. --RR And so for me for SCTP :D -Kiran */ @@ -87,32 +87,32 @@ static const unsigned int * sctp_timeouts[] #define sSA SCTP_CONNTRACK_SHUTDOWN_ACK_SENT #define sIV SCTP_CONNTRACK_MAX -/* +/* These are the descriptions of the states: -NOTE: These state names are tantalizingly similar to the states of an +NOTE: These state names are tantalizingly similar to the states of an SCTP endpoint. But the interpretation of the states is a little different, -considering that these are the states of the connection and not of an end +considering that these are the states of the connection and not of an end point. Please note the subtleties. -Kiran NONE - Nothing so far. -COOKIE WAIT - We have seen an INIT chunk in the original direction, or also - an INIT_ACK chunk in the reply direction. +COOKIE WAIT - We have seen an INIT chunk in the original direction, or also + an INIT_ACK chunk in the reply direction. COOKIE ECHOED - We have seen a COOKIE_ECHO chunk in the original direction. ESTABLISHED - We have seen a COOKIE_ACK in the reply direction. SHUTDOWN_SENT - We have seen a SHUTDOWN chunk in the original direction. SHUTDOWN_RECD - We have seen a SHUTDOWN chunk in the reply directoin. SHUTDOWN_ACK_SENT - We have seen a SHUTDOWN_ACK chunk in the direction opposite - to that of the SHUTDOWN chunk. -CLOSED - We have seen a SHUTDOWN_COMPLETE chunk in the direction of - the SHUTDOWN chunk. Connection is closed. + to that of the SHUTDOWN chunk. +CLOSED - We have seen a SHUTDOWN_COMPLETE chunk in the direction of + the SHUTDOWN chunk. Connection is closed. */ /* TODO - - I have assumed that the first INIT is in the original direction. + - I have assumed that the first INIT is in the original direction. This messes things when an INIT comes in the reply direction in CLOSED state. - - Check the error type in the reply dir before transitioning from + - Check the error type in the reply dir before transitioning from cookie echoed to closed. - Sec 5.2.4 of RFC 2960 - Multi Homing support. @@ -229,7 +229,7 @@ static int do_basic_checks(struct ip_conntrack *conntrack, for_each_sctp_chunk (skb, sch, _sch, offset, count) { DEBUGP("Chunk Num: %d Type: %d\n", count, sch->type); - if (sch->type == SCTP_CID_INIT + if (sch->type == SCTP_CID_INIT || sch->type == SCTP_CID_INIT_ACK || sch->type == SCTP_CID_SHUTDOWN_COMPLETE) { flag = 1; @@ -269,42 +269,42 @@ static int new_state(enum ip_conntrack_dir dir, DEBUGP("Chunk type: %d\n", chunk_type); switch (chunk_type) { - case SCTP_CID_INIT: + case SCTP_CID_INIT: DEBUGP("SCTP_CID_INIT\n"); i = 0; break; - case SCTP_CID_INIT_ACK: + case SCTP_CID_INIT_ACK: DEBUGP("SCTP_CID_INIT_ACK\n"); i = 1; break; - case SCTP_CID_ABORT: + case SCTP_CID_ABORT: DEBUGP("SCTP_CID_ABORT\n"); i = 2; break; - case SCTP_CID_SHUTDOWN: + case SCTP_CID_SHUTDOWN: DEBUGP("SCTP_CID_SHUTDOWN\n"); i = 3; break; - case SCTP_CID_SHUTDOWN_ACK: + case SCTP_CID_SHUTDOWN_ACK: DEBUGP("SCTP_CID_SHUTDOWN_ACK\n"); i = 4; break; - case SCTP_CID_ERROR: + case SCTP_CID_ERROR: DEBUGP("SCTP_CID_ERROR\n"); i = 5; break; - case SCTP_CID_COOKIE_ECHO: + case SCTP_CID_COOKIE_ECHO: DEBUGP("SCTP_CID_COOKIE_ECHO\n"); i = 6; break; - case SCTP_CID_COOKIE_ACK: + case SCTP_CID_COOKIE_ACK: DEBUGP("SCTP_CID_COOKIE_ACK\n"); i = 7; break; - case SCTP_CID_SHUTDOWN_COMPLETE: + case SCTP_CID_SHUTDOWN_COMPLETE: DEBUGP("SCTP_CID_SHUTDOWN_COMPLETE\n"); i = 8; break; default: /* Other chunks like DATA, SACK, HEARTBEAT and its ACK do not cause a change in state */ - DEBUGP("Unknown chunk type, Will stay in %s\n", + DEBUGP("Unknown chunk type, Will stay in %s\n", sctp_conntrack_names[cur_state]); return cur_state; } - DEBUGP("dir: %d cur_state: %s chunk_type: %d new_state: %s\n", + DEBUGP("dir: %d cur_state: %s chunk_type: %d new_state: %s\n", dir, sctp_conntrack_names[cur_state], chunk_type, sctp_conntrack_names[sctp_conntracks[dir][i][cur_state]]); @@ -367,7 +367,7 @@ static int sctp_packet(struct ip_conntrack *conntrack, /* Sec 8.5.1 (C) */ if (!(sh->vtag == conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)]) && !(sh->vtag == conntrack->proto.sctp.vtag - [1 - CTINFO2DIR(ctinfo)] + [1 - CTINFO2DIR(ctinfo)] && (sch->flags & 1))) { write_unlock_bh(&sctp_lock); return -1; @@ -392,17 +392,17 @@ static int sctp_packet(struct ip_conntrack *conntrack, } /* If it is an INIT or an INIT ACK note down the vtag */ - if (sch->type == SCTP_CID_INIT + if (sch->type == SCTP_CID_INIT || sch->type == SCTP_CID_INIT_ACK) { sctp_inithdr_t _inithdr, *ih; ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), - sizeof(_inithdr), &_inithdr); + sizeof(_inithdr), &_inithdr); if (ih == NULL) { write_unlock_bh(&sctp_lock); return -1; } - DEBUGP("Setting vtag %x for dir %d\n", + DEBUGP("Setting vtag %x for dir %d\n", ih->init_tag, !CTINFO2DIR(ctinfo)); conntrack->proto.sctp.vtag[!CTINFO2DIR(ctinfo)] = ih->init_tag; } @@ -427,7 +427,7 @@ static int sctp_packet(struct ip_conntrack *conntrack, } /* Called when a new connection for this protocol found. */ -static int sctp_new(struct ip_conntrack *conntrack, +static int sctp_new(struct ip_conntrack *conntrack, const struct sk_buff *skb) { enum sctp_conntrack newconntrack; @@ -457,7 +457,7 @@ static int sctp_new(struct ip_conntrack *conntrack, newconntrack = SCTP_CONNTRACK_MAX; for_each_sctp_chunk (skb, sch, _sch, offset, count) { /* Don't need lock here: this conntrack not in circulation yet */ - newconntrack = new_state (IP_CT_DIR_ORIGINAL, + newconntrack = new_state (IP_CT_DIR_ORIGINAL, SCTP_CONNTRACK_NONE, sch->type); /* Invalid: delete conntrack */ @@ -472,14 +472,14 @@ static int sctp_new(struct ip_conntrack *conntrack, sctp_inithdr_t _inithdr, *ih; ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), - sizeof(_inithdr), &_inithdr); + sizeof(_inithdr), &_inithdr); if (ih == NULL) return 0; - DEBUGP("Setting vtag %x for new conn\n", + DEBUGP("Setting vtag %x for new conn\n", ih->init_tag); - conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = + conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = ih->init_tag; } else { /* Sec 8.5.1 (A) */ @@ -489,7 +489,7 @@ static int sctp_new(struct ip_conntrack *conntrack, /* If it is a shutdown ack OOTB packet, we expect a return shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */ else { - DEBUGP("Setting vtag %x for new conn OOTB\n", + DEBUGP("Setting vtag %x for new conn OOTB\n", sh->vtag); conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = sh->vtag; } @@ -500,16 +500,16 @@ static int sctp_new(struct ip_conntrack *conntrack, return 1; } -static struct ip_conntrack_protocol ip_conntrack_protocol_sctp = { - .proto = IPPROTO_SCTP, +static struct ip_conntrack_protocol ip_conntrack_protocol_sctp = { + .proto = IPPROTO_SCTP, .name = "sctp", - .pkt_to_tuple = sctp_pkt_to_tuple, - .invert_tuple = sctp_invert_tuple, - .print_tuple = sctp_print_tuple, + .pkt_to_tuple = sctp_pkt_to_tuple, + .invert_tuple = sctp_invert_tuple, + .print_tuple = sctp_print_tuple, .print_conntrack = sctp_print_conntrack, - .packet = sctp_packet, - .new = sctp_new, - .destroy = NULL, + .packet = sctp_packet, + .new = sctp_new, + .destroy = NULL, .me = THIS_MODULE, #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) @@ -603,7 +603,7 @@ static ctl_table ip_ct_net_table[] = { { .ctl_name = CTL_NET, .procname = "net", - .mode = 0555, + .mode = 0555, .child = ip_ct_ipv4_table, }, { .ctl_name = 0 } @@ -638,7 +638,7 @@ static int __init ip_conntrack_proto_sctp_init(void) ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp); #endif out: - DEBUGP("SCTP conntrack module loading %s\n", + DEBUGP("SCTP conntrack module loading %s\n", ret ? "failed": "succeeded"); return ret; } @@ -647,7 +647,7 @@ static void __exit ip_conntrack_proto_sctp_fini(void) { ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp); #ifdef CONFIG_SYSCTL - unregister_sysctl_table(ip_ct_sysctl_header); + unregister_sysctl_table(ip_ct_sysctl_header); #endif DEBUGP("SCTP conntrack module unloaded\n"); } diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index c34f48f..fa35b49f 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c @@ -45,8 +45,8 @@ /* Protects conntrack->proto.tcp */ static DEFINE_RWLOCK(tcp_lock); -/* "Be conservative in what you do, - be liberal in what you accept from others." +/* "Be conservative in what you do, + be liberal in what you accept from others." If it's non-zero, we mark only out of window RST segments as INVALID. */ int ip_ct_tcp_be_liberal __read_mostly = 0; @@ -54,8 +54,8 @@ int ip_ct_tcp_be_liberal __read_mostly = 0; connections. */ int ip_ct_tcp_loose __read_mostly = 1; -/* Max number of the retransmitted packets without receiving an (acceptable) - ACK from the destination. If this number is reached, a shorter timer +/* Max number of the retransmitted packets without receiving an (acceptable) + ACK from the destination. If this number is reached, a shorter timer will be started. */ int ip_ct_tcp_max_retrans __read_mostly = 3; @@ -74,7 +74,7 @@ static const char *tcp_conntrack_names[] = { "CLOSE", "LISTEN" }; - + #define SECS * HZ #define MINS * 60 SECS #define HOURS * 60 MINS @@ -90,10 +90,10 @@ unsigned int ip_ct_tcp_timeout_time_wait __read_mostly = 2 MINS; unsigned int ip_ct_tcp_timeout_close __read_mostly = 10 SECS; /* RFC1122 says the R2 limit should be at least 100 seconds. - Linux uses 15 packets as limit, which corresponds + Linux uses 15 packets as limit, which corresponds to ~13-30min depending on RTO. */ unsigned int ip_ct_tcp_timeout_max_retrans __read_mostly = 5 MINS; - + static const unsigned int * tcp_timeouts[] = { NULL, /* TCP_CONNTRACK_NONE */ &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */ @@ -106,7 +106,7 @@ static const unsigned int * tcp_timeouts[] &ip_ct_tcp_timeout_close, /* TCP_CONNTRACK_CLOSE, */ NULL, /* TCP_CONNTRACK_LISTEN */ }; - + #define sNO TCP_CONNTRACK_NONE #define sSS TCP_CONNTRACK_SYN_SENT #define sSR TCP_CONNTRACK_SYN_RECV @@ -129,13 +129,13 @@ enum tcp_bit_set { TCP_RST_SET, TCP_NONE_SET, }; - + /* * The TCP state transition table needs a few words... * * We are the man in the middle. All the packets go through us * but might get lost in transit to the destination. - * It is assumed that the destinations can't receive segments + * It is assumed that the destinations can't receive segments * we haven't seen. * * The checked segment is in window, but our windows are *not* @@ -145,11 +145,11 @@ enum tcp_bit_set { * The meaning of the states are: * * NONE: initial state - * SYN_SENT: SYN-only packet seen + * SYN_SENT: SYN-only packet seen * SYN_RECV: SYN-ACK packet seen * ESTABLISHED: ACK packet seen * FIN_WAIT: FIN packet seen - * CLOSE_WAIT: ACK seen (after FIN) + * CLOSE_WAIT: ACK seen (after FIN) * LAST_ACK: FIN seen (after FIN) * TIME_WAIT: last ACK seen * CLOSE: closed connection @@ -157,8 +157,8 @@ enum tcp_bit_set { * LISTEN state is not used. * * Packets marked as IGNORED (sIG): - * if they may be either invalid or valid - * and the receiver may send back a connection + * if they may be either invalid or valid + * and the receiver may send back a connection * closing RST or a SYN/ACK. * * Packets marked as INVALID (sIV): @@ -175,7 +175,7 @@ static const enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { * sSS -> sSS Retransmitted SYN * sSR -> sIG Late retransmitted SYN? * sES -> sIG Error: SYNs in window outside the SYN_SENT state - * are errors. Receiver will reply with RST + * are errors. Receiver will reply with RST * and close the connection. * Or we are not in sync and hold a dead connection. * sFW -> sIG @@ -188,10 +188,10 @@ static const enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { /*synack*/ { sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV }, /* * A SYN/ACK from the client is always invalid: - * - either it tries to set up a simultaneous open, which is + * - either it tries to set up a simultaneous open, which is * not supported; * - or the firewall has just been inserted between the two hosts - * during the session set-up. The SYN will be retransmitted + * during the session set-up. The SYN will be retransmitted * by the true client (or it'll time out). */ /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */ @@ -201,9 +201,9 @@ static const enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { * sSS -> sIV Client migth not send FIN in this state: * we enforce waiting for a SYN/ACK reply first. * sSR -> sFW Close started. - * sES -> sFW + * sES -> sFW * sFW -> sLA FIN seen in both directions, waiting for - * the last ACK. + * the last ACK. * Migth be a retransmitted FIN as well... * sCW -> sLA * sLA -> sLA Retransmitted FIN. Remain in the same state. @@ -281,7 +281,7 @@ static const enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */ /*rst*/ { sIV, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sIV }, /*none*/ { sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV } - } + } }; static int tcp_pkt_to_tuple(const struct sk_buff *skb, @@ -337,7 +337,7 @@ static int tcp_to_nfattr(struct sk_buff *skb, struct nfattr *nfa, const struct ip_conntrack *ct) { struct nfattr *nest_parms; - + read_lock_bh(&tcp_lock); nest_parms = NFA_NEST(skb, CTA_PROTOINFO_TCP); NFA_PUT(skb, CTA_PROTOINFO_TCP_STATE, sizeof(u_int8_t), @@ -367,7 +367,7 @@ static int nfattr_to_tcp(struct nfattr *cda[], struct ip_conntrack *ct) if (!attr) return 0; - nfattr_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr); + nfattr_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr); if (nfattr_bad_size(tb, CTA_PROTOINFO_TCP_MAX, cta_min_tcp)) return -EINVAL; @@ -376,7 +376,7 @@ static int nfattr_to_tcp(struct nfattr *cda[], struct ip_conntrack *ct) return -EINVAL; write_lock_bh(&tcp_lock); - ct->proto.tcp.state = + ct->proto.tcp.state = *(u_int8_t *)NFA_DATA(tb[CTA_PROTOINFO_TCP_STATE-1]); write_unlock_bh(&tcp_lock); @@ -395,30 +395,30 @@ static unsigned int get_conntrack_index(const struct tcphdr *tcph) /* TCP connection tracking based on 'Real Stateful TCP Packet Filtering in IP Filter' by Guido van Rooij. - + http://www.nluug.nl/events/sane2000/papers.html http://www.iae.nl/users/guido/papers/tcp_filtering.ps.gz - + The boundaries and the conditions are changed according to RFC793: the packet must intersect the window (i.e. segments may be after the right or before the left edge) and thus receivers may ACK segments after the right edge of the window. - td_maxend = max(sack + max(win,1)) seen in reply packets + td_maxend = max(sack + max(win,1)) seen in reply packets td_maxwin = max(max(win, 1)) + (sack - ack) seen in sent packets td_maxwin += seq + len - sender.td_maxend if seq + len > sender.td_maxend td_end = max(seq + len) seen in sent packets - + I. Upper bound for valid data: seq <= sender.td_maxend II. Lower bound for valid data: seq + len >= sender.td_end - receiver.td_maxwin III. Upper bound for valid ack: sack <= receiver.td_end IV. Lower bound for valid ack: ack >= receiver.td_end - MAXACKWINDOW - + where sack is the highest right edge of sack block found in the packet. - - The upper bound limit for a valid ack is not ignored - - we doesn't have to deal with fragments. + + The upper bound limit for a valid ack is not ignored - + we doesn't have to deal with fragments. */ static inline __u32 segment_seq_plus_len(__u32 seq, @@ -429,25 +429,25 @@ static inline __u32 segment_seq_plus_len(__u32 seq, return (seq + len - (iph->ihl + tcph->doff)*4 + (tcph->syn ? 1 : 0) + (tcph->fin ? 1 : 0)); } - + /* Fixme: what about big packets? */ #define MAXACKWINCONST 66000 #define MAXACKWINDOW(sender) \ ((sender)->td_maxwin > MAXACKWINCONST ? (sender)->td_maxwin \ : MAXACKWINCONST) - + /* * Simplified tcp_parse_options routine from tcp_input.c */ static void tcp_options(const struct sk_buff *skb, struct iphdr *iph, - struct tcphdr *tcph, + struct tcphdr *tcph, struct ip_ct_tcp_state *state) { unsigned char buff[(15 * 4) - sizeof(struct tcphdr)]; unsigned char *ptr; int length = (tcph->doff*4) - sizeof(struct tcphdr); - + if (!length) return; @@ -456,13 +456,13 @@ static void tcp_options(const struct sk_buff *skb, length, buff); BUG_ON(ptr == NULL); - state->td_scale = + state->td_scale = state->flags = 0; - + while (length > 0) { int opcode=*ptr++; int opsize; - + switch (opcode) { case TCPOPT_EOL: return; @@ -476,13 +476,13 @@ static void tcp_options(const struct sk_buff *skb, if (opsize > length) break; /* don't parse partial options */ - if (opcode == TCPOPT_SACK_PERM + if (opcode == TCPOPT_SACK_PERM && opsize == TCPOLEN_SACK_PERM) state->flags |= IP_CT_TCP_FLAG_SACK_PERM; else if (opcode == TCPOPT_WINDOW && opsize == TCPOLEN_WINDOW) { state->td_scale = *(u_int8_t *)ptr; - + if (state->td_scale > 14) { /* See RFC1323 */ state->td_scale = 14; @@ -517,16 +517,16 @@ static void tcp_sack(const struct sk_buff *skb, /* Fast path for timestamp-only option */ if (length == TCPOLEN_TSTAMP_ALIGNED*4 && *(__be32 *)ptr == - __constant_htonl((TCPOPT_NOP << 24) - | (TCPOPT_NOP << 16) - | (TCPOPT_TIMESTAMP << 8) - | TCPOLEN_TIMESTAMP)) + __constant_htonl((TCPOPT_NOP << 24) + | (TCPOPT_NOP << 16) + | (TCPOPT_TIMESTAMP << 8) + | TCPOLEN_TIMESTAMP)) return; - + while (length > 0) { int opcode=*ptr++; int opsize, i; - + switch (opcode) { case TCPOPT_EOL: return; @@ -540,16 +540,16 @@ static void tcp_sack(const struct sk_buff *skb, if (opsize > length) break; /* don't parse partial options */ - if (opcode == TCPOPT_SACK - && opsize >= (TCPOLEN_SACK_BASE - + TCPOLEN_SACK_PERBLOCK) - && !((opsize - TCPOLEN_SACK_BASE) - % TCPOLEN_SACK_PERBLOCK)) { - for (i = 0; - i < (opsize - TCPOLEN_SACK_BASE); - i += TCPOLEN_SACK_PERBLOCK) { + if (opcode == TCPOPT_SACK + && opsize >= (TCPOLEN_SACK_BASE + + TCPOLEN_SACK_PERBLOCK) + && !((opsize - TCPOLEN_SACK_BASE) + % TCPOLEN_SACK_PERBLOCK)) { + for (i = 0; + i < (opsize - TCPOLEN_SACK_BASE); + i += TCPOLEN_SACK_PERBLOCK) { tmp = ntohl(*((__be32 *)(ptr+i)+1)); - + if (after(tmp, *sack)) *sack = tmp; } @@ -561,18 +561,18 @@ static void tcp_sack(const struct sk_buff *skb, } } -static int tcp_in_window(struct ip_ct_tcp *state, - enum ip_conntrack_dir dir, - unsigned int index, - const struct sk_buff *skb, - struct iphdr *iph, - struct tcphdr *tcph) +static int tcp_in_window(struct ip_ct_tcp *state, + enum ip_conntrack_dir dir, + unsigned int index, + const struct sk_buff *skb, + struct iphdr *iph, + struct tcphdr *tcph) { struct ip_ct_tcp_state *sender = &state->seen[dir]; struct ip_ct_tcp_state *receiver = &state->seen[!dir]; __u32 seq, ack, sack, end, win, swin; int res; - + /* * Get the required data from the packet. */ @@ -580,23 +580,23 @@ static int tcp_in_window(struct ip_ct_tcp *state, ack = sack = ntohl(tcph->ack_seq); win = ntohs(tcph->window); end = segment_seq_plus_len(seq, skb->len, iph, tcph); - + if (receiver->flags & IP_CT_TCP_FLAG_SACK_PERM) tcp_sack(skb, iph, tcph, &sack); - + DEBUGP("tcp_in_window: START\n"); DEBUGP("tcp_in_window: src=%u.%u.%u.%u:%hu dst=%u.%u.%u.%u:%hu " "seq=%u ack=%u sack=%u win=%u end=%u\n", - NIPQUAD(iph->saddr), ntohs(tcph->source), + NIPQUAD(iph->saddr), ntohs(tcph->source), NIPQUAD(iph->daddr), ntohs(tcph->dest), seq, ack, sack, win, end); DEBUGP("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " "receiver end=%u maxend=%u maxwin=%u scale=%i\n", sender->td_end, sender->td_maxend, sender->td_maxwin, - sender->td_scale, - receiver->td_end, receiver->td_maxend, receiver->td_maxwin, + sender->td_scale, + receiver->td_end, receiver->td_maxend, receiver->td_maxwin, receiver->td_scale); - + if (sender->td_end == 0) { /* * Initialize sender data. @@ -605,26 +605,26 @@ static int tcp_in_window(struct ip_ct_tcp *state, /* * Outgoing SYN-ACK in reply to a SYN. */ - sender->td_end = + sender->td_end = sender->td_maxend = end; sender->td_maxwin = (win == 0 ? 1 : win); tcp_options(skb, iph, tcph, sender); - /* + /* * RFC 1323: * Both sides must send the Window Scale option * to enable window scaling in either direction. */ if (!(sender->flags & IP_CT_TCP_FLAG_WINDOW_SCALE && receiver->flags & IP_CT_TCP_FLAG_WINDOW_SCALE)) - sender->td_scale = + sender->td_scale = receiver->td_scale = 0; } else { /* * We are in the middle of a connection, * its history is lost for us. * Let's try to use the data from the packet. - */ + */ sender->td_end = end; sender->td_maxwin = (win == 0 ? 1 : win); sender->td_maxend = end + sender->td_maxwin; @@ -632,11 +632,11 @@ static int tcp_in_window(struct ip_ct_tcp *state, } else if (((state->state == TCP_CONNTRACK_SYN_SENT && dir == IP_CT_DIR_ORIGINAL) || (state->state == TCP_CONNTRACK_SYN_RECV - && dir == IP_CT_DIR_REPLY)) + && dir == IP_CT_DIR_REPLY)) && after(end, sender->td_end)) { /* * RFC 793: "if a TCP is reinitialized ... then it need - * not wait at all; it must only be sure to use sequence + * not wait at all; it must only be sure to use sequence * numbers larger than those recently used." */ sender->td_end = @@ -645,14 +645,14 @@ static int tcp_in_window(struct ip_ct_tcp *state, tcp_options(skb, iph, tcph, sender); } - + if (!(tcph->ack)) { /* * If there is no ACK, just pretend it was set and OK. */ ack = sack = receiver->td_end; - } else if (((tcp_flag_word(tcph) & (TCP_FLAG_ACK|TCP_FLAG_RST)) == - (TCP_FLAG_ACK|TCP_FLAG_RST)) + } else if (((tcp_flag_word(tcph) & (TCP_FLAG_ACK|TCP_FLAG_RST)) == + (TCP_FLAG_ACK|TCP_FLAG_RST)) && (ack == 0)) { /* * Broken TCP stacks, that set ACK in RST packets as well @@ -662,8 +662,8 @@ static int tcp_in_window(struct ip_ct_tcp *state, } if (seq == end - && (!tcph->rst - || (seq == 0 && state->state == TCP_CONNTRACK_SYN_SENT))) + && (!tcph->rst + || (seq == 0 && state->state == TCP_CONNTRACK_SYN_SENT))) /* * Packets contains no data: we assume it is valid * and check the ack value only. @@ -672,7 +672,7 @@ static int tcp_in_window(struct ip_ct_tcp *state, * SYN. */ seq = end = sender->td_end; - + DEBUGP("tcp_in_window: src=%u.%u.%u.%u:%hu dst=%u.%u.%u.%u:%hu " "seq=%u ack=%u sack =%u win=%u end=%u\n", NIPQUAD(iph->saddr), ntohs(tcph->source), @@ -681,26 +681,26 @@ static int tcp_in_window(struct ip_ct_tcp *state, DEBUGP("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " "receiver end=%u maxend=%u maxwin=%u scale=%i\n", sender->td_end, sender->td_maxend, sender->td_maxwin, - sender->td_scale, + sender->td_scale, receiver->td_end, receiver->td_maxend, receiver->td_maxwin, receiver->td_scale); - + DEBUGP("tcp_in_window: I=%i II=%i III=%i IV=%i\n", before(seq, sender->td_maxend + 1), - after(end, sender->td_end - receiver->td_maxwin - 1), - before(sack, receiver->td_end + 1), - after(ack, receiver->td_end - MAXACKWINDOW(sender))); - + after(end, sender->td_end - receiver->td_maxwin - 1), + before(sack, receiver->td_end + 1), + after(ack, receiver->td_end - MAXACKWINDOW(sender))); + if (before(seq, sender->td_maxend + 1) && after(end, sender->td_end - receiver->td_maxwin - 1) && before(sack, receiver->td_end + 1) && after(ack, receiver->td_end - MAXACKWINDOW(sender))) { - /* + /* * Take into account window scaling (RFC 1323). */ if (!tcph->syn) win <<= sender->td_scale; - + /* * Update sender data. */ @@ -720,7 +720,7 @@ static int tcp_in_window(struct ip_ct_tcp *state, receiver->td_maxend++; } - /* + /* * Check retransmissions. */ if (index == TCP_ACK_SET) { @@ -756,11 +756,11 @@ static int tcp_in_window(struct ip_ct_tcp *state, : "ACK is over the upper bound (ACKed data not seen yet)" : "SEQ is under the lower bound (already ACKed data retransmitted)" : "SEQ is over the upper bound (over the window of the receiver)"); - } - + } + DEBUGP("tcp_in_window: res=%i sender end=%u maxend=%u maxwin=%u " "receiver end=%u maxend=%u maxwin=%u\n", - res, sender->td_end, sender->td_maxend, sender->td_maxwin, + res, sender->td_end, sender->td_maxend, sender->td_maxwin, receiver->td_end, receiver->td_maxend, receiver->td_maxwin); return res; @@ -769,7 +769,7 @@ static int tcp_in_window(struct ip_ct_tcp *state, #ifdef CONFIG_IP_NF_NAT_NEEDED /* Update sender->td_end after NAT successfully mangled the packet */ void ip_conntrack_tcp_update(struct sk_buff *skb, - struct ip_conntrack *conntrack, + struct ip_conntrack *conntrack, enum ip_conntrack_dir dir) { struct iphdr *iph = skb->nh.iph; @@ -781,7 +781,7 @@ void ip_conntrack_tcp_update(struct sk_buff *skb, #endif end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, iph, tcph); - + write_lock_bh(&tcp_lock); /* * We have to worry for the ack in the reply packet only... @@ -793,11 +793,11 @@ void ip_conntrack_tcp_update(struct sk_buff *skb, DEBUGP("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i " "receiver end=%u maxend=%u maxwin=%u scale=%i\n", sender->td_end, sender->td_maxend, sender->td_maxwin, - sender->td_scale, + sender->td_scale, receiver->td_end, receiver->td_maxend, receiver->td_maxwin, receiver->td_scale); } - + #endif #define TH_FIN 0x01 @@ -847,8 +847,8 @@ static int tcp_error(struct sk_buff *skb, nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, "ip_ct_tcp: short packet "); return -NF_ACCEPT; - } - + } + /* Not whole TCP header or malformed packet */ if (th->doff*4 < sizeof(struct tcphdr) || tcplen < th->doff*4) { if (LOG_INVALID(IPPROTO_TCP)) @@ -856,7 +856,7 @@ static int tcp_error(struct sk_buff *skb, "ip_ct_tcp: truncated/malformed packet "); return -NF_ACCEPT; } - + /* Checksum invalid? Ignore. * We skip checking packets on the outgoing path * because it is assumed to be correct. @@ -893,11 +893,11 @@ static int tcp_packet(struct ip_conntrack *conntrack, struct tcphdr *th, _tcph; unsigned long timeout; unsigned int index; - + th = skb_header_pointer(skb, iph->ihl * 4, sizeof(_tcph), &_tcph); BUG_ON(th == NULL); - + write_lock_bh(&tcp_lock); old_state = conntrack->proto.tcp.state; dir = CTINFO2DIR(ctinfo); @@ -907,7 +907,7 @@ static int tcp_packet(struct ip_conntrack *conntrack, switch (new_state) { case TCP_CONNTRACK_IGNORE: /* Ignored packets: - * + * * a) SYN in ORIGINAL * b) SYN/ACK in REPLY * c) ACK in reply direction after initial SYN in original. @@ -916,30 +916,30 @@ static int tcp_packet(struct ip_conntrack *conntrack, && conntrack->proto.tcp.last_index == TCP_SYN_SET && conntrack->proto.tcp.last_dir != dir && ntohl(th->ack_seq) == - conntrack->proto.tcp.last_end) { - /* This SYN/ACK acknowledges a SYN that we earlier + conntrack->proto.tcp.last_end) { + /* This SYN/ACK acknowledges a SYN that we earlier * ignored as invalid. This means that the client and * the server are both in sync, while the firewall is * not. We kill this session and block the SYN/ACK so - * that the client cannot but retransmit its SYN and + * that the client cannot but retransmit its SYN and * thus initiate a clean new session. */ - write_unlock_bh(&tcp_lock); + write_unlock_bh(&tcp_lock); if (LOG_INVALID(IPPROTO_TCP)) nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, "ip_ct_tcp: " "killing out of sync session "); - if (del_timer(&conntrack->timeout)) - conntrack->timeout.function((unsigned long) - conntrack); - return -NF_DROP; + if (del_timer(&conntrack->timeout)) + conntrack->timeout.function((unsigned long) + conntrack); + return -NF_DROP; } conntrack->proto.tcp.last_index = index; conntrack->proto.tcp.last_dir = dir; conntrack->proto.tcp.last_seq = ntohl(th->seq); - conntrack->proto.tcp.last_end = + conntrack->proto.tcp.last_end = segment_seq_plus_len(ntohl(th->seq), skb->len, iph, th); - + write_unlock_bh(&tcp_lock); if (LOG_INVALID(IPPROTO_TCP)) nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, @@ -959,16 +959,16 @@ static int tcp_packet(struct ip_conntrack *conntrack, if (old_state < TCP_CONNTRACK_TIME_WAIT) break; if ((conntrack->proto.tcp.seen[dir].flags & - IP_CT_TCP_FLAG_CLOSE_INIT) + IP_CT_TCP_FLAG_CLOSE_INIT) || after(ntohl(th->seq), - conntrack->proto.tcp.seen[dir].td_end)) { - /* Attempt to reopen a closed connection. - * Delete this connection and look up again. */ - write_unlock_bh(&tcp_lock); - if (del_timer(&conntrack->timeout)) - conntrack->timeout.function((unsigned long) - conntrack); - return -NF_REPEAT; + conntrack->proto.tcp.seen[dir].td_end)) { + /* Attempt to reopen a closed connection. + * Delete this connection and look up again. */ + write_unlock_bh(&tcp_lock); + if (del_timer(&conntrack->timeout)) + conntrack->timeout.function((unsigned long) + conntrack); + return -NF_REPEAT; } else { write_unlock_bh(&tcp_lock); if (LOG_INVALID(IPPROTO_TCP)) @@ -979,9 +979,9 @@ static int tcp_packet(struct ip_conntrack *conntrack, case TCP_CONNTRACK_CLOSE: if (index == TCP_RST_SET && ((test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status) - && conntrack->proto.tcp.last_index == TCP_SYN_SET) - || (!test_bit(IPS_ASSURED_BIT, &conntrack->status) - && conntrack->proto.tcp.last_index == TCP_ACK_SET)) + && conntrack->proto.tcp.last_index == TCP_SYN_SET) + || (!test_bit(IPS_ASSURED_BIT, &conntrack->status) + && conntrack->proto.tcp.last_index == TCP_ACK_SET)) && ntohl(th->ack_seq) == conntrack->proto.tcp.last_end) { /* RST sent to invalid SYN or ACK we had let through * at a) and c) above: @@ -1000,13 +1000,13 @@ static int tcp_packet(struct ip_conntrack *conntrack, break; } - if (!tcp_in_window(&conntrack->proto.tcp, dir, index, + if (!tcp_in_window(&conntrack->proto.tcp, dir, index, skb, iph, th)) { write_unlock_bh(&tcp_lock); return -NF_ACCEPT; } in_window: - /* From now on we have got in-window packets */ + /* From now on we have got in-window packets */ conntrack->proto.tcp.last_index = index; DEBUGP("tcp_conntracks: src=%u.%u.%u.%u:%hu dst=%u.%u.%u.%u:%hu " @@ -1018,9 +1018,9 @@ static int tcp_packet(struct ip_conntrack *conntrack, old_state, new_state); conntrack->proto.tcp.state = new_state; - if (old_state != new_state + if (old_state != new_state && (new_state == TCP_CONNTRACK_FIN_WAIT - || new_state == TCP_CONNTRACK_CLOSE)) + || new_state == TCP_CONNTRACK_CLOSE)) conntrack->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT; timeout = conntrack->proto.tcp.retrans >= ip_ct_tcp_max_retrans && *tcp_timeouts[new_state] > ip_ct_tcp_timeout_max_retrans @@ -1046,8 +1046,8 @@ static int tcp_packet(struct ip_conntrack *conntrack, && (old_state == TCP_CONNTRACK_SYN_RECV || old_state == TCP_CONNTRACK_ESTABLISHED) && new_state == TCP_CONNTRACK_ESTABLISHED) { - /* Set ASSURED if we see see valid ack in ESTABLISHED - after SYN_RECV or a valid answer for a picked up + /* Set ASSURED if we see see valid ack in ESTABLISHED + after SYN_RECV or a valid answer for a picked up connection. */ set_bit(IPS_ASSURED_BIT, &conntrack->status); ip_conntrack_event_cache(IPCT_STATUS, skb); @@ -1056,7 +1056,7 @@ static int tcp_packet(struct ip_conntrack *conntrack, return NF_ACCEPT; } - + /* Called when a new connection for this protocol found. */ static int tcp_new(struct ip_conntrack *conntrack, const struct sk_buff *skb) @@ -1072,7 +1072,7 @@ static int tcp_new(struct ip_conntrack *conntrack, th = skb_header_pointer(skb, iph->ihl * 4, sizeof(_tcph), &_tcph); BUG_ON(th == NULL); - + /* Don't need lock here: this conntrack not in circulation yet */ new_state = tcp_conntracks[0][get_conntrack_index(th)] @@ -1113,7 +1113,7 @@ static int tcp_new(struct ip_conntrack *conntrack, if (conntrack->proto.tcp.seen[0].td_maxwin == 0) conntrack->proto.tcp.seen[0].td_maxwin = 1; conntrack->proto.tcp.seen[0].td_maxend = - conntrack->proto.tcp.seen[0].td_end + + conntrack->proto.tcp.seen[0].td_end + conntrack->proto.tcp.seen[0].td_maxwin; conntrack->proto.tcp.seen[0].td_scale = 0; @@ -1123,25 +1123,25 @@ static int tcp_new(struct ip_conntrack *conntrack, conntrack->proto.tcp.seen[1].flags = IP_CT_TCP_FLAG_SACK_PERM | IP_CT_TCP_FLAG_BE_LIBERAL; } - + conntrack->proto.tcp.seen[1].td_end = 0; conntrack->proto.tcp.seen[1].td_maxend = 0; conntrack->proto.tcp.seen[1].td_maxwin = 1; - conntrack->proto.tcp.seen[1].td_scale = 0; + conntrack->proto.tcp.seen[1].td_scale = 0; /* tcp_packet will set them */ conntrack->proto.tcp.state = TCP_CONNTRACK_NONE; conntrack->proto.tcp.last_index = TCP_NONE_SET; - + DEBUGP("tcp_new: sender end=%u maxend=%u maxwin=%u scale=%i " "receiver end=%u maxend=%u maxwin=%u scale=%i\n", sender->td_end, sender->td_maxend, sender->td_maxwin, - sender->td_scale, + sender->td_scale, receiver->td_end, receiver->td_maxend, receiver->td_maxwin, receiver->td_scale); return 1; } - + struct ip_conntrack_protocol ip_conntrack_protocol_tcp = { .proto = IPPROTO_TCP, diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c index d0e8a16..a99a7c7 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c @@ -70,7 +70,7 @@ static int udp_packet(struct ip_conntrack *conntrack, /* If we've seen traffic both ways, this is some kind of UDP stream. Extend timeout. */ if (test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) { - ip_ct_refresh_acct(conntrack, ctinfo, skb, + ip_ct_refresh_acct(conntrack, ctinfo, skb, ip_ct_udp_timeout_stream); /* Also, more likely to be important, and not a probe */ if (!test_and_set_bit(IPS_ASSURED_BIT, &conntrack->status)) @@ -102,7 +102,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, "ip_ct_udp: short packet "); return -NF_ACCEPT; } - + /* Truncated/malformed packets */ if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) { if (LOG_INVALID(IPPROTO_UDP)) @@ -110,7 +110,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, "ip_ct_udp: truncated/malformed packet "); return -NF_ACCEPT; } - + /* Packet with no checksum */ if (!hdr->check) return NF_ACCEPT; @@ -126,7 +126,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, "ip_ct_udp: bad UDP checksum "); return -NF_ACCEPT; } - + return NF_ACCEPT; } diff --git a/net/ipv4/netfilter/ip_conntrack_sip.c b/net/ipv4/netfilter/ip_conntrack_sip.c index 11c588a..c59a962 100644 --- a/net/ipv4/netfilter/ip_conntrack_sip.c +++ b/net/ipv4/netfilter/ip_conntrack_sip.c @@ -321,7 +321,7 @@ int ct_sip_get_info(const char *dptr, size_t dlen, continue; } aux = ct_sip_search(hnfo->ln_str, dptr, hnfo->ln_strlen, - ct_sip_lnlen(dptr, limit), + ct_sip_lnlen(dptr, limit), hnfo->case_sensitive); if (!aux) { DEBUGP("'%s' not found in '%s'.\n", hnfo->ln_str, @@ -406,7 +406,7 @@ static int sip_help(struct sk_buff **pskb, if (dataoff >= (*pskb)->len) { DEBUGP("skb->len = %u\n", (*pskb)->len); return NF_ACCEPT; - } + } ip_ct_refresh(ct, *pskb, sip_timeout * HZ); @@ -439,16 +439,16 @@ static int sip_help(struct sk_buff **pskb, } /* Get ip and port address from SDP packet. */ if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen, - POS_CONNECTION) > 0) { + POS_CONNECTION) > 0) { /* We'll drop only if there are parse problems. */ if (parse_ipaddr(dptr + matchoff, NULL, &ipaddr, - dptr + datalen) < 0) { + dptr + datalen) < 0) { ret = NF_DROP; goto out; } if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen, - POS_MEDIA) > 0) { + POS_MEDIA) > 0) { port = simple_strtoul(dptr + matchoff, NULL, 10); if (port < 1024) { diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index 86efb54..5903588 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c @@ -46,7 +46,7 @@ DECLARE_PER_CPU(struct ip_conntrack_stat, ip_conntrack_stat); static int kill_proto(struct ip_conntrack *i, void *data) { - return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum == + return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum == *((u_int8_t *) data)); } @@ -124,12 +124,12 @@ static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos) (*pos)++; return ct_get_next(s, v); } - + static void ct_seq_stop(struct seq_file *s, void *v) { read_unlock_bh(&ip_conntrack_lock); } - + static int ct_seq_show(struct seq_file *s, void *v) { const struct ip_conntrack_tuple_hash *hash = v; @@ -155,12 +155,12 @@ static int ct_seq_show(struct seq_file *s, void *v) if (proto->print_conntrack(s, conntrack)) return -ENOSPC; - + if (print_tuple(s, &conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple, proto)) return -ENOSPC; - if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_ORIGINAL])) + if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_ORIGINAL])) return -ENOSPC; if (!(test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status))) @@ -171,7 +171,7 @@ static int ct_seq_show(struct seq_file *s, void *v) proto)) return -ENOSPC; - if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_REPLY])) + if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_REPLY])) return -ENOSPC; if (test_bit(IPS_ASSURED_BIT, &conntrack->status)) @@ -200,7 +200,7 @@ static struct seq_operations ct_seq_ops = { .stop = ct_seq_stop, .show = ct_seq_show }; - + static int ct_open(struct inode *inode, struct file *file) { struct seq_file *seq; @@ -229,7 +229,7 @@ static struct file_operations ct_file_ops = { .llseek = seq_lseek, .release = seq_release_private, }; - + /* expects */ static void *exp_seq_start(struct seq_file *s, loff_t *pos) { @@ -253,7 +253,7 @@ static void *exp_seq_start(struct seq_file *s, loff_t *pos) static void *exp_seq_next(struct seq_file *s, void *v, loff_t *pos) { - struct list_head *e = v; + struct list_head *e = v; ++*pos; e = e->next; @@ -297,7 +297,7 @@ static int exp_open(struct inode *inode, struct file *file) { return seq_open(file, &exp_seq_ops); } - + static struct file_operations exp_file_ops = { .owner = THIS_MODULE, .open = exp_open, @@ -426,14 +426,14 @@ static unsigned int ip_conntrack_help(unsigned int hooknum, } static unsigned int ip_conntrack_defrag(unsigned int hooknum, - struct sk_buff **pskb, - const struct net_device *in, - const struct net_device *out, - int (*okfn)(struct sk_buff *)) + struct sk_buff **pskb, + const struct net_device *in, + const struct net_device *out, + int (*okfn)(struct sk_buff *)) { #if !defined(CONFIG_IP_NF_NAT) && !defined(CONFIG_IP_NF_NAT_MODULE) /* Previously seen (loopback)? Ignore. Do this before - fragment check. */ + fragment check. */ if ((*pskb)->nfct) return NF_ACCEPT; #endif @@ -441,7 +441,7 @@ static unsigned int ip_conntrack_defrag(unsigned int hooknum, /* Gather fragments. */ if ((*pskb)->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) { *pskb = ip_ct_gather_frags(*pskb, - hooknum == NF_IP_PRE_ROUTING ? + hooknum == NF_IP_PRE_ROUTING ? IP_DEFRAG_CONNTRACK_IN : IP_DEFRAG_CONNTRACK_OUT); if (!*pskb) @@ -776,7 +776,7 @@ static ctl_table ip_ct_net_table[] = { { .ctl_name = CTL_NET, .procname = "net", - .mode = 0555, + .mode = 0555, .child = ip_ct_ipv4_table, }, { .ctl_name = 0 } diff --git a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c index ef56de2..76e175e 100644 --- a/net/ipv4/netfilter/ip_conntrack_tftp.c +++ b/net/ipv4/netfilter/ip_conntrack_tftp.c @@ -33,7 +33,7 @@ MODULE_PARM_DESC(ports, "port numbers of tftp servers"); #if 0 #define DEBUGP(format, args...) printk("%s:%s:" format, \ - __FILE__, __FUNCTION__ , ## args) + __FILE__, __FUNCTION__ , ## args) #else #define DEBUGP(format, args...) #endif @@ -113,7 +113,7 @@ static void ip_conntrack_tftp_fini(void) DEBUGP("unregistering helper for port %d\n", ports[i]); ip_conntrack_helper_unregister(&tftp[i]); - } + } } static int __init ip_conntrack_tftp_init(void) diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c index 5e08c2b..275a4d3 100644 --- a/net/ipv4/netfilter/ip_nat_core.c +++ b/net/ipv4/netfilter/ip_nat_core.c @@ -120,7 +120,7 @@ static int in_range(const struct ip_conntrack_tuple *tuple, const struct ip_nat_range *range) { - struct ip_nat_protocol *proto = + struct ip_nat_protocol *proto = __ip_nat_proto_find(tuple->dst.protonum); /* If we are supposed to map IPs, then we must be in the @@ -443,8 +443,8 @@ int ip_nat_icmp_reply_translation(struct ip_conntrack *ct, (*pskb)->nfctinfo == IP_CT_RELATED+IP_CT_IS_REPLY); /* Redirects on non-null nats must be dropped, else they'll - start talking to each other without our translation, and be - confused... --RR */ + start talking to each other without our translation, and be + confused... --RR */ if (inside->icmp.type == ICMP_REDIRECT) { /* If NAT isn't finished, assume it and drop. */ if ((ct->status & IPS_NAT_DONE_MASK) != IPS_NAT_DONE_MASK) @@ -458,8 +458,8 @@ int ip_nat_icmp_reply_translation(struct ip_conntrack *ct, *pskb, manip, dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY"); if (!ip_ct_get_tuple(&inside->ip, *pskb, (*pskb)->nh.iph->ihl*4 + - sizeof(struct icmphdr) + inside->ip.ihl*4, - &inner, + sizeof(struct icmphdr) + inside->ip.ihl*4, + &inner, __ip_conntrack_proto_find(inside->ip.protocol))) return 0; @@ -537,7 +537,7 @@ EXPORT_SYMBOL(ip_nat_protocol_unregister); #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) int -ip_nat_port_range_to_nfattr(struct sk_buff *skb, +ip_nat_port_range_to_nfattr(struct sk_buff *skb, const struct ip_nat_range *range) { NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16), @@ -555,21 +555,21 @@ int ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) { int ret = 0; - + /* we have to return whether we actually parsed something or not */ if (tb[CTA_PROTONAT_PORT_MIN-1]) { ret = 1; - range->min.tcp.port = + range->min.tcp.port = *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); } - + if (!tb[CTA_PROTONAT_PORT_MAX-1]) { - if (ret) + if (ret) range->max.tcp.port = range->min.tcp.port; } else { ret = 1; - range->max.tcp.port = + range->max.tcp.port = *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); } diff --git a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c index 913960e..32e01d8 100644 --- a/net/ipv4/netfilter/ip_nat_ftp.c +++ b/net/ipv4/netfilter/ip_nat_ftp.c @@ -50,7 +50,7 @@ mangle_rfc959_packet(struct sk_buff **pskb, DEBUGP("calling ip_nat_mangle_tcp_packet\n"); *seq += strlen(buffer) - matchlen; - return ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, + return ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, matchlen, buffer, strlen(buffer)); } @@ -72,7 +72,7 @@ mangle_eprt_packet(struct sk_buff **pskb, DEBUGP("calling ip_nat_mangle_tcp_packet\n"); *seq += strlen(buffer) - matchlen; - return ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, + return ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, matchlen, buffer, strlen(buffer)); } @@ -94,7 +94,7 @@ mangle_epsv_packet(struct sk_buff **pskb, DEBUGP("calling ip_nat_mangle_tcp_packet\n"); *seq += strlen(buffer) - matchlen; - return ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, + return ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, matchlen, buffer, strlen(buffer)); } diff --git a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c index 2e5c4bc..dc778cf 100644 --- a/net/ipv4/netfilter/ip_nat_helper.c +++ b/net/ipv4/netfilter/ip_nat_helper.c @@ -1,4 +1,4 @@ -/* ip_nat_helper.c - generic support functions for NAT helpers +/* ip_nat_helper.c - generic support functions for NAT helpers * * (C) 2000-2002 Harald Welte <laforge@netfilter.org> * (C) 2003-2004 Netfilter Core Team <coreteam@netfilter.org> @@ -8,7 +8,7 @@ * published by the Free Software Foundation. * * 14 Jan 2002 Harald Welte <laforge@gnumonks.org>: - * - add support for SACK adjustment + * - add support for SACK adjustment * 14 Mar 2002 Harald Welte <laforge@gnumonks.org>: * - merge SACK support into newnat API * 16 Aug 2002 Brian J. Murrell <netfilter@interlinx.bc.ca>: @@ -45,10 +45,10 @@ static DEFINE_SPINLOCK(ip_nat_seqofs_lock); /* Setup TCP sequence correction given this change at this sequence */ -static inline void +static inline void adjust_tcp_sequence(u32 seq, int sizediff, - struct ip_conntrack *ct, + struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) { int dir; @@ -150,7 +150,7 @@ static int enlarge_skb(struct sk_buff **pskb, unsigned int extra) * skb enlargement, ... * * */ -int +int ip_nat_mangle_tcp_packet(struct sk_buff **pskb, struct ip_conntrack *ct, enum ip_conntrack_info ctinfo, @@ -186,7 +186,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, tcph->check = tcp_v4_check(datalen, iph->saddr, iph->daddr, csum_partial((char *)tcph, - datalen, 0)); + datalen, 0)); } else nf_proto_csum_replace2(&tcph->check, *pskb, htons(oldlen), htons(datalen), 1); @@ -202,7 +202,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, return 1; } EXPORT_SYMBOL(ip_nat_mangle_tcp_packet); - + /* Generic function for mangling variable-length address changes inside * NATed UDP connections (like the CONNECT DATA XXXXX MESG XXXXX INDEX XXXXX * command in the Amanda protocol) @@ -213,7 +213,7 @@ EXPORT_SYMBOL(ip_nat_mangle_tcp_packet); * XXX - This function could be merged with ip_nat_mangle_tcp_packet which * should be fairly easy to do. */ -int +int ip_nat_mangle_udp_packet(struct sk_buff **pskb, struct ip_conntrack *ct, enum ip_conntrack_info ctinfo, @@ -228,8 +228,8 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, /* UDP helpers might accidentally mangle the wrong packet */ iph = (*pskb)->nh.iph; - if ((*pskb)->len < iph->ihl*4 + sizeof(*udph) + - match_offset + match_len) + if ((*pskb)->len < iph->ihl*4 + sizeof(*udph) + + match_offset + match_len) return 0; if (!skb_make_writable(pskb, (*pskb)->len)) @@ -258,9 +258,9 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, if ((*pskb)->ip_summed != CHECKSUM_PARTIAL) { udph->check = 0; udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr, - datalen, IPPROTO_UDP, - csum_partial((char *)udph, - datalen, 0)); + datalen, IPPROTO_UDP, + csum_partial((char *)udph, + datalen, 0)); if (!udph->check) udph->check = CSUM_MANGLED_0; } else @@ -273,7 +273,7 @@ EXPORT_SYMBOL(ip_nat_mangle_udp_packet); /* Adjust one found SACK option including checksum correction */ static void sack_adjust(struct sk_buff *skb, - struct tcphdr *tcph, + struct tcphdr *tcph, unsigned int sackoff, unsigned int sackend, struct ip_nat_seq *natseq) @@ -360,14 +360,14 @@ ip_nat_sack_adjust(struct sk_buff **pskb, /* TCP sequence number adjustment. Returns 1 on success, 0 on failure */ int -ip_nat_seq_adjust(struct sk_buff **pskb, - struct ip_conntrack *ct, +ip_nat_seq_adjust(struct sk_buff **pskb, + struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) { struct tcphdr *tcph; int dir; __be32 newseq, newack; - struct ip_nat_seq *this_way, *other_way; + struct ip_nat_seq *this_way, *other_way; dir = CTINFO2DIR(ctinfo); diff --git a/net/ipv4/netfilter/ip_nat_helper_pptp.c b/net/ipv4/netfilter/ip_nat_helper_pptp.c index ec957bb..24ce4a5 100644 --- a/net/ipv4/netfilter/ip_nat_helper_pptp.c +++ b/net/ipv4/netfilter/ip_nat_helper_pptp.c @@ -202,10 +202,10 @@ pptp_outbound_pkt(struct sk_buff **pskb, /* mangle packet */ if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, - cid_off + sizeof(struct pptp_pkt_hdr) + - sizeof(struct PptpControlHeader), - sizeof(new_callid), (char *)&new_callid, - sizeof(new_callid)) == 0) + cid_off + sizeof(struct pptp_pkt_hdr) + + sizeof(struct PptpControlHeader), + sizeof(new_callid), (char *)&new_callid, + sizeof(new_callid)) == 0) return NF_DROP; return NF_ACCEPT; @@ -293,7 +293,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, ntohs(REQ_CID(pptpReq, pcid_off)), ntohs(new_pcid)); if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, - pcid_off + sizeof(struct pptp_pkt_hdr) + + pcid_off + sizeof(struct pptp_pkt_hdr) + sizeof(struct PptpControlHeader), sizeof(new_pcid), (char *)&new_pcid, sizeof(new_pcid)) == 0) diff --git a/net/ipv4/netfilter/ip_nat_irc.c b/net/ipv4/netfilter/ip_nat_irc.c index feb26b4..cfaeea3 100644 --- a/net/ipv4/netfilter/ip_nat_irc.c +++ b/net/ipv4/netfilter/ip_nat_irc.c @@ -88,8 +88,8 @@ static unsigned int help(struct sk_buff **pskb, DEBUGP("ip_nat_irc: Inserting '%s' == %u.%u.%u.%u, port %u\n", buffer, NIPQUAD(exp->tuple.src.ip), port); - ret = ip_nat_mangle_tcp_packet(pskb, exp->master, ctinfo, - matchoff, matchlen, buffer, + ret = ip_nat_mangle_tcp_packet(pskb, exp->master, ctinfo, + matchoff, matchlen, buffer, strlen(buffer)); if (ret != NF_ACCEPT) ip_conntrack_unexpect_related(exp); diff --git a/net/ipv4/netfilter/ip_nat_proto_icmp.c b/net/ipv4/netfilter/ip_nat_proto_icmp.c index fb716ed..22a528a 100644 --- a/net/ipv4/netfilter/ip_nat_proto_icmp.c +++ b/net/ipv4/netfilter/ip_nat_proto_icmp.c @@ -45,7 +45,7 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple, for (i = 0; i < range_size; i++, id++) { tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) + - (id % range_size)); + (id % range_size)); if (!ip_nat_used_tuple(tuple, conntrack)) return 1; } diff --git a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c index e1c8a05..080eb1d 100644 --- a/net/ipv4/netfilter/ip_nat_rule.c +++ b/net/ipv4/netfilter/ip_nat_rule.c @@ -112,7 +112,7 @@ static unsigned int ipt_snat_target(struct sk_buff **pskb, /* Connection must be valid and new. */ IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED - || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); + || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); IP_NF_ASSERT(out); return ip_nat_setup_info(ct, &mr->range[0], hooknum); @@ -223,8 +223,8 @@ alloc_null_binding(struct ip_conntrack *conntrack, unsigned int alloc_null_binding_confirmed(struct ip_conntrack *conntrack, - struct ip_nat_info *info, - unsigned int hooknum) + struct ip_nat_info *info, + unsigned int hooknum) { __be32 ip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC diff --git a/net/ipv4/netfilter/ip_nat_sip.c b/net/ipv4/netfilter/ip_nat_sip.c index 6223abc..325c5a9 100644 --- a/net/ipv4/netfilter/ip_nat_sip.c +++ b/net/ipv4/netfilter/ip_nat_sip.c @@ -88,7 +88,7 @@ static int map_sip_addr(struct sk_buff **pskb, enum ip_conntrack_info ctinfo, return 1; if (!ip_nat_mangle_udp_packet(pskb, ct, ctinfo, - matchoff, matchlen, addr, addrlen)) + matchoff, matchlen, addr, addrlen)) return 0; *dptr = (*pskb)->data + (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr); return 1; @@ -149,7 +149,7 @@ static unsigned int mangle_sip_packet(struct sk_buff **pskb, return 0; if (!ip_nat_mangle_udp_packet(pskb, ct, ctinfo, - matchoff, matchlen, buffer, bufflen)) + matchoff, matchlen, buffer, bufflen)) return 0; /* We need to reload this. Thanks Patrick. */ @@ -170,7 +170,7 @@ static int mangle_content_len(struct sk_buff **pskb, /* Get actual SDP lenght */ if (ct_sip_get_info(dptr, (*pskb)->len - dataoff, &matchoff, - &matchlen, POS_SDP_HEADER) > 0) { + &matchlen, POS_SDP_HEADER) > 0) { /* since ct_sip_get_info() give us a pointer passing 'v=' we need to add 2 bytes in this count. */ @@ -178,7 +178,7 @@ static int mangle_content_len(struct sk_buff **pskb, /* Now, update SDP lenght */ if (ct_sip_get_info(dptr, (*pskb)->len - dataoff, &matchoff, - &matchlen, POS_CONTENT) > 0) { + &matchlen, POS_CONTENT) > 0) { bufflen = sprintf(buffer, "%u", c_len); @@ -204,17 +204,17 @@ static unsigned int mangle_sdp(struct sk_buff **pskb, /* Mangle owner and contact info. */ bufflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(newip)); if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff, - buffer, bufflen, POS_OWNER)) + buffer, bufflen, POS_OWNER)) return 0; if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff, - buffer, bufflen, POS_CONNECTION)) + buffer, bufflen, POS_CONNECTION)) return 0; /* Mangle media port. */ bufflen = sprintf(buffer, "%u", port); if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff, - buffer, bufflen, POS_MEDIA)) + buffer, bufflen, POS_MEDIA)) return 0; return mangle_content_len(pskb, ctinfo, ct, dptr); diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index c3d9f3b..e41d0ef 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c @@ -3,11 +3,11 @@ * * Basic SNMP Application Layer Gateway * - * This IP NAT module is intended for use with SNMP network - * discovery and monitoring applications where target networks use + * This IP NAT module is intended for use with SNMP network + * discovery and monitoring applications where target networks use * conflicting private address realms. * - * Static NAT is used to remap the networks from the view of the network + * Static NAT is used to remap the networks from the view of the network * management system at the IP layer, and this module remaps some application * layer addresses to match. * @@ -20,7 +20,7 @@ * More information on ALG and associated issues can be found in * RFC 2962 * - * The ASB.1/BER parsing code is derived from the gxsnmp package by Gregory + * The ASB.1/BER parsing code is derived from the gxsnmp package by Gregory * McLean & Jochen Friedrich, stripped down for use in the kernel. * * Copyright (c) 2000 RP Internet (www.rpi.net.au). @@ -69,8 +69,8 @@ MODULE_DESCRIPTION("Basic SNMP Application Layer Gateway"); static int debug; static DEFINE_SPINLOCK(snmp_lock); -/* - * Application layer address mapping mimics the NAT mapping, but +/* + * Application layer address mapping mimics the NAT mapping, but * only for the first octet in this case (a more flexible system * can be implemented if needed). */ @@ -80,7 +80,7 @@ struct oct1_map u_int8_t to; }; - + /***************************************************************************** * * Basic ASN.1 decoding routines (gxsnmp author Dirk Wisse) @@ -129,7 +129,7 @@ struct oct1_map #define ASN1_ERR_DEC_LENGTH_MISMATCH 4 #define ASN1_ERR_DEC_BADVALUE 5 -/* +/* * ASN.1 context. */ struct asn1_ctx @@ -148,10 +148,10 @@ struct asn1_octstr unsigned char *data; unsigned int len; }; - + static void asn1_open(struct asn1_ctx *ctx, - unsigned char *buf, - unsigned int len) + unsigned char *buf, + unsigned int len) { ctx->begin = buf; ctx->end = buf + len; @@ -172,9 +172,9 @@ static unsigned char asn1_octet_decode(struct asn1_ctx *ctx, unsigned char *ch) static unsigned char asn1_tag_decode(struct asn1_ctx *ctx, unsigned int *tag) { unsigned char ch; - + *tag = 0; - + do { if (!asn1_octet_decode(ctx, &ch)) @@ -185,20 +185,20 @@ static unsigned char asn1_tag_decode(struct asn1_ctx *ctx, unsigned int *tag) return 1; } -static unsigned char asn1_id_decode(struct asn1_ctx *ctx, - unsigned int *cls, - unsigned int *con, - unsigned int *tag) +static unsigned char asn1_id_decode(struct asn1_ctx *ctx, + unsigned int *cls, + unsigned int *con, + unsigned int *tag) { unsigned char ch; - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + *cls = (ch & 0xC0) >> 6; *con = (ch & 0x20) >> 5; *tag = (ch & 0x1F); - + if (*tag == 0x1F) { if (!asn1_tag_decode(ctx, tag)) return 0; @@ -207,25 +207,25 @@ static unsigned char asn1_id_decode(struct asn1_ctx *ctx, } static unsigned char asn1_length_decode(struct asn1_ctx *ctx, - unsigned int *def, - unsigned int *len) + unsigned int *def, + unsigned int *len) { unsigned char ch, cnt; - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + if (ch == 0x80) *def = 0; else { *def = 1; - + if (ch < 0x80) *len = ch; else { cnt = (unsigned char) (ch & 0x7F); *len = 0; - + while (cnt > 0) { if (!asn1_octet_decode(ctx, &ch)) return 0; @@ -239,20 +239,20 @@ static unsigned char asn1_length_decode(struct asn1_ctx *ctx, } static unsigned char asn1_header_decode(struct asn1_ctx *ctx, - unsigned char **eoc, - unsigned int *cls, - unsigned int *con, - unsigned int *tag) + unsigned char **eoc, + unsigned int *cls, + unsigned int *con, + unsigned int *tag) { unsigned int def, len; - + if (!asn1_id_decode(ctx, cls, con, tag)) return 0; - + def = len = 0; if (!asn1_length_decode(ctx, &def, &len)) return 0; - + if (def) *eoc = ctx->pointer + len; else @@ -263,19 +263,19 @@ static unsigned char asn1_header_decode(struct asn1_ctx *ctx, static unsigned char asn1_eoc_decode(struct asn1_ctx *ctx, unsigned char *eoc) { unsigned char ch; - + if (eoc == 0) { if (!asn1_octet_decode(ctx, &ch)) return 0; - + if (ch != 0x00) { ctx->error = ASN1_ERR_DEC_EOC_MISMATCH; return 0; } - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + if (ch != 0x00) { ctx->error = ASN1_ERR_DEC_EOC_MISMATCH; return 0; @@ -297,27 +297,27 @@ static unsigned char asn1_null_decode(struct asn1_ctx *ctx, unsigned char *eoc) } static unsigned char asn1_long_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - long *integer) + unsigned char *eoc, + long *integer) { unsigned char ch; unsigned int len; - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + *integer = (signed char) ch; len = 1; - + while (ctx->pointer < eoc) { if (++len > sizeof (long)) { ctx->error = ASN1_ERR_DEC_BADVALUE; return 0; } - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + *integer <<= 8; *integer |= ch; } @@ -325,28 +325,28 @@ static unsigned char asn1_long_decode(struct asn1_ctx *ctx, } static unsigned char asn1_uint_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned int *integer) + unsigned char *eoc, + unsigned int *integer) { unsigned char ch; unsigned int len; - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + *integer = ch; if (ch == 0) len = 0; else len = 1; - + while (ctx->pointer < eoc) { if (++len > sizeof (unsigned int)) { ctx->error = ASN1_ERR_DEC_BADVALUE; return 0; } - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + *integer <<= 8; *integer |= ch; } @@ -354,28 +354,28 @@ static unsigned char asn1_uint_decode(struct asn1_ctx *ctx, } static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned long *integer) + unsigned char *eoc, + unsigned long *integer) { unsigned char ch; unsigned int len; - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + *integer = ch; if (ch == 0) len = 0; else len = 1; - + while (ctx->pointer < eoc) { if (++len > sizeof (unsigned long)) { ctx->error = ASN1_ERR_DEC_BADVALUE; return 0; } - + if (!asn1_octet_decode(ctx, &ch)) return 0; - + *integer <<= 8; *integer |= ch; } @@ -383,21 +383,21 @@ static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx, } static unsigned char asn1_octets_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned char **octets, - unsigned int *len) + unsigned char *eoc, + unsigned char **octets, + unsigned int *len) { unsigned char *ptr; - + *len = 0; - + *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC); if (*octets == NULL) { if (net_ratelimit()) printk("OOM in bsalg (%d)\n", __LINE__); return 0; } - + ptr = *octets; while (ctx->pointer < eoc) { if (!asn1_octet_decode(ctx, (unsigned char *)ptr++)) { @@ -411,16 +411,16 @@ static unsigned char asn1_octets_decode(struct asn1_ctx *ctx, } static unsigned char asn1_subid_decode(struct asn1_ctx *ctx, - unsigned long *subid) + unsigned long *subid) { unsigned char ch; - + *subid = 0; - + do { if (!asn1_octet_decode(ctx, &ch)) return 0; - + *subid <<= 7; *subid |= ch & 0x7F; } while ((ch & 0x80) == 0x80); @@ -428,14 +428,14 @@ static unsigned char asn1_subid_decode(struct asn1_ctx *ctx, } static unsigned char asn1_oid_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned long **oid, - unsigned int *len) + unsigned char *eoc, + unsigned long **oid, + unsigned int *len) { unsigned long subid; unsigned int size; unsigned long *optr; - + size = eoc - ctx->pointer + 1; *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); if (*oid == NULL) { @@ -443,15 +443,15 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx, printk("OOM in bsalg (%d)\n", __LINE__); return 0; } - + optr = *oid; - + if (!asn1_subid_decode(ctx, &subid)) { kfree(*oid); *oid = NULL; return 0; } - + if (subid < 40) { optr [0] = 0; optr [1] = subid; @@ -462,10 +462,10 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx, optr [0] = 2; optr [1] = subid - 80; } - + *len = 2; optr += 2; - + while (ctx->pointer < eoc) { if (++(*len) > size) { ctx->error = ASN1_ERR_DEC_BADVALUE; @@ -473,7 +473,7 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx, *oid = NULL; return 0; } - + if (!asn1_subid_decode(ctx, optr++)) { kfree(*oid); *oid = NULL; @@ -611,9 +611,9 @@ struct snmp_v1_trap #define SERR_EOM 2 static inline void mangle_address(unsigned char *begin, - unsigned char *addr, - const struct oct1_map *map, - __sum16 *check); + unsigned char *addr, + const struct oct1_map *map, + __sum16 *check); struct snmp_cnv { unsigned int class; @@ -633,7 +633,7 @@ static struct snmp_cnv snmp_conv [] = {ASN1_APL, SNMP_GGE, SNMP_GAUGE}, /* Gauge32 == Unsigned32 */ {ASN1_APL, SNMP_TIT, SNMP_TIMETICKS}, {ASN1_APL, SNMP_OPQ, SNMP_OPAQUE}, - + /* SNMPv2 data types and errors */ {ASN1_UNI, ASN1_BTS, SNMP_BITSTR}, {ASN1_APL, SNMP_C64, SNMP_COUNTER64}, @@ -644,13 +644,13 @@ static struct snmp_cnv snmp_conv [] = }; static unsigned char snmp_tag_cls2syntax(unsigned int tag, - unsigned int cls, - unsigned short *syntax) + unsigned int cls, + unsigned short *syntax) { struct snmp_cnv *cnv; - + cnv = snmp_conv; - + while (cnv->syntax != -1) { if (cnv->tag == tag && cnv->class == cls) { *syntax = cnv->syntax; @@ -662,7 +662,7 @@ static unsigned char snmp_tag_cls2syntax(unsigned int tag, } static unsigned char snmp_object_decode(struct asn1_ctx *ctx, - struct snmp_object **obj) + struct snmp_object **obj) { unsigned int cls, con, tag, len, idlen; unsigned short type; @@ -670,41 +670,41 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, unsigned long *lp, *id; unsigned long ul; long l; - + *obj = NULL; id = NULL; - + if (!asn1_header_decode(ctx, &eoc, &cls, &con, &tag)) return 0; - + if (cls != ASN1_UNI || con != ASN1_CON || tag != ASN1_SEQ) return 0; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) return 0; - + if (cls != ASN1_UNI || con != ASN1_PRI || tag != ASN1_OJI) return 0; - + if (!asn1_oid_decode(ctx, end, &id, &idlen)) return 0; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) { kfree(id); return 0; } - + if (con != ASN1_PRI) { kfree(id); return 0; } - + type = 0; if (!snmp_tag_cls2syntax(tag, cls, &type)) { kfree(id); return 0; } - + l = 0; switch (type) { case SNMP_INTEGER: @@ -714,7 +714,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, return 0; } *obj = kmalloc(sizeof(struct snmp_object) + len, - GFP_ATOMIC); + GFP_ATOMIC); if (*obj == NULL) { kfree(id); if (net_ratelimit()) @@ -730,7 +730,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, return 0; } *obj = kmalloc(sizeof(struct snmp_object) + len, - GFP_ATOMIC); + GFP_ATOMIC); if (*obj == NULL) { kfree(id); if (net_ratelimit()) @@ -818,12 +818,12 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, kfree(id); return 0; } - + (*obj)->syntax_len = len; (*obj)->type = type; (*obj)->id = id; (*obj)->id_len = idlen; - + if (!asn1_eoc_decode(ctx, eoc)) { kfree(id); kfree(*obj); @@ -834,49 +834,49 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, } static unsigned char snmp_request_decode(struct asn1_ctx *ctx, - struct snmp_request *request) + struct snmp_request *request) { unsigned int cls, con, tag; unsigned char *end; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) return 0; - + if (cls != ASN1_UNI || con != ASN1_PRI || tag != ASN1_INT) return 0; - + if (!asn1_ulong_decode(ctx, end, &request->id)) return 0; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) return 0; - + if (cls != ASN1_UNI || con != ASN1_PRI || tag != ASN1_INT) return 0; - + if (!asn1_uint_decode(ctx, end, &request->error_status)) return 0; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) return 0; - + if (cls != ASN1_UNI || con != ASN1_PRI || tag != ASN1_INT) return 0; - + if (!asn1_uint_decode(ctx, end, &request->error_index)) return 0; - + return 1; } -/* +/* * Fast checksum update for possibly oddly-aligned UDP byte, from the * code example in the draft. */ static void fast_csum(__sum16 *csum, - const unsigned char *optr, - const unsigned char *nptr, - int offset) + const unsigned char *optr, + const unsigned char *nptr, + int offset) { unsigned char s[4]; @@ -893,30 +893,30 @@ static void fast_csum(__sum16 *csum, *csum = csum_fold(csum_partial(s, 4, ~csum_unfold(*csum))); } -/* +/* * Mangle IP address. * - begin points to the start of the snmp messgae * - addr points to the start of the address */ static inline void mangle_address(unsigned char *begin, - unsigned char *addr, - const struct oct1_map *map, - __sum16 *check) + unsigned char *addr, + const struct oct1_map *map, + __sum16 *check) { if (map->from == NOCT1(addr)) { u_int32_t old; - + if (debug) memcpy(&old, (unsigned char *)addr, sizeof(old)); - + *addr = map->to; - + /* Update UDP checksum if being used */ if (*check) { fast_csum(check, - &map->from, &map->to, addr - begin); + &map->from, &map->to, addr - begin); } - + if (debug) printk(KERN_DEBUG "bsalg: mapped %u.%u.%u.%u to " "%u.%u.%u.%u\n", NIPQUAD(old), NIPQUAD(*addr)); @@ -924,66 +924,66 @@ static inline void mangle_address(unsigned char *begin, } static unsigned char snmp_trap_decode(struct asn1_ctx *ctx, - struct snmp_v1_trap *trap, - const struct oct1_map *map, - __sum16 *check) + struct snmp_v1_trap *trap, + const struct oct1_map *map, + __sum16 *check) { unsigned int cls, con, tag, len; unsigned char *end; if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) return 0; - + if (cls != ASN1_UNI || con != ASN1_PRI || tag != ASN1_OJI) return 0; - + if (!asn1_oid_decode(ctx, end, &trap->id, &trap->id_len)) return 0; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) goto err_id_free; if (!((cls == ASN1_APL && con == ASN1_PRI && tag == SNMP_IPA) || (cls == ASN1_UNI && con == ASN1_PRI && tag == ASN1_OTS))) goto err_id_free; - + if (!asn1_octets_decode(ctx, end, (unsigned char **)&trap->ip_address, &len)) goto err_id_free; - + /* IPv4 only */ if (len != 4) goto err_addr_free; - + mangle_address(ctx->begin, ctx->pointer - 4, map, check); - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) goto err_addr_free; - + if (cls != ASN1_UNI || con != ASN1_PRI || tag != ASN1_INT) goto err_addr_free; - + if (!asn1_uint_decode(ctx, end, &trap->general)) goto err_addr_free; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) goto err_addr_free; - + if (cls != ASN1_UNI || con != ASN1_PRI || tag != ASN1_INT) goto err_addr_free; - + if (!asn1_uint_decode(ctx, end, &trap->specific)) goto err_addr_free; - + if (!asn1_header_decode(ctx, &end, &cls, &con, &tag)) goto err_addr_free; - + if (!((cls == ASN1_APL && con == ASN1_PRI && tag == SNMP_TIT) || (cls == ASN1_UNI && con == ASN1_PRI && tag == ASN1_INT))) goto err_addr_free; - + if (!asn1_ulong_decode(ctx, end, &trap->time)) goto err_addr_free; - + return 1; err_addr_free: @@ -1004,7 +1004,7 @@ err_id_free: static void hex_dump(unsigned char *buf, size_t len) { size_t i; - + for (i = 0; i < len; i++) { if (i && !(i % 16)) printk("\n"); @@ -1018,30 +1018,30 @@ static void hex_dump(unsigned char *buf, size_t len) * (And this is the fucking 'basic' method). */ static int snmp_parse_mangle(unsigned char *msg, - u_int16_t len, - const struct oct1_map *map, - __sum16 *check) + u_int16_t len, + const struct oct1_map *map, + __sum16 *check) { unsigned char *eoc, *end; unsigned int cls, con, tag, vers, pdutype; struct asn1_ctx ctx; struct asn1_octstr comm; struct snmp_object **obj; - + if (debug > 1) hex_dump(msg, len); asn1_open(&ctx, msg, len); - - /* + + /* * Start of SNMP message. */ if (!asn1_header_decode(&ctx, &eoc, &cls, &con, &tag)) return 0; if (cls != ASN1_UNI || con != ASN1_CON || tag != ASN1_SEQ) return 0; - - /* + + /* * Version 1 or 2 handled. */ if (!asn1_header_decode(&ctx, &end, &cls, &con, &tag)) @@ -1054,7 +1054,7 @@ static int snmp_parse_mangle(unsigned char *msg, printk(KERN_DEBUG "bsalg: snmp version: %u\n", vers + 1); if (vers > 1) return 1; - + /* * Community. */ @@ -1066,14 +1066,14 @@ static int snmp_parse_mangle(unsigned char *msg, return 0; if (debug > 1) { unsigned int i; - + printk(KERN_DEBUG "bsalg: community: "); for (i = 0; i < comm.len; i++) printk("%c", comm.data[i]); printk("\n"); } kfree(comm.data); - + /* * PDU type */ @@ -1092,7 +1092,7 @@ static int snmp_parse_mangle(unsigned char *msg, [SNMP_PDU_INFORM] = "inform", [SNMP_PDU_TRAP2] = "trapv2" }; - + if (pdutype > SNMP_PDU_TRAP2) printk(KERN_DEBUG "bsalg: bad pdu type %u\n", pdutype); else @@ -1101,56 +1101,56 @@ static int snmp_parse_mangle(unsigned char *msg, if (pdutype != SNMP_PDU_RESPONSE && pdutype != SNMP_PDU_TRAP1 && pdutype != SNMP_PDU_TRAP2) return 1; - + /* * Request header or v1 trap */ if (pdutype == SNMP_PDU_TRAP1) { struct snmp_v1_trap trap; unsigned char ret = snmp_trap_decode(&ctx, &trap, map, check); - + if (ret) { kfree(trap.id); kfree((unsigned long *)trap.ip_address); - } else + } else return ret; - + } else { struct snmp_request req; - + if (!snmp_request_decode(&ctx, &req)) return 0; - + if (debug > 1) printk(KERN_DEBUG "bsalg: request: id=0x%lx error_status=%u " "error_index=%u\n", req.id, req.error_status, req.error_index); } - + /* * Loop through objects, look for IP addresses to mangle. */ if (!asn1_header_decode(&ctx, &eoc, &cls, &con, &tag)) return 0; - + if (cls != ASN1_UNI || con != ASN1_CON || tag != ASN1_SEQ) return 0; - + obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); if (obj == NULL) { if (net_ratelimit()) printk(KERN_WARNING "OOM in bsalg(%d)\n", __LINE__); - return 0; + return 0; } while (!asn1_eoc_decode(&ctx, eoc)) { unsigned int i; - + if (!snmp_object_decode(&ctx, obj)) { if (*obj) { kfree((*obj)->id); kfree(*obj); - } + } kfree(obj); return 0; } @@ -1163,20 +1163,20 @@ static int snmp_parse_mangle(unsigned char *msg, printk("%lu", (*obj)->id[i]); } printk(": type=%u\n", (*obj)->type); - + } if ((*obj)->type == SNMP_IPADDR) mangle_address(ctx.begin, ctx.pointer - 4 , map, check); - + kfree((*obj)->id); kfree(*obj); } kfree(obj); - + if (!asn1_eoc_decode(&ctx, eoc)) return 0; - + return 1; } @@ -1186,12 +1186,12 @@ static int snmp_parse_mangle(unsigned char *msg, * *****************************************************************************/ -/* +/* * SNMP translation routine. */ static int snmp_translate(struct ip_conntrack *ct, - enum ip_conntrack_info ctinfo, - struct sk_buff **pskb) + enum ip_conntrack_info ctinfo, + struct sk_buff **pskb) { struct iphdr *iph = (*pskb)->nh.iph; struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl); @@ -1213,12 +1213,12 @@ static int snmp_translate(struct ip_conntrack *ct, map.from = NOCT1(&ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); map.to = NOCT1(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip); } - + if (map.from == map.to) return NF_ACCEPT; - + if (!snmp_parse_mangle((unsigned char *)udph + sizeof(struct udphdr), - paylen, &map, &udph->check)) { + paylen, &map, &udph->check)) { if (net_ratelimit()) printk(KERN_WARNING "bsalg: parser failed\n"); return NF_DROP; @@ -1247,7 +1247,7 @@ static int help(struct sk_buff **pskb, if (!(ct->status & IPS_NAT_MASK)) return NF_ACCEPT; - /* + /* * Make sure the packet length is ok. So far, we were only guaranteed * to have a valid length IP header plus 8 bytes, which means we have * enough room for a UDP header. Just verify the UDP length field so we @@ -1305,7 +1305,7 @@ static struct ip_conntrack_helper snmp_trap_helper = { * Module stuff. * *****************************************************************************/ - + static int __init ip_nat_snmp_basic_init(void) { int ret = 0; diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c index ad66328..adf25f9 100644 --- a/net/ipv4/netfilter/ip_nat_standalone.c +++ b/net/ipv4/netfilter/ip_nat_standalone.c @@ -81,7 +81,7 @@ static void nat_decode_session(struct sk_buff *skb, struct flowi *fl) } } #endif - + static unsigned int ip_nat_fn(unsigned int hooknum, struct sk_buff **pskb, @@ -107,8 +107,8 @@ ip_nat_fn(unsigned int hooknum, protocol. 8) --RR */ if (!ct) { /* Exception: ICMP redirect to new connection (not in - hash table yet). We must not let this through, in - case we're doing NAT to the same network. */ + hash table yet). We must not let this through, in + case we're doing NAT to the same network. */ if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP) { struct icmphdr _hdr, *hp; @@ -148,7 +148,7 @@ ip_nat_fn(unsigned int hooknum, if (unlikely(is_confirmed(ct))) /* NAT module was loaded late */ ret = alloc_null_binding_confirmed(ct, info, - hooknum); + hooknum); else if (hooknum == NF_IP_LOCAL_IN) /* LOCAL_IN hook doesn't have a chain! */ ret = alloc_null_binding(ct, info, hooknum); @@ -179,10 +179,10 @@ ip_nat_fn(unsigned int hooknum, static unsigned int ip_nat_in(unsigned int hooknum, - struct sk_buff **pskb, - const struct net_device *in, - const struct net_device *out, - int (*okfn)(struct sk_buff *)) + struct sk_buff **pskb, + const struct net_device *in, + const struct net_device *out, + int (*okfn)(struct sk_buff *)) { unsigned int ret; __be32 daddr = (*pskb)->nh.iph->daddr; @@ -277,9 +277,9 @@ ip_nat_adjust(unsigned int hooknum, ct = ip_conntrack_get(*pskb, &ctinfo); if (ct && test_bit(IPS_SEQ_ADJUST_BIT, &ct->status)) { - DEBUGP("ip_nat_standalone: adjusting sequence number\n"); - if (!ip_nat_seq_adjust(pskb, ct, ctinfo)) - return NF_DROP; + DEBUGP("ip_nat_standalone: adjusting sequence number\n"); + if (!ip_nat_seq_adjust(pskb, ct, ctinfo)) + return NF_DROP; } return NF_ACCEPT; } diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index cd520df..68bf19f 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c @@ -11,13 +11,13 @@ * * 2000-03-27: Simplified code (thanks to Andi Kleen for clues). * 2000-05-20: Fixed notifier problems (following Miguel Freitas' report). - * 2000-06-19: Fixed so nfmark is copied to metadata (reported by Sebastian + * 2000-06-19: Fixed so nfmark is copied to metadata (reported by Sebastian * Zander). * 2000-08-01: Added Nick Williams' MAC support. * 2002-06-25: Code cleanup. * 2005-01-10: Added /proc counter for dropped packets; fixed so - * packets aren't delivered to user space if they're going - * to be dropped. + * packets aren't delivered to user space if they're going + * to be dropped. * 2005-05-26: local_bh_{disable,enable} around nf_reinject (Harald Welte) * */ @@ -97,7 +97,7 @@ __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data) list_for_each_prev(p, &queue_list) { struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p; - + if (!cmpfn || cmpfn(entry, data)) return entry; } @@ -129,7 +129,7 @@ static inline void __ipq_flush(int verdict) { struct ipq_queue_entry *entry; - + while ((entry = __ipq_find_dequeue_entry(NULL, 0))) ipq_issue_verdict(entry, verdict); } @@ -138,21 +138,21 @@ static inline int __ipq_set_mode(unsigned char mode, unsigned int range) { int status = 0; - + switch(mode) { case IPQ_COPY_NONE: case IPQ_COPY_META: copy_mode = mode; copy_range = 0; break; - + case IPQ_COPY_PACKET: copy_mode = mode; copy_range = range; if (copy_range > 0xFFFF) copy_range = 0xFFFF; break; - + default: status = -EINVAL; @@ -173,7 +173,7 @@ static struct ipq_queue_entry * ipq_find_dequeue_entry(ipq_cmpfn cmpfn, unsigned long data) { struct ipq_queue_entry *entry; - + write_lock_bh(&queue_lock); entry = __ipq_find_dequeue_entry(cmpfn, data); write_unlock_bh(&queue_lock); @@ -199,14 +199,14 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) struct nlmsghdr *nlh; read_lock_bh(&queue_lock); - + switch (copy_mode) { case IPQ_COPY_META: case IPQ_COPY_NONE: size = NLMSG_SPACE(sizeof(*pmsg)); data_len = 0; break; - + case IPQ_COPY_PACKET: if ((entry->skb->ip_summed == CHECKSUM_PARTIAL || entry->skb->ip_summed == CHECKSUM_COMPLETE) && @@ -218,10 +218,10 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) data_len = entry->skb->len; else data_len = copy_range; - + size = NLMSG_SPACE(sizeof(*pmsg) + data_len); break; - + default: *errp = -EINVAL; read_unlock_bh(&queue_lock); @@ -233,7 +233,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) skb = alloc_skb(size, GFP_ATOMIC); if (!skb) goto nlmsg_failure; - + old_tail= skb->tail; nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); pmsg = NLMSG_DATA(nlh); @@ -246,29 +246,29 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) pmsg->mark = entry->skb->mark; pmsg->hook = entry->info->hook; pmsg->hw_protocol = entry->skb->protocol; - + if (entry->info->indev) strcpy(pmsg->indev_name, entry->info->indev->name); else pmsg->indev_name[0] = '\0'; - + if (entry->info->outdev) strcpy(pmsg->outdev_name, entry->info->outdev->name); else pmsg->outdev_name[0] = '\0'; - + if (entry->info->indev && entry->skb->dev) { pmsg->hw_type = entry->skb->dev->type; if (entry->skb->dev->hard_header_parse) pmsg->hw_addrlen = entry->skb->dev->hard_header_parse(entry->skb, - pmsg->hw_addr); + pmsg->hw_addr); } - + if (data_len) if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len)) BUG(); - + nlh->nlmsg_len = skb->tail - old_tail; return skb; @@ -303,26 +303,26 @@ ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, nskb = ipq_build_packet_message(entry, &status); if (nskb == NULL) goto err_out_free; - + write_lock_bh(&queue_lock); - + if (!peer_pid) - goto err_out_free_nskb; + goto err_out_free_nskb; if (queue_total >= queue_maxlen) { - queue_dropped++; + queue_dropped++; status = -ENOSPC; if (net_ratelimit()) - printk (KERN_WARNING "ip_queue: full at %d entries, " + printk (KERN_WARNING "ip_queue: full at %d entries, " "dropping packets(s). Dropped: %d\n", queue_total, queue_dropped); goto err_out_free_nskb; } - /* netlink_unicast will either free the nskb or attach it to a socket */ + /* netlink_unicast will either free the nskb or attach it to a socket */ status = netlink_unicast(ipqnl, nskb, peer_pid, MSG_DONTWAIT); if (status < 0) { - queue_user_dropped++; + queue_user_dropped++; goto err_out_unlock; } @@ -332,8 +332,8 @@ ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, return status; err_out_free_nskb: - kfree_skb(nskb); - + kfree_skb(nskb); + err_out_unlock: write_unlock_bh(&queue_lock); @@ -359,11 +359,11 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) return -EINVAL; if (diff > skb_tailroom(e->skb)) { struct sk_buff *newskb; - + newskb = skb_copy_expand(e->skb, - skb_headroom(e->skb), - diff, - GFP_ATOMIC); + skb_headroom(e->skb), + diff, + GFP_ATOMIC); if (newskb == NULL) { printk(KERN_WARNING "ip_queue: OOM " "in mangle, dropping packet\n"); @@ -403,11 +403,11 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len) return -ENOENT; else { int verdict = vmsg->value; - + if (vmsg->data_len && vmsg->data_len == len) if (ipq_mangle_ipv4(vmsg, entry) < 0) verdict = NF_DROP; - + ipq_issue_verdict(entry, verdict); return 0; } @@ -426,7 +426,7 @@ ipq_set_mode(unsigned char mode, unsigned int range) static int ipq_receive_peer(struct ipq_peer_msg *pmsg, - unsigned char type, unsigned int len) + unsigned char type, unsigned int len) { int status = 0; @@ -436,15 +436,15 @@ ipq_receive_peer(struct ipq_peer_msg *pmsg, switch (type) { case IPQM_MODE: status = ipq_set_mode(pmsg->msg.mode.value, - pmsg->msg.mode.range); + pmsg->msg.mode.range); break; - + case IPQM_VERDICT: if (pmsg->msg.verdict.value > NF_MAX_VERDICT) status = -EINVAL; else status = ipq_set_verdict(&pmsg->msg.verdict, - len - sizeof(*pmsg)); + len - sizeof(*pmsg)); break; default: status = -EINVAL; @@ -468,7 +468,7 @@ dev_cmp(struct ipq_queue_entry *entry, unsigned long ifindex) return 1; if (entry->skb->nf_bridge->physoutdev && entry->skb->nf_bridge->physoutdev->ifindex == ifindex) - return 1; + return 1; } #endif return 0; @@ -478,7 +478,7 @@ static void ipq_dev_drop(int ifindex) { struct ipq_queue_entry *entry; - + while ((entry = ipq_find_dequeue_entry(dev_cmp, ifindex)) != NULL) ipq_issue_verdict(entry, NF_DROP); } @@ -502,25 +502,25 @@ ipq_rcv_skb(struct sk_buff *skb) pid = nlh->nlmsg_pid; flags = nlh->nlmsg_flags; - + if(pid <= 0 || !(flags & NLM_F_REQUEST) || flags & NLM_F_MULTI) RCV_SKB_FAIL(-EINVAL); - + if (flags & MSG_TRUNC) RCV_SKB_FAIL(-ECOMM); - + type = nlh->nlmsg_type; if (type < NLMSG_NOOP || type >= IPQM_MAX) RCV_SKB_FAIL(-EINVAL); - + if (type <= IPQM_BASE) return; - + if (security_netlink_recv(skb, CAP_NET_ADMIN)) RCV_SKB_FAIL(-EPERM); - + write_lock_bh(&queue_lock); - + if (peer_pid) { if (peer_pid != pid) { write_unlock_bh(&queue_lock); @@ -530,17 +530,17 @@ ipq_rcv_skb(struct sk_buff *skb) net_enable_timestamp(); peer_pid = pid; } - + write_unlock_bh(&queue_lock); - + status = ipq_receive_peer(NLMSG_DATA(nlh), type, - nlmsglen - NLMSG_LENGTH(0)); + nlmsglen - NLMSG_LENGTH(0)); if (status < 0) RCV_SKB_FAIL(status); - + if (flags & NLM_F_ACK) netlink_ack(skb, nlh, 0); - return; + return; } static void @@ -550,19 +550,19 @@ ipq_rcv_sk(struct sock *sk, int len) unsigned int qlen; mutex_lock(&ipqnl_mutex); - + for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { skb = skb_dequeue(&sk->sk_receive_queue); ipq_rcv_skb(skb); kfree_skb(skb); } - + mutex_unlock(&ipqnl_mutex); } static int ipq_rcv_dev_event(struct notifier_block *this, - unsigned long event, void *ptr) + unsigned long event, void *ptr) { struct net_device *dev = ptr; @@ -578,7 +578,7 @@ static struct notifier_block ipq_dev_notifier = { static int ipq_rcv_nl_event(struct notifier_block *this, - unsigned long event, void *ptr) + unsigned long event, void *ptr) { struct netlink_notify *n = ptr; @@ -607,7 +607,7 @@ static ctl_table ipq_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { .ctl_name = 0 } + { .ctl_name = 0 } }; static ctl_table ipq_dir_table[] = { @@ -637,25 +637,25 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length) int len; read_lock_bh(&queue_lock); - + len = sprintf(buffer, - "Peer PID : %d\n" - "Copy mode : %hu\n" - "Copy range : %u\n" - "Queue length : %u\n" - "Queue max. length : %u\n" + "Peer PID : %d\n" + "Copy mode : %hu\n" + "Copy range : %u\n" + "Queue length : %u\n" + "Queue max. length : %u\n" "Queue dropped : %u\n" "Netlink dropped : %u\n", - peer_pid, - copy_mode, - copy_range, - queue_total, - queue_maxlen, + peer_pid, + copy_mode, + copy_range, + queue_total, + queue_maxlen, queue_dropped, queue_user_dropped); read_unlock_bh(&queue_lock); - + *start = buffer + offset; len -= offset; if (len > length) @@ -675,7 +675,7 @@ static int __init ip_queue_init(void) { int status = -ENOMEM; struct proc_dir_entry *proc; - + netlink_register_notifier(&ipq_nl_notifier); ipqnl = netlink_kernel_create(NETLINK_FIREWALL, 0, ipq_rcv_sk, THIS_MODULE); @@ -691,10 +691,10 @@ static int __init ip_queue_init(void) printk(KERN_ERR "ip_queue: failed to create proc entry\n"); goto cleanup_ipqnl; } - + register_netdevice_notifier(&ipq_dev_notifier); ipq_sysctl_header = register_sysctl_table(ipq_root_table, 0); - + status = nf_register_queue_handler(PF_INET, &nfqh); if (status < 0) { printk(KERN_ERR "ip_queue: failed to register queue handler\n"); @@ -706,12 +706,12 @@ cleanup_sysctl: unregister_sysctl_table(ipq_sysctl_header); unregister_netdevice_notifier(&ipq_dev_notifier); proc_net_remove(IPQ_PROC_FS_NAME); - + cleanup_ipqnl: sock_release(ipqnl->sk_socket); mutex_lock(&ipqnl_mutex); mutex_unlock(&ipqnl_mutex); - + cleanup_netlink_notifier: netlink_unregister_notifier(&ipq_nl_notifier); return status; diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 5a7b3a34..50cc4b9 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c @@ -297,7 +297,7 @@ ipt_do_table(struct sk_buff **pskb, e = get_entry(table_base, v); } else { /* Targets which reenter must return - abs. verdicts */ + abs. verdicts */ #ifdef CONFIG_NETFILTER_DEBUG ((struct ipt_entry *)table_base)->comefrom = 0xeeeeeeec; @@ -556,9 +556,9 @@ err: static inline int check_target(struct ipt_entry *e, const char *name) { - struct ipt_entry_target *t; + struct ipt_entry_target *t; struct xt_target *target; - int ret; + int ret; t = ipt_get_target(e); target = t->u.kernel.target; @@ -652,7 +652,7 @@ check_entry_size_and_hooks(struct ipt_entry *e, } /* FIXME: underflows must be unconditional, standard verdicts - < 0 (not IPT_RETURN). --RR */ + < 0 (not IPT_RETURN). --RR */ /* Clear counters and comefrom */ e->counters = ((struct xt_counters) { 0, 0 }); @@ -2057,7 +2057,7 @@ void ipt_unregister_table(struct xt_table *table) struct xt_table_info *private; void *loc_cpu_entry; - private = xt_unregister_table(table); + private = xt_unregister_table(table); /* Decrease module usage counts and free resources */ loc_cpu_entry = private->entries[raw_smp_processor_id()]; diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 343c2ab..4fe28f2 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -1,4 +1,4 @@ -/* Cluster IP hashmark target +/* Cluster IP hashmark target * (C) 2003-2004 by Harald Welte <laforge@netfilter.org> * based on ideas of Fabio Olive Leite <olive@unixforge.org> * @@ -123,7 +123,7 @@ __clusterip_config_find(__be32 clusterip) struct list_head *pos; list_for_each(pos, &clusterip_configs) { - struct clusterip_config *c = list_entry(pos, + struct clusterip_config *c = list_entry(pos, struct clusterip_config, list); if (c->clusterip == clusterip) { return c; @@ -229,7 +229,7 @@ clusterip_del_node(struct clusterip_config *c, u_int16_t nodenum) if (nodenum == 0 || nodenum > c->num_total_nodes) return 1; - + if (test_and_clear_bit(nodenum - 1, &c->local_nodes)) return 0; @@ -270,7 +270,7 @@ clusterip_hashfn(struct sk_buff *skb, struct clusterip_config *config) config->hash_initval); break; case CLUSTERIP_HASHMODE_SIP_SPT: - hashval = jhash_2words(ntohl(iph->saddr), sport, + hashval = jhash_2words(ntohl(iph->saddr), sport, config->hash_initval); break; case CLUSTERIP_HASHMODE_SIP_SPT_DPT: @@ -297,8 +297,8 @@ clusterip_responsible(struct clusterip_config *config, u_int32_t hash) return test_bit(hash - 1, &config->local_nodes); } -/*********************************************************************** - * IPTABLES TARGET +/*********************************************************************** + * IPTABLES TARGET ***********************************************************************/ static unsigned int @@ -321,7 +321,7 @@ target(struct sk_buff **pskb, if (mark == NULL) { printk(KERN_ERR "CLUSTERIP: no conntrack!\n"); /* FIXME: need to drop invalid ones, since replies - * to outgoing connections of other nodes will be + * to outgoing connections of other nodes will be * marked as INVALID */ return NF_DROP; } @@ -329,11 +329,11 @@ target(struct sk_buff **pskb, /* special case: ICMP error handling. conntrack distinguishes between * error messages (RELATED) and information requests (see below) */ if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP - && (ctinfo == IP_CT_RELATED + && (ctinfo == IP_CT_RELATED || ctinfo == IP_CT_RELATED+IP_CT_IS_REPLY)) return XT_CONTINUE; - /* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO, + /* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO, * TIMESTAMP, INFO_REQUEST or ADDRESS type icmp packets from here * on, which all have an ID field [relevant for hashing]. */ @@ -376,8 +376,8 @@ static int checkentry(const char *tablename, const void *e_void, const struct xt_target *target, - void *targinfo, - unsigned int hook_mask) + void *targinfo, + unsigned int hook_mask) { struct ipt_clusterip_tgt_info *cipinfo = targinfo; const struct ipt_entry *e = e_void; @@ -437,7 +437,7 @@ checkentry(const char *tablename, return 0; } - config = clusterip_config_init(cipinfo, + config = clusterip_config_init(cipinfo, e->ip.dst.s_addr, dev); if (!config) { printk(KERN_WARNING "CLUSTERIP: cannot allocate config\n"); @@ -483,8 +483,8 @@ static struct xt_target clusterip_tgt = { }; -/*********************************************************************** - * ARP MANGLING CODE +/*********************************************************************** + * ARP MANGLING CODE ***********************************************************************/ /* hardcoded for 48bit ethernet and 32bit ipv4 addresses */ @@ -496,7 +496,7 @@ struct arp_payload { } __attribute__ ((packed)); #ifdef CLUSTERIP_DEBUG -static void arp_print(struct arp_payload *payload) +static void arp_print(struct arp_payload *payload) { #define HBUFFERLEN 30 char hbuffer[HBUFFERLEN]; @@ -510,7 +510,7 @@ static void arp_print(struct arp_payload *payload) } hbuffer[--k]='\0'; - printk("src %u.%u.%u.%u@%s, dst %u.%u.%u.%u\n", + printk("src %u.%u.%u.%u@%s, dst %u.%u.%u.%u\n", NIPQUAD(payload->src_ip), hbuffer, NIPQUAD(payload->dst_ip)); } @@ -540,13 +540,13 @@ arp_mangle(unsigned int hook, payload = (void *)(arp+1); - /* if there is no clusterip configuration for the arp reply's + /* if there is no clusterip configuration for the arp reply's * source ip, we don't want to mangle it */ c = clusterip_config_find_get(payload->src_ip, 0); if (!c) return NF_ACCEPT; - /* normally the linux kernel always replies to arp queries of + /* normally the linux kernel always replies to arp queries of * addresses on different interfacs. However, in the CLUSTERIP case * this wouldn't work, since we didn't subscribe the mcast group on * other interfaces */ @@ -577,8 +577,8 @@ static struct nf_hook_ops cip_arp_ops = { .priority = -1 }; -/*********************************************************************** - * PROC DIR HANDLING +/*********************************************************************** + * PROC DIR HANDLING ***********************************************************************/ #ifdef CONFIG_PROC_FS @@ -640,7 +640,7 @@ static int clusterip_seq_show(struct seq_file *s, void *v) { struct clusterip_seq_position *idx = (struct clusterip_seq_position *)v; - if (idx->pos != 0) + if (idx->pos != 0) seq_putc(s, ','); seq_printf(s, "%u", idx->bit); diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c index b5ca593..4f56563 100644 --- a/net/ipv4/netfilter/ipt_ECN.c +++ b/net/ipv4/netfilter/ipt_ECN.c @@ -1,9 +1,9 @@ /* iptables module for the IPv4 and TCP ECN bits, Version 1.5 * * (C) 2002 by Harald Welte <laforge@netfilter.org> - * + * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as + * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * ipt_ECN.c,v 1.5 2002/08/18 19:36:51 laforge Exp @@ -40,7 +40,7 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) iph->tos &= ~IPT_ECN_IP_MASK; iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); nf_csum_replace2(&iph->check, htons(oldtos), htons(iph->tos)); - } + } return 1; } @@ -104,8 +104,8 @@ static int checkentry(const char *tablename, const void *e_void, const struct xt_target *target, - void *targinfo, - unsigned int hook_mask) + void *targinfo, + unsigned int hook_mask) { const struct ipt_ECN_info *einfo = (struct ipt_ECN_info *)targinfo; const struct ipt_entry *e = e_void; diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index f68370f..f4a62f2 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c @@ -289,7 +289,7 @@ static void dump_packet(const struct nf_loginfo *info, if (ntohs(ih->frag_off) & IP_OFFSET) break; - + /* Max length: 9 "PROTO=AH " */ printk("PROTO=AH "); @@ -334,10 +334,10 @@ static void dump_packet(const struct nf_loginfo *info, } /* Max length: 15 "UID=4294967295 " */ - if ((logflags & IPT_LOG_UID) && !iphoff && skb->sk) { + if ((logflags & IPT_LOG_UID) && !iphoff && skb->sk) { read_lock_bh(&skb->sk->sk_callback_lock); if (skb->sk->sk_socket && skb->sk->sk_socket->file) - printk("UID=%u ", skb->sk->sk_socket->file->f_uid); + printk("UID=%u ", skb->sk->sk_socket->file->f_uid); read_unlock_bh(&skb->sk->sk_callback_lock); } @@ -431,7 +431,7 @@ ipt_log_target(struct sk_buff **pskb, li.u.log.logflags = loginfo->logflags; ipt_log_packet(PF_INET, hooknum, *pskb, in, out, &li, - loginfo->prefix); + loginfo->prefix); return XT_CONTINUE; } @@ -483,7 +483,7 @@ static int __init ipt_log_init(void) /* we cannot make module load fail here, since otherwise * iptables userspace would abort */ } - + return 0; } diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index 91c42ef..b5955f3 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c @@ -86,7 +86,7 @@ masquerade_target(struct sk_buff **pskb, nat = nfct_nat(ct); #endif IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED - || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); + || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); /* Source address is 0.0.0.0 - locally generated packet that is * probably not supposed to be masqueraded. @@ -221,7 +221,7 @@ static void __exit ipt_masquerade_fini(void) { xt_unregister_target(&masquerade); unregister_netdevice_notifier(&masq_dev_notifier); - unregister_inetaddr_notifier(&masq_inet_notifier); + unregister_inetaddr_notifier(&masq_inet_notifier); } module_init(ipt_masquerade_init); diff --git a/net/ipv4/netfilter/ipt_NETMAP.c b/net/ipv4/netfilter/ipt_NETMAP.c index b4acc24..fd7aaa3 100644 --- a/net/ipv4/netfilter/ipt_NETMAP.c +++ b/net/ipv4/netfilter/ipt_NETMAP.c @@ -92,13 +92,13 @@ target(struct sk_buff **pskb, static struct xt_target target_module = { .name = MODULENAME, .family = AF_INET, - .target = target, + .target = target, .targetsize = sizeof(struct ip_nat_multi_range_compat), .table = "nat", .hooks = (1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_POST_ROUTING) | (1 << NF_IP_LOCAL_OUT), .checkentry = check, - .me = THIS_MODULE + .me = THIS_MODULE }; static int __init ipt_netmap_init(void) diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index 54cd021..c2b6b80 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c @@ -84,7 +84,7 @@ redirect_target(struct sk_buff **pskb, struct in_ifaddr *ifa; newdst = 0; - + rcu_read_lock(); indev = __in_dev_get_rcu((*pskb)->dev); if (indev && (ifa = indev->ifa_list)) diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index e4a1ddb..a9eb363 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c @@ -57,7 +57,7 @@ static void send_reset(struct sk_buff *oldskb, int hook) oth = skb_header_pointer(oldskb, oldskb->nh.iph->ihl * 4, sizeof(_otcph), &_otcph); if (oth == NULL) - return; + return; /* No RST for RST. */ if (oth->rst) @@ -145,7 +145,7 @@ static void send_reset(struct sk_buff *oldskb, int hook) /* Adjust IP checksum */ nskb->nh.iph->check = 0; - nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph, + nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph, nskb->nh.iph->ihl); /* "Never happens" */ @@ -165,7 +165,7 @@ static void send_reset(struct sk_buff *oldskb, int hook) static inline void send_unreach(struct sk_buff *skb_in, int code) { icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0); -} +} static unsigned int reject(struct sk_buff **pskb, const struct net_device *in, @@ -177,33 +177,33 @@ static unsigned int reject(struct sk_buff **pskb, const struct ipt_reject_info *reject = targinfo; /* Our naive response construction doesn't deal with IP - options, and probably shouldn't try. */ + options, and probably shouldn't try. */ if ((*pskb)->nh.iph->ihl<<2 != sizeof(struct iphdr)) return NF_DROP; /* WARNING: This code causes reentry within iptables. This means that the iptables jump stack is now crap. We must return an absolute verdict. --RR */ - switch (reject->with) { - case IPT_ICMP_NET_UNREACHABLE: - send_unreach(*pskb, ICMP_NET_UNREACH); - break; - case IPT_ICMP_HOST_UNREACHABLE: - send_unreach(*pskb, ICMP_HOST_UNREACH); - break; - case IPT_ICMP_PROT_UNREACHABLE: - send_unreach(*pskb, ICMP_PROT_UNREACH); - break; - case IPT_ICMP_PORT_UNREACHABLE: - send_unreach(*pskb, ICMP_PORT_UNREACH); - break; - case IPT_ICMP_NET_PROHIBITED: - send_unreach(*pskb, ICMP_NET_ANO); - break; + switch (reject->with) { + case IPT_ICMP_NET_UNREACHABLE: + send_unreach(*pskb, ICMP_NET_UNREACH); + break; + case IPT_ICMP_HOST_UNREACHABLE: + send_unreach(*pskb, ICMP_HOST_UNREACH); + break; + case IPT_ICMP_PROT_UNREACHABLE: + send_unreach(*pskb, ICMP_PROT_UNREACH); + break; + case IPT_ICMP_PORT_UNREACHABLE: + send_unreach(*pskb, ICMP_PORT_UNREACH); + break; + case IPT_ICMP_NET_PROHIBITED: + send_unreach(*pskb, ICMP_NET_ANO); + break; case IPT_ICMP_HOST_PROHIBITED: - send_unreach(*pskb, ICMP_HOST_ANO); - break; - case IPT_ICMP_ADMIN_PROHIBITED: + send_unreach(*pskb, ICMP_HOST_ANO); + break; + case IPT_ICMP_ADMIN_PROHIBITED: send_unreach(*pskb, ICMP_PKT_FILTERED); break; case IPT_TCP_RESET: @@ -222,7 +222,7 @@ static int check(const char *tablename, void *targinfo, unsigned int hook_mask) { - const struct ipt_reject_info *rejinfo = targinfo; + const struct ipt_reject_info *rejinfo = targinfo; const struct ipt_entry *e = e_void; if (rejinfo->with == IPT_ICMP_ECHOREPLY) { diff --git a/net/ipv4/netfilter/ipt_SAME.c b/net/ipv4/netfilter/ipt_SAME.c index a1cdd12..bd4404e 100644 --- a/net/ipv4/netfilter/ipt_SAME.c +++ b/net/ipv4/netfilter/ipt_SAME.c @@ -87,24 +87,24 @@ same_check(const char *tablename, DEBUGP("same_check: bad MAP_IPS.\n"); return 0; } - rangeip = (ntohl(mr->range[count].max_ip) - + rangeip = (ntohl(mr->range[count].max_ip) - ntohl(mr->range[count].min_ip) + 1); mr->ipnum += rangeip; - + DEBUGP("same_check: range %u, ipnum = %u\n", count, rangeip); } DEBUGP("same_check: total ipaddresses = %u\n", mr->ipnum); - + mr->iparray = kmalloc((sizeof(u_int32_t) * mr->ipnum), GFP_KERNEL); if (!mr->iparray) { DEBUGP("same_check: Couldn't allocate %u bytes " - "for %u ipaddresses!\n", + "for %u ipaddresses!\n", (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); return 0; } DEBUGP("same_check: Allocated %u bytes for %u ipaddresses.\n", (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); - + for (count = 0; count < mr->rangesize; count++) { for (countess = ntohl(mr->range[count].min_ip); countess <= ntohl(mr->range[count].max_ip); @@ -119,13 +119,13 @@ same_check(const char *tablename, return 1; } -static void +static void same_destroy(const struct xt_target *target, void *targinfo) { struct ipt_same_info *mr = targinfo; kfree(mr->iparray); - + DEBUGP("same_destroy: Deallocated %u bytes for %u ipaddresses.\n", (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); } @@ -156,7 +156,7 @@ same_target(struct sk_buff **pskb, giving some hope for consistency across reboots. Here we calculate the index in same->iparray which holds the ipaddress we should use */ - + #ifdef CONFIG_NF_NAT_NEEDED tmpip = ntohl(t->src.u3.ip); diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c index 29b05a6..cedf9f7 100644 --- a/net/ipv4/netfilter/ipt_TOS.c +++ b/net/ipv4/netfilter/ipt_TOS.c @@ -47,8 +47,8 @@ static int checkentry(const char *tablename, const void *e_void, const struct xt_target *target, - void *targinfo, - unsigned int hook_mask) + void *targinfo, + unsigned int hook_mask) { const u_int8_t tos = ((struct ipt_tos_target_info *)targinfo)->tos; diff --git a/net/ipv4/netfilter/ipt_TTL.c b/net/ipv4/netfilter/ipt_TTL.c index d2b6fa3..64be31c 100644 --- a/net/ipv4/netfilter/ipt_TTL.c +++ b/net/ipv4/netfilter/ipt_TTL.c @@ -19,7 +19,7 @@ MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); MODULE_DESCRIPTION("IP tables TTL modification module"); MODULE_LICENSE("GPL"); -static unsigned int +static unsigned int ipt_ttl_target(struct sk_buff **pskb, const struct net_device *in, const struct net_device *out, unsigned int hooknum, const struct xt_target *target, @@ -71,7 +71,7 @@ static int ipt_ttl_checkentry(const char *tablename, struct ipt_TTL_info *info = targinfo; if (info->mode > IPT_TTL_MAXMODE) { - printk(KERN_WARNING "ipt_TTL: invalid or unknown Mode %u\n", + printk(KERN_WARNING "ipt_TTL: invalid or unknown Mode %u\n", info->mode); return 0; } @@ -83,10 +83,10 @@ static int ipt_ttl_checkentry(const char *tablename, static struct xt_target ipt_TTL = { .name = "TTL", .family = AF_INET, - .target = ipt_ttl_target, + .target = ipt_ttl_target, .targetsize = sizeof(struct ipt_TTL_info), .table = "mangle", - .checkentry = ipt_ttl_checkentry, + .checkentry = ipt_ttl_checkentry, .me = THIS_MODULE, }; diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index 7af57a3..3a1eacc 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c @@ -4,9 +4,9 @@ * (C) 2000-2004 by Harald Welte <laforge@netfilter.org> * * 2000/09/22 ulog-cprange feature added - * 2001/01/04 in-kernel queue as proposed by Sebastian Zander + * 2001/01/04 in-kernel queue as proposed by Sebastian Zander * <zander@fokus.gmd.de> - * 2001/01/30 per-rule nlgroup conflicts with global queue. + * 2001/01/30 per-rule nlgroup conflicts with global queue. * nlgroup now global (sysctl) * 2001/04/19 ulog-queue reworked, now fixed buffer size specified at * module loadtime -HW @@ -23,8 +23,8 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * - * This module accepts two parameters: - * + * This module accepts two parameters: + * * nlbufsiz: * The parameter specifies how big the buffer for each netlink multicast * group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will @@ -72,7 +72,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NFLOG); #if 0 #define DEBUGP(format, args...) printk("%s:%s:" format, \ - __FILE__, __FUNCTION__ , ## args) + __FILE__, __FUNCTION__ , ## args) #else #define DEBUGP(format, args...) #endif @@ -162,7 +162,7 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size) PRINTR("ipt_ULOG: can't alloc whole buffer %ub!\n", n); if (n > size) { - /* try to allocate only as much as we need for + /* try to allocate only as much as we need for * current packet */ skb = alloc_skb(size, GFP_ATOMIC); @@ -203,7 +203,7 @@ static void ipt_ulog_packet(unsigned int hooknum, size = NLMSG_SPACE(sizeof(*pm) + copy_len); ub = &ulog_buffers[groupnum]; - + spin_lock_bh(&ulog_lock); if (!ub->skb) { @@ -211,7 +211,7 @@ static void ipt_ulog_packet(unsigned int hooknum, goto alloc_failure; } else if (ub->qlen >= loginfo->qthreshold || size > skb_tailroom(ub->skb)) { - /* either the queue len is too high or we don't have + /* either the queue len is too high or we don't have * enough room in nlskb left. send it to userspace. */ ulog_send(groupnum); @@ -220,11 +220,11 @@ static void ipt_ulog_packet(unsigned int hooknum, goto alloc_failure; } - DEBUGP("ipt_ULOG: qlen %d, qthreshold %d\n", ub->qlen, + DEBUGP("ipt_ULOG: qlen %d, qthreshold %d\n", ub->qlen, loginfo->qthreshold); /* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */ - nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT, + nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT, sizeof(*pm)+copy_len); ub->qlen++; @@ -268,7 +268,7 @@ static void ipt_ulog_packet(unsigned int hooknum, /* copy_len <= skb->len, so can't fail. */ if (skb_copy_bits(skb, 0, pm->payload, copy_len) < 0) BUG(); - + /* check if we are building multi-part messages */ if (ub->qlen > 1) { ub->lastnlh->nlmsg_flags |= NLM_F_MULTI; @@ -312,10 +312,10 @@ static unsigned int ipt_ulog_target(struct sk_buff **pskb, struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo; ipt_ulog_packet(hooknum, *pskb, in, out, loginfo, NULL); - + return XT_CONTINUE; } - + static void ipt_logfn(unsigned int pf, unsigned int hooknum, const struct sk_buff *skb, @@ -396,7 +396,7 @@ static int __init ipt_ulog_init(void) } nflognl = netlink_kernel_create(NETLINK_NFLOG, ULOG_MAXNLGROUPS, NULL, - THIS_MODULE); + THIS_MODULE); if (!nflognl) return -ENOMEM; @@ -407,7 +407,7 @@ static int __init ipt_ulog_init(void) } if (nflog) nf_log_register(PF_INET, &ipt_ulog_logger); - + return 0; } diff --git a/net/ipv4/netfilter/ipt_addrtype.c b/net/ipv4/netfilter/ipt_addrtype.c index 648f555..cfa0472 100644 --- a/net/ipv4/netfilter/ipt_addrtype.c +++ b/net/ipv4/netfilter/ipt_addrtype.c @@ -40,7 +40,7 @@ static int match(const struct sk_buff *skb, ret &= match_type(iph->saddr, info->source)^info->invert_source; if (info->dest) ret &= match_type(iph->daddr, info->dest)^info->invert_dest; - + return ret; } diff --git a/net/ipv4/netfilter/ipt_ah.c b/net/ipv4/netfilter/ipt_ah.c index 42f4122..18a1678 100644 --- a/net/ipv4/netfilter/ipt_ah.c +++ b/net/ipv4/netfilter/ipt_ah.c @@ -29,8 +29,8 @@ static inline int spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) { int r=0; - duprintf("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', - min,spi,max); + duprintf("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', + min,spi,max); r=(spi >= min && spi <= max) ^ invert; duprintf(" result %s\n",r? "PASS" : "FAILED"); return r; diff --git a/net/ipv4/netfilter/ipt_iprange.c b/net/ipv4/netfilter/ipt_iprange.c index 05de593..bc5d5e6 100644 --- a/net/ipv4/netfilter/ipt_iprange.c +++ b/net/ipv4/netfilter/ipt_iprange.c @@ -41,7 +41,7 @@ match(const struct sk_buff *skb, DEBUGP("src IP %u.%u.%u.%u NOT in range %s" "%u.%u.%u.%u-%u.%u.%u.%u\n", NIPQUAD(iph->saddr), - info->flags & IPRANGE_SRC_INV ? "(INV) " : "", + info->flags & IPRANGE_SRC_INV ? "(INV) " : "", NIPQUAD(info->src.min_ip), NIPQUAD(info->src.max_ip)); return 0; @@ -54,7 +54,7 @@ match(const struct sk_buff *skb, DEBUGP("dst IP %u.%u.%u.%u NOT in range %s" "%u.%u.%u.%u-%u.%u.%u.%u\n", NIPQUAD(iph->daddr), - info->flags & IPRANGE_DST_INV ? "(INV) " : "", + info->flags & IPRANGE_DST_INV ? "(INV) " : "", NIPQUAD(info->dst.min_ip), NIPQUAD(info->dst.max_ip)); return 0; diff --git a/net/ipv4/netfilter/ipt_owner.c b/net/ipv4/netfilter/ipt_owner.c index 9f496ac..7fae9aa 100644 --- a/net/ipv4/netfilter/ipt_owner.c +++ b/net/ipv4/netfilter/ipt_owner.c @@ -53,10 +53,10 @@ match(const struct sk_buff *skb, static int checkentry(const char *tablename, - const void *ip, + const void *ip, const struct xt_match *match, - void *matchinfo, - unsigned int hook_mask) + void *matchinfo, + unsigned int hook_mask) { const struct ipt_owner_info *info = matchinfo; diff --git a/net/ipv4/netfilter/ipt_ttl.c b/net/ipv4/netfilter/ipt_ttl.c index d5cd984e..1eca9f4 100644 --- a/net/ipv4/netfilter/ipt_ttl.c +++ b/net/ipv4/netfilter/ipt_ttl.c @@ -1,4 +1,4 @@ -/* IP tables module for matching the value of the TTL +/* IP tables module for matching the value of the TTL * * ipt_ttl.c,v 1.5 2000/11/13 11:16:08 laforge Exp * @@ -41,7 +41,7 @@ static int match(const struct sk_buff *skb, return (skb->nh.iph->ttl > info->ttl); break; default: - printk(KERN_WARNING "ipt_ttl: unknown mode %d\n", + printk(KERN_WARNING "ipt_ttl: unknown mode %d\n", info->mode); return 0; } diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c index 51053cb..d1d61e9 100644 --- a/net/ipv4/netfilter/iptable_filter.c +++ b/net/ipv4/netfilter/iptable_filter.c @@ -25,7 +25,7 @@ static struct struct ipt_replace repl; struct ipt_standard entries[3]; struct ipt_error term; -} initial_table __initdata +} initial_table __initdata = { { "filter", FILTER_VALID_HOOKS, 4, sizeof(struct ipt_standard) * 3 + sizeof(struct ipt_error), { [NF_IP_LOCAL_IN] = 0, diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c index a532e4d..98b66ef 100644 --- a/net/ipv4/netfilter/iptable_mangle.c +++ b/net/ipv4/netfilter/iptable_mangle.c @@ -58,7 +58,7 @@ static struct { { { { IPT_ALIGN(sizeof(struct ipt_standard_target)), "" } }, { } }, -NF_ACCEPT - 1 } }, /* LOCAL_IN */ - { { { { 0 }, { 0 }, { 0 }, { 0 }, "", "", { 0 }, { 0 }, 0, 0, 0 }, + { { { { 0 }, { 0 }, { 0 }, { 0 }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 0, sizeof(struct ipt_entry), sizeof(struct ipt_standard), @@ -66,7 +66,7 @@ static struct { { { { IPT_ALIGN(sizeof(struct ipt_standard_target)), "" } }, { } }, -NF_ACCEPT - 1 } }, /* FORWARD */ - { { { { 0 }, { 0 }, { 0 }, { 0 }, "", "", { 0 }, { 0 }, 0, 0, 0 }, + { { { { 0 }, { 0 }, { 0 }, { 0 }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 0, sizeof(struct ipt_entry), sizeof(struct ipt_standard), @@ -166,7 +166,7 @@ static struct nf_hook_ops ipt_ops[] = { .hook = ipt_route_hook, .owner = THIS_MODULE, .pf = PF_INET, - .hooknum = NF_IP_PRE_ROUTING, + .hooknum = NF_IP_PRE_ROUTING, .priority = NF_IP_PRI_MANGLE, }, { diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c index 5277550..18c3d4c 100644 --- a/net/ipv4/netfilter/iptable_raw.c +++ b/net/ipv4/netfilter/iptable_raw.c @@ -1,4 +1,4 @@ -/* +/* * 'raw' table, which is the very first hooked in at PRE_ROUTING and LOCAL_OUT . * * Copyright (C) 2003 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> @@ -15,26 +15,26 @@ static struct struct ipt_error term; } initial_table __initdata = { .repl = { - .name = "raw", - .valid_hooks = RAW_VALID_HOOKS, + .name = "raw", + .valid_hooks = RAW_VALID_HOOKS, .num_entries = 3, .size = sizeof(struct ipt_standard) * 2 + sizeof(struct ipt_error), - .hook_entry = { + .hook_entry = { [NF_IP_PRE_ROUTING] = 0, [NF_IP_LOCAL_OUT] = sizeof(struct ipt_standard) }, - .underflow = { + .underflow = { [NF_IP_PRE_ROUTING] = 0, [NF_IP_LOCAL_OUT] = sizeof(struct ipt_standard) }, }, .entries = { /* PRE_ROUTING */ - { - .entry = { + { + .entry = { .target_offset = sizeof(struct ipt_entry), .next_offset = sizeof(struct ipt_standard), }, - .target = { - .target = { + .target = { + .target = { .u = { .target_size = IPT_ALIGN(sizeof(struct ipt_standard_target)), }, @@ -69,7 +69,7 @@ static struct .target = { .u = { .user = { - .target_size = IPT_ALIGN(sizeof(struct ipt_error_target)), + .target_size = IPT_ALIGN(sizeof(struct ipt_error_target)), .name = IPT_ERROR_TARGET, }, }, @@ -80,9 +80,9 @@ static struct }; static struct xt_table packet_raw = { - .name = "raw", - .valid_hooks = RAW_VALID_HOOKS, - .lock = RW_LOCK_UNLOCKED, + .name = "raw", + .valid_hooks = RAW_VALID_HOOKS, + .lock = RW_LOCK_UNLOCKED, .me = THIS_MODULE, .af = AF_INET, }; diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index 471b638..b984db7 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c @@ -66,7 +66,7 @@ static int ipv4_print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple) { return seq_printf(s, "src=%u.%u.%u.%u dst=%u.%u.%u.%u ", - NIPQUAD(tuple->src.u3.ip), + NIPQUAD(tuple->src.u3.ip), NIPQUAD(tuple->dst.u3.ip)); } @@ -82,14 +82,14 @@ nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user) { skb_orphan(skb); - local_bh_disable(); - skb = ip_defrag(skb, user); - local_bh_enable(); + local_bh_disable(); + skb = ip_defrag(skb, user); + local_bh_enable(); - if (skb) + if (skb) ip_send_check(skb->nh.iph); - return skb; + return skb; } static int @@ -192,10 +192,10 @@ static unsigned int ipv4_conntrack_in(unsigned int hooknum, } static unsigned int ipv4_conntrack_local(unsigned int hooknum, - struct sk_buff **pskb, - const struct net_device *in, - const struct net_device *out, - int (*okfn)(struct sk_buff *)) + struct sk_buff **pskb, + const struct net_device *in, + const struct net_device *out, + int (*okfn)(struct sk_buff *)) { /* root is playing with raw sockets. */ if ((*pskb)->len < sizeof(struct iphdr) @@ -332,7 +332,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) struct inet_sock *inet = inet_sk(sk); struct nf_conntrack_tuple_hash *h; struct nf_conntrack_tuple tuple; - + NF_CT_TUPLE_U_BLANK(&tuple); tuple.src.u3.ip = inet->rcv_saddr; tuple.src.u.tcp.port = inet->sport; @@ -501,7 +501,7 @@ static int __init nf_conntrack_l3proto_ipv4_init(void) return ret; #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) cleanup_hooks: - nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); + nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); #endif cleanup_ipv4: nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4); diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index 3b31bc6..14a93a7 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c @@ -135,7 +135,7 @@ static int ct_seq_show(struct seq_file *s, void *v) l3proto, l4proto)) return -ENOSPC; - if (seq_print_counters(s, &ct->counters[IP_CT_DIR_ORIGINAL])) + if (seq_print_counters(s, &ct->counters[IP_CT_DIR_ORIGINAL])) return -ENOSPC; if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) @@ -146,7 +146,7 @@ static int ct_seq_show(struct seq_file *s, void *v) l3proto, l4proto)) return -ENOSPC; - if (seq_print_counters(s, &ct->counters[IP_CT_DIR_REPLY])) + if (seq_print_counters(s, &ct->counters[IP_CT_DIR_REPLY])) return -ENOSPC; if (test_bit(IPS_ASSURED_BIT, &ct->status)) @@ -228,7 +228,7 @@ static void *exp_seq_start(struct seq_file *s, loff_t *pos) static void *exp_seq_next(struct seq_file *s, void *v, loff_t *pos) { - struct list_head *e = v; + struct list_head *e = v; ++*pos; e = e->next; @@ -262,7 +262,7 @@ static int exp_seq_show(struct seq_file *s, void *v) print_tuple(s, &exp->tuple, __nf_ct_l3proto_find(exp->tuple.src.l3num), __nf_ct_l4proto_find(exp->tuple.src.l3num, - exp->tuple.dst.protonum)); + exp->tuple.dst.protonum)); return seq_putc(s, '\n'); } diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index db9e7c4..677b6c8 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c @@ -101,9 +101,9 @@ static int icmp_packet(struct nf_conn *ct, unsigned int hooknum) { /* Try to delete connection immediately after all replies: - won't actually vanish as we still have skb, and del_timer - means this will only run once even if count hits zero twice - (theoretically possible with SMP) */ + won't actually vanish as we still have skb, and del_timer + means this will only run once even if count hits zero twice + (theoretically possible with SMP) */ if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) { if (atomic_dec_and_test(&ct->proto.icmp.count) && del_timer(&ct->timeout)) @@ -144,8 +144,8 @@ extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ static int icmp_error_message(struct sk_buff *skb, - enum ip_conntrack_info *ctinfo, - unsigned int hooknum) + enum ip_conntrack_info *ctinfo, + unsigned int hooknum) { struct nf_conntrack_tuple innertuple, origtuple; struct { @@ -181,9 +181,9 @@ icmp_error_message(struct sk_buff *skb, return -NF_ACCEPT; } - /* Ordinarily, we'd expect the inverted tupleproto, but it's - been preserved inside the ICMP. */ - if (!nf_ct_invert_tuple(&innertuple, &origtuple, + /* Ordinarily, we'd expect the inverted tupleproto, but it's + been preserved inside the ICMP. */ + if (!nf_ct_invert_tuple(&innertuple, &origtuple, &nf_conntrack_l3proto_ipv4, innerproto)) { DEBUGP("icmp_error_message: no match\n"); return -NF_ACCEPT; @@ -212,10 +212,10 @@ icmp_error_message(struct sk_buff *skb, *ctinfo += IP_CT_IS_REPLY; } - /* Update skb to refer to this connection */ - skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general; - skb->nfctinfo = *ctinfo; - return -NF_ACCEPT; + /* Update skb to refer to this connection */ + skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general; + skb->nfctinfo = *ctinfo; + return -NF_ACCEPT; } /* Small and modified version of icmp_rcv */ @@ -306,7 +306,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[], if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto)) return -EINVAL; - tuple->dst.u.icmp.type = + tuple->dst.u.icmp.type = *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_TYPE-1]); tuple->dst.u.icmp.code = *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]); @@ -332,7 +332,7 @@ static struct ctl_table icmp_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_dointvec_jiffies, }, - { + { .ctl_name = 0 } }; @@ -346,7 +346,7 @@ static struct ctl_table icmp_compat_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_dointvec_jiffies, }, - { + { .ctl_name = 0 } }; diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 998b255..cf10108 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c @@ -452,8 +452,8 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct, (*pskb)->nfctinfo == IP_CT_RELATED+IP_CT_IS_REPLY); /* Redirects on non-null nats must be dropped, else they'll - start talking to each other without our translation, and be - confused... --RR */ + start talking to each other without our translation, and be + confused... --RR */ if (inside->icmp.type == ICMP_REDIRECT) { /* If NAT isn't finished, assume it and drop. */ if ((ct->status & IPS_NAT_DONE_MASK) != IPS_NAT_DONE_MASK) @@ -469,13 +469,13 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct, if (!nf_ct_get_tuple(*pskb, (*pskb)->nh.iph->ihl*4 + sizeof(struct icmphdr), (*pskb)->nh.iph->ihl*4 + - sizeof(struct icmphdr) + inside->ip.ihl*4, - (u_int16_t)AF_INET, - inside->ip.protocol, - &inner, - l3proto, + sizeof(struct icmphdr) + inside->ip.ihl*4, + (u_int16_t)AF_INET, + inside->ip.protocol, + &inner, + l3proto, __nf_ct_l4proto_find((u_int16_t)PF_INET, - inside->ip.protocol))) + inside->ip.protocol))) return 0; /* Change inner back to look like incoming packet. We do the diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c index fb9ab01..9cbf3f9 100644 --- a/net/ipv4/netfilter/nf_nat_h323.c +++ b/net/ipv4/netfilter/nf_nat_h323.c @@ -256,7 +256,7 @@ static int nat_rtp_rtcp(struct sk_buff **pskb, struct nf_conn *ct, if (set_h245_addr(pskb, data, dataoff, taddr, &ct->tuplehash[!dir].tuple.dst.u3, htons((port & htons(1)) ? nated_port + 1 : - nated_port)) == 0) { + nated_port)) == 0) { /* Save ports */ info->rtp_port[i][dir] = rtp_port; info->rtp_port[i][!dir] = htons(nated_port); diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c index dc6738b..49a90c3 100644 --- a/net/ipv4/netfilter/nf_nat_helper.c +++ b/net/ipv4/netfilter/nf_nat_helper.c @@ -179,7 +179,7 @@ nf_nat_mangle_tcp_packet(struct sk_buff **pskb, tcph->check = tcp_v4_check(datalen, iph->saddr, iph->daddr, csum_partial((char *)tcph, - datalen, 0)); + datalen, 0)); } else nf_proto_csum_replace2(&tcph->check, *pskb, htons(oldlen), htons(datalen), 1); @@ -223,7 +223,7 @@ nf_nat_mangle_udp_packet(struct sk_buff **pskb, /* UDP helpers might accidentally mangle the wrong packet */ iph = (*pskb)->nh.iph; if ((*pskb)->len < iph->ihl*4 + sizeof(*udph) + - match_offset + match_len) + match_offset + match_len) return 0; if (!skb_make_writable(pskb, (*pskb)->len)) @@ -252,9 +252,9 @@ nf_nat_mangle_udp_packet(struct sk_buff **pskb, if ((*pskb)->ip_summed != CHECKSUM_PARTIAL) { udph->check = 0; udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr, - datalen, IPPROTO_UDP, - csum_partial((char *)udph, - datalen, 0)); + datalen, IPPROTO_UDP, + csum_partial((char *)udph, + datalen, 0)); if (!udph->check) udph->check = CSUM_MANGLED_0; } else diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c index 5df4fca..7ba341c 100644 --- a/net/ipv4/netfilter/nf_nat_pptp.c +++ b/net/ipv4/netfilter/nf_nat_pptp.c @@ -184,10 +184,10 @@ pptp_outbound_pkt(struct sk_buff **pskb, /* mangle packet */ if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, - cid_off + sizeof(struct pptp_pkt_hdr) + - sizeof(struct PptpControlHeader), - sizeof(new_callid), (char *)&new_callid, - sizeof(new_callid)) == 0) + cid_off + sizeof(struct pptp_pkt_hdr) + + sizeof(struct PptpControlHeader), + sizeof(new_callid), (char *)&new_callid, + sizeof(new_callid)) == 0) return NF_DROP; return NF_ACCEPT; } @@ -276,7 +276,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, ntohs(REQ_CID(pptpReq, pcid_off)), ntohs(new_pcid)); if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, - pcid_off + sizeof(struct pptp_pkt_hdr) + + pcid_off + sizeof(struct pptp_pkt_hdr) + sizeof(struct PptpControlHeader), sizeof(new_pcid), (char *)&new_pcid, sizeof(new_pcid)) == 0) diff --git a/net/ipv4/netfilter/nf_nat_proto_icmp.c b/net/ipv4/netfilter/nf_nat_proto_icmp.c index dcfd772..6bc2f06 100644 --- a/net/ipv4/netfilter/nf_nat_proto_icmp.c +++ b/net/ipv4/netfilter/nf_nat_proto_icmp.c @@ -44,7 +44,7 @@ icmp_unique_tuple(struct nf_conntrack_tuple *tuple, for (i = 0; i < range_size; i++, id++) { tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) + - (id % range_size)); + (id % range_size)); if (!nf_nat_used_tuple(tuple, ct)) return 1; } diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c index 7f95b4e..147a437 100644 --- a/net/ipv4/netfilter/nf_nat_rule.c +++ b/net/ipv4/netfilter/nf_nat_rule.c @@ -56,8 +56,8 @@ static struct /* PRE_ROUTING */ { .entry = { - .target_offset = sizeof(struct ipt_entry), - .next_offset = sizeof(struct ipt_standard), + .target_offset = sizeof(struct ipt_entry), + .next_offset = sizeof(struct ipt_standard), }, .target = { .target = { @@ -71,8 +71,8 @@ static struct /* POST_ROUTING */ { .entry = { - .target_offset = sizeof(struct ipt_entry), - .next_offset = sizeof(struct ipt_standard), + .target_offset = sizeof(struct ipt_entry), + .next_offset = sizeof(struct ipt_standard), }, .target = { .target = { @@ -86,8 +86,8 @@ static struct /* LOCAL_OUT */ { .entry = { - .target_offset = sizeof(struct ipt_entry), - .next_offset = sizeof(struct ipt_standard), + .target_offset = sizeof(struct ipt_entry), + .next_offset = sizeof(struct ipt_standard), }, .target = { .target = { @@ -145,7 +145,7 @@ static unsigned int ipt_snat_target(struct sk_buff **pskb, /* Connection must be valid and new. */ NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || - ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); + ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); NF_CT_ASSERT(out); return nf_nat_setup_info(ct, &mr->range[0], hooknum); @@ -256,8 +256,8 @@ alloc_null_binding(struct nf_conn *ct, unsigned int alloc_null_binding_confirmed(struct nf_conn *ct, - struct nf_nat_info *info, - unsigned int hooknum) + struct nf_nat_info *info, + unsigned int hooknum) { __be32 ip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c index 3d524b9..b12cd7c 100644 --- a/net/ipv4/netfilter/nf_nat_sip.c +++ b/net/ipv4/netfilter/nf_nat_sip.c @@ -90,7 +90,7 @@ static int map_sip_addr(struct sk_buff **pskb, enum ip_conntrack_info ctinfo, return 1; if (!nf_nat_mangle_udp_packet(pskb, ct, ctinfo, - matchoff, matchlen, addr, addrlen)) + matchoff, matchlen, addr, addrlen)) return 0; *dptr = (*pskb)->data + (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr); return 1; @@ -151,7 +151,7 @@ static unsigned int mangle_sip_packet(struct sk_buff **pskb, return 0; if (!nf_nat_mangle_udp_packet(pskb, ct, ctinfo, - matchoff, matchlen, buffer, bufflen)) + matchoff, matchlen, buffer, bufflen)) return 0; /* We need to reload this. Thanks Patrick. */ @@ -172,7 +172,7 @@ static int mangle_content_len(struct sk_buff **pskb, /* Get actual SDP lenght */ if (ct_sip_get_info(ct, dptr, (*pskb)->len - dataoff, &matchoff, - &matchlen, POS_SDP_HEADER) > 0) { + &matchlen, POS_SDP_HEADER) > 0) { /* since ct_sip_get_info() give us a pointer passing 'v=' we need to add 2 bytes in this count. */ @@ -180,7 +180,7 @@ static int mangle_content_len(struct sk_buff **pskb, /* Now, update SDP length */ if (ct_sip_get_info(ct, dptr, (*pskb)->len - dataoff, &matchoff, - &matchlen, POS_CONTENT) > 0) { + &matchlen, POS_CONTENT) > 0) { bufflen = sprintf(buffer, "%u", c_len); return nf_nat_mangle_udp_packet(pskb, ct, ctinfo, @@ -205,17 +205,17 @@ static unsigned int mangle_sdp(struct sk_buff **pskb, /* Mangle owner and contact info. */ bufflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(newip)); if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff, - buffer, bufflen, POS_OWNER_IP4)) + buffer, bufflen, POS_OWNER_IP4)) return 0; if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff, - buffer, bufflen, POS_CONNECTION_IP4)) + buffer, bufflen, POS_CONNECTION_IP4)) return 0; /* Mangle media port. */ bufflen = sprintf(buffer, "%u", port); if (!mangle_sip_packet(pskb, ctinfo, ct, &dptr, (*pskb)->len - dataoff, - buffer, bufflen, POS_MEDIA)) + buffer, bufflen, POS_MEDIA)) return 0; return mangle_content_len(pskb, ctinfo, ct, dptr); diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c index f12528f..ce5c493 100644 --- a/net/ipv4/netfilter/nf_nat_snmp_basic.c +++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c @@ -150,8 +150,8 @@ struct asn1_octstr }; static void asn1_open(struct asn1_ctx *ctx, - unsigned char *buf, - unsigned int len) + unsigned char *buf, + unsigned int len) { ctx->begin = buf; ctx->end = buf + len; @@ -186,9 +186,9 @@ static unsigned char asn1_tag_decode(struct asn1_ctx *ctx, unsigned int *tag) } static unsigned char asn1_id_decode(struct asn1_ctx *ctx, - unsigned int *cls, - unsigned int *con, - unsigned int *tag) + unsigned int *cls, + unsigned int *con, + unsigned int *tag) { unsigned char ch; @@ -207,8 +207,8 @@ static unsigned char asn1_id_decode(struct asn1_ctx *ctx, } static unsigned char asn1_length_decode(struct asn1_ctx *ctx, - unsigned int *def, - unsigned int *len) + unsigned int *def, + unsigned int *len) { unsigned char ch, cnt; @@ -239,10 +239,10 @@ static unsigned char asn1_length_decode(struct asn1_ctx *ctx, } static unsigned char asn1_header_decode(struct asn1_ctx *ctx, - unsigned char **eoc, - unsigned int *cls, - unsigned int *con, - unsigned int *tag) + unsigned char **eoc, + unsigned int *cls, + unsigned int *con, + unsigned int *tag) { unsigned int def, len; @@ -297,8 +297,8 @@ static unsigned char asn1_null_decode(struct asn1_ctx *ctx, unsigned char *eoc) } static unsigned char asn1_long_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - long *integer) + unsigned char *eoc, + long *integer) { unsigned char ch; unsigned int len; @@ -325,8 +325,8 @@ static unsigned char asn1_long_decode(struct asn1_ctx *ctx, } static unsigned char asn1_uint_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned int *integer) + unsigned char *eoc, + unsigned int *integer) { unsigned char ch; unsigned int len; @@ -354,8 +354,8 @@ static unsigned char asn1_uint_decode(struct asn1_ctx *ctx, } static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned long *integer) + unsigned char *eoc, + unsigned long *integer) { unsigned char ch; unsigned int len; @@ -383,9 +383,9 @@ static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx, } static unsigned char asn1_octets_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned char **octets, - unsigned int *len) + unsigned char *eoc, + unsigned char **octets, + unsigned int *len) { unsigned char *ptr; @@ -411,7 +411,7 @@ static unsigned char asn1_octets_decode(struct asn1_ctx *ctx, } static unsigned char asn1_subid_decode(struct asn1_ctx *ctx, - unsigned long *subid) + unsigned long *subid) { unsigned char ch; @@ -428,9 +428,9 @@ static unsigned char asn1_subid_decode(struct asn1_ctx *ctx, } static unsigned char asn1_oid_decode(struct asn1_ctx *ctx, - unsigned char *eoc, - unsigned long **oid, - unsigned int *len) + unsigned char *eoc, + unsigned long **oid, + unsigned int *len) { unsigned long subid; unsigned int size; @@ -611,9 +611,9 @@ struct snmp_v1_trap #define SERR_EOM 2 static inline void mangle_address(unsigned char *begin, - unsigned char *addr, - const struct oct1_map *map, - __sum16 *check); + unsigned char *addr, + const struct oct1_map *map, + __sum16 *check); struct snmp_cnv { unsigned int class; @@ -644,8 +644,8 @@ static struct snmp_cnv snmp_conv [] = }; static unsigned char snmp_tag_cls2syntax(unsigned int tag, - unsigned int cls, - unsigned short *syntax) + unsigned int cls, + unsigned short *syntax) { struct snmp_cnv *cnv; @@ -662,7 +662,7 @@ static unsigned char snmp_tag_cls2syntax(unsigned int tag, } static unsigned char snmp_object_decode(struct asn1_ctx *ctx, - struct snmp_object **obj) + struct snmp_object **obj) { unsigned int cls, con, tag, len, idlen; unsigned short type; @@ -714,7 +714,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, return 0; } *obj = kmalloc(sizeof(struct snmp_object) + len, - GFP_ATOMIC); + GFP_ATOMIC); if (*obj == NULL) { kfree(id); if (net_ratelimit()) @@ -730,7 +730,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, return 0; } *obj = kmalloc(sizeof(struct snmp_object) + len, - GFP_ATOMIC); + GFP_ATOMIC); if (*obj == NULL) { kfree(id); if (net_ratelimit()) @@ -834,7 +834,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, } static unsigned char snmp_request_decode(struct asn1_ctx *ctx, - struct snmp_request *request) + struct snmp_request *request) { unsigned int cls, con, tag; unsigned char *end; @@ -874,9 +874,9 @@ static unsigned char snmp_request_decode(struct asn1_ctx *ctx, * code example in the draft. */ static void fast_csum(__sum16 *csum, - const unsigned char *optr, - const unsigned char *nptr, - int offset) + const unsigned char *optr, + const unsigned char *nptr, + int offset) { unsigned char s[4]; @@ -899,9 +899,9 @@ static void fast_csum(__sum16 *csum, * - addr points to the start of the address */ static inline void mangle_address(unsigned char *begin, - unsigned char *addr, - const struct oct1_map *map, - __sum16 *check) + unsigned char *addr, + const struct oct1_map *map, + __sum16 *check) { if (map->from == NOCT1(addr)) { u_int32_t old; @@ -914,7 +914,7 @@ static inline void mangle_address(unsigned char *begin, /* Update UDP checksum if being used */ if (*check) { fast_csum(check, - &map->from, &map->to, addr - begin); + &map->from, &map->to, addr - begin); } @@ -925,9 +925,9 @@ static inline void mangle_address(unsigned char *begin, } static unsigned char snmp_trap_decode(struct asn1_ctx *ctx, - struct snmp_v1_trap *trap, - const struct oct1_map *map, - __sum16 *check) + struct snmp_v1_trap *trap, + const struct oct1_map *map, + __sum16 *check) { unsigned int cls, con, tag, len; unsigned char *end; @@ -1019,9 +1019,9 @@ static void hex_dump(unsigned char *buf, size_t len) * (And this is the fucking 'basic' method). */ static int snmp_parse_mangle(unsigned char *msg, - u_int16_t len, - const struct oct1_map *map, - __sum16 *check) + u_int16_t len, + const struct oct1_map *map, + __sum16 *check) { unsigned char *eoc, *end; unsigned int cls, con, tag, vers, pdutype; @@ -1191,8 +1191,8 @@ static int snmp_parse_mangle(unsigned char *msg, * SNMP translation routine. */ static int snmp_translate(struct nf_conn *ct, - enum ip_conntrack_info ctinfo, - struct sk_buff **pskb) + enum ip_conntrack_info ctinfo, + struct sk_buff **pskb) { struct iphdr *iph = (*pskb)->nh.iph; struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl); @@ -1219,7 +1219,7 @@ static int snmp_translate(struct nf_conn *ct, return NF_ACCEPT; if (!snmp_parse_mangle((unsigned char *)udph + sizeof(struct udphdr), - paylen, &map, &udph->check)) { + paylen, &map, &udph->check)) { if (net_ratelimit()) printk(KERN_WARNING "bsalg: parser failed\n"); return NF_DROP; diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c index 5a964a1..e4d3ef1 100644 --- a/net/ipv4/netfilter/nf_nat_standalone.c +++ b/net/ipv4/netfilter/nf_nat_standalone.c @@ -96,8 +96,8 @@ nf_nat_fn(unsigned int hooknum, protocol. 8) --RR */ if (!ct) { /* Exception: ICMP redirect to new connection (not in - hash table yet). We must not let this through, in - case we're doing NAT to the same network. */ + hash table yet). We must not let this through, in + case we're doing NAT to the same network. */ if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP) { struct icmphdr _hdr, *hp; @@ -141,7 +141,7 @@ nf_nat_fn(unsigned int hooknum, if (unlikely(nf_ct_is_confirmed(ct))) /* NAT module was loaded late */ ret = alloc_null_binding_confirmed(ct, info, - hooknum); + hooknum); else if (hooknum == NF_IP_LOCAL_IN) /* LOCAL_IN hook doesn't have a chain! */ ret = alloc_null_binding(ct, info, hooknum); @@ -171,10 +171,10 @@ nf_nat_fn(unsigned int hooknum, static unsigned int nf_nat_in(unsigned int hooknum, - struct sk_buff **pskb, - const struct net_device *in, - const struct net_device *out, - int (*okfn)(struct sk_buff *)) + struct sk_buff **pskb, + const struct net_device *in, + const struct net_device *out, + int (*okfn)(struct sk_buff *)) { unsigned int ret; __be32 daddr = (*pskb)->nh.iph->daddr; @@ -269,9 +269,9 @@ nf_nat_adjust(unsigned int hooknum, ct = nf_ct_get(*pskb, &ctinfo); if (ct && test_bit(IPS_SEQ_ADJUST_BIT, &ct->status)) { - DEBUGP("nf_nat_standalone: adjusting sequence number\n"); - if (!nf_nat_seq_adjust(pskb, ct, ctinfo)) - return NF_DROP; + DEBUGP("nf_nat_standalone: adjusting sequence number\n"); + if (!nf_nat_seq_adjust(pskb, ct, ctinfo)) + return NF_DROP; } return NF_ACCEPT; } diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index cd873da..ccb199e 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -266,7 +266,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) seq_printf(seq, " %lu", - fold_field((void **) ip_statistics, + fold_field((void **) ip_statistics, snmp4_ipstats_list[i].entry)); seq_puts(seq, "\nIcmp:"); @@ -276,7 +276,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "\nIcmp:"); for (i = 0; snmp4_icmp_list[i].name != NULL; i++) seq_printf(seq, " %lu", - fold_field((void **) icmp_statistics, + fold_field((void **) icmp_statistics, snmp4_icmp_list[i].entry)); seq_puts(seq, "\nTcp:"); @@ -288,7 +288,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) /* MaxConn field is signed, RFC 2012 */ if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN) seq_printf(seq, " %ld", - fold_field((void **) tcp_statistics, + fold_field((void **) tcp_statistics, snmp4_tcp_list[i].entry)); else seq_printf(seq, " %lu", @@ -303,7 +303,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "\nUdp:"); for (i = 0; snmp4_udp_list[i].name != NULL; i++) seq_printf(seq, " %lu", - fold_field((void **) udp_statistics, + fold_field((void **) udp_statistics, snmp4_udp_list[i].entry)); /* the UDP and UDP-Lite MIBs are the same */ @@ -348,7 +348,7 @@ static int netstat_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "\nTcpExt:"); for (i = 0; snmp4_net_list[i].name != NULL; i++) seq_printf(seq, " %lu", - fold_field((void **) net_statistics, + fold_field((void **) net_statistics, snmp4_net_list[i].entry)); seq_putc(seq, '\n'); diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c index 05f5114..6cd6340 100644 --- a/net/ipv4/protocol.c +++ b/net/ipv4/protocol.c @@ -74,7 +74,7 @@ int inet_add_protocol(struct net_protocol *prot, unsigned char protocol) /* * Remove a protocol from the hash tables. */ - + int inet_del_protocol(struct net_protocol *prot, unsigned char protocol) { int hash, ret; diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index fed6a1e..931084b 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -95,7 +95,7 @@ static void raw_v4_hash(struct sock *sk) static void raw_v4_unhash(struct sock *sk) { - write_lock_bh(&raw_v4_lock); + write_lock_bh(&raw_v4_lock); if (sk_del_node_init(sk)) sock_prot_dec_use(sk->sk_prot); write_unlock_bh(&raw_v4_lock); @@ -238,7 +238,7 @@ void raw_err (struct sock *sk, struct sk_buff *skb, u32 info) static int raw_rcv_skb(struct sock * sk, struct sk_buff * skb) { /* Charge it to the socket. */ - + if (sock_queue_rcv_skb(sk, skb) < 0) { /* FIXME: increment a raw drops counter here */ kfree_skb(skb); @@ -263,7 +263,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb) } static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, - struct rtable *rt, + struct rtable *rt, unsigned int flags) { struct inet_sock *inet = inet_sk(sk); @@ -285,7 +285,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, skb = sock_alloc_send_skb(sk, length+hh_len+15, flags&MSG_DONTWAIT, &err); if (skb == NULL) - goto error; + goto error; skb_reserve(skb, hh_len); skb->priority = sk->sk_priority; @@ -326,7 +326,7 @@ error_fault: kfree_skb(skb); error: IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS); - return err; + return err; } static int raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg) @@ -399,9 +399,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, err = -EOPNOTSUPP; if (msg->msg_flags & MSG_OOB) /* Mirror BSD error message */ goto out; /* compatibility */ - + /* - * Get and verify the address. + * Get and verify the address. */ if (msg->msg_namelen) { @@ -426,7 +426,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, */ } else { err = -EDESTADDRREQ; - if (sk->sk_state != TCP_ESTABLISHED) + if (sk->sk_state != TCP_ESTABLISHED) goto out; daddr = inet->daddr; } @@ -480,7 +480,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, .saddr = saddr, .tos = tos } }, .proto = inet->hdrincl ? IPPROTO_RAW : - sk->sk_protocol, + sk->sk_protocol, }; if (!inet->hdrincl) { err = raw_probe_proto_opt(&fl, msg); @@ -503,9 +503,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, back_from_confirm: if (inet->hdrincl) - err = raw_send_hdrinc(sk, msg->msg_iov, len, + err = raw_send_hdrinc(sk, msg->msg_iov, len, rt, msg->msg_flags); - + else { if (!ipc.addr) ipc.addr = rt->rt_dst; @@ -538,7 +538,7 @@ do_confirm: static void raw_close(struct sock *sk, long timeout) { - /* + /* * Raw sockets may have direct kernel refereneces. Kill them. */ ip_ra_control(sk, 0, NULL); @@ -861,7 +861,7 @@ static __inline__ char *get_raw_sock(struct sock *sp, char *tmpbuf, int i) sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X" " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p", - i, src, srcp, dest, destp, sp->sk_state, + i, src, srcp, dest, destp, sp->sk_state, atomic_read(&sp->sk_wmem_alloc), atomic_read(&sp->sk_rmem_alloc), 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), diff --git a/net/ipv4/route.c b/net/ipv4/route.c index baee304..5b3834b3 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -20,7 +20,7 @@ * (rco@di.uminho.pt) Routing table insertion and update * Linus Torvalds : Rewrote bits to be sensible * Alan Cox : Added BSD route gw semantics - * Alan Cox : Super /proc >4K + * Alan Cox : Super /proc >4K * Alan Cox : MTU in route table * Alan Cox : MSS actually. Also added the window * clamper. @@ -38,7 +38,7 @@ * Alan Cox : Faster /proc handling * Alexey Kuznetsov : Massive rework to support tree based routing, * routing caches and better behaviour. - * + * * Olaf Erb : irtt wasn't being copied right. * Bjorn Ekwall : Kerneld route support. * Alan Cox : Multicast fixed (I hope) @@ -289,7 +289,7 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) { struct rt_cache_iter_state *st = rcu_dereference(seq->private); - r = r->u.rt_next; + r = r->u.dst.rt_next; while (!r) { rcu_read_unlock_bh(); if (--st->bucket < 0) @@ -361,8 +361,8 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) dev_queue_xmit) : 0, r->rt_spec_dst); seq_printf(seq, "%-127s\n", temp); - } - return 0; + } + return 0; } static struct seq_operations rt_cache_seq_ops = { @@ -429,7 +429,7 @@ static void *rt_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) return &per_cpu(rt_cache_stat, cpu); } return NULL; - + } static void rt_cpu_seq_stop(struct seq_file *seq, void *v) @@ -445,7 +445,7 @@ static int rt_cpu_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "entries in_hit in_slow_tot in_slow_mc in_no_route in_brd in_martian_dst in_martian_src out_hit out_slow_tot out_slow_mc gc_total gc_ignored gc_goal_miss gc_dst_overflow in_hlist_search out_hlist_search\n"); return 0; } - + seq_printf(seq,"%08x %08x %08x %08x %08x %08x %08x %08x " " %08x %08x %08x %08x %08x %08x %08x %08x %08x \n", atomic_read(&ipv4_dst_ops.entries), @@ -459,7 +459,7 @@ static int rt_cpu_seq_show(struct seq_file *seq, void *v) st->out_hit, st->out_slow_tot, - st->out_slow_mc, + st->out_slow_mc, st->gc_total, st->gc_ignored, @@ -493,7 +493,7 @@ static struct file_operations rt_cpu_seq_fops = { }; #endif /* CONFIG_PROC_FS */ - + static __inline__ void rt_free(struct rtable *rt) { multipath_remove(rt); @@ -512,7 +512,7 @@ static __inline__ int rt_fast_clean(struct rtable *rth) /* Kill broadcast/multicast entries very aggresively, if they collide in hash table with more useful entries */ return (rth->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) && - rth->fl.iif && rth->u.rt_next; + rth->fl.iif && rth->u.dst.rt_next; } static __inline__ int rt_valuable(struct rtable *rth) @@ -595,10 +595,10 @@ static struct rtable **rt_remove_balanced_route(struct rtable **chain_head, if (((*rthp)->u.dst.flags & DST_BALANCED) != 0 && compare_keys(&(*rthp)->fl, &expentry->fl)) { if (*rthp == expentry) { - *rthp = rth->u.rt_next; + *rthp = rth->u.dst.rt_next; continue; } else { - *rthp = rth->u.rt_next; + *rthp = rth->u.dst.rt_next; rt_free(rth); if (removed_count) ++(*removed_count); @@ -606,9 +606,9 @@ static struct rtable **rt_remove_balanced_route(struct rtable **chain_head, } else { if (!((*rthp)->u.dst.flags & DST_BALANCED) && passedexpired && !nextstep) - nextstep = &rth->u.rt_next; + nextstep = &rth->u.dst.rt_next; - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.rt_next; } } @@ -649,12 +649,12 @@ static void rt_check_expire(unsigned long dummy) /* Entry is expired even if it is in use */ if (time_before_eq(now, rth->u.dst.expires)) { tmo >>= 1; - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.rt_next; continue; } } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) { tmo >>= 1; - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.rt_next; continue; } @@ -668,12 +668,12 @@ static void rt_check_expire(unsigned long dummy) if (!rthp) break; } else { - *rthp = rth->u.rt_next; + *rthp = rth->u.dst.rt_next; rt_free(rth); } #else /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ - *rthp = rth->u.rt_next; - rt_free(rth); + *rthp = rth->u.dst.rt_next; + rt_free(rth); #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ } spin_unlock(rt_hash_lock_addr(i)); @@ -706,7 +706,7 @@ static void rt_run_flush(unsigned long dummy) spin_unlock_bh(rt_hash_lock_addr(i)); for (; rth; rth = next) { - next = rth->u.rt_next; + next = rth->u.dst.rt_next; rt_free(rth); } } @@ -739,7 +739,7 @@ void rt_cache_flush(int delay) if (user_mode && tmo < ip_rt_max_delay-ip_rt_min_delay) tmo = 0; - + if (delay > tmo) delay = tmo; } @@ -840,7 +840,7 @@ static int rt_garbage_collect(void) while ((rth = *rthp) != NULL) { if (!rt_may_expire(rth, tmo, expire)) { tmo >>= 1; - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.rt_next; continue; } #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED @@ -858,12 +858,12 @@ static int rt_garbage_collect(void) if (!rthp) break; } else { - *rthp = rth->u.rt_next; + *rthp = rth->u.dst.rt_next; rt_free(rth); goal--; } #else /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ - *rthp = rth->u.rt_next; + *rthp = rth->u.dst.rt_next; rt_free(rth); goal--; #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ @@ -947,13 +947,13 @@ restart: if (compare_keys(&rth->fl, &rt->fl)) { #endif /* Put it first */ - *rthp = rth->u.rt_next; + *rthp = rth->u.dst.rt_next; /* * Since lookup is lockfree, the deletion * must be visible to another weakly ordered CPU before * the insertion at the start of the hash chain. */ - rcu_assign_pointer(rth->u.rt_next, + rcu_assign_pointer(rth->u.dst.rt_next, rt_hash_table[hash].chain); /* * Since lookup is lockfree, the update writes @@ -983,7 +983,7 @@ restart: chain_length++; - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.rt_next; } if (cand) { @@ -994,7 +994,7 @@ restart: * only 2 entries per bucket. We will see. */ if (chain_length > ip_rt_gc_elasticity) { - *candp = cand->u.rt_next; + *candp = cand->u.dst.rt_next; rt_free(cand); } } @@ -1034,13 +1034,13 @@ restart: } } - rt->u.rt_next = rt_hash_table[hash].chain; + rt->u.dst.rt_next = rt_hash_table[hash].chain; #if RT_CACHE_DEBUG >= 2 - if (rt->u.rt_next) { + if (rt->u.dst.rt_next) { struct rtable *trt; printk(KERN_DEBUG "rt_cache @%02x: %u.%u.%u.%u", hash, NIPQUAD(rt->rt_dst)); - for (trt = rt->u.rt_next; trt; trt = trt->u.rt_next) + for (trt = rt->u.dst.rt_next; trt; trt = trt->u.dst.rt_next) printk(" . %u.%u.%u.%u", NIPQUAD(trt->rt_dst)); printk("\n"); } @@ -1104,7 +1104,7 @@ void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more) return; } } else - printk(KERN_DEBUG "rt_bind_peer(0) @%p\n", + printk(KERN_DEBUG "rt_bind_peer(0) @%p\n", __builtin_return_address(0)); ip_select_fb_ident(iph); @@ -1117,9 +1117,9 @@ static void rt_del(unsigned hash, struct rtable *rt) spin_lock_bh(rt_hash_lock_addr(hash)); ip_rt_put(rt); for (rthp = &rt_hash_table[hash].chain; *rthp; - rthp = &(*rthp)->u.rt_next) + rthp = &(*rthp)->u.dst.rt_next) if (*rthp == rt) { - *rthp = rt->u.rt_next; + *rthp = rt->u.dst.rt_next; rt_free(rt); break; } @@ -1167,7 +1167,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, rth->fl.fl4_src != skeys[i] || rth->fl.oif != ikeys[k] || rth->fl.iif != 0) { - rthp = &rth->u.rt_next; + rthp = &rth->u.dst.rt_next; continue; } @@ -1190,7 +1190,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, /* Copy all the information. */ *rt = *rth; - INIT_RCU_HEAD(&rt->u.dst.rcu_head); + INIT_RCU_HEAD(&rt->u.dst.rcu_head); rt->u.dst.__use = 1; atomic_set(&rt->u.dst.__refcnt, 1); rt->u.dst.child = NULL; @@ -1225,11 +1225,11 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, rt_drop(rt); goto do_next; } - + netevent.old = &rth->u.dst; netevent.new = &rt->u.dst; - call_netevent_notifiers(NETEVENT_REDIRECT, - &netevent); + call_netevent_notifiers(NETEVENT_REDIRECT, + &netevent); rt_del(hash, rth); if (!rt_intern_hash(hash, rt, &rt)) @@ -1343,7 +1343,7 @@ void ip_rt_send_redirect(struct sk_buff *skb) #endif } out: - in_dev_put(in_dev); + in_dev_put(in_dev); } static int ip_error(struct sk_buff *skb) @@ -1379,7 +1379,7 @@ static int ip_error(struct sk_buff *skb) out: kfree_skb(skb); return 0; -} +} /* * The last two values are not from the RFC but @@ -1392,7 +1392,7 @@ static const unsigned short mtu_plateau[] = static __inline__ unsigned short guess_mtu(unsigned short old_mtu) { int i; - + for (i = 0; i < ARRAY_SIZE(mtu_plateau); i++) if (old_mtu > mtu_plateau[i]) return mtu_plateau[i]; @@ -1416,7 +1416,7 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) rcu_read_lock(); for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; - rth = rcu_dereference(rth->u.rt_next)) { + rth = rcu_dereference(rth->u.dst.rt_next)) { if (rth->fl.fl4_dst == daddr && rth->fl.fl4_src == skeys[i] && rth->rt_dst == daddr && @@ -1436,7 +1436,7 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) mtu = guess_mtu(old_mtu); } if (mtu <= rth->u.dst.metrics[RTAX_MTU-1]) { - if (mtu < rth->u.dst.metrics[RTAX_MTU-1]) { + if (mtu < rth->u.dst.metrics[RTAX_MTU-1]) { dst_confirm(&rth->u.dst); if (mtu < ip_rt_min_pmtu) { mtu = ip_rt_min_pmtu; @@ -1600,7 +1600,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) #endif set_class_tag(rt, itag); #endif - rt->rt_type = res->type; + rt->rt_type = res->type; } static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, @@ -1714,11 +1714,11 @@ static void ip_handle_martian_source(struct net_device *dev, #endif } -static inline int __mkroute_input(struct sk_buff *skb, - struct fib_result* res, - struct in_device *in_dev, +static inline int __mkroute_input(struct sk_buff *skb, + struct fib_result* res, + struct in_device *in_dev, __be32 daddr, __be32 saddr, u32 tos, - struct rtable **result) + struct rtable **result) { struct rtable *rth; @@ -1738,12 +1738,12 @@ static inline int __mkroute_input(struct sk_buff *skb, } - err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(*res), + err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(*res), in_dev->dev, &spec_dst, &itag); if (err < 0) { - ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, + ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, saddr); - + err = -EINVAL; goto cleanup; } @@ -1811,10 +1811,10 @@ static inline int __mkroute_input(struct sk_buff *skb, /* release the working reference to the output device */ in_dev_put(out_dev); return err; -} +} -static inline int ip_mkroute_input_def(struct sk_buff *skb, - struct fib_result* res, +static inline int ip_mkroute_input_def(struct sk_buff *skb, + struct fib_result* res, const struct flowi *fl, struct in_device *in_dev, __be32 daddr, __be32 saddr, u32 tos) @@ -1835,11 +1835,11 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb, /* put it into the cache */ hash = rt_hash(daddr, saddr, fl->iif); - return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); + return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); } -static inline int ip_mkroute_input(struct sk_buff *skb, - struct fib_result* res, +static inline int ip_mkroute_input(struct sk_buff *skb, + struct fib_result* res, const struct flowi *fl, struct in_device *in_dev, __be32 daddr, __be32 saddr, u32 tos) @@ -1859,7 +1859,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, if (hopcount < 2) return ip_mkroute_input_def(skb, res, fl, in_dev, daddr, saddr, tos); - + /* add all alternatives to the routing cache */ for (hop = 0; hop < hopcount; hop++) { res->nh_sel = hop; @@ -1988,7 +1988,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, goto e_nobufs; if (err == -EINVAL) goto e_inval; - + done: in_dev_put(in_dev); if (free_res) @@ -2071,8 +2071,8 @@ martian_destination: #endif e_hostunreach: - err = -EHOSTUNREACH; - goto done; + err = -EHOSTUNREACH; + goto done; e_inval: err = -EINVAL; @@ -2099,7 +2099,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, rcu_read_lock(); for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; - rth = rcu_dereference(rth->u.rt_next)) { + rth = rcu_dereference(rth->u.dst.rt_next)) { if (rth->fl.fl4_dst == daddr && rth->fl.fl4_src == saddr && rth->fl.iif == iif && @@ -2153,11 +2153,11 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, } static inline int __mkroute_output(struct rtable **result, - struct fib_result* res, + struct fib_result* res, const struct flowi *fl, - const struct flowi *oldflp, - struct net_device *dev_out, - unsigned flags) + const struct flowi *oldflp, + struct net_device *dev_out, + unsigned flags) { struct rtable *rth; struct in_device *in_dev; @@ -2190,7 +2190,7 @@ static inline int __mkroute_output(struct rtable **result, } } else if (res->type == RTN_MULTICAST) { flags |= RTCF_MULTICAST|RTCF_LOCAL; - if (!ip_check_mc(in_dev, oldflp->fl4_dst, oldflp->fl4_src, + if (!ip_check_mc(in_dev, oldflp->fl4_dst, oldflp->fl4_src, oldflp->proto)) flags &= ~RTCF_LOCAL; /* If multicast route do not exist use @@ -2208,7 +2208,7 @@ static inline int __mkroute_output(struct rtable **result, if (!rth) { err = -ENOBUFS; goto cleanup; - } + } atomic_set(&rth->u.dst.__refcnt, 1); rth->u.dst.flags= DST_HOST; @@ -2232,7 +2232,7 @@ static inline int __mkroute_output(struct rtable **result, rth->rt_dst = fl->fl4_dst; rth->rt_src = fl->fl4_src; rth->rt_iif = oldflp->oif ? : dev_out->ifindex; - /* get references to the devices that are to be hold by the routing + /* get references to the devices that are to be hold by the routing cache entry */ rth->u.dst.dev = dev_out; dev_hold(dev_out); @@ -2250,7 +2250,7 @@ static inline int __mkroute_output(struct rtable **result, } if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { rth->rt_spec_dst = fl->fl4_src; - if (flags & RTCF_LOCAL && + if (flags & RTCF_LOCAL && !(dev_out->flags & IFF_LOOPBACK)) { rth->u.dst.output = ip_mc_output; RT_CACHE_STAT_INC(out_slow_mc); @@ -2292,7 +2292,7 @@ static inline int ip_mkroute_output_def(struct rtable **rp, hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif); err = rt_intern_hash(hash, rth, rp); } - + return err; } @@ -2563,7 +2563,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp) rcu_read_lock_bh(); for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; - rth = rcu_dereference(rth->u.rt_next)) { + rth = rcu_dereference(rth->u.dst.rt_next)) { if (rth->fl.fl4_dst == flp->fl4_dst && rth->fl.fl4_src == flp->fl4_src && rth->fl.iif == 0 && @@ -2825,12 +2825,12 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) s_idx = 0; rcu_read_lock_bh(); for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; - rt = rcu_dereference(rt->u.rt_next), idx++) { + rt = rcu_dereference(rt->u.dst.rt_next), idx++) { if (idx < s_idx) continue; skb->dst = dst_clone(&rt->u.dst); if (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(); @@ -2863,7 +2863,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write, proc_dointvec(ctl, write, filp, buffer, lenp, ppos); rt_cache_flush(flush_delay); return 0; - } + } return -EINVAL; } @@ -2880,13 +2880,13 @@ static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, if (newlen != sizeof(int)) return -EINVAL; if (get_user(delay, (int __user *)newval)) - return -EFAULT; - rt_cache_flush(delay); + return -EFAULT; + rt_cache_flush(delay); return 0; } ctl_table ipv4_route_table[] = { - { + { .ctl_name = NET_IPV4_ROUTE_FLUSH, .procname = "flush", .data = &flush_delay, @@ -2931,7 +2931,7 @@ ctl_table ipv4_route_table[] = { }, { /* Deprecated. Use gc_min_interval_ms */ - + .ctl_name = NET_IPV4_ROUTE_GC_MIN_INTERVAL, .procname = "gc_min_interval", .data = &ip_rt_gc_min_interval, @@ -3180,8 +3180,8 @@ int __init ip_rt_init(void) { struct proc_dir_entry *rtstat_pde = NULL; /* keep gcc happy */ if (!proc_net_fops_create("rt_cache", S_IRUGO, &rt_cache_seq_fops) || - !(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO, - proc_net_stat))) { + !(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO, + proc_net_stat))) { return -ENOMEM; } rtstat_pde->proc_fops = &rt_cpu_seq_fops; diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 6b19530..33016cc 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c @@ -2,16 +2,16 @@ * Syncookies implementation for the Linux kernel * * Copyright (C) 1997 Andi Kleen - * Based on ideas by D.J.Bernstein and Eric Schenk. + * Based on ideas by D.J.Bernstein and Eric Schenk. * * 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 (at your option) any later version. - * + * * $Id: syncookies.c,v 1.18 2002/02/01 22:01:04 davem Exp $ * - * Missing: IPv6 support. + * Missing: IPv6 support. */ #include <linux/tcp.h> @@ -57,7 +57,7 @@ static __u32 secure_tcp_syn_cookie(__be32 saddr, __be32 daddr, __be16 sport, /* * Compute the secure sequence number. * The output should be: - * HASH(sec1,saddr,sport,daddr,dport,sec1) + sseq + (count * 2^24) + * HASH(sec1,saddr,sport,daddr,dport,sec1) + sseq + (count * 2^24) * + (HASH(sec2,saddr,sport,daddr,dport,count,sec2) % 2^24). * Where sseq is their sequence number and count increases every * minute by 1. @@ -99,17 +99,17 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr, & COOKIEMASK; /* Leaving the data behind */ } -/* +/* * This table has to be sorted and terminated with (__u16)-1. * XXX generate a better table. * Unresolved Issues: HIPPI with a 64k MSS is not well supported. */ static __u16 const msstab[] = { 64 - 1, - 256 - 1, + 256 - 1, 512 - 1, 536 - 1, - 1024 - 1, + 1024 - 1, 1440 - 1, 1460 - 1, 4312 - 1, @@ -128,7 +128,7 @@ __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) int mssind; const __u16 mss = *mssp; - + tp->last_synq_overflow = jiffies; /* XXX sort msstab[] by probability? Binary search? */ @@ -144,23 +144,23 @@ __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) jiffies / (HZ * 60), mssind); } -/* +/* * This (misnamed) value is the age of syncookie which is permitted. * Its ideal value should be dependent on TCP_TIMEOUT_INIT and * sysctl_tcp_retries1. It's a rather complicated formula (exponential * backoff) to compute at runtime so it's currently hardcoded here. */ #define COUNTER_TRIES 4 -/* - * Check if a ack sequence number is a valid syncookie. +/* + * Check if a ack sequence number is a valid syncookie. * Return the decoded mss if it is, or 0 if not. */ static inline int cookie_check(struct sk_buff *skb, __u32 cookie) { - __u32 seq; + __u32 seq; __u32 mssind; - seq = ntohl(skb->h.th->seq)-1; + seq = ntohl(skb->h.th->seq)-1; mssind = check_tcp_syn_cookie(cookie, skb->nh.iph->saddr, skb->nh.iph->daddr, skb->h.th->source, skb->h.th->dest, @@ -191,19 +191,19 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, struct inet_request_sock *ireq; struct tcp_request_sock *treq; struct tcp_sock *tp = tcp_sk(sk); - __u32 cookie = ntohl(skb->h.th->ack_seq) - 1; + __u32 cookie = ntohl(skb->h.th->ack_seq) - 1; struct sock *ret = sk; - struct request_sock *req; - int mss; - struct rtable *rt; + struct request_sock *req; + int mss; + struct rtable *rt; __u8 rcv_wscale; if (!sysctl_tcp_syncookies || !skb->h.th->ack) goto out; - if (time_after(jiffies, tp->last_synq_overflow + TCP_TIMEOUT_INIT) || + if (time_after(jiffies, tp->last_synq_overflow + TCP_TIMEOUT_INIT) || (mss = cookie_check(skb, cookie)) == 0) { - NET_INC_STATS_BH(LINUX_MIB_SYNCOOKIESFAILED); + NET_INC_STATS_BH(LINUX_MIB_SYNCOOKIESFAILED); goto out; } @@ -221,9 +221,9 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, ireq = inet_rsk(req); treq = tcp_rsk(req); treq->rcv_isn = ntohl(skb->h.th->seq) - 1; - treq->snt_isn = cookie; + treq->snt_isn = cookie; req->mss = mss; - ireq->rmt_port = skb->h.th->source; + ireq->rmt_port = skb->h.th->source; ireq->loc_addr = skb->nh.iph->daddr; ireq->rmt_addr = skb->nh.iph->saddr; ireq->opt = NULL; @@ -242,15 +242,15 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, } ireq->snd_wscale = ireq->rcv_wscale = ireq->tstamp_ok = 0; - ireq->wscale_ok = ireq->sack_ok = 0; - req->expires = 0UL; - req->retrans = 0; - + ireq->wscale_ok = ireq->sack_ok = 0; + req->expires = 0UL; + req->retrans = 0; + /* * We need to lookup the route here to get at the correct * window size. We should better make sure that the window size * hasn't changed since we received the original syn, but I see - * no easy way to do this. + * no easy way to do this. */ { struct flowi fl = { .nl_u = { .ip4_u = @@ -266,17 +266,17 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, security_req_classify_flow(req, &fl); if (ip_route_output_key(&rt, &fl)) { reqsk_free(req); - goto out; + goto out; } } /* Try to redo what tcp_v4_send_synack did. */ req->window_clamp = dst_metric(&rt->u.dst, RTAX_WINDOW); tcp_select_initial_window(tcp_full_space(sk), req->mss, - &req->rcv_wnd, &req->window_clamp, + &req->rcv_wnd, &req->window_clamp, 0, &rcv_wscale); /* BTW win scale with syncookies is 0 by definition */ - ireq->rcv_wscale = rcv_wscale; + ireq->rcv_wscale = rcv_wscale; ret = get_cookie_sock(sk, skb, req, &rt->u.dst); out: return ret; diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index fabf69a..0aa3047 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -24,7 +24,7 @@ extern int sysctl_ip_nonlocal_bind; #ifdef CONFIG_SYSCTL static int zero; -static int tcp_retr1_max = 255; +static int tcp_retr1_max = 255; static int ip_local_port_range_min[] = { 1, 1 }; static int ip_local_port_range_max[] = { 65535, 65535 }; #endif @@ -187,7 +187,7 @@ static int strategy_allowed_congestion_control(ctl_table *table, int __user *nam } ctl_table ipv4_table[] = { - { + { .ctl_name = NET_IPV4_TCP_TIMESTAMPS, .procname = "tcp_timestamps", .data = &sysctl_tcp_timestamps, @@ -195,7 +195,7 @@ ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = NET_IPV4_TCP_WINDOW_SCALING, .procname = "tcp_window_scaling", .data = &sysctl_tcp_window_scaling, @@ -203,7 +203,7 @@ ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = NET_IPV4_TCP_SACK, .procname = "tcp_sack", .data = &sysctl_tcp_sack, @@ -211,7 +211,7 @@ ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = NET_IPV4_TCP_RETRANS_COLLAPSE, .procname = "tcp_retrans_collapse", .data = &sysctl_tcp_retrans_collapse, @@ -219,7 +219,7 @@ ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = NET_IPV4_FORWARD, .procname = "ip_forward", .data = &ipv4_devconf.forwarding, @@ -228,16 +228,16 @@ ctl_table ipv4_table[] = { .proc_handler = &ipv4_sysctl_forward, .strategy = &ipv4_sysctl_forward_strategy }, - { + { .ctl_name = NET_IPV4_DEFAULT_TTL, .procname = "ip_default_ttl", - .data = &sysctl_ip_default_ttl, + .data = &sysctl_ip_default_ttl, .maxlen = sizeof(int), .mode = 0644, .proc_handler = &ipv4_doint_and_flush, .strategy = &ipv4_doint_and_flush_strategy, }, - { + { .ctl_name = NET_IPV4_NO_PMTU_DISC, .procname = "ip_no_pmtu_disc", .data = &ipv4_config.no_pmtu_disc, @@ -728,7 +728,7 @@ ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = &proc_dointvec, }, - { + { .ctl_name = NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, .procname = "tcp_workaround_signed_windows", .data = &sysctl_tcp_workaround_signed_windows, diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 5bd43d7..ac6516c 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -475,7 +475,7 @@ static inline void skb_entail(struct sock *sk, struct tcp_sock *tp, if (!sk->sk_send_head) sk->sk_send_head = skb; if (tp->nonagle & TCP_NAGLE_PUSH) - tp->nonagle &= ~TCP_NAGLE_PUSH; + tp->nonagle &= ~TCP_NAGLE_PUSH; } static inline void tcp_mark_urg(struct tcp_sock *tp, int flags, @@ -557,7 +557,7 @@ new_segment: } if (!sk_stream_wmem_schedule(sk, copy)) goto wait_for_memory; - + if (can_coalesce) { skb_shinfo(skb)->frags[i - 1].size += copy; } else { @@ -1439,12 +1439,12 @@ skip_copy: dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); while (dma_async_memcpy_complete(tp->ucopy.dma_chan, - tp->ucopy.dma_cookie, &done, - &used) == DMA_IN_PROGRESS) { + tp->ucopy.dma_cookie, &done, + &used) == DMA_IN_PROGRESS) { /* do partial cleanup of sk_async_wait_queue */ while ((skb = skb_peek(&sk->sk_async_wait_queue)) && (dma_async_is_complete(skb->dma_cookie, done, - used) == DMA_SUCCESS)) { + used) == DMA_SUCCESS)) { __skb_dequeue(&sk->sk_async_wait_queue); kfree_skb(skb); } @@ -2006,7 +2006,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) info->tcpi_options |= TCPI_OPT_WSCALE; info->tcpi_snd_wscale = tp->rx_opt.snd_wscale; info->tcpi_rcv_wscale = tp->rx_opt.rcv_wscale; - } + } if (tp->ecn_flags&TCP_ECN_OK) info->tcpi_options |= TCPI_OPT_ECN; diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 5ca7723..c1b34f1 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c @@ -313,28 +313,28 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 rtt, u32 in_flight, return; /* In "safe" area, increase. */ - if (tp->snd_cwnd <= tp->snd_ssthresh) + if (tp->snd_cwnd <= tp->snd_ssthresh) tcp_slow_start(tp); - /* In dangerous area, increase slowly. */ + /* In dangerous area, increase slowly. */ else if (sysctl_tcp_abc) { - /* RFC3465: Appropriate Byte Count - * increase once for each full cwnd acked - */ - if (tp->bytes_acked >= tp->snd_cwnd*tp->mss_cache) { - tp->bytes_acked -= tp->snd_cwnd*tp->mss_cache; - if (tp->snd_cwnd < tp->snd_cwnd_clamp) - tp->snd_cwnd++; - } - } else { - /* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd */ - if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { - if (tp->snd_cwnd < tp->snd_cwnd_clamp) - tp->snd_cwnd++; - tp->snd_cwnd_cnt = 0; - } else - tp->snd_cwnd_cnt++; - } + /* RFC3465: Appropriate Byte Count + * increase once for each full cwnd acked + */ + if (tp->bytes_acked >= tp->snd_cwnd*tp->mss_cache) { + tp->bytes_acked -= tp->snd_cwnd*tp->mss_cache; + if (tp->snd_cwnd < tp->snd_cwnd_clamp) + tp->snd_cwnd++; + } + } else { + /* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd */ + if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { + if (tp->snd_cwnd < tp->snd_cwnd_clamp) + tp->snd_cwnd++; + tp->snd_cwnd_cnt = 0; + } else + tp->snd_cwnd_cnt++; + } } EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid); diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 6ad1848..5ce6cd8 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c @@ -175,42 +175,42 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) } } - /* cubic function - calc*/ - /* calculate c * time^3 / rtt, - * while considering overflow in calculation of time^3 + /* cubic function - calc*/ + /* calculate c * time^3 / rtt, + * while considering overflow in calculation of time^3 * (so time^3 is done by using 64 bit) * and without the support of division of 64bit numbers * (so all divisions are done by using 32 bit) - * also NOTE the unit of those veriables - * time = (t - K) / 2^bictcp_HZ - * c = bic_scale >> 10 + * also NOTE the unit of those veriables + * time = (t - K) / 2^bictcp_HZ + * c = bic_scale >> 10 * rtt = (srtt >> 3) / HZ * !!! The following code does not have overflow problems, * if the cwnd < 1 million packets !!! - */ + */ /* change the unit from HZ to bictcp_HZ */ - t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start) + t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start) << BICTCP_HZ) / HZ; - if (t < ca->bic_K) /* t - K */ + if (t < ca->bic_K) /* t - K */ offs = ca->bic_K - t; - else - offs = t - ca->bic_K; + else + offs = t - ca->bic_K; /* c/rtt * (t-K)^3 */ delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*BICTCP_HZ); - if (t < ca->bic_K) /* below origin*/ - bic_target = ca->bic_origin_point - delta; - else /* above origin*/ - bic_target = ca->bic_origin_point + delta; + if (t < ca->bic_K) /* below origin*/ + bic_target = ca->bic_origin_point - delta; + else /* above origin*/ + bic_target = ca->bic_origin_point + delta; - /* cubic function - calc bictcp_cnt*/ - if (bic_target > cwnd) { + /* cubic function - calc bictcp_cnt*/ + if (bic_target > cwnd) { ca->cnt = cwnd / (bic_target - cwnd); - } else { - ca->cnt = 100 * cwnd; /* very small increment*/ - } + } else { + ca->cnt = 100 * cwnd; /* very small increment*/ + } if (ca->delay_min > 0) { /* max increment = Smax * rtt / 0.1 */ @@ -219,7 +219,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) ca->cnt = min_cnt; } - /* slow start and low utilization */ + /* slow start and low utilization */ if (ca->loss_cwnd == 0) /* could be aggressive in slow start */ ca->cnt = 50; @@ -227,9 +227,9 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) if (tcp_friendliness) { u32 scale = beta_scale; delta = (cwnd * scale) >> 3; - while (ca->ack_cnt > delta) { /* update tcp cwnd */ - ca->ack_cnt -= delta; - ca->tcp_cwnd++; + while (ca->ack_cnt > delta) { /* update tcp cwnd */ + ca->ack_cnt -= delta; + ca->tcp_cwnd++; } if (ca->tcp_cwnd > cwnd){ /* if bic is slower than tcp */ @@ -238,7 +238,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) if (ca->cnt > max_cnt) ca->cnt = max_cnt; } - } + } ca->cnt = (ca->cnt << ACK_RATIO_SHIFT) / ca->delayed_ack; if (ca->cnt == 0) /* cannot be zero */ diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c index c4fc811..a291097 100644 --- a/net/ipv4/tcp_highspeed.c +++ b/net/ipv4/tcp_highspeed.c @@ -14,8 +14,8 @@ * with fixed-point MD scaled <<8. */ static const struct hstcp_aimd_val { - unsigned int cwnd; - unsigned int md; + unsigned int cwnd; + unsigned int md; } hstcp_aimd_vals[] = { { 38, 128, /* 0.50 */ }, { 118, 112, /* 0.44 */ }, diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c index 753987a..63318b6 100644 --- a/net/ipv4/tcp_htcp.c +++ b/net/ipv4/tcp_htcp.c @@ -224,7 +224,7 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack, u32 rtt, if (!tcp_is_cwnd_limited(sk, in_flight)) return; - if (tp->snd_cwnd <= tp->snd_ssthresh) + if (tp->snd_cwnd <= tp->snd_ssthresh) tcp_slow_start(tp); else { diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index c610989..1a14191 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -50,9 +50,9 @@ * Andi Kleen: Make sure we never ack data there is not * enough room for. Also make this condition * a fatal error if it might still happen. - * Andi Kleen: Add tcp_measure_rcv_mss to make + * Andi Kleen: Add tcp_measure_rcv_mss to make * connections with MSS<min(MTU,ann. MSS) - * work without delayed acks. + * work without delayed acks. * Andi Kleen: Process packets with PSH set in the * fast path. * J Hadi Salim: ECN support @@ -112,17 +112,17 @@ int sysctl_tcp_abc __read_mostly; #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH) -/* Adapt the MSS value used to make delayed ack decision to the +/* Adapt the MSS value used to make delayed ack decision to the * real world. - */ + */ static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb) { struct inet_connection_sock *icsk = inet_csk(sk); - const unsigned int lss = icsk->icsk_ack.last_seg_size; + const unsigned int lss = icsk->icsk_ack.last_seg_size; unsigned int len; - icsk->icsk_ack.last_seg_size = 0; + icsk->icsk_ack.last_seg_size = 0; /* skb->len may jitter because of SACKs, even if peer * sends good full-sized frames. @@ -440,15 +440,15 @@ void tcp_rcv_space_adjust(struct sock *sk) struct tcp_sock *tp = tcp_sk(sk); int time; int space; - + if (tp->rcvq_space.time == 0) goto new_measure; - + time = tcp_time_stamp - tp->rcvq_space.time; if (time < (tp->rcv_rtt_est.rtt >> 3) || tp->rcv_rtt_est.rtt == 0) return; - + space = 2 * (tp->copied_seq - tp->rcvq_space.seq); space = max(tp->rcvq_space.space, space); @@ -483,7 +483,7 @@ void tcp_rcv_space_adjust(struct sock *sk) } } } - + new_measure: tp->rcvq_space.seq = tp->copied_seq; tp->rcvq_space.time = tcp_time_stamp; @@ -509,7 +509,7 @@ static void tcp_event_data_recv(struct sock *sk, struct tcp_sock *tp, struct sk_ tcp_measure_rcv_mss(sk, skb); tcp_rcv_rtt_measure(tp); - + now = tcp_time_stamp; if (!icsk->icsk_ack.ato) { @@ -561,7 +561,7 @@ static void tcp_rtt_estimator(struct sock *sk, const __u32 mrtt) /* The following amusing code comes from Jacobson's * article in SIGCOMM '88. Note that rtt and mdev * are scaled versions of rtt and mean deviation. - * This is designed to be as fast as possible + * This is designed to be as fast as possible * m stands for "measurement". * * On a 1990 paper the rto value is changed to: @@ -1249,8 +1249,8 @@ void tcp_enter_frto(struct sock *sk) tp->frto_counter = 1; if (icsk->icsk_ca_state <= TCP_CA_Disorder || - tp->snd_una == tp->high_seq || - (icsk->icsk_ca_state == TCP_CA_Loss && !icsk->icsk_retransmits)) { + tp->snd_una == tp->high_seq || + (icsk->icsk_ca_state == TCP_CA_Loss && !icsk->icsk_retransmits)) { tp->prior_ssthresh = tcp_current_ssthresh(sk); tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk); tcp_ca_event(sk, CA_EVENT_FRTO); @@ -1969,11 +1969,11 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, * 1. Reno does not count dupacks (sacked_out) automatically. */ if (!tp->packets_out) tp->sacked_out = 0; - /* 2. SACK counts snd_fack in packets inaccurately. */ + /* 2. SACK counts snd_fack in packets inaccurately. */ if (tp->sacked_out == 0) tp->fackets_out = 0; - /* Now state machine starts. + /* Now state machine starts. * A. ECE, hence prohibit cwnd undoing, the reduction is required. */ if (flag&FLAG_ECE) tp->prior_ssthresh = 0; @@ -2203,7 +2203,7 @@ static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, __u32 now, __s32 *seq_rtt) { struct tcp_sock *tp = tcp_sk(sk); - struct tcp_skb_cb *scb = TCP_SKB_CB(skb); + struct tcp_skb_cb *scb = TCP_SKB_CB(skb); __u32 seq = tp->snd_una; __u32 packets_acked; int acked = 0; @@ -2279,7 +2279,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) while ((skb = skb_peek(&sk->sk_write_queue)) && skb != sk->sk_send_head) { - struct tcp_skb_cb *scb = TCP_SKB_CB(skb); + struct tcp_skb_cb *scb = TCP_SKB_CB(skb); __u8 sacked = scb->sacked; /* If our packet is before the ack sequence we can @@ -2470,9 +2470,9 @@ static int tcp_ack_update_window(struct sock *sk, struct tcp_sock *tp, static void tcp_process_frto(struct sock *sk, u32 prior_snd_una) { struct tcp_sock *tp = tcp_sk(sk); - + tcp_sync_left_out(tp); - + if (tp->snd_una == prior_snd_una || !before(tp->snd_una, tp->frto_highmark)) { /* RTO was caused by loss, start retransmitting in @@ -2627,7 +2627,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, opt_rx->saw_tstamp = 0; while(length>0) { - int opcode=*ptr++; + int opcode=*ptr++; int opsize; switch (opcode) { @@ -2642,7 +2642,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, return; if (opsize > length) return; /* don't parse partial options */ - switch(opcode) { + switch(opcode) { case TCPOPT_MSS: if(opsize==TCPOLEN_MSS && th->syn && !estab) { u16 in_mss = ntohs(get_unaligned((__be16 *)ptr)); @@ -2701,10 +2701,10 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, */ break; #endif - }; - ptr+=opsize-2; - length-=opsize; - }; + }; + ptr+=opsize-2; + length-=opsize; + }; } } @@ -3263,7 +3263,7 @@ drop: TCP_SKB_CB(skb)->end_seq); tcp_dsack_set(tp, TCP_SKB_CB(skb)->seq, tp->rcv_nxt); - + /* If window is closed, drop tail of packet. But after * remembering D-SACK for its head made in previous line. */ @@ -3342,7 +3342,7 @@ drop: } } __skb_insert(skb, skb1, skb1->next, &tp->out_of_order_queue); - + /* And clean segments covered by new one as whole. */ while ((skb1 = skb->next) != (struct sk_buff*)&tp->out_of_order_queue && @@ -3507,7 +3507,7 @@ static void tcp_collapse_ofo_queue(struct sock *sk) */ static int tcp_prune_queue(struct sock *sk) { - struct tcp_sock *tp = tcp_sk(sk); + struct tcp_sock *tp = tcp_sk(sk); SOCK_DEBUG(sk, "prune_queue: c=%x\n", tp->copied_seq); @@ -3617,7 +3617,7 @@ static void tcp_new_space(struct sock *sk) struct tcp_sock *tp = tcp_sk(sk); if (tcp_should_expand_sndbuf(sk, tp)) { - int sndmem = max_t(u32, tp->rx_opt.mss_clamp, tp->mss_cache) + + int sndmem = max_t(u32, tp->rx_opt.mss_clamp, tp->mss_cache) + MAX_TCP_HEADER + 16 + sizeof(struct sk_buff), demanded = max_t(unsigned int, tp->snd_cwnd, tp->reordering + 1); @@ -3690,7 +3690,7 @@ static inline void tcp_ack_snd_check(struct sock *sk) * For 1003.1g we should support a new option TCP_STDURG to permit * either form (or just set the sysctl tcp_stdurg). */ - + static void tcp_check_urg(struct sock * sk, struct tcphdr * th) { struct tcp_sock *tp = tcp_sk(sk); @@ -3771,7 +3771,7 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th) u32 ptr = tp->urg_seq - ntohl(th->seq) + (th->doff * 4) - th->syn; - /* Is the urgent pointer pointing into this packet? */ + /* Is the urgent pointer pointing into this packet? */ if (ptr < skb->len) { u8 tmp; if (skb_copy_bits(skb, ptr, &tmp, 1)) @@ -3835,7 +3835,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb, int hlen int copied_early = 0; if (tp->ucopy.wakeup) - return 0; + return 0; if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) tp->ucopy.dma_chan = get_softnet_dma(); @@ -3871,26 +3871,26 @@ out: #endif /* CONFIG_NET_DMA */ /* - * TCP receive function for the ESTABLISHED state. + * TCP receive function for the ESTABLISHED state. * - * It is split into a fast path and a slow path. The fast path is + * It is split into a fast path and a slow path. The fast path is * disabled when: * - A zero window was announced from us - zero window probing - * is only handled properly in the slow path. + * is only handled properly in the slow path. * - Out of order segments arrived. * - Urgent data is expected. * - There is no buffer space left * - Unexpected TCP flags/window values/header lengths are received - * (detected by checking the TCP header against pred_flags) + * (detected by checking the TCP header against pred_flags) * - Data is sent in both directions. Fast path only supports pure senders * or pure receivers (this means either the sequence number or the ack * value must stay constant) * - Unexpected TCP option. * - * When these conditions are not satisfied it drops into a standard + * When these conditions are not satisfied it drops into a standard * receive procedure patterned after RFC793 to handle all cases. * The first three cases are guaranteed by proper pred_flags setting, - * the rest is checked inline. Fast processing is turned on in + * the rest is checked inline. Fast processing is turned on in * tcp_data_queue when everything is OK. */ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, @@ -3900,15 +3900,15 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, /* * Header prediction. - * The code loosely follows the one in the famous + * The code loosely follows the one in the famous * "30 instruction TCP receive" Van Jacobson mail. - * - * Van's trick is to deposit buffers into socket queue + * + * Van's trick is to deposit buffers into socket queue * on a device interrupt, to call tcp_recv function * on the receive process context and checksum and copy * the buffer to user space. smart... * - * Our current scheme is not silly either but we take the + * Our current scheme is not silly either but we take the * extra cost of the net_bh soft interrupt processing... * We do checksum and copy also but from device to kernel. */ @@ -3919,7 +3919,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, * if header_prediction is to be made * 'S' will always be tp->tcp_header_len >> 2 * '?' will be 0 for the fast path, otherwise pred_flags is 0 to - * turn it off (when there are holes in the receive + * turn it off (when there are holes in the receive * space for instance) * PSH flag is ignored. */ @@ -3943,7 +3943,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, goto slow_path; tp->rx_opt.saw_tstamp = 1; - ++ptr; + ++ptr; tp->rx_opt.rcv_tsval = ntohl(*ptr); ++ptr; tp->rx_opt.rcv_tsecr = ntohl(*ptr); @@ -3975,7 +3975,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, * on entry. */ tcp_ack(sk, skb, 0); - __kfree_skb(skb); + __kfree_skb(skb); tcp_data_snd_check(sk, tp); return 0; } else { /* Header too small */ @@ -4393,11 +4393,11 @@ reset_and_undo: /* * This function implements the receiving procedure of RFC 793 for - * all states except ESTABLISHED and TIME_WAIT. + * all states except ESTABLISHED and TIME_WAIT. * It's called from both tcp_v4_rcv and tcp_v6_rcv and should be * address independent. */ - + int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, struct tcphdr *th, unsigned len) { @@ -4422,19 +4422,19 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, if (icsk->icsk_af_ops->conn_request(sk, skb) < 0) return 1; - /* Now we have several options: In theory there is - * nothing else in the frame. KA9Q has an option to + /* Now we have several options: In theory there is + * nothing else in the frame. KA9Q has an option to * send data with the syn, BSD accepts data with the - * syn up to the [to be] advertised window and - * Solaris 2.1 gives you a protocol error. For now - * we just ignore it, that fits the spec precisely + * syn up to the [to be] advertised window and + * Solaris 2.1 gives you a protocol error. For now + * we just ignore it, that fits the spec precisely * and avoids incompatibilities. It would be nice in * future to drop through and process the data. * - * Now that TTCP is starting to be used we ought to + * Now that TTCP is starting to be used we ought to * queue this data. * But, this leaves one open to an easy denial of - * service attack, and SYN cookies can't defend + * service attack, and SYN cookies can't defend * against this problem. So, we drop the data * in the interest of security over speed unless * it's still in use. @@ -4624,7 +4624,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, case TCP_FIN_WAIT1: case TCP_FIN_WAIT2: /* RFC 793 says to queue data in these states, - * RFC 1122 says we MUST send a reset. + * RFC 1122 says we MUST send a reset. * BSD 4.4 also does reset. */ if (sk->sk_shutdown & RCV_SHUTDOWN) { @@ -4636,7 +4636,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, } } /* Fall through */ - case TCP_ESTABLISHED: + case TCP_ESTABLISHED: tcp_data_queue(sk, skb); queued = 1; break; @@ -4648,7 +4648,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, tcp_ack_snd_check(sk); } - if (!queued) { + if (!queued) { discard: __kfree_skb(skb); } diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f51d640..0ba74bb 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -303,7 +303,7 @@ static void do_pmtu_discovery(struct sock *sk, struct iphdr *iph, u32 mtu) /* We don't check in the destentry if pmtu discovery is forbidden * on this route. We just assume that no packet_to_big packets * are send back when pmtu discovery is not active. - * There is a small race when the user changes this flag in the + * There is a small race when the user changes this flag in the * route, but I think that's acceptable. */ if ((dst = __sk_dst_check(sk, 0)) == NULL) @@ -880,7 +880,7 @@ int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, if (md5sig->alloced4 == md5sig->entries4) { keys = kmalloc((sizeof(*keys) * - (md5sig->entries4 + 1)), GFP_ATOMIC); + (md5sig->entries4 + 1)), GFP_ATOMIC); if (!keys) { kfree(newkey); tcp_free_md5sig_pool(); @@ -934,7 +934,7 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr) memcpy(&tp->md5sig_info->keys4[i], &tp->md5sig_info->keys4[i+1], (tp->md5sig_info->entries4 - i) * - sizeof(struct tcp4_md5sig_key)); + sizeof(struct tcp4_md5sig_key)); } tcp_free_md5sig_pool(); return 0; @@ -1388,7 +1388,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) goto drop_and_free; if (want_cookie) { - reqsk_free(req); + reqsk_free(req); } else { inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT); } @@ -1704,7 +1704,7 @@ bad_packet: discard_it: /* Discard frame. */ kfree_skb(skb); - return 0; + return 0; discard_and_relse: sock_put(sk); @@ -1890,10 +1890,10 @@ int tcp_v4_destroy_sock(struct sock *sk) tcp_cleanup_congestion_control(sk); /* Cleanup up the write buffer. */ - sk_stream_writequeue_purge(sk); + sk_stream_writequeue_purge(sk); /* Cleans up our, hopefully empty, out_of_order_queue. */ - __skb_queue_purge(&tp->out_of_order_queue); + __skb_queue_purge(&tp->out_of_order_queue); #ifdef CONFIG_TCP_MD5SIG /* Clean up the MD5 key list, if any */ @@ -1906,7 +1906,7 @@ int tcp_v4_destroy_sock(struct sock *sk) #ifdef CONFIG_NET_DMA /* Cleans up our sk_async_wait_queue */ - __skb_queue_purge(&sk->sk_async_wait_queue); + __skb_queue_purge(&sk->sk_async_wait_queue); #endif /* Clean prequeue, it must be empty really */ @@ -1983,7 +1983,7 @@ get_req: st->state = TCP_SEQ_STATE_LISTENING; read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); } else { - icsk = inet_csk(sk); + icsk = inet_csk(sk); read_lock_bh(&icsk->icsk_accept_queue.syn_wait_lock); if (reqsk_queue_len(&icsk->icsk_accept_queue)) goto start_req; @@ -1996,7 +1996,7 @@ get_sk: cur = sk; goto out; } - icsk = inet_csk(sk); + icsk = inet_csk(sk); read_lock_bh(&icsk->icsk_accept_queue.syn_wait_lock); if (reqsk_queue_len(&icsk->icsk_accept_queue)) { start_req: diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 4a3889d..30b1e52 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -64,7 +64,7 @@ static __inline__ int tcp_in_window(u32 seq, u32 end_seq, u32 s_win, u32 e_win) return (seq == e_win && seq == end_seq); } -/* +/* * * Main purpose of TIME-WAIT state is to close connection gracefully, * when one of ends sits in LAST-ACK or CLOSING retransmitting FIN * (and, probably, tail of data) and one or more our ACKs are lost. @@ -176,13 +176,13 @@ kill_with_rst: * "When a connection is [...] on TIME-WAIT state [...] * [a TCP] MAY accept a new SYN from the remote TCP to * reopen the connection directly, if it: - * + * * (1) assigns its initial sequence number for the new * connection to be larger than the largest sequence * number it used on the previous connection incarnation, * and * - * (2) returns to TIME-WAIT state if the SYN turns out + * (2) returns to TIME-WAIT state if the SYN turns out * to be an old duplicate". */ @@ -266,9 +266,9 @@ kill: return TCP_TW_SUCCESS; } -/* +/* * Move a socket to time-wait or dead fin-wait-2 state. - */ + */ void tcp_time_wait(struct sock *sk, int state, int timeo) { struct inet_timewait_sock *tw = NULL; @@ -481,7 +481,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, return newsk; } -/* +/* * Process an incoming packet for SYN_RECV sockets represented * as a request_sock. */ diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 58b7111..cebe9aa 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -198,7 +198,7 @@ void tcp_select_initial_window(int __space, __u32 mss, (*rcv_wscale) = 0; if (wscale_ok) { /* Set window scaling on max possible window - * See RFC1323 for an explanation of the limit to 14 + * See RFC1323 for an explanation of the limit to 14 */ space = max_t(u32, sysctl_tcp_rmem[2], sysctl_rmem_max); space = min_t(u32, space, *window_clamp); @@ -451,7 +451,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK)); } - + if (tcp_packets_in_flight(tp) == 0) tcp_ca_event(sk, CA_EVENT_TX_START); @@ -555,7 +555,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, } -/* This routine just queue's the buffer +/* This routine just queue's the buffer * * NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames, * otherwise socket can stall. @@ -597,7 +597,7 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned /* Function to create two new TCP segments. Shrinks the given segment * to the specified size and appends a new segment with the rest of the - * packet to the list. This won't be called frequently, I hope. + * packet to the list. This won't be called frequently, I hope. * Remember, these are still headerless SKBs at this point. */ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss_now) @@ -610,7 +610,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss BUG_ON(len > skb->len); - clear_all_retrans_hints(tp); + clear_all_retrans_hints(tp); nsize = skb_headlen(skb) - len; if (nsize < 0) nsize = 0; @@ -821,7 +821,7 @@ void tcp_mtup_init(struct sock *sk) icsk->icsk_mtup.enabled = sysctl_tcp_mtu_probing > 1; icsk->icsk_mtup.search_high = tp->rx_opt.mss_clamp + sizeof(struct tcphdr) + - icsk->icsk_af_ops->net_header_len; + icsk->icsk_af_ops->net_header_len; icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, sysctl_tcp_base_mss); icsk->icsk_mtup.probe_size = 0; } @@ -1008,7 +1008,7 @@ static inline int tcp_minshall_check(const struct tcp_sock *tp) */ static inline int tcp_nagle_check(const struct tcp_sock *tp, - const struct sk_buff *skb, + const struct sk_buff *skb, unsigned mss_now, int nonagle) { return (skb->len < mss_now && @@ -1078,7 +1078,7 @@ static unsigned int tcp_snd_test(struct sock *sk, struct sk_buff *skb, return cwnd_quota; } -static inline int tcp_skb_is_last(const struct sock *sk, +static inline int tcp_skb_is_last(const struct sock *sk, const struct sk_buff *skb) { return skb->next == (struct sk_buff *)&sk->sk_write_queue; @@ -1298,7 +1298,7 @@ static int tcp_mtu_probe(struct sock *sk) skb_copy_bits(skb, 0, skb_put(nskb, copy), copy); else nskb->csum = skb_copy_and_csum_bits(skb, 0, - skb_put(nskb, copy), copy, nskb->csum); + skb_put(nskb, copy), copy, nskb->csum); if (skb->len <= copy) { /* We've eaten all the data from this skb. @@ -1308,7 +1308,7 @@ static int tcp_mtu_probe(struct sock *sk) sk_stream_free_skb(sk, skb); } else { TCP_SKB_CB(nskb)->flags |= TCP_SKB_CB(skb)->flags & - ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH); + ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH); if (!skb_shinfo(skb)->nr_frags) { skb_pull(skb, copy); if (skb->ip_summed != CHECKSUM_PARTIAL) @@ -1501,7 +1501,7 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now) /* This function returns the amount that we can raise the * usable window based on the following constraints - * + * * 1. The window can never be shrunk once it is offered (RFC 793) * 2. We limit memory per socket * @@ -1520,12 +1520,12 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now) * side SWS prevention criteria. The problem is that under this rule * a stream of single byte packets will cause the right side of the * window to always advance by a single byte. - * + * * Of course, if the sender implements sender side SWS prevention * then this will not be a problem. - * + * * BSD seems to make the following compromise: - * + * * If the free space is less than the 1/4 of the maximum * space available and the free space is less than 1/2 mss, * then set the window to 0. @@ -1567,7 +1567,7 @@ u32 __tcp_select_window(struct sock *sk) int window; if (mss > full_space) - mss = full_space; + mss = full_space; if (free_space < full_space/2) { icsk->icsk_ack.quick = 0; @@ -1691,9 +1691,9 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m } /* Do a simple retransmit without using the backoff mechanisms in - * tcp_timer. This is used for path mtu discovery. + * tcp_timer. This is used for path mtu discovery. * The socket is already locked here. - */ + */ void tcp_simple_retransmit(struct sock *sk) { const struct inet_connection_sock *icsk = inet_csk(sk); @@ -1703,7 +1703,7 @@ void tcp_simple_retransmit(struct sock *sk) int lost = 0; sk_stream_for_retrans_queue(skb, sk) { - if (skb->len > mss && + if (skb->len > mss && !(TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_ACKED)) { if (TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_RETRANS) { TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; @@ -1724,7 +1724,7 @@ void tcp_simple_retransmit(struct sock *sk) tcp_sync_left_out(tp); - /* Don't muck with the congestion window here. + /* Don't muck with the congestion window here. * Reason is that we do not increase amount of _data_ * in network, but units changed and effective * cwnd/ssthresh really reduced now. @@ -1747,7 +1747,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); struct inet_connection_sock *icsk = inet_csk(sk); - unsigned int cur_mss = tcp_current_mss(sk, 0); + unsigned int cur_mss = tcp_current_mss(sk, 0); int err; /* Inconslusive MTU probe */ @@ -1984,10 +1984,10 @@ void tcp_xmit_retransmit_queue(struct sock *sk) */ void tcp_send_fin(struct sock *sk) { - struct tcp_sock *tp = tcp_sk(sk); + struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *skb = skb_peek_tail(&sk->sk_write_queue); int mss_now; - + /* Optimization, tack on the FIN if we have a queue of * unsent frames. But be careful about outgoing SACKS * and IP options. @@ -2146,17 +2146,17 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, th->seq = htonl(TCP_SKB_CB(skb)->seq); th->ack_seq = htonl(tcp_rsk(req)->rcv_isn + 1); if (req->rcv_wnd == 0) { /* ignored for retransmitted syns */ - __u8 rcv_wscale; + __u8 rcv_wscale; /* Set this up on the first call only */ req->window_clamp = tp->window_clamp ? : dst_metric(dst, RTAX_WINDOW); /* tcp_full_space because it is guaranteed to be the first packet */ - tcp_select_initial_window(tcp_full_space(sk), + tcp_select_initial_window(tcp_full_space(sk), dst_metric(dst, RTAX_ADVMSS) - (ireq->tstamp_ok ? TCPOLEN_TSTAMP_ALIGNED : 0), &req->rcv_wnd, &req->window_clamp, ireq->wscale_ok, &rcv_wscale); - ireq->rcv_wscale = rcv_wscale; + ireq->rcv_wscale = rcv_wscale; } /* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */ @@ -2192,9 +2192,9 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, return skb; } -/* +/* * Do all connect socket setups that can be done AF independent. - */ + */ static void tcp_connect_init(struct sock *sk) { struct dst_entry *dst = __sk_dst_get(sk); @@ -2251,7 +2251,7 @@ static void tcp_connect_init(struct sock *sk) /* * Build a SYN and send it off. - */ + */ int tcp_connect(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); @@ -2409,7 +2409,7 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent) /* We don't queue it, tcp_transmit_skb() sets ownership. */ skb = alloc_skb(MAX_TCP_HEADER, GFP_ATOMIC); - if (skb == NULL) + if (skb == NULL) return -1; /* Reserve space for headers and set control bits. */ @@ -2498,7 +2498,7 @@ void tcp_send_probe0(struct sock *sk) if (icsk->icsk_backoff < sysctl_tcp_retries2) icsk->icsk_backoff++; icsk->icsk_probes_out++; - inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, + inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, min(icsk->icsk_rto << icsk->icsk_backoff, TCP_RTO_MAX), TCP_RTO_MAX); } else { @@ -2510,7 +2510,7 @@ void tcp_send_probe0(struct sock *sk) */ if (!icsk->icsk_probes_out) icsk->icsk_probes_out = 1; - inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, + inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, min(icsk->icsk_rto << icsk->icsk_backoff, TCP_RESOURCE_PROBE_INTERVAL), TCP_RTO_MAX); diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 3355c276..a9243cf 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -69,7 +69,7 @@ static int tcp_out_of_resources(struct sock *sk, int do_reset) struct tcp_sock *tp = tcp_sk(sk); int orphans = atomic_read(&tcp_orphan_count); - /* If peer does not open window for long time, or did not transmit + /* If peer does not open window for long time, or did not transmit * anything for long time, penalize it. */ if ((s32)(tcp_time_stamp - tp->lsndtime) > 2*TCP_RTO_MAX || !do_reset) orphans <<= 1; @@ -137,7 +137,7 @@ static int tcp_write_timeout(struct sock *sk) tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); } else { mss = min(sysctl_tcp_base_mss, - tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_low)/2); + tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_low)/2); mss = max(mss, 68 - tp->tcp_header_len); icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, mss); tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); @@ -150,7 +150,7 @@ static int tcp_write_timeout(struct sock *sk) retry_until = sysctl_tcp_retries2; if (sock_flag(sk, SOCK_DEAD)) { const int alive = (icsk->icsk_rto < TCP_RTO_MAX); - + retry_until = tcp_orphan_retries(sk, alive); if (tcp_out_of_resources(sk, alive || icsk->icsk_retransmits < retry_until)) @@ -257,7 +257,7 @@ static void tcp_probe_timer(struct sock *sk) if (sock_flag(sk, SOCK_DEAD)) { const int alive = ((icsk->icsk_rto << icsk->icsk_backoff) < TCP_RTO_MAX); - + max_probes = tcp_orphan_retries(sk, alive); if (tcp_out_of_resources(sk, alive || icsk->icsk_probes_out <= max_probes)) @@ -453,7 +453,7 @@ static void tcp_keepalive_timer (unsigned long data) /* Only process if socket is not in use. */ bh_lock_sock(sk); if (sock_owned_by_user(sk)) { - /* Try again later. */ + /* Try again later. */ inet_csk_reset_keepalive_timer (sk, HZ/20); goto out; } @@ -515,7 +515,7 @@ resched: inet_csk_reset_keepalive_timer (sk, elapsed); goto out; -death: +death: tcp_done(sk); out: diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c index ddc4bcc..5c484dc 100644 --- a/net/ipv4/tcp_vegas.c +++ b/net/ipv4/tcp_vegas.c @@ -330,9 +330,9 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, vegas->minRTT = 0x7fffffff; } /* Use normal slow start */ - else if (tp->snd_cwnd <= tp->snd_ssthresh) + else if (tp->snd_cwnd <= tp->snd_ssthresh) tcp_slow_start(tp); - + } /* Extract info for Tcp socket info provided via netlink. */ diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c index 4f42a86..4e1b610 100644 --- a/net/ipv4/tcp_westwood.c +++ b/net/ipv4/tcp_westwood.c @@ -63,10 +63,10 @@ static void tcp_westwood_init(struct sock *sk) struct westwood *w = inet_csk_ca(sk); w->bk = 0; - w->bw_ns_est = 0; - w->bw_est = 0; - w->accounted = 0; - w->cumul_ack = 0; + w->bw_ns_est = 0; + w->bw_est = 0; + w->accounted = 0; + w->cumul_ack = 0; w->reset_rtt_min = 1; w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT; w->rtt_win_sx = tcp_time_stamp; @@ -121,7 +121,7 @@ static void westwood_update_window(struct sock *sk) * to fix mismatch between tp->snd_una and w->snd_una for the first * bandwidth sample */ - if (w->first_ack) { + if (w->first_ack) { w->snd_una = tcp_sk(sk)->snd_una; w->first_ack = 0; } @@ -147,7 +147,7 @@ static inline void update_rtt_min(struct westwood *w) { if (w->reset_rtt_min) { w->rtt_min = w->rtt; - w->reset_rtt_min = 0; + w->reset_rtt_min = 0; } else w->rtt_min = min(w->rtt, w->rtt_min); } @@ -183,15 +183,15 @@ static inline u32 westwood_acked_count(struct sock *sk) w->cumul_ack = tp->snd_una - w->snd_una; - /* If cumul_ack is 0 this is a dupack since it's not moving - * tp->snd_una. - */ - if (!w->cumul_ack) { + /* If cumul_ack is 0 this is a dupack since it's not moving + * tp->snd_una. + */ + if (!w->cumul_ack) { w->accounted += tp->mss_cache; w->cumul_ack = tp->mss_cache; } - if (w->cumul_ack > tp->mss_cache) { + if (w->cumul_ack > tp->mss_cache) { /* Partial or delayed ack */ if (w->accounted >= w->cumul_ack) { w->accounted -= w->cumul_ack; @@ -237,7 +237,7 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) case CA_EVENT_FRTO: tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk); - /* Update RTT_min when next ack arrives */ + /* Update RTT_min when next ack arrives */ w->reset_rtt_min = 1; break; diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 8b54c68..ce6c460 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -20,8 +20,8 @@ * for udp at least is 'valid'. * Alan Cox : Fixed icmp handling properly * Alan Cox : Correct error for oversized datagrams - * Alan Cox : Tidied select() semantics. - * Alan Cox : udp_err() fixed properly, also now + * Alan Cox : Tidied select() semantics. + * Alan Cox : udp_err() fixed properly, also now * select and read wake correctly on errors * Alan Cox : udp_send verify_area moved to avoid mem leak * Alan Cox : UDP can count its memory @@ -56,7 +56,7 @@ * does have a high hit rate. * Olaf Kirch : Don't linearise iovec on sendmsg. * Andi Kleen : Some cleanups, cache destination entry - * for connect. + * for connect. * Vitaly E. Lavrov : Transparent proxy revived after year coma. * Melvin Smith : Check msg_name not msg_namelen in sendto(), * return ENOTCONN for unconnected sockets (POSIX) @@ -77,7 +77,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ - + #include <asm/system.h> #include <asm/uaccess.h> #include <asm/ioctls.h> @@ -120,7 +120,7 @@ static inline int __udp_lib_lport_inuse(__u16 num, struct hlist_head udptable[]) struct hlist_node *node; sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)]) - if (inet_sk(sk)->num == num) + if (sk->sk_hash == num) return 1; return 0; } @@ -191,7 +191,7 @@ gotit: head = &udptable[snum & (UDP_HTABLE_SIZE - 1)]; sk_for_each(sk2, node, head) - if (inet_sk(sk2)->num == snum && + if (sk2->sk_hash == snum && sk2 != sk && (!sk2->sk_reuse || !sk->sk_reuse) && (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if @@ -200,6 +200,7 @@ gotit: goto fail; } inet_sk(sk)->num = snum; + sk->sk_hash = snum; if (sk_unhashed(sk)) { head = &udptable[snum & (UDP_HTABLE_SIZE - 1)]; sk_add_node(sk, head); @@ -247,7 +248,7 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport, sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { struct inet_sock *inet = inet_sk(sk); - if (inet->num == hnum && !ipv6_only_sock(sk)) { + if (sk->sk_hash == hnum && !ipv6_only_sock(sk)) { int score = (sk->sk_family == PF_INET ? 1 : 0); if (inet->rcv_saddr) { if (inet->rcv_saddr != daddr) @@ -296,7 +297,7 @@ static inline struct sock *udp_v4_mcast_next(struct sock *sk, sk_for_each_from(s, node) { struct inet_sock *inet = inet_sk(s); - if (inet->num != hnum || + if (s->sk_hash != hnum || (inet->daddr && inet->daddr != rmt_addr) || (inet->dport != rmt_port && inet->dport) || (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || @@ -306,17 +307,17 @@ static inline struct sock *udp_v4_mcast_next(struct sock *sk, if (!ip_mc_sf_allow(s, loc_addr, rmt_addr, dif)) continue; goto found; - } + } s = NULL; found: - return s; + return s; } /* * This routine is called by the ICMP module when it gets some * sort of error condition. If err < 0 then the socket should * be closed and the error returned to the user. If err > 0 - * it's just the icmp type << 8 | icmp code. + * it's just the icmp type << 8 | icmp code. * Header points to the ip header of the error packet. We move * on past this. Then (as it used to claim before adjustment) * header points to the first 8 bytes of the udp header. We need @@ -338,7 +339,7 @@ void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[]) skb->dev->ifindex, udptable ); if (sk == NULL) { ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); - return; /* No socket for error */ + return; /* No socket for error */ } err = 0; @@ -374,7 +375,7 @@ void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[]) } /* - * RFC1122: OK. Passes ICMP errors back to application, as per + * RFC1122: OK. Passes ICMP errors back to application, as per * 4.1.3.3. */ if (!inet->recverr) { @@ -524,7 +525,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, if (len > 0xFFFF) return -EMSGSIZE; - /* + /* * Check the flags. */ @@ -536,7 +537,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, if (up->pending) { /* * There are pending frames. - * The socket lock must be held while it's corked. + * The socket lock must be held while it's corked. */ lock_sock(sk); if (likely(up->pending)) { @@ -544,14 +545,14 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, release_sock(sk); return -EINVAL; } - goto do_append_data; + goto do_append_data; } release_sock(sk); } ulen += sizeof(struct udphdr); /* - * Get and verify the address. + * Get and verify the address. */ if (msg->msg_name) { struct sockaddr_in * usin = (struct sockaddr_in*)msg->msg_name; @@ -575,7 +576,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, Route will not be used, if at least one option is set. */ connected = 1; - } + } ipc.addr = inet->saddr; ipc.oif = sk->sk_bound_dev_if; @@ -601,7 +602,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, } tos = RT_TOS(inet->tos); if (sock_flag(sk, SOCK_LOCALROUTE) || - (msg->msg_flags & MSG_DONTROUTE) || + (msg->msg_flags & MSG_DONTROUTE) || (ipc.opt && ipc.opt->is_strictroute)) { tos |= RTO_ONLINK; connected = 0; @@ -761,10 +762,10 @@ out: /* * IOCTL requests applicable to the UDP protocol */ - + int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) { - switch(cmd) + switch(cmd) { case SIOCOUTQ: { @@ -804,11 +805,11 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) */ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, - size_t len, int noblock, int flags, int *addr_len) + size_t len, int noblock, int flags, int *addr_len) { struct inet_sock *inet = inet_sk(sk); - struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; - struct sk_buff *skb; + struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; + struct sk_buff *skb; int copied, err, copy_only, is_udplite = IS_UDPLITE(sk); /* @@ -824,8 +825,8 @@ try_again: skb = skb_recv_datagram(sk, flags, noblock, &err); if (!skb) goto out; - - copied = skb->len - sizeof(struct udphdr); + + copied = skb->len - sizeof(struct udphdr); if (copied > len) { copied = len; msg->msg_flags |= MSG_TRUNC; @@ -868,18 +869,18 @@ try_again: sin->sin_port = skb->h.uh->source; sin->sin_addr.s_addr = skb->nh.iph->saddr; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); - } + } if (inet->cmsg_flags) ip_cmsg_recv(msg, skb); err = copied; if (flags & MSG_TRUNC) err = skb->len - sizeof(struct udphdr); - + out_free: - skb_free_datagram(sk, skb); + skb_free_datagram(sk, skb); out: - return err; + return err; csum_copy_err: UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite); @@ -887,7 +888,7 @@ csum_copy_err: skb_kill_datagram(sk, skb, flags); if (noblock) - return -EAGAIN; + return -EAGAIN; goto try_again; } @@ -898,7 +899,7 @@ int udp_disconnect(struct sock *sk, int flags) /* * 1003.1g - break association. */ - + sk->sk_state = TCP_CLOSE; inet->daddr = 0; inet->dport = 0; @@ -922,13 +923,13 @@ int udp_disconnect(struct sock *sk, int flags) static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) { #ifndef CONFIG_XFRM - return 1; + return 1; #else struct udp_sock *up = udp_sk(sk); - struct udphdr *uh; + struct udphdr *uh; struct iphdr *iph; int iphlen, len; - + __u8 *udpdata; __be32 *udpdata32; __u16 encap_type = up->encap_type; @@ -971,7 +972,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) return 0; } else if (len > 2 * sizeof(u32) + sizeof(struct ip_esp_hdr) && udpdata32[0] == 0 && udpdata32[1] == 0) { - + /* ESP Packet with Non-IKE marker */ len = sizeof(struct udphdr) + 2 * sizeof(u32); } else @@ -1187,14 +1188,14 @@ static inline void udp4_csum_init(struct sk_buff *skb, struct udphdr *uh) } /* - * All we need to do is get the socket, and then do a checksum. + * All we need to do is get the socket, and then do a checksum. */ - + int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], int is_udplite) { - struct sock *sk; - struct udphdr *uh = skb->h.uh; + struct sock *sk; + struct udphdr *uh = skb->h.uh; unsigned short ulen; struct rtable *rt = (struct rtable*)skb->dst; __be32 saddr = skb->nh.iph->saddr; @@ -1270,9 +1271,9 @@ short_packet: goto drop; csum_error: - /* - * RFC1122: OK. Discards the bad packet silently (as far as - * the network is concerned, anyway) as per 4.1.3.4 (MUST). + /* + * RFC1122: OK. Discards the bad packet silently (as far as + * the network is concerned, anyway) as per 4.1.3.4 (MUST). */ LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: bad checksum. From %d.%d.%d.%d:%d to %d.%d.%d.%d:%d ulen %d\n", is_udplite? "-Lite" : "", @@ -1328,7 +1329,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, release_sock(sk); } break; - + case UDP_ENCAP: switch (val) { case 0: @@ -1356,8 +1357,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, up->pcflag |= UDPLITE_SEND_CC; break; - /* The receiver specifies a minimum checksum coverage value. To make - * sense, this should be set to at least 8 (as done below). If zero is + /* The receiver specifies a minimum checksum coverage value. To make + * sense, this should be set to at least 8 (as done below). If zero is * used, this again means full checksum coverage. */ case UDPLITE_RECV_CSCOV: if (!up->pcflag) /* Disable the option on UDP sockets */ @@ -1406,7 +1407,7 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, return -EFAULT; len = min_t(unsigned int, len, sizeof(int)); - + if(len < 0) return -EINVAL; @@ -1433,11 +1434,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, return -ENOPROTOOPT; }; - if(put_user(len, optlen)) - return -EFAULT; + if(put_user(len, optlen)) + return -EFAULT; if(copy_to_user(optval, &val,len)) return -EFAULT; - return 0; + return 0; } int udp_getsockopt(struct sock *sk, int level, int optname, @@ -1463,7 +1464,7 @@ int compat_udp_getsockopt(struct sock *sk, int level, int optname, * @sock - socket * @wait - poll table * - * This is same as datagram poll, except for the special case of + * This is same as datagram poll, except for the special case of * blocking sockets. If application is using a blocking fd * and a packet with checksum error is in the queue; * then it could get return from select indicating data available @@ -1502,11 +1503,11 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) } return mask; - + } struct proto udp_prot = { - .name = "UDP", + .name = "UDP", .owner = THIS_MODULE, .close = udp_lib_close, .connect = ip4_datagram_connect, @@ -1670,7 +1671,7 @@ static void udp4_format_sock(struct sock *sp, char *tmpbuf, int bucket) sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X" " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p", - bucket, src, srcp, dest, destp, sp->sk_state, + bucket, src, srcp, dest, destp, sp->sk_state, atomic_read(&sp->sk_wmem_alloc), atomic_read(&sp->sk_rmem_alloc), 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h index f6f4277..820a477 100644 --- a/net/ipv4/udp_impl.h +++ b/net/ipv4/udp_impl.h @@ -10,7 +10,7 @@ extern void __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []); extern int __udp_lib_get_port(struct sock *sk, unsigned short snum, struct hlist_head udptable[], int *port_rover, - int (*)(const struct sock*,const struct sock*)); + int (*)(const struct sock*,const struct sock*)); extern int ipv4_rcv_saddr_equal(const struct sock *, const struct sock *); diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 8655d03..289146b 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c @@ -6,7 +6,7 @@ * Split up af-specific portion * Derek Atkins <derek@ihtfp.com> * Add Encapsulation support - * + * */ #include <linux/module.h> @@ -42,7 +42,7 @@ static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb) if (skb->dst == NULL) { if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, - skb->dev)) + skb->dev)) goto drop; } return dst_input(skb); @@ -149,7 +149,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) ip_send_check(skb->nh.iph); NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL, - xfrm4_rcv_encap_finish); + xfrm4_rcv_encap_finish); return 0; #else return -skb->nh.iph->protocol; diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index 04403fb0..038ca16 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c @@ -1,7 +1,7 @@ /* * xfrm4_output.c - Common IPsec encapsulation code for IPv4. * Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au> - * + * * 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 @@ -28,7 +28,7 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb) goto out; IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE; - + if (!(iph->frag_off & htons(IP_DF)) || skb->local_df) goto out; @@ -47,7 +47,7 @@ static int xfrm4_output_one(struct sk_buff *skb) struct dst_entry *dst = skb->dst; struct xfrm_state *x = dst->xfrm; int err; - + if (skb->ip_summed == CHECKSUM_PARTIAL) { err = skb_checksum_help(skb); if (err) @@ -78,7 +78,7 @@ static int xfrm4_output_one(struct sk_buff *skb) x->curlft.packets++; spin_unlock_bh(&x->lock); - + if (!(skb->dst = dst_pop(dst))) { err = -EHOSTUNREACH; goto error_nolock; diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 699f27c..fef19c6 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c @@ -1,11 +1,11 @@ -/* +/* * xfrm4_policy.c * * Changes: * Kazunori MIYAZAWA @USAGI * YOSHIFUJI Hideaki @USAGI * Split up af-specific portion - * + * */ #include <linux/compiler.h> @@ -50,8 +50,8 @@ __xfrm4_find_bundle(struct flowi *fl, struct xfrm_policy *policy) struct xfrm_dst *xdst = (struct xfrm_dst*)dst; if (xdst->u.rt.fl.oif == fl->oif && /*XXX*/ xdst->u.rt.fl.fl4_dst == fl->fl4_dst && - xdst->u.rt.fl.fl4_src == fl->fl4_src && - xdst->u.rt.fl.fl4_tos == fl->fl4_tos && + xdst->u.rt.fl.fl4_src == fl->fl4_src && + xdst->u.rt.fl.fl4_tos == fl->fl4_tos && xfrm_bundle_ok(policy, xdst, fl, AF_INET, 0)) { dst_clone(dst); break; diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c index f110af5..1be6762 100644 --- a/net/ipv4/xfrm4_tunnel.c +++ b/net/ipv4/xfrm4_tunnel.c @@ -13,7 +13,7 @@ static int ipip_output(struct xfrm_state *x, struct sk_buff *skb) { struct iphdr *iph; - + iph = skb->nh.iph; iph->tot_len = htons(skb->len); ip_send_check(iph); diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index fe5e1d8..77e56f2 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3,7 +3,7 @@ * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> * * $Id: addrconf.c,v 1.69 2001/10/31 21:55:54 davem Exp $ @@ -105,7 +105,7 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p); #ifdef CONFIG_IPV6_PRIVACY static int __ipv6_regen_rndid(struct inet6_dev *idev); -static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr); +static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr); static void ipv6_regen_rndid(unsigned long data); static int desync_factor = MAX_DESYNC_FACTOR * HZ; @@ -137,7 +137,7 @@ static void addrconf_rs_timer(unsigned long data); static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); -static void inet6_prefix_notify(int event, struct inet6_dev *idev, +static void inet6_prefix_notify(int event, struct inet6_dev *idev, struct prefix_info *pinfo); static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev); @@ -241,7 +241,7 @@ int __ipv6_addr_type(const struct in6_addr *addr) */ if ((st & htonl(0xE0000000)) != htonl(0x00000000) && (st & htonl(0xE0000000)) != htonl(0xE0000000)) - return (IPV6_ADDR_UNICAST | + return (IPV6_ADDR_UNICAST | IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) { @@ -252,7 +252,7 @@ int __ipv6_addr_type(const struct in6_addr *addr) } if ((st & htonl(0xFFC00000)) == htonl(0xFE800000)) - return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST | + return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST | IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL)); /* addr-select 3.1 */ if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000)) return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST | @@ -272,11 +272,11 @@ int __ipv6_addr_type(const struct in6_addr *addr) } if (addr->s6_addr32[2] == htonl(0x0000ffff)) - return (IPV6_ADDR_MAPPED | + return (IPV6_ADDR_MAPPED | IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.3 */ } - return (IPV6_ADDR_RESERVED | + return (IPV6_ADDR_RESERVED | IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.4 */ } @@ -348,10 +348,10 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) if (dev->mtu < IPV6_MIN_MTU) return NULL; - ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL); + ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL); - if (ndev == NULL) - return NULL; + if (ndev == NULL) + return NULL; rwlock_init(&ndev->lock); ndev->dev = dev; @@ -462,7 +462,7 @@ static void dev_forward_change(struct inet6_dev *idev) dev = idev->dev; if (dev && (dev->flags & IFF_MULTICAST)) { ipv6_addr_all_routers(&addr); - + if (idev->cnf.forwarding) ipv6_dev_mc_inc(dev, &addr); else @@ -817,8 +817,8 @@ retry: tmp_valid_lft = min_t(__u32, ifp->valid_lft, idev->cnf.temp_valid_lft); - tmp_prefered_lft = min_t(__u32, - ifp->prefered_lft, + tmp_prefered_lft = min_t(__u32, + ifp->prefered_lft, idev->cnf.temp_prefered_lft - desync_factor / HZ); tmp_plen = ifp->prefix_len; max_addresses = idev->cnf.max_addresses; @@ -828,7 +828,7 @@ retry: write_unlock(&idev->lock); ift = !max_addresses || - ipv6_count_addresses(idev) < max_addresses ? + ipv6_count_addresses(idev) < max_addresses ? ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, IFA_F_TEMPORARY) : NULL; if (!ift || IS_ERR(ift)) { @@ -1160,7 +1160,7 @@ record_it: if (!ifa_result) return -EADDRNOTAVAIL; - + ipv6_addr_copy(saddr, &ifa_result->addr); in6_ifa_put(ifa_result); return 0; @@ -1475,7 +1475,7 @@ regen: * - value 0 * - XXX: already assigned to an address on the device */ - if (idev->rndid[0] == 0xfd && + if (idev->rndid[0] == 0xfd && (idev->rndid[1]&idev->rndid[2]&idev->rndid[3]&idev->rndid[4]&idev->rndid[5]&idev->rndid[6]) == 0xff && (idev->rndid[7]&0x80)) goto regen; @@ -1502,9 +1502,9 @@ static void ipv6_regen_rndid(unsigned long data) if (__ipv6_regen_rndid(idev) < 0) goto out; - + expires = jiffies + - idev->cnf.temp_prefered_lft * HZ - + idev->cnf.temp_prefered_lft * HZ - idev->cnf.regen_max_retry * idev->cnf.dad_transmits * idev->nd_parms->retrans_time - desync_factor; if (time_before(expires, jiffies)) { printk(KERN_WARNING @@ -1630,12 +1630,12 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) struct inet6_dev *in6_dev; pinfo = (struct prefix_info *) opt; - + if (len < sizeof(struct prefix_info)) { ADBG(("addrconf: prefix option too short\n")); return; } - + /* * Validation checks ([ADDRCONF], page 19) */ @@ -1827,7 +1827,7 @@ ok: * When a new public address is created as described in [ADDRCONF], * also create a new temporary address. */ - read_unlock_bh(&in6_dev->lock); + read_unlock_bh(&in6_dev->lock); ipv6_create_tempaddr(ifp, NULL); } else { read_unlock_bh(&in6_dev->lock); @@ -1913,14 +1913,14 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen, int scope; ASSERT_RTNL(); - + /* check the lifetime */ if (!valid_lft || prefered_lft > valid_lft) return -EINVAL; if ((dev = __dev_get_by_index(ifindex)) == NULL) return -ENODEV; - + if ((idev = addrconf_add_dev(dev)) == NULL) return -ENOBUFS; @@ -1960,7 +1960,7 @@ static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen) struct inet6_ifaddr *ifp; struct inet6_dev *idev; struct net_device *dev; - + if ((dev = __dev_get_by_index(ifindex)) == NULL) return -ENODEV; @@ -1973,7 +1973,7 @@ static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen) ipv6_addr_equal(pfx, &ifp->addr)) { in6_ifa_hold(ifp); read_unlock_bh(&idev->lock); - + ipv6_del_addr(ifp); /* If the last address is deleted administratively, @@ -1993,10 +1993,10 @@ int addrconf_add_ifaddr(void __user *arg) { struct in6_ifreq ireq; int err; - + if (!capable(CAP_NET_ADMIN)) return -EPERM; - + if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq))) return -EFAULT; @@ -2011,7 +2011,7 @@ int addrconf_del_ifaddr(void __user *arg) { struct in6_ifreq ireq; int err; - + if (!capable(CAP_NET_ADMIN)) return -EPERM; @@ -2056,7 +2056,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) return; } - for (dev = dev_base; dev != NULL; dev = dev->next) { + for (dev = dev_base; dev != NULL; dev = dev->next) { struct in_device * in_dev = __in_dev_get_rtnl(dev); if (in_dev && (dev->flags & IFF_UP)) { struct in_ifaddr * ifa; @@ -2091,7 +2091,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) } } } - } + } } #endif @@ -2137,7 +2137,7 @@ static void addrconf_dev_config(struct net_device *dev) ASSERT_RTNL(); - if ((dev->type != ARPHRD_ETHER) && + if ((dev->type != ARPHRD_ETHER) && (dev->type != ARPHRD_FDDI) && (dev->type != ARPHRD_IEEE802_TR) && (dev->type != ARPHRD_ARCNET) && @@ -2164,9 +2164,9 @@ static void addrconf_sit_config(struct net_device *dev) ASSERT_RTNL(); - /* - * Configure the tunnel with one of our IPv4 - * addresses... we should configure all of + /* + * Configure the tunnel with one of our IPv4 + * addresses... we should configure all of * our v4 addrs in the tunnel */ @@ -2233,7 +2233,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev) ip6_tnl_add_linklocal(idev); } -static int addrconf_notify(struct notifier_block *this, unsigned long event, +static int addrconf_notify(struct notifier_block *this, unsigned long event, void * data) { struct net_device *dev = (struct net_device *) data; @@ -2378,7 +2378,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) return -ENODEV; /* Step 1: remove reference to ipv6 device from parent device. - Do not dev_put! + Do not dev_put! */ if (how == 1) { idev->dead = 1; @@ -2461,7 +2461,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) /* Step 5: netlink notification of this interface */ idev->tstamp = jiffies; inet6_ifinfo_notify(RTM_DELLINK, idev); - + /* Shot the device (if unregistered) */ if (how == 1) { @@ -2850,8 +2850,8 @@ restart: age = (now - ifp->tstamp) / HZ; #ifdef CONFIG_IPV6_PRIVACY - regen_advance = ifp->idev->cnf.regen_max_retry * - ifp->idev->cnf.dad_transmits * + regen_advance = ifp->idev->cnf.regen_max_retry * + ifp->idev->cnf.dad_transmits * ifp->idev->nd_parms->retrans_time / HZ; #endif @@ -3217,7 +3217,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, s_idx = cb->args[0]; s_ip_idx = ip_idx = cb->args[1]; read_lock(&dev_base_lock); - + for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) { if (idx < s_idx) continue; @@ -3234,8 +3234,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, ifa = ifa->if_next, ip_idx++) { if (ip_idx < s_ip_idx) continue; - if ((err = inet6_fill_ifaddr(skb, ifa, - NETLINK_CB(cb->skb).pid, + if ((err = inet6_fill_ifaddr(skb, ifa, + NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, RTM_NEWADDR, NLM_F_MULTI)) <= 0) goto done; @@ -3243,12 +3243,12 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, break; case MULTICAST_ADDR: /* multicast address */ - for (ifmca = idev->mc_list; ifmca; + for (ifmca = idev->mc_list; ifmca; ifmca = ifmca->next, ip_idx++) { if (ip_idx < s_ip_idx) continue; - if ((err = inet6_fill_ifmcaddr(skb, ifmca, - NETLINK_CB(cb->skb).pid, + if ((err = inet6_fill_ifmcaddr(skb, ifmca, + NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, RTM_GETMULTICAST, NLM_F_MULTI)) <= 0) goto done; @@ -3260,10 +3260,10 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, ifaca = ifaca->aca_next, ip_idx++) { if (ip_idx < s_ip_idx) continue; - if ((err = inet6_fill_ifacaddr(skb, ifaca, - NETLINK_CB(cb->skb).pid, + if ((err = inet6_fill_ifacaddr(skb, ifaca, + NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, RTM_GETANYCAST, - NLM_F_MULTI)) <= 0) + NLM_F_MULTI)) <= 0) goto done; } break; @@ -3426,7 +3426,7 @@ static inline size_t inet6_if_nlmsg_size(void) ); } -static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, +static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, u32 pid, u32 seq, int event, unsigned int flags) { struct net_device *dev = idev->dev; @@ -3498,7 +3498,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) continue; if ((idev = in6_dev_get(dev)) == NULL) continue; - err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, + err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI); in6_dev_put(idev); if (err <= 0) @@ -3514,7 +3514,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev) { struct sk_buff *skb; int err = -ENOBUFS; - + skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC); if (skb == NULL) goto errout; @@ -3578,7 +3578,7 @@ nla_put_failure: return -EMSGSIZE; } -static void inet6_prefix_notify(int event, struct inet6_dev *idev, +static void inet6_prefix_notify(int event, struct inet6_dev *idev, struct prefix_info *pinfo) { struct sk_buff *skb; @@ -3675,10 +3675,10 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp, rt6_purge_dflt_routers(); } - return ret; + return ret; } -static int addrconf_sysctl_forward_strategy(ctl_table *table, +static int addrconf_sysctl_forward_strategy(ctl_table *table, int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp, @@ -3743,19 +3743,19 @@ static struct addrconf_sysctl_table } addrconf_sysctl __read_mostly = { .sysctl_header = NULL, .addrconf_vars = { - { + { .ctl_name = NET_IPV6_FORWARDING, .procname = "forwarding", - .data = &ipv6_devconf.forwarding, + .data = &ipv6_devconf.forwarding, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &addrconf_sysctl_forward, + .proc_handler = &addrconf_sysctl_forward, .strategy = &addrconf_sysctl_forward_strategy, }, { .ctl_name = NET_IPV6_HOP_LIMIT, .procname = "hop_limit", - .data = &ipv6_devconf.hop_limit, + .data = &ipv6_devconf.hop_limit, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, @@ -3764,116 +3764,116 @@ static struct addrconf_sysctl_table .ctl_name = NET_IPV6_MTU, .procname = "mtu", .data = &ipv6_devconf.mtu6, - .maxlen = sizeof(int), + .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_ACCEPT_RA, .procname = "accept_ra", - .data = &ipv6_devconf.accept_ra, + .data = &ipv6_devconf.accept_ra, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_ACCEPT_REDIRECTS, .procname = "accept_redirects", - .data = &ipv6_devconf.accept_redirects, + .data = &ipv6_devconf.accept_redirects, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_AUTOCONF, .procname = "autoconf", - .data = &ipv6_devconf.autoconf, + .data = &ipv6_devconf.autoconf, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_DAD_TRANSMITS, .procname = "dad_transmits", - .data = &ipv6_devconf.dad_transmits, + .data = &ipv6_devconf.dad_transmits, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_RTR_SOLICITS, .procname = "router_solicitations", - .data = &ipv6_devconf.rtr_solicits, + .data = &ipv6_devconf.rtr_solicits, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL, .procname = "router_solicitation_interval", - .data = &ipv6_devconf.rtr_solicit_interval, + .data = &ipv6_devconf.rtr_solicit_interval, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY, .procname = "router_solicitation_delay", - .data = &ipv6_devconf.rtr_solicit_delay, + .data = &ipv6_devconf.rtr_solicit_delay, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_FORCE_MLD_VERSION, .procname = "force_mld_version", - .data = &ipv6_devconf.force_mld_version, + .data = &ipv6_devconf.force_mld_version, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, #ifdef CONFIG_IPV6_PRIVACY { .ctl_name = NET_IPV6_USE_TEMPADDR, .procname = "use_tempaddr", - .data = &ipv6_devconf.use_tempaddr, + .data = &ipv6_devconf.use_tempaddr, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_TEMP_VALID_LFT, .procname = "temp_valid_lft", - .data = &ipv6_devconf.temp_valid_lft, + .data = &ipv6_devconf.temp_valid_lft, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_TEMP_PREFERED_LFT, .procname = "temp_prefered_lft", - .data = &ipv6_devconf.temp_prefered_lft, + .data = &ipv6_devconf.temp_prefered_lft, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_REGEN_MAX_RETRY, .procname = "regen_max_retry", - .data = &ipv6_devconf.regen_max_retry, + .data = &ipv6_devconf.regen_max_retry, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR, .procname = "max_desync_factor", - .data = &ipv6_devconf.max_desync_factor, + .data = &ipv6_devconf.max_desync_factor, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, #endif { @@ -3887,18 +3887,18 @@ static struct addrconf_sysctl_table { .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR, .procname = "accept_ra_defrtr", - .data = &ipv6_devconf.accept_ra_defrtr, + .data = &ipv6_devconf.accept_ra_defrtr, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_ACCEPT_RA_PINFO, .procname = "accept_ra_pinfo", - .data = &ipv6_devconf.accept_ra_pinfo, + .data = &ipv6_devconf.accept_ra_pinfo, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, #ifdef CONFIG_IPV6_ROUTER_PREF { @@ -4003,18 +4003,18 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */ } if (dev) { - dev_name = dev->name; + dev_name = dev->name; t->addrconf_dev[0].ctl_name = dev->ifindex; } else { dev_name = "default"; t->addrconf_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT; } - /* - * Make a copy of dev_name, because '.procname' is regarded as const + /* + * Make a copy of dev_name, because '.procname' is regarded as const * by sysctl and we wouldn't want anyone to change it under our feet * (see SIOCSIFNAME). - */ + */ dev_name = kstrdup(dev_name, GFP_KERNEL); if (!dev_name) goto free; @@ -4066,12 +4066,12 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p) int register_inet6addr_notifier(struct notifier_block *nb) { - return atomic_notifier_chain_register(&inet6addr_chain, nb); + return atomic_notifier_chain_register(&inet6addr_chain, nb); } int unregister_inet6addr_notifier(struct notifier_block *nb) { - return atomic_notifier_chain_unregister(&inet6addr_chain,nb); + return atomic_notifier_chain_unregister(&inet6addr_chain,nb); } /* @@ -4124,9 +4124,9 @@ int __init addrconf_init(void) void __exit addrconf_cleanup(void) { - struct net_device *dev; - struct inet6_dev *idev; - struct inet6_ifaddr *ifa; + struct net_device *dev; + struct inet6_dev *idev; + struct inet6_ifaddr *ifa; int i; unregister_netdevice_notifier(&ipv6_dev_notf); diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 0e0e426..a006d24 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -1,9 +1,9 @@ /* * PF_INET6 socket protocol family - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * Adapted from linux/net/ipv4/af_inet.c * @@ -191,7 +191,7 @@ lookup_protocol: np->mc_loop = 1; np->pmtudisc = IPV6_PMTUDISC_WANT; np->ipv6only = sysctl_ipv6_bindv6only; - + /* Init the ipv4 part of the socket since we can have sockets * using v6 API for ipv4. */ @@ -206,7 +206,7 @@ lookup_protocol: inet->pmtudisc = IP_PMTUDISC_DONT; else inet->pmtudisc = IP_PMTUDISC_WANT; - /* + /* * Increment only the relevant sk_prot->socks debug field, this changes * the previous behaviour of incrementing both the equivalent to * answer->prot->socks (inet6_sock_nr) and inet_sock_nr. @@ -293,7 +293,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) */ sk->sk_bound_dev_if = addr->sin6_scope_id; } - + /* Binding to link-local address requires an interface */ if (!sk->sk_bound_dev_if) { err = -EINVAL; @@ -327,7 +327,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) inet->saddr = v4addr; ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); - + if (!(addr_type & IPV6_ADDR_MULTICAST)) ipv6_addr_copy(&np->saddr, &addr->sin6_addr); @@ -393,7 +393,7 @@ EXPORT_SYMBOL_GPL(inet6_destroy_sock); /* * This does both peername and sockname. */ - + int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { @@ -401,7 +401,7 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, struct sock *sk = sock->sk; struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); - + sin->sin6_family = AF_INET6; sin->sin6_flowinfo = 0; sin->sin6_scope_id = 0; @@ -433,14 +433,14 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; - switch(cmd) + switch(cmd) { case SIOCGSTAMP: return sock_get_timestamp(sk, (struct timeval __user *)arg); case SIOCADDRT: case SIOCDELRT: - + return(ipv6_route_ioctl(cmd,(void __user *)arg)); case SIOCSIFADDR: @@ -584,7 +584,7 @@ inet6_register_protosw(struct inet_protosw *p) /* Add the new entry after the last permanent entry if any, so that * the new entry does not override a permanent entry when matched with * a wild-card protocol. But it is allowed to override any existing - * non-permanent entry. This means that when we remove this entry, the + * non-permanent entry. This means that when we remove this entry, the * system automatically returns to the old behavior. */ list_add_rcu(&p->list, last_perm); @@ -749,7 +749,7 @@ err_icmp_mib: snmp6_mib_free((void **)ipv6_statistics); err_ip_mib: return -ENOMEM; - + } static void cleanup_ipv6_mibs(void) @@ -763,7 +763,7 @@ static void cleanup_ipv6_mibs(void) static int __init inet6_init(void) { struct sk_buff *dummy_skb; - struct list_head *r; + struct list_head *r; int err; BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); @@ -814,7 +814,7 @@ static int __init inet6_init(void) err = init_ipv6_mibs(); if (err) goto out_unregister_sock; - + /* * ipngwg API draft makes clear that the correct semantics * for TCP and UDP is to consider one TCP and UDP instance @@ -933,11 +933,11 @@ static void __exit inet6_exit(void) #ifdef CONFIG_PROC_FS if6_proc_exit(); ac6_proc_exit(); - ipv6_misc_proc_exit(); - udp6_proc_exit(); - udplite6_proc_exit(); - tcp6_proc_exit(); - raw6_proc_exit(); + ipv6_misc_proc_exit(); + udp6_proc_exit(); + udplite6_proc_exit(); + tcp6_proc_exit(); + raw6_proc_exit(); #endif #ifdef CONFIG_IPV6_MIP6 mip6_fini(); @@ -952,7 +952,7 @@ static void __exit inet6_exit(void) ndisc_cleanup(); icmpv6_cleanup(); #ifdef CONFIG_SYSCTL - ipv6_sysctl_unregister(); + ipv6_sysctl_unregister(); #endif cleanup_ipv6_mibs(); proto_unregister(&rawv6_prot); diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 12c5a4d..dc68b72 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c @@ -1,26 +1,26 @@ /* * Copyright (C)2002 USAGI/WIDE Project - * + * * 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 * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors * - * Mitsuru KANDA @USAGI : IPv6 Support + * Mitsuru KANDA @USAGI : IPv6 Support * Kazunori MIYAZAWA @USAGI : * Kunihiro Ishiguro <kunihiro@ipinfusion.com> - * + * * This file is derived from net/ipv4/ah.c. */ @@ -54,7 +54,7 @@ static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr) optlen = 1; break; default: - if (len < 2) + if (len < 2) goto bad; optlen = opt[off+1]+2; if (len < optlen) @@ -152,7 +152,7 @@ static void ipv6_rearrange_rthdr(struct ipv6hdr *iph, struct ipv6_rt_hdr *rthdr) segments_left = rthdr->segments_left; if (segments_left == 0) return; - rthdr->segments_left = 0; + rthdr->segments_left = 0; /* The value of rthdr->hdrlen has been verified either by the system * call if it is locally generated, or by ipv6_rthdr_rcv() for incoming @@ -278,7 +278,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) top_iph->hop_limit = 0; ahp = x->data; - ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + + ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len) >> 2) - 2; ah->reserved = 0; @@ -319,7 +319,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) * Moving the pointer of skb->nh.raw by using skb_pull as long as AH * header length. Then copy back the copy as long as hdr_len * If destination header following AH exists, copy it into after [Ext2]. - * + * * |<>|[IPv6][Ext1][Ext2][Dest][Payload] * There is offset of AH before IPv6 header after the process. */ @@ -347,9 +347,9 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) nexthdr = ah->nexthdr; ah_hlen = (ah->hdrlen + 2) << 2; - if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) && - ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len)) - goto out; + if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) && + ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len)) + goto out; if (!pskb_may_pull(skb, ah_hlen)) goto out; @@ -365,7 +365,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) skb->nh.ipv6h->flow_lbl[2] = 0; skb->nh.ipv6h->hop_limit = 0; - { + { u8 auth_data[MAX_AH_AUTH_LEN]; memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); @@ -395,8 +395,8 @@ out: return err; } -static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, - int type, int code, int offset, __be32 info) +static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, + int type, int code, int offset, __be32 info) { struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset); @@ -445,7 +445,7 @@ static int ah6_init_state(struct xfrm_state *x) ahp->tfm = tfm; if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len)) goto error; - + /* * Lookup the algorithm description maintained by xfrm_algo, * verify crypto transform properties, and store information @@ -462,16 +462,16 @@ static int ah6_init_state(struct xfrm_state *x) aalg_desc->uinfo.auth.icv_fullbits/8); goto error; } - + ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; - + BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); - + ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL); if (!ahp->work_icv) goto error; - + x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len); if (x->props.mode == XFRM_MODE_TUNNEL) x->props.header_len += sizeof(struct ipv6hdr); diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index a960476..e2dc1c4 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c @@ -1,6 +1,6 @@ /* * Anycast support for IPv6 - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: * David L Stevens (dlstevens@us.ibm.com) @@ -397,7 +397,7 @@ static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr) in6_dev_put(idev); return ret; } - + /* * check if the interface has this anycast address */ diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index ecde301..5f54dec 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -1,9 +1,9 @@ /* * common UDP/RAW code - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * $Id: datagram.c,v 1.24 2002/02/01 22:01:04 davem Exp $ * @@ -55,10 +55,10 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) } if (addr_len < SIN6_LEN_RFC2133) - return -EINVAL; + return -EINVAL; - if (usin->sin6_family != AF_INET6) - return -EAFNOSUPPORT; + if (usin->sin6_family != AF_INET6) + return -EAFNOSUPPORT; memset(&fl, 0, sizeof(fl)); if (np->sndflow) { @@ -93,14 +93,14 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) sin.sin_addr.s_addr = daddr->s6_addr32[3]; sin.sin_port = usin->sin6_port; - err = ip4_datagram_connect(sk, - (struct sockaddr*) &sin, + err = ip4_datagram_connect(sk, + (struct sockaddr*) &sin, sizeof(sin)); ipv4_connected: if (err) goto out; - + ipv6_addr_set(&np->daddr, 0, 0, htonl(0x0000ffff), inet->daddr); if (ipv6_addr_any(&np->saddr)) { @@ -206,7 +206,7 @@ out: return err; } -void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, +void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, u32 info, u8 *payload) { struct ipv6_pinfo *np = inet6_sk(sk); @@ -223,7 +223,7 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, serr = SKB_EXT_ERR(skb); serr->ee.ee_errno = err; serr->ee.ee_origin = SO_EE_ORIGIN_ICMP6; - serr->ee.ee_type = icmph->icmp6_type; + serr->ee.ee_type = icmph->icmp6_type; serr->ee.ee_code = icmph->icmp6_code; serr->ee.ee_pad = 0; serr->ee.ee_info = info; @@ -259,7 +259,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info) serr = SKB_EXT_ERR(skb); serr->ee.ee_errno = err; serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL; - serr->ee.ee_type = 0; + serr->ee.ee_type = 0; serr->ee.ee_code = 0; serr->ee.ee_pad = 0; serr->ee.ee_info = info; @@ -274,7 +274,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info) kfree_skb(skb); } -/* +/* * Handle MSG_ERRQUEUE */ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) @@ -312,7 +312,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) if (sin) { sin->sin6_family = AF_INET6; sin->sin6_flowinfo = 0; - sin->sin6_port = serr->port; + sin->sin6_port = serr->port; sin->sin6_scope_id = 0; if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) { ipv6_addr_copy(&sin->sin6_addr, @@ -370,7 +370,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) spin_unlock_bh(&sk->sk_error_queue.lock); } -out_free_skb: +out_free_skb: kfree_skb(skb); out: return err; @@ -419,7 +419,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) * report extension headers (except for HbH) * in order. * - * Also note that IPV6_RECVRTHDRDSTOPTS is NOT + * Also note that IPV6_RECVRTHDRDSTOPTS is NOT * (and WILL NOT be) defined because * IPV6_RECVDSTOPTS is more generic. --yoshfuji */ @@ -512,15 +512,15 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, continue; switch (cmsg->cmsg_type) { - case IPV6_PKTINFO: - case IPV6_2292PKTINFO: - if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) { + case IPV6_PKTINFO: + case IPV6_2292PKTINFO: + if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) { err = -EINVAL; goto exit_f; } src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg); - + if (src_info->ipi6_ifindex) { if (fl->oif && src_info->ipi6_ifindex != fl->oif) return -EINVAL; @@ -531,7 +531,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, if (addr_type == IPV6_ADDR_ANY) break; - + if (addr_type & IPV6_ADDR_LINKLOCAL) { if (!src_info->ipi6_ifindex) return -EINVAL; @@ -554,7 +554,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, break; case IPV6_FLOWINFO: - if (cmsg->cmsg_len < CMSG_LEN(4)) { + if (cmsg->cmsg_len < CMSG_LEN(4)) { err = -EINVAL; goto exit_f; } @@ -570,7 +570,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, case IPV6_2292HOPOPTS: case IPV6_HOPOPTS: - if (opt->hopopt || cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) { + if (opt->hopopt || cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) { err = -EINVAL; goto exit_f; } @@ -590,7 +590,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, break; case IPV6_2292DSTOPTS: - if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) { + if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) { err = -EINVAL; goto exit_f; } @@ -641,7 +641,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, case IPV6_2292RTHDR: case IPV6_RTHDR: - if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_rt_hdr))) { + if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_rt_hdr))) { err = -EINVAL; goto exit_f; } @@ -661,7 +661,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, len = ((rthdr->hdrlen + 1) << 3); - if (cmsg->cmsg_len < CMSG_LEN(len)) { + if (cmsg->cmsg_len < CMSG_LEN(len)) { err = -EINVAL; goto exit_f; } @@ -716,7 +716,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, } default: LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n", - cmsg->cmsg_type); + cmsg->cmsg_type); err = -EINVAL; break; }; diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 25dcf69..363e63f 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -1,26 +1,26 @@ /* * Copyright (C)2002 USAGI/WIDE Project - * + * * 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 * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors * - * Mitsuru KANDA @USAGI : IPv6 Support + * Mitsuru KANDA @USAGI : IPv6 Support * Kazunori MIYAZAWA @USAGI : * Kunihiro Ishiguro <kunihiro@ipinfusion.com> - * + * * This file is derived from net/ipv4/esp.c */ @@ -166,7 +166,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) } /* If integrity check is required, do this. */ - if (esp->auth.icv_full_len) { + if (esp->auth.icv_full_len) { u8 sum[alen]; ret = esp_mac_digest(esp, skb, 0, skb->len - alen); @@ -197,7 +197,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) if (esp->conf.ivlen) crypto_blkcipher_set_iv(tfm, esph->enc_data, esp->conf.ivlen); - { + { u8 nexthdr[2]; struct scatterlist *sg = &esp->sgbuf[0]; u8 padlen; @@ -225,7 +225,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) ret = -EINVAL; goto out; } - /* ... check padding bits here. Silly. :-) */ + /* ... check padding bits here. Silly. :-) */ pskb_trim(skb, skb->len - alen - padlen - 2); ret = nexthdr[1]; @@ -256,20 +256,20 @@ static u32 esp6_get_max_size(struct xfrm_state *x, int mtu) } static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, - int type, int code, int offset, __be32 info) + int type, int code, int offset, __be32 info) { struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; struct ipv6_esp_hdr *esph = (struct ipv6_esp_hdr*)(skb->data+offset); struct xfrm_state *x; - if (type != ICMPV6_DEST_UNREACH && + if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG) return; x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6); if (!x) return; - printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n", + printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n", ntohl(esph->spi), NIP6(iph->daddr)); xfrm_state_put(x); } @@ -326,10 +326,10 @@ static int esp6_init_state(struct xfrm_state *x) esp->auth.tfm = hash; if (crypto_hash_setkey(hash, esp->auth.key, esp->auth.key_len)) goto error; - + aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0); BUG_ON(!aalg_desc); - + if (aalg_desc->uinfo.auth.icv_fullbits/8 != crypto_hash_digestsize(hash)) { NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n", @@ -338,10 +338,10 @@ static int esp6_init_state(struct xfrm_state *x) aalg_desc->uinfo.auth.icv_fullbits/8); goto error; } - + esp->auth.icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; esp->auth.icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; - + esp->auth.work_icv = kmalloc(esp->auth.icv_full_len, GFP_KERNEL); if (!esp->auth.work_icv) goto error; diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 0711f92..08313ef 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -16,7 +16,7 @@ */ /* Changes: - * yoshfuji : ensure not to overrun while parsing + * yoshfuji : ensure not to overrun while parsing * tlv options. * Mitsuru KANDA @USAGI and: Remove ipv6_parse_exthdrs(). * YOSHIFUJI Hideaki @USAGI Register inbound extension header @@ -167,8 +167,8 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp) goto bad; for (curr=procs; curr->type >= 0; curr++) { if (curr->type == skb->nh.raw[off]) { - /* type specific length/alignment - checks will be performed in the + /* type specific length/alignment + checks will be performed in the func(). */ if (curr->func(skbp, off) == 0) return 0; @@ -572,7 +572,7 @@ void __init ipv6_rthdr_init(void) For now we need to test the engine, so that I created temporary (or permanent) backdoor. If listening socket set IPV6_RTHDR to 2, then we invert header. - --ANK (980729) + --ANK (980729) */ struct ipv6_txoptions * @@ -635,7 +635,7 @@ static int ipv6_hop_ra(struct sk_buff **skbp, int optoff) return 1; } LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_ra: wrong RA length %d\n", - skb->nh.raw[optoff+1]); + skb->nh.raw[optoff+1]); kfree_skb(skb); return 0; } @@ -649,7 +649,7 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int optoff) if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) { LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", - skb->nh.raw[optoff+1]); + skb->nh.raw[optoff+1]); IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); goto drop; @@ -740,7 +740,7 @@ static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto, int hops; ihdr = (struct rt0_hdr *) opt; - + phdr = (struct rt0_hdr *) skb_push(skb, (ihdr->rt_hdr.hdrlen + 1) << 3); memcpy(phdr, ihdr, sizeof(struct rt0_hdr)); diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c index 21cbbbd..e1caa5d 100644 --- a/net/ipv6/exthdrs_core.c +++ b/net/ipv6/exthdrs_core.c @@ -4,13 +4,13 @@ */ #include <net/ipv6.h> -/* +/* * find out if nexthdr is a well-known extension header or a protocol */ int ipv6_ext_hdr(u8 nexthdr) { - /* + /* * find out if nexthdr is an extension header or a protocol */ return ( (nexthdr == NEXTHDR_HOP) || @@ -25,18 +25,18 @@ int ipv6_ext_hdr(u8 nexthdr) * Skip any extension headers. This is used by the ICMP module. * * Note that strictly speaking this conflicts with RFC 2460 4.0: - * ...The contents and semantics of each extension header determine whether + * ...The contents and semantics of each extension header determine whether * or not to proceed to the next header. Therefore, extension headers must * be processed strictly in the order they appear in the packet; a * receiver must not, for example, scan through a packet looking for a * particular kind of extension header and process that header prior to * processing all preceding ones. - * + * * We do exactly this. This is a protocol bug. We can't decide after a - * seeing an unknown discard-with-error flavour TLV option if it's a + * seeing an unknown discard-with-error flavour TLV option if it's a * ICMP error message or not (errors should never be send in reply to * ICMP error messages). - * + * * But I see no other way to do this. This might need to be reexamined * when Linux implements ESP (and maybe AUTH) headers. * --AK @@ -90,9 +90,9 @@ int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp) break; hdrlen = 8; } else if (nexthdr == NEXTHDR_AUTH) - hdrlen = (hp->hdrlen+2)<<2; + hdrlen = (hp->hdrlen+2)<<2; else - hdrlen = ipv6_optlen(hp); + hdrlen = ipv6_optlen(hp); nexthdr = hp->nexthdr; start += hdrlen; diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 3dcc4b7..9377fea 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -107,7 +107,7 @@ static __inline__ void icmpv6_xmit_unlock(void) spin_unlock_bh(&icmpv6_socket->sk->sk_lock.slock); } -/* +/* * Slightly more convenient version of icmpv6_send. */ void icmpv6_param_prob(struct sk_buff *skb, int code, int pos) @@ -153,8 +153,8 @@ static int is_ineligible(struct sk_buff *skb) static int sysctl_icmpv6_time __read_mostly = 1*HZ; -/* - * Check the ICMP output rate limit +/* + * Check the ICMP output rate limit */ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, struct flowi *fl) @@ -170,7 +170,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, if (type == ICMPV6_PKT_TOOBIG) return 1; - /* + /* * Look up the output route. * XXX: perhaps the expire for routing entries cloned by * this lookup should be more aggressive (not longer than timeout). @@ -198,7 +198,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, /* * an inline helper for the "simple" if statement below * checks if parameter problem report is caused by an - * unrecognized IPv6 option that has the Option Type + * unrecognized IPv6 option that has the Option Type * highest-order two bits set to 10 */ @@ -298,7 +298,7 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {} /* * Send an ICMP message in response to a packet in error */ -void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, +void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, struct net_device *dev) { struct inet6_dev *idev = NULL; @@ -320,7 +320,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, return; /* - * Make sure we respect the rules + * Make sure we respect the rules * i.e. RFC 1885 2.4(e) * Rule (e.1) is enforced by not using icmpv6_send * in any code that processes icmp errors. @@ -336,8 +336,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, if ((addr_type & IPV6_ADDR_MULTICAST || skb->pkt_type != PACKET_HOST)) { if (type != ICMPV6_PKT_TOOBIG && - !(type == ICMPV6_PARAMPROB && - code == ICMPV6_UNK_OPTION && + !(type == ICMPV6_PARAMPROB && + code == ICMPV6_UNK_OPTION && (opt_unrec(skb, info)))) return; @@ -364,7 +364,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, return; } - /* + /* * Never answer to a ICMP packet. */ if (is_ineligible(skb)) { @@ -543,14 +543,14 @@ static void icmpv6_echo_reply(struct sk_buff *skb) } err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr)); - ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTECHOREPLIES); - ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); + ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTECHOREPLIES); + ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); -out_put: +out_put: if (likely(idev != NULL)) in6_dev_put(idev); dst_release(dst); -out: +out: icmpv6_xmit_unlock(); } @@ -608,7 +608,7 @@ static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info) } read_unlock(&raw_v6_lock); } - + /* * Handle icmp messages */ @@ -722,9 +722,9 @@ static int icmpv6_rcv(struct sk_buff **pskb) if (type & ICMPV6_INFOMSG_MASK) break; - /* - * error of unknown type. - * must pass to upper level + /* + * error of unknown type. + * must pass to upper level */ icmpv6_notify(skb, type, hdr->icmp6_code, hdr->icmp6_mtu); @@ -852,7 +852,7 @@ int icmpv6_err_convert(int type, int code, int *err) case ICMPV6_PKT_TOOBIG: *err = EMSGSIZE; break; - + case ICMPV6_PARAMPROB: *err = EPROTO; fatal = 1; diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index e611169..30b16da 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c @@ -115,7 +115,7 @@ struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { if (inet_sk(sk)->num == hnum && sk->sk_family == PF_INET6) { const struct ipv6_pinfo *np = inet6_sk(sk); - + score = 1; if (!ipv6_addr_any(&np->rcv_saddr)) { if (!ipv6_addr_equal(&np->rcv_saddr, daddr)) @@ -249,81 +249,81 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row, { struct inet_hashinfo *hinfo = death_row->hashinfo; const unsigned short snum = inet_sk(sk)->num; - struct inet_bind_hashbucket *head; - struct inet_bind_bucket *tb; + struct inet_bind_hashbucket *head; + struct inet_bind_bucket *tb; int ret; - if (snum == 0) { - const int low = sysctl_local_port_range[0]; - const int high = sysctl_local_port_range[1]; + if (snum == 0) { + const int low = sysctl_local_port_range[0]; + const int high = sysctl_local_port_range[1]; const int range = high - low; - int i, port; + int i, port; static u32 hint; const u32 offset = hint + inet6_sk_port_offset(sk); struct hlist_node *node; - struct inet_timewait_sock *tw = NULL; + struct inet_timewait_sock *tw = NULL; - local_bh_disable(); + local_bh_disable(); for (i = 1; i <= range; i++) { port = low + (i + offset) % range; - head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; - spin_lock(&head->lock); + head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; + spin_lock(&head->lock); - /* Does not bother with rcv_saddr checks, - * because the established check is already - * unique enough. - */ + /* Does not bother with rcv_saddr checks, + * because the established check is already + * unique enough. + */ inet_bind_bucket_for_each(tb, node, &head->chain) { - if (tb->port == port) { - BUG_TRAP(!hlist_empty(&tb->owners)); - if (tb->fastreuse >= 0) - goto next_port; - if (!__inet6_check_established(death_row, + if (tb->port == port) { + BUG_TRAP(!hlist_empty(&tb->owners)); + if (tb->fastreuse >= 0) + goto next_port; + if (!__inet6_check_established(death_row, sk, port, &tw)) - goto ok; - goto next_port; - } - } + goto ok; + goto next_port; + } + } - tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, + tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, head, port); - if (!tb) { - spin_unlock(&head->lock); - break; - } - tb->fastreuse = -1; - goto ok; + if (!tb) { + spin_unlock(&head->lock); + break; + } + tb->fastreuse = -1; + goto ok; - next_port: - spin_unlock(&head->lock); - } - local_bh_enable(); + next_port: + spin_unlock(&head->lock); + } + local_bh_enable(); - return -EADDRNOTAVAIL; + return -EADDRNOTAVAIL; ok: hint += i; - /* Head lock still held and bh's disabled */ - inet_bind_hash(sk, tb, port); + /* Head lock still held and bh's disabled */ + inet_bind_hash(sk, tb, port); if (sk_unhashed(sk)) { - inet_sk(sk)->sport = htons(port); - __inet6_hash(hinfo, sk); - } - spin_unlock(&head->lock); + inet_sk(sk)->sport = htons(port); + __inet6_hash(hinfo, sk); + } + spin_unlock(&head->lock); - if (tw) { - inet_twsk_deschedule(tw, death_row); - inet_twsk_put(tw); - } + if (tw) { + inet_twsk_deschedule(tw, death_row); + inet_twsk_put(tw); + } ret = 0; goto out; - } + } - head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; - tb = inet_csk(sk)->icsk_bind_hash; + head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; + tb = inet_csk(sk)->icsk_bind_hash; spin_lock_bh(&head->lock); if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) { diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 827f884..f4d7be7 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -1,9 +1,9 @@ /* - * Linux INET6 implementation + * Linux INET6 implementation * Forwarding Information Database * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * $Id: ip6_fib.c,v 1.25 2001/10/31 21:55:55 davem Exp $ * @@ -97,7 +97,7 @@ static DEFINE_TIMER(ip6_fib_timer, fib6_run_gc, 0, 0); static struct fib6_walker_t fib6_walker_list = { .prev = &fib6_walker_list, - .next = &fib6_walker_list, + .next = &fib6_walker_list, }; #define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next) @@ -131,7 +131,7 @@ static __inline__ u32 fib6_new_sernum(void) /* * Auxiliary address test functions for the radix tree. * - * These assume a 32bit processor (although it will work on + * These assume a 32bit processor (although it will work on * 64bit processors) */ @@ -297,7 +297,7 @@ static int fib6_dump_node(struct fib6_walker_t *w) int res; struct rt6_info *rt; - for (rt = w->leaf; rt; rt = rt->u.next) { + for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) { res = rt6_dump_route(rt, w->args); if (res < 0) { /* Frame is full, suspend walking */ @@ -433,7 +433,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, struct fib6_node *pn = NULL; struct rt6key *key; int bit; - __be32 dir = 0; + __be32 dir = 0; __u32 sernum = fib6_new_sernum(); RT6_TRACE("fib6_add_1\n"); @@ -451,27 +451,27 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, if (plen < fn->fn_bit || !ipv6_prefix_equal(&key->addr, addr, fn->fn_bit)) goto insert_above; - + /* * Exact match ? */ - + if (plen == fn->fn_bit) { /* clean up an intermediate node */ if ((fn->fn_flags & RTN_RTINFO) == 0) { rt6_release(fn->leaf); fn->leaf = NULL; } - + fn->fn_sernum = sernum; - + return fn; } /* * We have more bits to go */ - + /* Try to walk down on tree. */ fn->fn_sernum = sernum; dir = addr_bit_set(addr, fn->fn_bit); @@ -489,7 +489,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, if (ln == NULL) return NULL; ln->fn_bit = plen; - + ln->parent = pn; ln->fn_sernum = sernum; @@ -503,7 +503,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, insert_above: /* - * split since we don't have a common prefix anymore or + * split since we don't have a common prefix anymore or * we have a less significant route. * we've to insert an intermediate node on the list * this new node will point to the one we need to create @@ -517,18 +517,18 @@ insert_above: See comment in __ipv6_addr_diff: bit may be an invalid value, but if it is >= plen, the value is ignored in any case. */ - + bit = __ipv6_addr_diff(addr, &key->addr, addrlen); - /* - * (intermediate)[in] + /* + * (intermediate)[in] * / \ * (new leaf node)[ln] (old node)[fn] */ if (plen > bit) { in = node_alloc(); ln = node_alloc(); - + if (in == NULL || ln == NULL) { if (in) node_free(in); @@ -537,8 +537,8 @@ insert_above: return NULL; } - /* - * new intermediate node. + /* + * new intermediate node. * RTN_RTINFO will * be off since that an address that chooses one of * the branches would not match less specific routes @@ -575,7 +575,7 @@ insert_above: } } else { /* plen <= bit */ - /* + /* * (new leaf node)[ln] * / \ * (old node)[fn] NULL @@ -591,7 +591,7 @@ insert_above: ln->parent = pn; ln->fn_sernum = sernum; - + if (dir) pn->right = ln; else @@ -623,11 +623,11 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, fn->leaf == &ip6_null_entry && !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){ fn->leaf = rt; - rt->u.next = NULL; + rt->u.dst.rt6_next = NULL; goto out; } - for (iter = fn->leaf; iter; iter=iter->u.next) { + for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) { /* * Search for duplicates */ @@ -655,7 +655,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, if (iter->rt6i_metric > rt->rt6i_metric) break; - ins = &iter->u.next; + ins = &iter->u.dst.rt6_next; } /* @@ -663,7 +663,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, */ out: - rt->u.next = iter; + rt->u.dst.rt6_next = iter; *ins = rt; rt->rt6i_node = fn; atomic_inc(&rt->rt6i_ref); @@ -1104,7 +1104,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, RT6_TRACE("fib6_del_route\n"); /* Unlink it */ - *rtp = rt->u.next; + *rtp = rt->u.dst.rt6_next; rt->rt6i_node = NULL; rt6_stats.fib_rt_entries--; rt6_stats.fib_discarded_routes++; @@ -1114,14 +1114,14 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, FOR_WALKERS(w) { if (w->state == FWS_C && w->leaf == rt) { RT6_TRACE("walker %p adjusted by delroute\n", w); - w->leaf = rt->u.next; + w->leaf = rt->u.dst.rt6_next; if (w->leaf == NULL) w->state = FWS_U; } } read_unlock(&fib6_walker_lock); - rt->u.next = NULL; + rt->u.dst.rt6_next = NULL; if (fn->leaf == NULL && fn->fn_flags&RTN_TL_ROOT) fn->leaf = &ip6_null_entry; @@ -1189,7 +1189,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info) * Walk the leaf entries looking for ourself */ - for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { + for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.dst.rt6_next) { if (*rtp == rt) { fib6_del_route(fn, rtp, info); return 0; @@ -1205,7 +1205,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info) * However, it is internally reenterable wrt itself and fib6_add/fib6_del. * It means, that we can modify tree during walking * and use this function for garbage collection, clone pruning, - * cleaning tree when a device goes down etc. etc. + * cleaning tree when a device goes down etc. etc. * * It guarantees that every node will be traversed, * and that it will be traversed only once. @@ -1244,7 +1244,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w) continue; } w->state = FWS_L; -#endif +#endif case FWS_L: if (fn->left) { w->node = fn->left; @@ -1316,7 +1316,7 @@ static int fib6_clean_node(struct fib6_walker_t *w) struct rt6_info *rt; struct fib6_cleaner_t *c = (struct fib6_cleaner_t*)w; - for (rt = w->leaf; rt; rt = rt->u.next) { + for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) { res = c->func(rt, c->arg); if (res < 0) { w->leaf = rt; @@ -1337,7 +1337,7 @@ static int fib6_clean_node(struct fib6_walker_t *w) /* * Convenient frontend to tree walker. - * + * * func is called on each route. * It may return -1 -> delete this route. * 0 -> continue walking diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 624fae2..1551ab3 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -228,10 +228,10 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, struct ipv6_txoptions * fopt) { struct ipv6_txoptions * fl_opt = fl->opt; - + if (fopt == NULL || fopt->opt_flen == 0) return fl_opt; - + if (fl_opt != NULL) { opt_space->hopopt = fl_opt->hopopt; opt_space->dst0opt = fl_opt->dst0opt; diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index ad0b8ab..4fdded0 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c @@ -1,6 +1,6 @@ /* * IPv6 input - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: * Pedro Roque <roque@di.fc.ul.pt> @@ -48,7 +48,7 @@ -inline int ip6_rcv_finish( struct sk_buff *skb) +inline int ip6_rcv_finish( struct sk_buff *skb) { if (skb->dst == NULL) ip6_route_input(skb); @@ -173,9 +173,9 @@ resubmit: hash = nexthdr & (MAX_INET_PROTOS - 1); if ((ipprot = rcu_dereference(inet6_protos[hash])) != NULL) { int ret; - + if (ipprot->flags & INET6_PROTO_FINAL) { - struct ipv6hdr *hdr; + struct ipv6hdr *hdr; /* Free reference early: we don't need it any more, and it may hold ip_conntrack module loaded @@ -192,9 +192,9 @@ resubmit: goto discard; } if (!(ipprot->flags & INET6_PROTO_NOPOLICY) && - !xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) + !xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) goto discard; - + ret = ipprot->handler(&skb); if (ret > 0) goto resubmit; @@ -205,8 +205,8 @@ resubmit: if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { IP6_INC_STATS_BH(idev, IPSTATS_MIB_INUNKNOWNPROTOS); icmpv6_send(skb, ICMPV6_PARAMPROB, - ICMPV6_UNK_NEXTHDR, nhoff, - skb->dev); + ICMPV6_UNK_NEXTHDR, nhoff, + skb->dev); } } else IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDELIVERS); @@ -253,7 +253,7 @@ int ip6_mc_input(struct sk_buff *skb) struct dst_entry *dst; dst = skb->dst; - + if (deliver) { skb2 = skb_clone(skb, GFP_ATOMIC); dst_output(skb2); diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 7b7bd44..3055169 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1,9 +1,9 @@ /* * IPv6 output functions - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * $Id: ip6_output.c,v 1.34 2002/02/01 22:01:04 davem Exp $ * @@ -363,7 +363,7 @@ int ip6_forward(struct sk_buff *skb) struct dst_entry *dst = skb->dst; struct ipv6hdr *hdr = skb->nh.ipv6h; struct inet6_skb_parm *opt = IP6CB(skb); - + if (ipv6_devconf.forwarding == 0) goto error; @@ -473,7 +473,7 @@ int ip6_forward(struct sk_buff *skb) hdr = skb->nh.ipv6h; /* Mangling hops number delayed to point after skb COW */ - + hdr->hop_limit--; IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS); @@ -659,7 +659,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); ip6_copy_metadata(frag, skb); } - + err = output(skb); if(!err) IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGCREATES); @@ -792,7 +792,7 @@ slow_path: fail: IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); - kfree_skb(skb); + kfree_skb(skb); return err; } @@ -955,7 +955,7 @@ static inline int ip6_ufo_append_data(struct sock *sk, struct frag_hdr fhdr; /* specify the length of each IP datagram fragment*/ - skb_shinfo(skb)->gso_size = mtu - fragheaderlen - + skb_shinfo(skb)->gso_size = mtu - fragheaderlen - sizeof(struct frag_hdr); skb_shinfo(skb)->gso_type = SKB_GSO_UDP; ipv6_select_ident(skb, &fhdr); @@ -1058,13 +1058,13 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, * fragment alignment (= 8-15 octects, in total). * * Note that we may need to "move" the data from the tail of - * of the buffer to the new fragment when we split + * of the buffer to the new fragment when we split * the message. * - * FIXME: It may be fragmented into multiple chunks + * FIXME: It may be fragmented into multiple chunks * at once if non-fragmentable extension headers * are too large. - * --yoshfuji + * --yoshfuji */ inet->cork.length += length; @@ -1129,7 +1129,7 @@ alloc_new_skb: /* * We just reserve space for fragment header. - * Note: this may be overallocation if the message + * Note: this may be overallocation if the message * (without MSG_MORE) fits into the MTU. */ alloclen += sizeof(struct frag_hdr); @@ -1310,7 +1310,7 @@ int ip6_push_pending_frames(struct sock *sk) ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst); skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr)); - + *(__be32*)hdr = fl->fl6_flowlabel | htonl(0x60000000 | ((int)np->cork.tclass << 20)); diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 2b9e3bb..367b748 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -3,7 +3,7 @@ * Linux INET6 implementation * * Authors: - * Ville Nuorvala <vnuorval@tcs.hut.fi> + * Ville Nuorvala <vnuorval@tcs.hut.fi> * * $Id$ * @@ -67,8 +67,8 @@ MODULE_LICENSE("GPL"); #define HASH_SIZE 32 #define HASH(addr) ((__force u32)((addr)->s6_addr32[0] ^ (addr)->s6_addr32[1] ^ \ - (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \ - (HASH_SIZE - 1)) + (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \ + (HASH_SIZE - 1)) static int ip6ip6_fb_tnl_dev_init(struct net_device *dev); static int ip6ip6_tnl_dev_init(struct net_device *dev); @@ -90,7 +90,7 @@ static inline struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t) { struct dst_entry *dst = t->dst_cache; - if (dst && dst->obsolete && + if (dst && dst->obsolete && dst->ops->check(dst, t->dst_cookie) == NULL) { t->dst_cache = NULL; dst_release(dst); @@ -116,12 +116,12 @@ static inline void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst) /** * ip6ip6_tnl_lookup - fetch tunnel matching the end-point addresses - * @remote: the address of the tunnel exit-point - * @local: the address of the tunnel entry-point + * @remote: the address of the tunnel exit-point + * @local: the address of the tunnel entry-point * - * Return: + * Return: * tunnel matching given end-points if found, - * else fallback tunnel if its device is up, + * else fallback tunnel if its device is up, * else %NULL **/ @@ -146,13 +146,13 @@ ip6ip6_tnl_lookup(struct in6_addr *remote, struct in6_addr *local) /** * ip6ip6_bucket - get head of list matching given tunnel parameters - * @p: parameters containing tunnel end-points + * @p: parameters containing tunnel end-points * * Description: - * ip6ip6_bucket() returns the head of the list matching the + * ip6ip6_bucket() returns the head of the list matching the * &struct in6_addr entries laddr and raddr in @p. * - * Return: head of IPv6 tunnel list + * Return: head of IPv6 tunnel list **/ static struct ip6_tnl ** @@ -213,8 +213,8 @@ ip6ip6_tnl_unlink(struct ip6_tnl *t) * * Description: * Create tunnel matching given parameters. - * - * Return: + * + * Return: * created tunnel or NULL **/ @@ -234,7 +234,7 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p) if (__dev_get_by_name(name) == NULL) break; } - if (i == IP6_TNL_MAX) + if (i == IP6_TNL_MAX) goto failed; } dev = alloc_netdev(sizeof (*t), name, ip6ip6_tnl_dev_setup); @@ -258,7 +258,7 @@ failed: /** * ip6ip6_tnl_locate - find or create tunnel matching given parameters - * @p: tunnel parameters + * @p: tunnel parameters * @create: != 0 if allowed to create new tunnel if no match found * * Description: @@ -289,7 +289,7 @@ static struct ip6_tnl *ip6ip6_tnl_locate(struct ip6_tnl_parm *p, int create) /** * ip6ip6_tnl_dev_uninit - tunnel device uninitializer * @dev: the device to be destroyed - * + * * Description: * ip6ip6_tnl_dev_uninit() removes tunnel from its list **/ @@ -314,8 +314,8 @@ ip6ip6_tnl_dev_uninit(struct net_device *dev) * parse_tvl_tnl_enc_lim - handle encapsulation limit option * @skb: received socket buffer * - * Return: - * 0 if none was found, + * Return: + * 0 if none was found, * else index to encapsulation limit **/ @@ -392,8 +392,8 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, __u16 len; int err = -ENOENT; - /* If the packet doesn't contain the original IPv6 header we are - in trouble since we might need the source address for further + /* If the packet doesn't contain the original IPv6 header we are + in trouble since we might need the source address for further processing of the error. */ read_lock(&ip6ip6_lock); @@ -418,7 +418,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, if (net_ratelimit()) printk(KERN_WARNING "%s: Too small hop limit or " - "routing loop in tunnel!\n", + "routing loop in tunnel!\n", t->parms.name); rel_msg = 1; } @@ -502,7 +502,7 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t) int ret = 0; if (p->flags & IP6_TNL_F_CAP_RCV) { - struct net_device *ldev = NULL; + struct net_device *ldev = NULL; if (p->link) ldev = dev_get_by_index(p->link); @@ -525,7 +525,7 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t) * Return: 0 **/ -static int +static int ip6ip6_rcv(struct sk_buff *skb) { struct ipv6hdr *ipv6h; @@ -595,13 +595,13 @@ static void init_tel_txopt(struct ipv6_tel_txoption *opt, __u8 encap_limit) /** * ip6ip6_tnl_addr_conflict - compare packet addresses to tunnel's own * @t: the outgoing tunnel device - * @hdr: IPv6 header from the incoming packet + * @hdr: IPv6 header from the incoming packet * * Description: - * Avoid trivial tunneling loop by checking that tunnel exit-point + * Avoid trivial tunneling loop by checking that tunnel exit-point * doesn't match source of incoming packet. * - * Return: + * Return: * 1 if conflict, * 0 else **/ @@ -617,7 +617,7 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t) struct ip6_tnl_parm *p = &t->parms; int ret = 0; - if (p->flags & IP6_TNL_F_CAP_XMIT) { + if (p->flags & IP6_TNL_F_CAP_XMIT) { struct net_device *ldev = NULL; if (p->link) @@ -641,19 +641,19 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t) return ret; } /** - * ip6ip6_tnl_xmit - encapsulate packet and send + * ip6ip6_tnl_xmit - encapsulate packet and send * @skb: the outgoing socket buffer - * @dev: the outgoing tunnel device + * @dev: the outgoing tunnel device * * Description: * Build new header and do some sanity checks on the packet before sending * it. * - * Return: + * Return: * 0 **/ -static int +static int ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) { struct ip6_tnl *t = netdev_priv(dev); @@ -715,7 +715,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) if (tdev == dev) { stats->collisions++; if (net_ratelimit()) - printk(KERN_WARNING + printk(KERN_WARNING "%s: Local routing loop detected!\n", t->parms.name); goto tx_err_dst_release; @@ -741,11 +741,11 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) * Okay, now see if we can stuff it in the buffer as-is. */ max_headroom += LL_RESERVED_SPACE(tdev); - - if (skb_headroom(skb) < max_headroom || + + if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) { struct sk_buff *new_skb; - + if (!(new_skb = skb_realloc_headroom(skb, max_headroom))) goto tx_err_dst_release; @@ -775,7 +775,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) ipv6_addr_copy(&ipv6h->daddr, &fl.fl6_dst); nf_reset(skb); pkt_len = skb->len; - err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, + err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output); if (net_xmit_eval(err) == 0) { @@ -898,14 +898,14 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p) } /** - * ip6ip6_tnl_ioctl - configure ipv6 tunnels from userspace + * ip6ip6_tnl_ioctl - configure ipv6 tunnels from userspace * @dev: virtual device associated with tunnel * @ifr: parameters passed from userspace * @cmd: command to be performed * * Description: - * ip6ip6_tnl_ioctl() is used for managing IPv6 tunnels - * from userspace. + * ip6ip6_tnl_ioctl() is used for managing IPv6 tunnels + * from userspace. * * The possible commands are the following: * %SIOCGETTUNNEL: get tunnel parameters for device @@ -913,7 +913,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p) * %SIOCCHGTUNNEL: change tunnel parameters to those given * %SIOCDELTUNNEL: delete tunnel * - * The fallback device "ip6tnl0", created during module + * The fallback device "ip6tnl0", created during module * initialization, can be used for creating other tunnel devices. * * Return: @@ -1009,7 +1009,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) } /** - * ip6ip6_tnl_get_stats - return the stats for tunnel device + * ip6ip6_tnl_get_stats - return the stats for tunnel device * @dev: virtual device associated with tunnel * * Return: stats for device @@ -1102,7 +1102,7 @@ ip6ip6_tnl_dev_init(struct net_device *dev) * Return: 0 **/ -static int +static int ip6ip6_fb_tnl_dev_init(struct net_device *dev) { struct ip6_tnl *t = netdev_priv(dev); diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 511730b..5724ba9 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c @@ -9,25 +9,25 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* +/* * [Memo] * * Outbound: - * The compression of IP datagram MUST be done before AH/ESP processing, - * fragmentation, and the addition of Hop-by-Hop/Routing header. + * The compression of IP datagram MUST be done before AH/ESP processing, + * fragmentation, and the addition of Hop-by-Hop/Routing header. * * Inbound: - * The decompression of IP datagram MUST be done after the reassembly, + * The decompression of IP datagram MUST be done after the reassembly, * AH/ESP processing. */ #include <linux/module.h> @@ -176,7 +176,7 @@ out_ok: } static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, - int type, int code, int offset, __be32 info) + int type, int code, int offset, __be32 info) { __be32 spi; struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; @@ -422,7 +422,7 @@ static int ipcomp6_init_state(struct xfrm_state *x) x->props.header_len = 0; if (x->props.mode == XFRM_MODE_TUNNEL) x->props.header_len += sizeof(struct ipv6hdr); - + mutex_lock(&ipcomp6_resource_mutex); if (!ipcomp6_alloc_scratches()) goto error; @@ -455,7 +455,7 @@ error: goto out; } -static struct xfrm_type ipcomp6_type = +static struct xfrm_type ipcomp6_type = { .description = "IPCOMP6", .owner = THIS_MODULE, @@ -467,7 +467,7 @@ static struct xfrm_type ipcomp6_type = .hdr_offset = xfrm6_find_1stfragopt, }; -static struct inet6_protocol ipcomp6_protocol = +static struct inet6_protocol ipcomp6_protocol = { .handler = xfrm6_rcv, .err_handler = ipcomp6_err, @@ -490,7 +490,7 @@ static int __init ipcomp6_init(void) static void __exit ipcomp6_fini(void) { - if (inet6_del_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) + if (inet6_del_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) printk(KERN_INFO "ipv6 ipcomp close: can't remove protocol\n"); if (xfrm_unregister_type(&ipcomp6_type, AF_INET6) < 0) printk(KERN_INFO "ipv6 ipcomp close: can't remove xfrm type\n"); diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 352690e..3f1e779 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -1,9 +1,9 @@ /* * IPv6 BSD socket options interface - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * Based on linux/net/ipv4/ip_sockglue.c * @@ -164,7 +164,7 @@ out: } static struct packet_type ipv6_packet_type = { - .type = __constant_htons(ETH_P_IPV6), + .type = __constant_htons(ETH_P_IPV6), .func = ipv6_rcv, .gso_send_check = ipv6_gso_send_check, .gso_segment = ipv6_gso_segment, @@ -320,7 +320,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, np->rxopt.bits.rxinfo = valbool; retv = 0; break; - + case IPV6_2292PKTINFO: np->rxopt.bits.rxoinfo = valbool; retv = 0; @@ -376,7 +376,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, np->tclass = val; retv = 0; break; - + case IPV6_RECVTCLASS: np->rxopt.bits.rxtclass = valbool; retv = 0; @@ -893,7 +893,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, case IPV6_MTU: { struct dst_entry *dst; - val = 0; + val = 0; lock_sock(sk); dst = sk_dst_get(sk); if (dst) { diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index e3ec216..c9db5bc 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1,13 +1,13 @@ /* * Multicast support for IPv6 - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * $Id: mcast.c,v 1.40 2002/02/08 03:57:19 davem Exp $ * - * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c + * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -644,7 +644,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, memset(&ss, 0, sizeof(ss)); psin6->sin6_family = AF_INET6; psin6->sin6_addr = psl->sl_addr[i]; - if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss))) + if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss))) return -EFAULT; } return 0; @@ -1168,7 +1168,7 @@ int igmp6_event_query(struct sk_buff *skb) /* compute payload length excluding extension headers */ len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr); - len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h; + len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h; /* Drop queries with not link local source */ if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL)) @@ -1206,7 +1206,7 @@ int igmp6_event_query(struct sk_buff *skb) /* clear deleted report items */ mld_clear_delrec(idev); } else if (len >= 28) { - int srcs_offset = sizeof(struct mld2_query) - + int srcs_offset = sizeof(struct mld2_query) - sizeof(struct icmp6hdr); if (!pskb_may_pull(skb, srcs_offset)) { in6_dev_put(idev); @@ -1230,7 +1230,7 @@ int igmp6_event_query(struct sk_buff *skb) } /* mark sources to include, if group & source-specific */ if (mlh2->nsrcs != 0) { - if (!pskb_may_pull(skb, srcs_offset + + if (!pskb_may_pull(skb, srcs_offset + ntohs(mlh2->nsrcs) * sizeof(struct in6_addr))) { in6_dev_put(idev); return -EINVAL; @@ -1304,7 +1304,7 @@ int igmp6_event_report(struct sk_buff *skb) /* Drop reports with not link local source */ addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr); - if (addr_type != IPV6_ADDR_ANY && + if (addr_type != IPV6_ADDR_ANY && !(addr_type&IPV6_ADDR_LINKLOCAL)) return -EINVAL; @@ -1413,7 +1413,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) if (ipv6_get_lladdr(dev, &addr_buf)) { /* <draft-ietf-magma-mld-source-05.txt>: - * use unspecified address as the source address + * use unspecified address as the source address * when a valid link-local address is not available. */ memset(&addr_buf, 0, sizeof(addr_buf)); @@ -1454,7 +1454,7 @@ static inline int mld_dev_queue_xmit2(struct sk_buff *skb) static inline int mld_dev_queue_xmit(struct sk_buff *skb) { return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev, - mld_dev_queue_xmit2); + mld_dev_queue_xmit2); } static void mld_sendpack(struct sk_buff *skb) @@ -1754,8 +1754,8 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) { struct sock *sk = igmp6_socket->sk; struct inet6_dev *idev; - struct sk_buff *skb; - struct icmp6hdr *hdr; + struct sk_buff *skb; + struct icmp6hdr *hdr; struct in6_addr *snd_addr; struct in6_addr *addrp; struct in6_addr addr_buf; @@ -1793,7 +1793,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) if (ipv6_get_lladdr(dev, &addr_buf)) { /* <draft-ietf-magma-mld-source-05.txt>: - * use unspecified address as the source address + * use unspecified address as the source address * when a valid link-local address is not available. */ memset(&addr_buf, 0, sizeof(addr_buf)); @@ -2330,7 +2330,7 @@ static inline struct ifmcaddr6 *igmp6_mc_get_first(struct seq_file *seq) struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); for (state->dev = dev_base, state->idev = NULL; - state->dev; + state->dev; state->dev = state->dev->next) { struct inet6_dev *idev; idev = in6_dev_get(state->dev); @@ -2413,7 +2413,7 @@ static int igmp6_mc_seq_show(struct seq_file *seq, void *v) struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); seq_printf(seq, - "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n", + "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n", state->dev->ifindex, state->dev->name, NIP6(im->mca_addr), im->mca_users, im->mca_flags, @@ -2474,7 +2474,7 @@ static inline struct ip6_sf_list *igmp6_mcf_get_first(struct seq_file *seq) struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); for (state->dev = dev_base, state->idev = NULL, state->im = NULL; - state->dev; + state->dev; state->dev = state->dev->next) { struct inet6_dev *idev; idev = in6_dev_get(state->dev); @@ -2579,7 +2579,7 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v) struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); if (v == SEQ_START_TOKEN) { - seq_printf(seq, + seq_printf(seq, "%3s %6s " "%32s %32s %6s %6s\n", "Idx", "Device", "Multicast Address", @@ -2608,7 +2608,7 @@ static int igmp6_mcf_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct igmp6_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 681bb07..0afcabd 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c @@ -333,7 +333,7 @@ static struct xfrm_type mip6_destopt_type = .destructor = mip6_destopt_destroy, .input = mip6_destopt_input, .output = mip6_destopt_output, - .reject = mip6_destopt_reject, + .reject = mip6_destopt_reject, .hdr_offset = mip6_destopt_offset, .local_addr = mip6_xfrm_addr, }; diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 39bb658..121f31c 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1,9 +1,9 @@ /* * Neighbour Discovery for IPv6 - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * Mike Shaver <shaver@ingenia.com> * * This program is free software; you can redistribute it and/or @@ -427,25 +427,25 @@ static inline void ndisc_flow_init(struct flowi *fl, u8 type, static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, struct in6_addr *daddr, struct in6_addr *solicited_addr, - int router, int solicited, int override, int inc_opt) + int router, int solicited, int override, int inc_opt) { struct in6_addr tmpaddr; struct inet6_ifaddr *ifp; struct inet6_dev *idev; struct flowi fl; struct dst_entry* dst; - struct sock *sk = ndisc_socket->sk; + struct sock *sk = ndisc_socket->sk; struct in6_addr *src_addr; - struct nd_msg *msg; - int len; - struct sk_buff *skb; + struct nd_msg *msg; + int len; + struct sk_buff *skb; int err; len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr); /* for anycast or proxy, solicited_addr != src_addr */ ifp = ipv6_get_ifaddr(solicited_addr, dev, 1); - if (ifp) { + if (ifp) { src_addr = solicited_addr; in6_ifa_put(ifp); } else { @@ -479,7 +479,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, if (skb == NULL) { ND_PRINTK0(KERN_ERR - "ICMPv6 NA: %s() failed to allocate an skb.\n", + "ICMPv6 NA: %s() failed to allocate an skb.\n", __FUNCTION__); dst_release(dst); return; @@ -491,16 +491,16 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, msg = (struct nd_msg *)skb_put(skb, len); skb->h.raw = (unsigned char*)msg; - msg->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; - msg->icmph.icmp6_code = 0; - msg->icmph.icmp6_cksum = 0; + msg->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; + msg->icmph.icmp6_code = 0; + msg->icmph.icmp6_cksum = 0; - msg->icmph.icmp6_unused = 0; - msg->icmph.icmp6_router = router; - msg->icmph.icmp6_solicited = solicited; - msg->icmph.icmp6_override = override; + msg->icmph.icmp6_unused = 0; + msg->icmph.icmp6_router = router; + msg->icmph.icmp6_solicited = solicited; + msg->icmph.icmp6_override = override; - /* Set the target address. */ + /* Set the target address. */ ipv6_addr_copy(&msg->target, solicited_addr); if (inc_opt) @@ -508,9 +508,9 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, dev->addr_len, dev->type); /* checksum */ - msg->icmph.icmp6_cksum = csum_ipv6_magic(src_addr, daddr, len, + msg->icmph.icmp6_cksum = csum_ipv6_magic(src_addr, daddr, len, IPPROTO_ICMPV6, - csum_partial((__u8 *) msg, + csum_partial((__u8 *) msg, len, 0)); skb->dst = dst; @@ -524,20 +524,20 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, if (likely(idev != NULL)) in6_dev_put(idev); -} +} void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, struct in6_addr *solicit, - struct in6_addr *daddr, struct in6_addr *saddr) + struct in6_addr *daddr, struct in6_addr *saddr) { struct flowi fl; struct dst_entry* dst; struct inet6_dev *idev; - struct sock *sk = ndisc_socket->sk; - struct sk_buff *skb; - struct nd_msg *msg; + struct sock *sk = ndisc_socket->sk; + struct sk_buff *skb; + struct nd_msg *msg; struct in6_addr addr_buf; - int len; + int len; int err; int send_llinfo; @@ -569,7 +569,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, 1, &err); if (skb == NULL) { ND_PRINTK0(KERN_ERR - "ICMPv6 NA: %s() failed to allocate an skb.\n", + "ICMPv6 NA: %s() failed to allocate an skb.\n", __FUNCTION__); dst_release(dst); return; @@ -594,9 +594,9 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, /* checksum */ msg->icmph.icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, - daddr, len, + daddr, len, IPPROTO_ICMPV6, - csum_partial((__u8 *) msg, + csum_partial((__u8 *) msg, len, 0)); /* send it! */ skb->dst = dst; @@ -619,10 +619,10 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, struct dst_entry* dst; struct inet6_dev *idev; struct sock *sk = ndisc_socket->sk; - struct sk_buff *skb; - struct icmp6hdr *hdr; + struct sk_buff *skb; + struct icmp6hdr *hdr; __u8 * opt; - int len; + int len; int err; ndisc_flow_init(&fl, NDISC_ROUTER_SOLICITATION, saddr, daddr, @@ -640,13 +640,13 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, if (dev->addr_len) len += ndisc_opt_addr_space(dev); - skb = sock_alloc_send_skb(sk, + skb = sock_alloc_send_skb(sk, (MAX_HEADER + sizeof(struct ipv6hdr) + len + LL_RESERVED_SPACE(dev)), 1, &err); if (skb == NULL) { ND_PRINTK0(KERN_ERR - "ICMPv6 RS: %s() failed to allocate an skb.\n", + "ICMPv6 RS: %s() failed to allocate an skb.\n", __FUNCTION__); dst_release(dst); return; @@ -655,12 +655,12 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, skb_reserve(skb, LL_RESERVED_SPACE(dev)); ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); - hdr = (struct icmp6hdr *)skb_put(skb, len); - skb->h.raw = (unsigned char*)hdr; - hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; - hdr->icmp6_code = 0; - hdr->icmp6_cksum = 0; - hdr->icmp6_unused = 0; + hdr = (struct icmp6hdr *)skb_put(skb, len); + skb->h.raw = (unsigned char*)hdr; + hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; + hdr->icmp6_code = 0; + hdr->icmp6_cksum = 0; + hdr->icmp6_unused = 0; opt = (u8*) (hdr + 1); @@ -686,7 +686,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, if (likely(idev != NULL)) in6_dev_put(idev); } - + static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb) { @@ -748,7 +748,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) int is_router; if (ipv6_addr_is_multicast(&msg->target)) { - ND_PRINTK2(KERN_WARNING + ND_PRINTK2(KERN_WARNING "ICMPv6 NS: multicast target address"); return; } @@ -768,7 +768,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) } if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) { - ND_PRINTK2(KERN_WARNING + ND_PRINTK2(KERN_WARNING "ICMPv6 NS: invalid ND options\n"); return; } @@ -782,12 +782,12 @@ static void ndisc_recv_ns(struct sk_buff *skb) } /* RFC2461 7.1.1: - * If the IP source address is the unspecified address, - * there MUST NOT be source link-layer address option + * If the IP source address is the unspecified address, + * there MUST NOT be source link-layer address option * in the message. */ if (dad) { - ND_PRINTK2(KERN_WARNING + ND_PRINTK2(KERN_WARNING "ICMPv6 NS: bad DAD packet (link-layer address option)\n"); return; } @@ -816,7 +816,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) goto out; } } - addrconf_dad_failure(ifp); + addrconf_dad_failure(ifp); return; } @@ -829,7 +829,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) } if (ipv6_chk_acast_addr(dev, &msg->target) || - (idev->cnf.forwarding && + (idev->cnf.forwarding && (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) && (pneigh = pneigh_lookup(&nd_tbl, &msg->target, dev, 0)) != NULL)) { @@ -839,8 +839,8 @@ static void ndisc_recv_ns(struct sk_buff *skb) idev->nd_parms->proxy_delay != 0) { /* * for anycast or proxy, - * sender should delay its response - * by a random time between 0 and + * sender should delay its response + * by a random time between 0 and * MAX_ANYCAST_DELAY_TIME seconds. * (RFC2461) -- yoshfuji */ @@ -869,14 +869,14 @@ static void ndisc_recv_ns(struct sk_buff *skb) else NEIGH_CACHE_STAT_INC(&nd_tbl, rcv_probes_ucast); - /* + /* * update / create cache entry * for the source address */ neigh = __neigh_lookup(&nd_tbl, saddr, dev, !inc || lladdr || !dev->addr_len); if (neigh) - neigh_update(neigh, lladdr, NUD_STALE, + neigh_update(neigh, lladdr, NUD_STALE, NEIGH_UPDATE_F_WEAK_OVERRIDE| NEIGH_UPDATE_F_OVERRIDE); if (neigh || !dev->hard_header) { @@ -926,7 +926,7 @@ static void ndisc_recv_na(struct sk_buff *skb) "ICMPv6 NA: solicited NA is multicasted.\n"); return; } - + if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) { ND_PRINTK2(KERN_WARNING "ICMPv6 NS: invalid ND option\n"); @@ -1057,7 +1057,7 @@ out: static void ndisc_router_discovery(struct sk_buff *skb) { - struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw; + struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw; struct neighbour *neigh = NULL; struct inet6_dev *in6_dev; struct rt6_info *rt = NULL; @@ -1076,7 +1076,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) return; } if (optlen < 0) { - ND_PRINTK2(KERN_WARNING + ND_PRINTK2(KERN_WARNING "ICMPv6 RA: packet too short\n"); return; } @@ -1286,7 +1286,7 @@ skip_defrtr: rt6_mtu_change(skb->dev, mtu); } } - + if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) { ND_PRINTK2(KERN_WARNING "ICMPv6 RA: invalid RA options"); @@ -1339,7 +1339,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) if (ipv6_addr_equal(dest, target)) { on_link = 1; } else if (!(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { - ND_PRINTK2(KERN_WARNING + ND_PRINTK2(KERN_WARNING "ICMPv6 Redirect: target address is not link-local.\n"); return; } @@ -1352,11 +1352,11 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) return; } - /* RFC2461 8.1: + /* RFC2461 8.1: * The IP source address of the Redirect MUST be the same as the current * first-hop router for the specified ICMP Destination Address. */ - + if (!ndisc_parse_options((u8*)(dest + 1), optlen, &ndopts)) { ND_PRINTK2(KERN_WARNING "ICMPv6 Redirect: invalid ND options\n"); @@ -1410,8 +1410,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ND_PRINTK2(KERN_WARNING "ICMPv6 Redirect: no link-local address on %s\n", dev->name); - return; - } + return; + } if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) && !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { @@ -1507,7 +1507,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, * build redirect option and copy skb over to the new packet. */ - memset(opt, 0, 8); + memset(opt, 0, 8); *(opt++) = ND_OPT_REDIRECT_HDR; *(opt++) = (rd_len >> 3); opt += 6; @@ -1556,7 +1556,7 @@ int ndisc_rcv(struct sk_buff *skb) } if (msg->icmph.icmp6_code != 0) { - ND_PRINTK2(KERN_WARNING + ND_PRINTK2(KERN_WARNING "ICMPv6 NDISC: invalid ICMPv6 code: %d\n", msg->icmph.icmp6_code); return 0; @@ -1717,12 +1717,12 @@ int __init ndisc_init(struct net_proto_family *ops) { struct ipv6_pinfo *np; struct sock *sk; - int err; + int err; err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, &ndisc_socket); if (err < 0) { ND_PRINTK0(KERN_ERR - "ICMPv6 NDISC: Failed to initialize the control socket (err %d).\n", + "ICMPv6 NDISC: Failed to initialize the control socket (err %d).\n", err); ndisc_socket = NULL; /* For safety. */ return err; @@ -1736,14 +1736,14 @@ int __init ndisc_init(struct net_proto_family *ops) np->mc_loop = 0; sk->sk_prot->unhash(sk); - /* - * Initialize the neighbour table - */ - + /* + * Initialize the neighbour table + */ + neigh_table_init(&nd_tbl); #ifdef CONFIG_SYSCTL - neigh_sysctl_register(NULL, &nd_tbl.parms, NET_IPV6, NET_IPV6_NEIGH, + neigh_sysctl_register(NULL, &nd_tbl.parms, NET_IPV6, NET_IPV6_NEIGH, "ipv6", &ndisc_ifinfo_sysctl_change, &ndisc_ifinfo_sysctl_strategy); diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c index f6294e5..0b2d265 100644 --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c @@ -91,7 +91,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, if (hook != NF_IP6_PRE_ROUTING && hook != NF_IP6_LOCAL_IN) break; if (!csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, - skb->len - dataoff, protocol, + skb->len - dataoff, protocol, csum_sub(skb->csum, skb_checksum(skb, 0, dataoff, 0)))) { @@ -106,7 +106,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, protocol, csum_sub(0, skb_checksum(skb, 0, - dataoff, 0)))); + dataoff, 0)))); csum = __skb_checksum_complete(skb); } return csum; diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index d4d9f18..58847d3 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c @@ -95,7 +95,7 @@ __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data) list_for_each_prev(p, &queue_list) { struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p; - + if (!cmpfn || cmpfn(entry, data)) return entry; } @@ -127,7 +127,7 @@ static inline void __ipq_flush(int verdict) { struct ipq_queue_entry *entry; - + while ((entry = __ipq_find_dequeue_entry(NULL, 0))) ipq_issue_verdict(entry, verdict); } @@ -136,21 +136,21 @@ static inline int __ipq_set_mode(unsigned char mode, unsigned int range) { int status = 0; - + switch(mode) { case IPQ_COPY_NONE: case IPQ_COPY_META: copy_mode = mode; copy_range = 0; break; - + case IPQ_COPY_PACKET: copy_mode = mode; copy_range = range; if (copy_range > 0xFFFF) copy_range = 0xFFFF; break; - + default: status = -EINVAL; @@ -171,7 +171,7 @@ static struct ipq_queue_entry * ipq_find_dequeue_entry(ipq_cmpfn cmpfn, unsigned long data) { struct ipq_queue_entry *entry; - + write_lock_bh(&queue_lock); entry = __ipq_find_dequeue_entry(cmpfn, data); write_unlock_bh(&queue_lock); @@ -197,14 +197,14 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) struct nlmsghdr *nlh; read_lock_bh(&queue_lock); - + switch (copy_mode) { case IPQ_COPY_META: case IPQ_COPY_NONE: size = NLMSG_SPACE(sizeof(*pmsg)); data_len = 0; break; - + case IPQ_COPY_PACKET: if ((entry->skb->ip_summed == CHECKSUM_PARTIAL || entry->skb->ip_summed == CHECKSUM_COMPLETE) && @@ -216,10 +216,10 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) data_len = entry->skb->len; else data_len = copy_range; - + size = NLMSG_SPACE(sizeof(*pmsg) + data_len); break; - + default: *errp = -EINVAL; read_unlock_bh(&queue_lock); @@ -231,7 +231,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) skb = alloc_skb(size, GFP_ATOMIC); if (!skb) goto nlmsg_failure; - + old_tail= skb->tail; nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); pmsg = NLMSG_DATA(nlh); @@ -244,29 +244,29 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) pmsg->mark = entry->skb->mark; pmsg->hook = entry->info->hook; pmsg->hw_protocol = entry->skb->protocol; - + if (entry->info->indev) strcpy(pmsg->indev_name, entry->info->indev->name); else pmsg->indev_name[0] = '\0'; - + if (entry->info->outdev) strcpy(pmsg->outdev_name, entry->info->outdev->name); else pmsg->outdev_name[0] = '\0'; - + if (entry->info->indev && entry->skb->dev) { pmsg->hw_type = entry->skb->dev->type; if (entry->skb->dev->hard_header_parse) pmsg->hw_addrlen = entry->skb->dev->hard_header_parse(entry->skb, - pmsg->hw_addr); + pmsg->hw_addr); } - + if (data_len) if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len)) BUG(); - + nlh->nlmsg_len = skb->tail - old_tail; return skb; @@ -279,7 +279,7 @@ nlmsg_failure: } static int -ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, +ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, unsigned int queuenum, void *data) { int status = -EINVAL; @@ -301,37 +301,37 @@ ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, nskb = ipq_build_packet_message(entry, &status); if (nskb == NULL) goto err_out_free; - + write_lock_bh(&queue_lock); - + if (!peer_pid) - goto err_out_free_nskb; + goto err_out_free_nskb; if (queue_total >= queue_maxlen) { - queue_dropped++; + queue_dropped++; status = -ENOSPC; if (net_ratelimit()) - printk (KERN_WARNING "ip6_queue: fill at %d entries, " + printk (KERN_WARNING "ip6_queue: fill at %d entries, " "dropping packet(s). Dropped: %d\n", queue_total, queue_dropped); goto err_out_free_nskb; } - /* netlink_unicast will either free the nskb or attach it to a socket */ + /* netlink_unicast will either free the nskb or attach it to a socket */ status = netlink_unicast(ipqnl, nskb, peer_pid, MSG_DONTWAIT); if (status < 0) { - queue_user_dropped++; + queue_user_dropped++; goto err_out_unlock; } - + __ipq_enqueue_entry(entry); write_unlock_bh(&queue_lock); return status; - + err_out_free_nskb: - kfree_skb(nskb); - + kfree_skb(nskb); + err_out_unlock: write_unlock_bh(&queue_lock); @@ -357,11 +357,11 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) return -EINVAL; if (diff > skb_tailroom(e->skb)) { struct sk_buff *newskb; - + newskb = skb_copy_expand(e->skb, - skb_headroom(e->skb), - diff, - GFP_ATOMIC); + skb_headroom(e->skb), + diff, + GFP_ATOMIC); if (newskb == NULL) { printk(KERN_WARNING "ip6_queue: OOM " "in mangle, dropping packet\n"); @@ -401,11 +401,11 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len) return -ENOENT; else { int verdict = vmsg->value; - + if (vmsg->data_len && vmsg->data_len == len) if (ipq_mangle_ipv6(vmsg, entry) < 0) verdict = NF_DROP; - + ipq_issue_verdict(entry, verdict); return 0; } @@ -424,7 +424,7 @@ ipq_set_mode(unsigned char mode, unsigned int range) static int ipq_receive_peer(struct ipq_peer_msg *pmsg, - unsigned char type, unsigned int len) + unsigned char type, unsigned int len) { int status = 0; @@ -434,15 +434,15 @@ ipq_receive_peer(struct ipq_peer_msg *pmsg, switch (type) { case IPQM_MODE: status = ipq_set_mode(pmsg->msg.mode.value, - pmsg->msg.mode.range); + pmsg->msg.mode.range); break; - + case IPQM_VERDICT: if (pmsg->msg.verdict.value > NF_MAX_VERDICT) status = -EINVAL; else status = ipq_set_verdict(&pmsg->msg.verdict, - len - sizeof(*pmsg)); + len - sizeof(*pmsg)); break; default: status = -EINVAL; @@ -456,7 +456,7 @@ dev_cmp(struct ipq_queue_entry *entry, unsigned long ifindex) if (entry->info->indev) if (entry->info->indev->ifindex == ifindex) return 1; - + if (entry->info->outdev) if (entry->info->outdev->ifindex == ifindex) return 1; @@ -468,7 +468,7 @@ static void ipq_dev_drop(int ifindex) { struct ipq_queue_entry *entry; - + while ((entry = ipq_find_dequeue_entry(dev_cmp, ifindex)) != NULL) ipq_issue_verdict(entry, NF_DROP); } @@ -492,25 +492,25 @@ ipq_rcv_skb(struct sk_buff *skb) pid = nlh->nlmsg_pid; flags = nlh->nlmsg_flags; - + if(pid <= 0 || !(flags & NLM_F_REQUEST) || flags & NLM_F_MULTI) RCV_SKB_FAIL(-EINVAL); - + if (flags & MSG_TRUNC) RCV_SKB_FAIL(-ECOMM); - + type = nlh->nlmsg_type; if (type < NLMSG_NOOP || type >= IPQM_MAX) RCV_SKB_FAIL(-EINVAL); - + if (type <= IPQM_BASE) return; - + if (security_netlink_recv(skb, CAP_NET_ADMIN)) - RCV_SKB_FAIL(-EPERM); + RCV_SKB_FAIL(-EPERM); write_lock_bh(&queue_lock); - + if (peer_pid) { if (peer_pid != pid) { write_unlock_bh(&queue_lock); @@ -520,17 +520,17 @@ ipq_rcv_skb(struct sk_buff *skb) net_enable_timestamp(); peer_pid = pid; } - + write_unlock_bh(&queue_lock); - + status = ipq_receive_peer(NLMSG_DATA(nlh), type, - nlmsglen - NLMSG_LENGTH(0)); + nlmsglen - NLMSG_LENGTH(0)); if (status < 0) RCV_SKB_FAIL(status); - + if (flags & NLM_F_ACK) netlink_ack(skb, nlh, 0); - return; + return; } static void @@ -540,19 +540,19 @@ ipq_rcv_sk(struct sock *sk, int len) unsigned int qlen; mutex_lock(&ipqnl_mutex); - + for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { skb = skb_dequeue(&sk->sk_receive_queue); ipq_rcv_skb(skb); kfree_skb(skb); } - + mutex_unlock(&ipqnl_mutex); } static int ipq_rcv_dev_event(struct notifier_block *this, - unsigned long event, void *ptr) + unsigned long event, void *ptr) { struct net_device *dev = ptr; @@ -568,7 +568,7 @@ static struct notifier_block ipq_dev_notifier = { static int ipq_rcv_nl_event(struct notifier_block *this, - unsigned long event, void *ptr) + unsigned long event, void *ptr) { struct netlink_notify *n = ptr; @@ -597,7 +597,7 @@ static ctl_table ipq_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { .ctl_name = 0 } + { .ctl_name = 0 } }; static ctl_table ipq_dir_table[] = { @@ -627,25 +627,25 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length) int len; read_lock_bh(&queue_lock); - + len = sprintf(buffer, - "Peer PID : %d\n" - "Copy mode : %hu\n" - "Copy range : %u\n" - "Queue length : %u\n" - "Queue max. length : %u\n" + "Peer PID : %d\n" + "Copy mode : %hu\n" + "Copy range : %u\n" + "Queue length : %u\n" + "Queue max. length : %u\n" "Queue dropped : %u\n" "Netfilter dropped : %u\n", - peer_pid, - copy_mode, - copy_range, - queue_total, - queue_maxlen, + peer_pid, + copy_mode, + copy_range, + queue_total, + queue_maxlen, queue_dropped, queue_user_dropped); read_unlock_bh(&queue_lock); - + *start = buffer + offset; len -= offset; if (len > length) @@ -665,10 +665,10 @@ static int __init ip6_queue_init(void) { int status = -ENOMEM; struct proc_dir_entry *proc; - + netlink_register_notifier(&ipq_nl_notifier); ipqnl = netlink_kernel_create(NETLINK_IP6_FW, 0, ipq_rcv_sk, - THIS_MODULE); + THIS_MODULE); if (ipqnl == NULL) { printk(KERN_ERR "ip6_queue: failed to create netlink socket\n"); goto cleanup_netlink_notifier; @@ -681,10 +681,10 @@ static int __init ip6_queue_init(void) printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); goto cleanup_ipqnl; } - + register_netdevice_notifier(&ipq_dev_notifier); ipq_sysctl_header = register_sysctl_table(ipq_root_table, 0); - + status = nf_register_queue_handler(PF_INET6, &nfqh); if (status < 0) { printk(KERN_ERR "ip6_queue: failed to register queue handler\n"); @@ -696,12 +696,12 @@ cleanup_sysctl: unregister_sysctl_table(ipq_sysctl_header); unregister_netdevice_notifier(&ipq_dev_notifier); proc_net_remove(IPQ_PROC_FS_NAME); - + cleanup_ipqnl: sock_release(ipqnl->sk_socket); mutex_lock(&ipqnl_mutex); mutex_unlock(&ipqnl_mutex); - + cleanup_netlink_notifier: netlink_unregister_notifier(&ipq_nl_notifier); return status; diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 7083e1c..7c512e1 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c @@ -92,16 +92,16 @@ do { \ #endif /* Check for an extension */ -int +int ip6t_ext_hdr(u8 nexthdr) { - return ( (nexthdr == IPPROTO_HOPOPTS) || - (nexthdr == IPPROTO_ROUTING) || - (nexthdr == IPPROTO_FRAGMENT) || - (nexthdr == IPPROTO_ESP) || - (nexthdr == IPPROTO_AH) || - (nexthdr == IPPROTO_NONE) || - (nexthdr == IPPROTO_DSTOPTS) ); + return ( (nexthdr == IPPROTO_HOPOPTS) || + (nexthdr == IPPROTO_ROUTING) || + (nexthdr == IPPROTO_FRAGMENT) || + (nexthdr == IPPROTO_ESP) || + (nexthdr == IPPROTO_AH) || + (nexthdr == IPPROTO_NONE) || + (nexthdr == IPPROTO_DSTOPTS) ); } /* Returns whether matches rule or not. */ @@ -120,9 +120,9 @@ ip6_packet_match(const struct sk_buff *skb, #define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg)) if (FWINV(ipv6_masked_addr_cmp(&ipv6->saddr, &ip6info->smsk, - &ip6info->src), IP6T_INV_SRCIP) + &ip6info->src), IP6T_INV_SRCIP) || FWINV(ipv6_masked_addr_cmp(&ipv6->daddr, &ip6info->dmsk, - &ip6info->dst), IP6T_INV_DSTIP)) { + &ip6info->dst), IP6T_INV_DSTIP)) { dprintf("Source or dest mismatch.\n"); /* dprintf("SRC: %u. Mask: %u. Target: %u.%s\n", ip->saddr, @@ -177,7 +177,7 @@ ip6_packet_match(const struct sk_buff *skb, *fragoff = _frag_off; dprintf("Packet protocol %hi ?= %s%hi.\n", - protohdr, + protohdr, ip6info->invflags & IP6T_INV_PROTO ? "!":"", ip6info->proto); @@ -197,7 +197,7 @@ ip6_packet_match(const struct sk_buff *skb, } /* should be ip6 safe */ -static inline int +static inline int ip6_checkentry(const struct ip6t_ip6 *ipv6) { if (ipv6->flags & ~IP6T_F_MASK) { @@ -337,7 +337,7 @@ ip6t_do_table(struct sk_buff **pskb, e = get_entry(table_base, v); } else { /* Targets which reenter must return - abs. verdicts */ + abs. verdicts */ #ifdef CONFIG_NETFILTER_DEBUG ((struct ip6t_entry *)table_base)->comefrom = 0xeeeeeeec; @@ -534,10 +534,10 @@ check_match(struct ip6t_entry_match *m, int ret; match = try_then_request_module(xt_find_match(AF_INET6, m->u.user.name, - m->u.user.revision), + m->u.user.revision), "ip6t_%s", m->u.user.name); if (IS_ERR(match) || !match) { - duprintf("check_match: `%s' not found\n", m->u.user.name); + duprintf("check_match: `%s' not found\n", m->u.user.name); return match ? PTR_ERR(match) : -ENOENT; } m->u.kernel.match = match; @@ -661,7 +661,7 @@ check_entry_size_and_hooks(struct ip6t_entry *e, } /* FIXME: underflows must be unconditional, standard verdicts - < 0 (not IP6T_RETURN). --RR */ + < 0 (not IP6T_RETURN). --RR */ /* Clear counters and comefrom */ e->counters = ((struct xt_counters) { 0, 0 }); @@ -1003,8 +1003,8 @@ do_replace(void __user *user, unsigned int len) /* Update module usage count based on number of rules */ duprintf("do_replace: oldnum=%u, initnum=%u, newnum=%u\n", oldinfo->number, oldinfo->initial_entries, newinfo->number); - if ((oldinfo->number > oldinfo->initial_entries) || - (newinfo->number <= oldinfo->initial_entries)) + if ((oldinfo->number > oldinfo->initial_entries) || + (newinfo->number <= oldinfo->initial_entries)) module_put(t->me); if ((oldinfo->number > oldinfo->initial_entries) && (newinfo->number <= oldinfo->initial_entries)) @@ -1492,9 +1492,9 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, } hdrlen = 8; } else if (nexthdr == NEXTHDR_AUTH) - hdrlen = (hp->hdrlen + 2) << 2; + hdrlen = (hp->hdrlen + 2) << 2; else - hdrlen = ipv6_optlen(hp); + hdrlen = ipv6_optlen(hp); nexthdr = hp->nexthdr; len -= hdrlen; diff --git a/net/ipv6/netfilter/ip6t_HL.c b/net/ipv6/netfilter/ip6t_HL.c index 04e5001..ccbab66 100644 --- a/net/ipv6/netfilter/ip6t_HL.c +++ b/net/ipv6/netfilter/ip6t_HL.c @@ -1,4 +1,4 @@ -/* +/* * Hop Limit modification target for ip6tables * Maciej Soltysiak <solt@dns.toxicfilms.tv> * Based on HW's TTL module @@ -18,7 +18,7 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>"); MODULE_DESCRIPTION("IP6 tables Hop Limit modification module"); MODULE_LICENSE("GPL"); -static unsigned int ip6t_hl_target(struct sk_buff **pskb, +static unsigned int ip6t_hl_target(struct sk_buff **pskb, const struct net_device *in, const struct net_device *out, unsigned int hooknum, @@ -67,7 +67,7 @@ static int ip6t_hl_checkentry(const char *tablename, struct ip6t_HL_info *info = targinfo; if (info->mode > IP6T_HL_MAXMODE) { - printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n", + printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n", info->mode); return 0; } @@ -80,12 +80,12 @@ static int ip6t_hl_checkentry(const char *tablename, } static struct xt_target ip6t_HL = { - .name = "HL", + .name = "HL", .family = AF_INET6, - .target = ip6t_hl_target, + .target = ip6t_hl_target, .targetsize = sizeof(struct ip6t_HL_info), .table = "mangle", - .checkentry = ip6t_hl_checkentry, + .checkentry = ip6t_hl_checkentry, .me = THIS_MODULE }; diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index 5587a77..dc9ec93 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c @@ -145,7 +145,7 @@ static void dump_packet(const struct nf_loginfo *info, &_ahdr); if (ah == NULL) { /* - * Max length: 26 "INCOMPLETE [65535 + * Max length: 26 "INCOMPLETE [65535 * bytes] )" */ printk("INCOMPLETE [%u bytes] )", @@ -387,7 +387,7 @@ ip6t_log_packet(unsigned int pf, loginfo = &default_loginfo; spin_lock_bh(&log_lock); - printk("<%d>%sIN=%s OUT=%s ", loginfo->u.log.level, + printk("<%d>%sIN=%s OUT=%s ", loginfo->u.log.level, prefix, in ? in->name : "", out ? out->name : ""); @@ -442,7 +442,7 @@ ip6t_log_target(struct sk_buff **pskb, li.u.log.logflags = loginfo->logflags; ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, - loginfo->prefix); + loginfo->prefix); return XT_CONTINUE; } @@ -470,9 +470,9 @@ static int ip6t_log_checkentry(const char *tablename, static struct xt_target ip6t_log_reg = { .name = "LOG", .family = AF_INET6, - .target = ip6t_log_target, + .target = ip6t_log_target, .targetsize = sizeof(struct ip6t_log_info), - .checkentry = ip6t_log_checkentry, + .checkentry = ip6t_log_checkentry, .me = THIS_MODULE, }; diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index 278349c..6abee94 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c @@ -189,23 +189,23 @@ static unsigned int reject6_target(struct sk_buff **pskb, /* WARNING: This code causes reentry within ip6tables. This means that the ip6tables jump stack is now crap. We must return an absolute verdict. --RR */ - switch (reject->with) { - case IP6T_ICMP6_NO_ROUTE: - send_unreach(*pskb, ICMPV6_NOROUTE, hooknum); - break; - case IP6T_ICMP6_ADM_PROHIBITED: - send_unreach(*pskb, ICMPV6_ADM_PROHIBITED, hooknum); - break; - case IP6T_ICMP6_NOT_NEIGHBOUR: - send_unreach(*pskb, ICMPV6_NOT_NEIGHBOUR, hooknum); - break; - case IP6T_ICMP6_ADDR_UNREACH: - send_unreach(*pskb, ICMPV6_ADDR_UNREACH, hooknum); - break; - case IP6T_ICMP6_PORT_UNREACH: - send_unreach(*pskb, ICMPV6_PORT_UNREACH, hooknum); - break; - case IP6T_ICMP6_ECHOREPLY: + switch (reject->with) { + case IP6T_ICMP6_NO_ROUTE: + send_unreach(*pskb, ICMPV6_NOROUTE, hooknum); + break; + case IP6T_ICMP6_ADM_PROHIBITED: + send_unreach(*pskb, ICMPV6_ADM_PROHIBITED, hooknum); + break; + case IP6T_ICMP6_NOT_NEIGHBOUR: + send_unreach(*pskb, ICMPV6_NOT_NEIGHBOUR, hooknum); + break; + case IP6T_ICMP6_ADDR_UNREACH: + send_unreach(*pskb, ICMPV6_ADDR_UNREACH, hooknum); + break; + case IP6T_ICMP6_PORT_UNREACH: + send_unreach(*pskb, ICMPV6_PORT_UNREACH, hooknum); + break; + case IP6T_ICMP6_ECHOREPLY: /* Do nothing */ break; case IP6T_TCP_RESET: @@ -226,7 +226,7 @@ static int check(const char *tablename, void *targinfo, unsigned int hook_mask) { - const struct ip6t_reject_info *rejinfo = targinfo; + const struct ip6t_reject_info *rejinfo = targinfo; const struct ip6t_entry *e = entry; if (rejinfo->with == IP6T_ICMP6_ECHOREPLY) { diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c index 456c76a..d3c1543 100644 --- a/net/ipv6/netfilter/ip6t_ah.c +++ b/net/ipv6/netfilter/ip6t_ah.c @@ -78,13 +78,13 @@ match(const struct sk_buff *skb, DEBUGP("IPv6 AH spi %02X ", (spi_match(ahinfo->spis[0], ahinfo->spis[1], - ntohl(ah->spi), - !!(ahinfo->invflags & IP6T_AH_INV_SPI)))); + ntohl(ah->spi), + !!(ahinfo->invflags & IP6T_AH_INV_SPI)))); DEBUGP("len %02X %04X %02X ", ahinfo->hdrlen, hdrlen, (!ahinfo->hdrlen || - (ahinfo->hdrlen == hdrlen) ^ - !!(ahinfo->invflags & IP6T_AH_INV_LEN))); + (ahinfo->hdrlen == hdrlen) ^ + !!(ahinfo->invflags & IP6T_AH_INV_LEN))); DEBUGP("res %02X %04X %02X\n", ahinfo->hdrres, ah->reserved, !(ahinfo->hdrres && ah->reserved)); @@ -92,12 +92,12 @@ match(const struct sk_buff *skb, return (ah != NULL) && (spi_match(ahinfo->spis[0], ahinfo->spis[1], - ntohl(ah->spi), - !!(ahinfo->invflags & IP6T_AH_INV_SPI))) + ntohl(ah->spi), + !!(ahinfo->invflags & IP6T_AH_INV_SPI))) && (!ahinfo->hdrlen || - (ahinfo->hdrlen == hdrlen) ^ - !!(ahinfo->invflags & IP6T_AH_INV_LEN)) + (ahinfo->hdrlen == hdrlen) ^ + !!(ahinfo->invflags & IP6T_AH_INV_LEN)) && !(ahinfo->hdrres && ah->reserved); } @@ -105,10 +105,10 @@ match(const struct sk_buff *skb, /* Called when user tries to insert an entry of this type. */ static int checkentry(const char *tablename, - const void *entry, + const void *entry, const struct xt_match *match, - void *matchinfo, - unsigned int hook_mask) + void *matchinfo, + unsigned int hook_mask) { const struct ip6t_ah *ahinfo = matchinfo; diff --git a/net/ipv6/netfilter/ip6t_hl.c b/net/ipv6/netfilter/ip6t_hl.c index 601cc12..37c8a4d 100644 --- a/net/ipv6/netfilter/ip6t_hl.c +++ b/net/ipv6/netfilter/ip6t_hl.c @@ -41,7 +41,7 @@ static int match(const struct sk_buff *skb, return (ip6h->hop_limit > info->hop_limit); break; default: - printk(KERN_WARNING "ip6t_hl: unknown mode %d\n", + printk(KERN_WARNING "ip6t_hl: unknown mode %d\n", info->mode); return 0; } diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c index 26ac084..700a11d 100644 --- a/net/ipv6/netfilter/ip6t_ipv6header.c +++ b/net/ipv6/netfilter/ip6t_ipv6header.c @@ -1,7 +1,7 @@ /* ipv6header match - matches IPv6 packets based on whether they contain certain headers */ -/* Original idea: Brad Chapman +/* Original idea: Brad Chapman * Rewritten by: Andras Kis-Szabo <kisza@sch.bme.hu> */ /* (C) 2001-2002 Andras Kis-Szabo <kisza@sch.bme.hu> diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c index 5f5aa0e..0c468d3 100644 --- a/net/ipv6/netfilter/ip6table_mangle.c +++ b/net/ipv6/netfilter/ip6table_mangle.c @@ -50,7 +50,7 @@ static struct 0, NULL, { } }, { /* PRE_ROUTING */ - { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, + { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 0, sizeof(struct ip6t_entry), sizeof(struct ip6t_standard), @@ -58,7 +58,7 @@ static struct { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } }, -NF_ACCEPT - 1 } }, /* LOCAL_IN */ - { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, + { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 0, sizeof(struct ip6t_entry), sizeof(struct ip6t_standard), @@ -66,7 +66,7 @@ static struct { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } }, -NF_ACCEPT - 1 } }, /* FORWARD */ - { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, + { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 0, sizeof(struct ip6t_entry), sizeof(struct ip6t_standard), @@ -74,7 +74,7 @@ static struct { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } }, -NF_ACCEPT - 1 } }, /* LOCAL_OUT */ - { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, + { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 0, sizeof(struct ip6t_entry), sizeof(struct ip6t_standard), @@ -156,7 +156,7 @@ ip6t_local_hook(unsigned int hook, ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler); - if (ret != NF_DROP && ret != NF_STOLEN + if (ret != NF_DROP && ret != NF_STOLEN && (memcmp(&(*pskb)->nh.ipv6h->saddr, &saddr, sizeof(saddr)) || memcmp(&(*pskb)->nh.ipv6h->daddr, &daddr, sizeof(daddr)) || (*pskb)->mark != mark diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c index 277bf34..a3eb5b8 100644 --- a/net/ipv6/netfilter/ip6table_raw.c +++ b/net/ipv6/netfilter/ip6table_raw.c @@ -87,10 +87,10 @@ static struct } }; -static struct xt_table packet_raw = { - .name = "raw", - .valid_hooks = RAW_VALID_HOOKS, - .lock = RW_LOCK_UNLOCKED, +static struct xt_table packet_raw = { + .name = "raw", + .valid_hooks = RAW_VALID_HOOKS, + .lock = RW_LOCK_UNLOCKED, .me = THIS_MODULE, .af = AF_INET6, }; @@ -106,17 +106,17 @@ ip6t_hook(unsigned int hook, return ip6t_do_table(pskb, hook, in, out, &packet_raw); } -static struct nf_hook_ops ip6t_ops[] = { +static struct nf_hook_ops ip6t_ops[] = { { - .hook = ip6t_hook, + .hook = ip6t_hook, .pf = PF_INET6, .hooknum = NF_IP6_PRE_ROUTING, .priority = NF_IP6_PRI_FIRST, .owner = THIS_MODULE, }, { - .hook = ip6t_hook, - .pf = PF_INET6, + .hook = ip6t_hook, + .pf = PF_INET6, .hooknum = NF_IP6_LOCAL_OUT, .priority = NF_IP6_PRI_FIRST, .owner = THIS_MODULE, diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index a20615f..a2353ed 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c @@ -349,7 +349,7 @@ static ctl_table nf_ct_ipv6_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_dointvec, }, - { .ctl_name = 0 } + { .ctl_name = 0 } }; #endif @@ -386,7 +386,7 @@ static int ipv6_nfattr_to_tuple(struct nfattr *tb[], if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip)) return -EINVAL; - memcpy(&t->src.u3.ip6, NFA_DATA(tb[CTA_IP_V6_SRC-1]), + memcpy(&t->src.u3.ip6, NFA_DATA(tb[CTA_IP_V6_SRC-1]), sizeof(u_int32_t) * 4); memcpy(&t->dst.u3.ip6, NFA_DATA(tb[CTA_IP_V6_DST-1]), sizeof(u_int32_t) * 4); diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 3905cac..b08622c 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c @@ -104,9 +104,9 @@ static int icmpv6_packet(struct nf_conn *ct, unsigned int hooknum) { /* Try to delete connection immediately after all replies: - won't actually vanish as we still have skb, and del_timer - means this will only run once even if count hits zero twice - (theoretically possible with SMP) */ + won't actually vanish as we still have skb, and del_timer + means this will only run once even if count hits zero twice + (theoretically possible with SMP) */ if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) { if (atomic_dec_and_test(&ct->proto.icmp.count) && del_timer(&ct->timeout)) diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index d9c1540..15ab1e3 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c @@ -311,7 +311,7 @@ static struct nf_ct_frag6_queue *nf_ct_frag6_intern(unsigned int hash, write_lock(&nf_ct_frag6_lock); #ifdef CONFIG_SMP hlist_for_each_entry(fq, n, &nf_ct_frag6_hash[hash], list) { - if (fq->id == fq_in->id && + if (fq->id == fq_in->id && ipv6_addr_equal(&fq_in->saddr, &fq->saddr) && ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) { atomic_inc(&fq->refcnt); @@ -374,7 +374,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst) read_lock(&nf_ct_frag6_lock); hlist_for_each_entry(fq, n, &nf_ct_frag6_hash[hash], list) { - if (fq->id == id && + if (fq->id == id && ipv6_addr_equal(src, &fq->saddr) && ipv6_addr_equal(dst, &fq->daddr)) { atomic_inc(&fq->refcnt); @@ -388,7 +388,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst) } -static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, +static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, struct frag_hdr *fhdr, int nhoff) { struct sk_buff *prev, *next; @@ -405,12 +405,12 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, if ((unsigned int)end > IPV6_MAXPLEN) { DEBUGP("offset is too large.\n"); - return -1; + return -1; } - if (skb->ip_summed == CHECKSUM_COMPLETE) - skb->csum = csum_sub(skb->csum, - csum_partial(skb->nh.raw, + if (skb->ip_summed == CHECKSUM_COMPLETE) + skb->csum = csum_sub(skb->csum, + csum_partial(skb->nh.raw, (u8*)(fhdr + 1) - skb->nh.raw, 0)); @@ -625,7 +625,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev) /* We have to remove fragment header from datagram and to relocate * header in order to calculate ICV correctly. */ head->nh.raw[fq->nhoffset] = head->h.raw[0]; - memmove(head->head + sizeof(struct frag_hdr), head->head, + memmove(head->head + sizeof(struct frag_hdr), head->head, (head->data - head->head) - sizeof(struct frag_hdr)); head->mac.raw += sizeof(struct frag_hdr); head->nh.raw += sizeof(struct frag_hdr); @@ -701,41 +701,41 @@ out_fail: static int find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) { - u8 nexthdr = skb->nh.ipv6h->nexthdr; + u8 nexthdr = skb->nh.ipv6h->nexthdr; u8 prev_nhoff = (u8 *)&skb->nh.ipv6h->nexthdr - skb->data; int start = (u8 *)(skb->nh.ipv6h+1) - skb->data; int len = skb->len - start; u8 prevhdr = NEXTHDR_IPV6; - while (nexthdr != NEXTHDR_FRAGMENT) { - struct ipv6_opt_hdr hdr; - int hdrlen; + while (nexthdr != NEXTHDR_FRAGMENT) { + struct ipv6_opt_hdr hdr; + int hdrlen; if (!ipv6_ext_hdr(nexthdr)) { return -1; } - if (len < (int)sizeof(struct ipv6_opt_hdr)) { + if (len < (int)sizeof(struct ipv6_opt_hdr)) { DEBUGP("too short\n"); return -1; } - if (nexthdr == NEXTHDR_NONE) { + if (nexthdr == NEXTHDR_NONE) { DEBUGP("next header is none\n"); return -1; } - if (skb_copy_bits(skb, start, &hdr, sizeof(hdr))) - BUG(); - if (nexthdr == NEXTHDR_AUTH) - hdrlen = (hdr.hdrlen+2)<<2; - else - hdrlen = ipv6_optlen(&hdr); + if (skb_copy_bits(skb, start, &hdr, sizeof(hdr))) + BUG(); + if (nexthdr == NEXTHDR_AUTH) + hdrlen = (hdr.hdrlen+2)<<2; + else + hdrlen = ipv6_optlen(&hdr); prevhdr = nexthdr; prev_nhoff = start; - nexthdr = hdr.nexthdr; - len -= hdrlen; - start += hdrlen; - } + nexthdr = hdr.nexthdr; + len -= hdrlen; + start += hdrlen; + } if (len < 0) return -1; @@ -749,7 +749,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) { - struct sk_buff *clone; + struct sk_buff *clone; struct net_device *dev = skb->dev; struct frag_hdr *fhdr; struct nf_ct_frag6_queue *fq; diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 35249d8..032ef95 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c @@ -50,7 +50,7 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "UDP6: inuse %d\n", fold_prot_inuse(&udpv6_prot)); seq_printf(seq, "UDPLITE6: inuse %d\n", - fold_prot_inuse(&udplitev6_prot)); + fold_prot_inuse(&udplitev6_prot)); seq_printf(seq, "RAW6: inuse %d\n", fold_prot_inuse(&rawv6_prot)); seq_printf(seq, "FRAG6: inuse %d memory %d\n", @@ -89,7 +89,7 @@ static struct snmp_mib snmp6_icmp6_list[] = { /* icmpv6 mib according to RFC 2466 Exceptions: {In|Out}AdminProhibs are removed, because I see - no good reasons to account them separately + no good reasons to account them separately of another dest.unreachs. OutErrs is zero identically. OutEchos too. @@ -146,14 +146,14 @@ static struct snmp_mib snmp6_udplite6_list[] = { static unsigned long fold_field(void *mib[], int offt) { - unsigned long res = 0; - int i; - - for_each_possible_cpu(i) { - res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt); - res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt); - } - return res; + unsigned long res = 0; + int i; + + for_each_possible_cpu(i) { + res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt); + res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt); + } + return res; } static inline void @@ -161,7 +161,7 @@ snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist) { int i; for (i=0; itemlist[i].name; i++) - seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, + seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, fold_field(mib, itemlist[i].entry)); } diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c index 52c1d58..ad0410c 100644 --- a/net/ipv6/protocol.c +++ b/net/ipv6/protocol.c @@ -64,7 +64,7 @@ int inet6_add_protocol(struct inet6_protocol *prot, unsigned char protocol) /* * Remove a protocol from the hash tables. */ - + int inet6_del_protocol(struct inet6_protocol *prot, unsigned char protocol) { int ret, hash = protocol & (MAX_INET_PROTOS - 1); diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index c2d8059..16d4c63 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -1,9 +1,9 @@ /* * RAW sockets for IPv6 - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * Adapted from linux/net/ipv4/raw.c * @@ -11,7 +11,7 @@ * * Fixes: * Hideaki YOSHIFUJI : sin6_scope_id support - * YOSHIFUJI,H.@USAGI : raw checksum (RFC2292(bis) compliance) + * YOSHIFUJI,H.@USAGI : raw checksum (RFC2292(bis) compliance) * Kazunori MIYAZAWA @USAGI: change process style to use ip6_append_data * * This program is free software; you can redistribute it and/or @@ -71,12 +71,12 @@ static void raw_v6_hash(struct sock *sk) write_lock_bh(&raw_v6_lock); sk_add_node(sk, list); sock_prot_inc_use(sk->sk_prot); - write_unlock_bh(&raw_v6_lock); + write_unlock_bh(&raw_v6_lock); } static void raw_v6_unhash(struct sock *sk) { - write_lock_bh(&raw_v6_lock); + write_lock_bh(&raw_v6_lock); if (sk_del_node_init(sk)) sock_prot_dec_use(sk->sk_prot); write_unlock_bh(&raw_v6_lock); @@ -250,7 +250,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) */ sk->sk_bound_dev_if = addr->sin6_scope_id; } - + /* Binding to link-local address requires an interface */ if (!sk->sk_bound_dev_if) goto out; @@ -261,7 +261,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) goto out; } } - + /* ipv4 addr of the socket is invalid. Only the * unspecified and mapped address have a v4 equivalent. */ @@ -324,7 +324,7 @@ void rawv6_err(struct sock *sk, struct sk_buff *skb, static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) { - if ((raw6_sk(sk)->checksum || sk->sk_filter) && + if ((raw6_sk(sk)->checksum || sk->sk_filter) && skb_checksum_complete(skb)) { /* FIXME: increment a raw6 drops counter here */ kfree_skb(skb); @@ -342,10 +342,10 @@ static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) } /* - * This is next to useless... + * This is next to useless... * if we demultiplex in network layer we don't need the extra call - * just to queue the skb... - * maybe we could have the network decide upon a hint if it + * just to queue the skb... + * maybe we could have the network decide upon a hint if it * should call raw_rcv for demultiplexing */ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) @@ -353,17 +353,17 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) struct inet_sock *inet = inet_sk(sk); struct raw6_sock *rp = raw6_sk(sk); - if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) { - kfree_skb(skb); - return NET_RX_DROP; - } + if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) { + kfree_skb(skb); + return NET_RX_DROP; + } if (!rp->checksum) skb->ip_summed = CHECKSUM_UNNECESSARY; if (skb->ip_summed == CHECKSUM_COMPLETE) { skb_postpull_rcsum(skb, skb->nh.raw, - skb->h.raw - skb->nh.raw); + skb->h.raw - skb->nh.raw); if (!csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, skb->len, inet->num, skb->csum)) @@ -404,8 +404,8 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, if (flags & MSG_OOB) return -EOPNOTSUPP; - - if (addr_len) + + if (addr_len) *addr_len=sizeof(*sin6); if (flags & MSG_ERRQUEUE) @@ -416,10 +416,10 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, goto out; copied = skb->len; - if (copied > len) { - copied = len; - msg->msg_flags |= MSG_TRUNC; - } + if (copied > len) { + copied = len; + msg->msg_flags |= MSG_TRUNC; + } if (skb->ip_summed==CHECKSUM_UNNECESSARY) { err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); @@ -549,7 +549,7 @@ out: } static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, - struct flowi *fl, struct rt6_info *rt, + struct flowi *fl, struct rt6_info *rt, unsigned int flags) { struct ipv6_pinfo *np = inet6_sk(sk); @@ -570,7 +570,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, skb = sock_alloc_send_skb(sk, length+hh_len+15, flags&MSG_DONTWAIT, &err); if (skb == NULL) - goto error; + goto error; skb_reserve(skb, hh_len); skb->priority = sk->sk_priority; @@ -600,7 +600,7 @@ error_fault: kfree_skb(skb); error: IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); - return err; + return err; } static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg) @@ -694,19 +694,19 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, return -EMSGSIZE; /* Mirror BSD error message compatibility */ - if (msg->msg_flags & MSG_OOB) + if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; /* - * Get and verify the address. + * Get and verify the address. */ memset(&fl, 0, sizeof(fl)); if (sin6) { - if (addr_len < SIN6_LEN_RFC2133) + if (addr_len < SIN6_LEN_RFC2133) return -EINVAL; - if (sin6->sin6_family && sin6->sin6_family != AF_INET6) + if (sin6->sin6_family && sin6->sin6_family != AF_INET6) return(-EAFNOSUPPORT); /* port is the proto value [0..255] carried in nexthdr */ @@ -744,17 +744,17 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL) fl.oif = sin6->sin6_scope_id; } else { - if (sk->sk_state != TCP_ESTABLISHED) + if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; - + proto = inet->num; daddr = &np->daddr; fl.fl6_flowlabel = np->flow_label; } if (ipv6_addr_any(daddr)) { - /* - * unspecified destination address + /* + * unspecified destination address * treated as error... is this correct ? */ fl6_sock_release(flowlabel); @@ -792,7 +792,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, err = rawv6_probe_proto_opt(&fl, msg); if (err) goto out; - + ipv6_addr_copy(&fl.fl6_dst, daddr); if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) ipv6_addr_copy(&fl.fl6_src, &np->saddr); @@ -856,7 +856,7 @@ done: dst_release(dst); if (!inet->hdrincl) release_sock(sk); -out: +out: fl6_sock_release(flowlabel); return err<0?err:len; do_confirm: @@ -867,7 +867,7 @@ do_confirm: goto done; } -static int rawv6_seticmpfilter(struct sock *sk, int level, int optname, +static int rawv6_seticmpfilter(struct sock *sk, int level, int optname, char __user *optval, int optlen) { switch (optname) { @@ -884,7 +884,7 @@ static int rawv6_seticmpfilter(struct sock *sk, int level, int optname, return 0; } -static int rawv6_geticmpfilter(struct sock *sk, int level, int optname, +static int rawv6_geticmpfilter(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { int len; @@ -916,7 +916,7 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, struct raw6_sock *rp = raw6_sk(sk); int val; - if (get_user(val, (int __user *)optval)) + if (get_user(val, (int __user *)optval)) return -EFAULT; switch (optname) { @@ -1224,7 +1224,7 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) src->s6_addr32[2], src->s6_addr32[3], srcp, dest->s6_addr32[0], dest->s6_addr32[1], dest->s6_addr32[2], dest->s6_addr32[3], destp, - sp->sk_state, + sp->sk_state, atomic_read(&sp->sk_wmem_alloc), atomic_read(&sp->sk_rmem_alloc), 0, 0L, 0, diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 6f9a904..7034c54 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c @@ -1,9 +1,9 @@ /* * IPv6 fragment reassembly - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * $Id: reassembly.c,v 1.26 2001/03/07 22:00:57 davem Exp $ * @@ -15,8 +15,8 @@ * 2 of the License, or (at your option) any later version. */ -/* - * Fixes: +/* + * Fixes: * Andi Kleen Make it work with multiple hosts. * More RFC compliance. * @@ -343,7 +343,7 @@ static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in) hash = ip6qhashfn(fq_in->id, &fq_in->saddr, &fq_in->daddr); #ifdef CONFIG_SMP hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) { - if (fq->id == fq_in->id && + if (fq->id == fq_in->id && ipv6_addr_equal(&fq_in->saddr, &fq->saddr) && ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) { atomic_inc(&fq->refcnt); @@ -406,7 +406,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst, read_lock(&ip6_frag_lock); hash = ip6qhashfn(id, src, dst); hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) { - if (fq->id == id && + if (fq->id == id && ipv6_addr_equal(src, &fq->saddr) && ipv6_addr_equal(dst, &fq->daddr)) { atomic_inc(&fq->refcnt); @@ -420,7 +420,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst, } -static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, +static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, struct frag_hdr *fhdr, int nhoff) { struct sk_buff *prev, *next; @@ -436,13 +436,13 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, if ((unsigned int)end > IPV6_MAXPLEN) { IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); - icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw); - return; + icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw); + return; } - if (skb->ip_summed == CHECKSUM_COMPLETE) - skb->csum = csum_sub(skb->csum, - csum_partial(skb->nh.raw, (u8*)(fhdr+1)-skb->nh.raw, 0)); + if (skb->ip_summed == CHECKSUM_COMPLETE) + skb->csum = csum_sub(skb->csum, + csum_partial(skb->nh.raw, (u8*)(fhdr+1)-skb->nh.raw, 0)); /* Is this the final fragment? */ if (!(fhdr->frag_off & htons(IP6_MF))) { @@ -464,7 +464,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, */ IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); - icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, + icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, offsetof(struct ipv6hdr, payload_len)); return; } @@ -482,7 +482,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, /* Point into the IP datagram 'data' part. */ if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data)) goto err; - + if (pskb_trim_rcsum(skb, end - offset)) goto err; @@ -640,7 +640,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in, * header in order to calculate ICV correctly. */ nhoff = fq->nhoffset; head->nh.raw[nhoff] = head->h.raw[0]; - memmove(head->head + sizeof(struct frag_hdr), head->head, + memmove(head->head + sizeof(struct frag_hdr), head->head, (head->data - head->head) - sizeof(struct frag_hdr)); head->mac.raw += sizeof(struct frag_hdr); head->nh.raw += sizeof(struct frag_hdr); @@ -695,7 +695,7 @@ out_fail: static int ipv6_frag_rcv(struct sk_buff **skbp) { - struct sk_buff *skb = *skbp; + struct sk_buff *skb = *skbp; struct net_device *dev = skb->dev; struct frag_hdr *fhdr; struct frag_queue *fq; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 19c906f..a415ac6 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3,7 +3,7 @@ * FIB front-end. * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $ * @@ -201,7 +201,7 @@ static void ip6_dst_destroy(struct dst_entry *dst) if (idev != NULL) { rt->rt6i_idev = NULL; in6_dev_put(idev); - } + } } static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, @@ -243,7 +243,7 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt, struct rt6_info *sprt; if (oif) { - for (sprt = rt; sprt; sprt = sprt->u.next) { + for (sprt = rt; sprt; sprt = sprt->u.dst.rt6_next) { struct net_device *dev = sprt->rt6i_dev; if (dev->ifindex == oif) return sprt; @@ -252,7 +252,7 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt, sprt->rt6i_idev->dev->ifindex != oif) { if (strict && oif) continue; - if (local && (!oif || + if (local && (!oif || local->rt6i_idev->dev->ifindex == oif)) continue; } @@ -350,7 +350,7 @@ static int rt6_score_route(struct rt6_info *rt, int oif, int strict) { int m, n; - + m = rt6_check_dev(rt, oif); if (!m && (strict & RT6_LOOKUP_F_IFACE)) return -1; @@ -376,7 +376,7 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif, for (rt = rt0, metric = rt0->rt6i_metric; rt && rt->rt6i_metric == metric && (!last || rt != rt0); - rt = rt->u.next) { + rt = rt->u.dst.rt6_next) { int m; if (rt6_check_expired(rt)) @@ -404,9 +404,9 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif, /* no entries matched; do round-robin */ static DEFINE_SPINLOCK(lock); spin_lock(&lock); - *head = rt0->u.next; - rt0->u.next = last->u.next; - last->u.next = rt0; + *head = rt0->u.dst.rt6_next; + rt0->u.dst.rt6_next = last->u.dst.rt6_next; + last->u.dst.rt6_next = rt0; spin_unlock(&lock); } @@ -723,7 +723,7 @@ void ip6_route_input(struct sk_buff *skb) .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK, }, }, - .mark = skb->mark, + .mark = skb->mark, .proto = iph->nexthdr, }; @@ -888,9 +888,9 @@ static inline unsigned int ipv6_advmss(unsigned int mtu) mtu = ip6_rt_min_advmss; /* - * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and - * corresponding MSS is IPV6_MAXPLEN - tcp_header_size. - * IPV6_MAXPLEN is also valid and means: "any MSS, + * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and + * corresponding MSS is IPV6_MAXPLEN - tcp_header_size. + * IPV6_MAXPLEN is also valid and means: "any MSS, * rely only on pmtu discovery" */ if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr)) @@ -901,7 +901,7 @@ static inline unsigned int ipv6_advmss(unsigned int mtu) static struct dst_entry *ndisc_dst_gc_list; static DEFINE_SPINLOCK(ndisc_lock); -struct dst_entry *ndisc_dst_alloc(struct net_device *dev, +struct dst_entry *ndisc_dst_alloc(struct net_device *dev, struct neighbour *neigh, struct in6_addr *addr, int (*output)(struct sk_buff *)) @@ -934,8 +934,8 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev, rt->u.dst.output = output; #if 0 /* there's no chance to use these for ndisc */ - rt->u.dst.flags = ipv6_addr_type(addr) & IPV6_ADDR_UNICAST - ? DST_HOST + rt->u.dst.flags = ipv6_addr_type(addr) & IPV6_ADDR_UNICAST + ? DST_HOST : 0; ipv6_addr_copy(&rt->rt6i_dst.addr, addr); rt->rt6i_dst.plen = 128; @@ -958,7 +958,7 @@ int ndisc_dst_gc(int *more) int freed; next = NULL; - freed = 0; + freed = 0; spin_lock_bh(&ndisc_lock); pprev = &ndisc_dst_gc_list; @@ -1276,9 +1276,9 @@ static int ip6_route_del(struct fib6_config *cfg) fn = fib6_locate(&table->tb6_root, &cfg->fc_dst, cfg->fc_dst_len, &cfg->fc_src, cfg->fc_src_len); - + if (fn) { - for (rt = fn->leaf; rt; rt = rt->u.next) { + for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) { if (cfg->fc_ifindex && (rt->rt6i_dev == NULL || rt->rt6i_dev->ifindex != cfg->fc_ifindex)) @@ -1329,7 +1329,7 @@ static struct rt6_info *__ip6_route_redirect(struct fib6_table *table, read_lock_bh(&table->tb6_lock); fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); restart: - for (rt = fn->leaf; rt; rt = rt->u.next) { + for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) { /* * Current route is on-link; redirect is always invalid. * @@ -1405,7 +1405,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, * We have finally decided to accept it. */ - neigh_update(neigh, lladdr, NUD_STALE, + neigh_update(neigh, lladdr, NUD_STALE, NEIGH_UPDATE_F_WEAK_OVERRIDE| NEIGH_UPDATE_F_OVERRIDE| (on_link ? 0 : (NEIGH_UPDATE_F_OVERRIDE_ISROUTER| @@ -1454,7 +1454,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, } out: - dst_release(&rt->u.dst); + dst_release(&rt->u.dst); return; } @@ -1478,7 +1478,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, if (pmtu < IPV6_MIN_MTU) { /* - * According to RFC2460, PMTU is set to the IPv6 Minimum Link + * According to RFC2460, PMTU is set to the IPv6 Minimum Link * MTU (1280) and a fragment header should always be included * after a node receiving Too Big message reporting PMTU is * less than the IPv6 Minimum Link MTU. @@ -1590,7 +1590,7 @@ static struct rt6_info *rt6_get_route_info(struct in6_addr *prefix, int prefixle if (!fn) goto out; - for (rt = fn->leaf; rt; rt = rt->u.next) { + for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) { if (rt->rt6i_dev->ifindex != ifindex) continue; if ((rt->rt6i_flags & (RTF_ROUTEINFO|RTF_GATEWAY)) != (RTF_ROUTEINFO|RTF_GATEWAY)) @@ -1632,7 +1632,7 @@ static struct rt6_info *rt6_add_route_info(struct in6_addr *prefix, int prefixle #endif struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *dev) -{ +{ struct rt6_info *rt; struct fib6_table *table; @@ -1641,7 +1641,7 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d return NULL; write_lock_bh(&table->tb6_lock); - for (rt = table->tb6_root.leaf; rt; rt=rt->u.next) { + for (rt = table->tb6_root.leaf; rt; rt=rt->u.dst.rt6_next) { if (dev == rt->rt6i_dev && ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) && ipv6_addr_equal(&rt->rt6i_gateway, addr)) @@ -1684,7 +1684,7 @@ void rt6_purge_dflt_routers(void) restart: read_lock_bh(&table->tb6_lock); - for (rt = table->tb6_root.leaf; rt; rt = rt->u.next) { + for (rt = table->tb6_root.leaf; rt; rt = rt->u.dst.rt6_next) { if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) { dst_hold(&rt->u.dst); read_unlock_bh(&table->tb6_lock); @@ -1896,8 +1896,8 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg) */ if (rt->rt6i_dev == arg->dev && !dst_metric_locked(&rt->u.dst, RTAX_MTU) && - (dst_mtu(&rt->u.dst) > arg->mtu || - (dst_mtu(&rt->u.dst) < arg->mtu && + (dst_mtu(&rt->u.dst) > arg->mtu || + (dst_mtu(&rt->u.dst) < arg->mtu && dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu; rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu); @@ -2083,13 +2083,13 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, if (dst) { NLA_PUT(skb, RTA_DST, 16, dst); - rtm->rtm_dst_len = 128; + rtm->rtm_dst_len = 128; } else if (rtm->rtm_dst_len) NLA_PUT(skb, RTA_DST, 16, &rt->rt6i_dst.addr); #ifdef CONFIG_IPV6_SUBTREES if (src) { NLA_PUT(skb, RTA_SRC, 16, src); - rtm->rtm_src_len = 128; + rtm->rtm_src_len = 128; } else if (rtm->rtm_src_len) NLA_PUT(skb, RTA_SRC, 16, &rt->rt6i_src.addr); #endif @@ -2299,7 +2299,7 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) arg->len += sprintf(arg->buffer + arg->len, " %08x %08x %08x %08x %8s\n", rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt), - rt->u.dst.__use, rt->rt6i_flags, + rt->u.dst.__use, rt->rt6i_flags, rt->rt6i_dev ? rt->rt6i_dev->name : ""); return 0; } @@ -2371,91 +2371,91 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp, } ctl_table ipv6_route_table[] = { - { - .ctl_name = NET_IPV6_ROUTE_FLUSH, + { + .ctl_name = NET_IPV6_ROUTE_FLUSH, .procname = "flush", - .data = &flush_delay, + .data = &flush_delay, .maxlen = sizeof(int), .mode = 0200, - .proc_handler = &ipv6_sysctl_rtcache_flush + .proc_handler = &ipv6_sysctl_rtcache_flush }, { .ctl_name = NET_IPV6_ROUTE_GC_THRESH, .procname = "gc_thresh", - .data = &ip6_dst_ops.gc_thresh, + .data = &ip6_dst_ops.gc_thresh, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_ROUTE_MAX_SIZE, .procname = "max_size", - .data = &ip6_rt_max_size, + .data = &ip6_rt_max_size, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec, }, { .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL, .procname = "gc_min_interval", - .data = &ip6_rt_gc_min_interval, + .data = &ip6_rt_gc_min_interval, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_ROUTE_GC_TIMEOUT, .procname = "gc_timeout", - .data = &ip6_rt_gc_timeout, + .data = &ip6_rt_gc_timeout, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_ROUTE_GC_INTERVAL, .procname = "gc_interval", - .data = &ip6_rt_gc_interval, + .data = &ip6_rt_gc_interval, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_ROUTE_GC_ELASTICITY, .procname = "gc_elasticity", - .data = &ip6_rt_gc_elasticity, + .data = &ip6_rt_gc_elasticity, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_ROUTE_MTU_EXPIRES, .procname = "mtu_expires", - .data = &ip6_rt_mtu_expires, + .data = &ip6_rt_mtu_expires, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_ROUTE_MIN_ADVMSS, .procname = "min_adv_mss", - .data = &ip6_rt_min_advmss, + .data = &ip6_rt_min_advmss, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_jiffies, + .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, { .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, .procname = "gc_min_interval_ms", - .data = &ip6_rt_gc_min_interval, + .data = &ip6_rt_gc_min_interval, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_ms_jiffies, + .proc_handler = &proc_dointvec_ms_jiffies, .strategy = &sysctl_ms_jiffies, }, { .ctl_name = 0 } diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 47cfead..4d3cf30 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -3,7 +3,7 @@ * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> * * $Id: sit.c,v 1.53 2001/09/25 05:09:53 davem Exp $ @@ -410,7 +410,7 @@ static inline __be32 try_6to4(struct in6_addr *v6dst) __be32 dst = 0; if (v6dst->s6_addr16[0] == htons(0x2002)) { - /* 6to4 v6 addr has 16 bits prefix, 32 v4addr, 16 SLA, ... */ + /* 6to4 v6 addr has 16 bits prefix, 32 v4addr, 16 SLA, ... */ memcpy(&dst, &v6dst->s6_addr16[1], 4); } return dst; @@ -434,7 +434,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) int max_headroom; /* The extra header space needed */ __be32 dst = tiph->daddr; int mtu; - struct in6_addr *addr6; + struct in6_addr *addr6; int addr_type; if (tunnel->recursion++) { @@ -537,7 +537,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); if (!new_skb) { ip_rt_put(rt); - stats->tx_dropped++; + stats->tx_dropped++; dev_kfree_skb(skb); tunnel->recursion--; return 0; @@ -831,7 +831,7 @@ static int __init sit_init(void) return -EAGAIN; } - ipip6_fb_tunnel_dev = alloc_netdev(sizeof(struct ip_tunnel), "sit0", + ipip6_fb_tunnel_dev = alloc_netdev(sizeof(struct ip_tunnel), "sit0", ipip6_tunnel_setup); if (!ipip6_fb_tunnel_dev) { err = -ENOMEM; diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index 7a4639d..25e8e77 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c @@ -92,7 +92,7 @@ static ctl_table ipv6_net_table[] = { .mode = 0555, .child = ipv6_table }, - { .ctl_name = 0 } + { .ctl_name = 0 } }; static ctl_table ipv6_root_table[] = { @@ -102,7 +102,7 @@ static ctl_table ipv6_root_table[] = { .mode = 0555, .child = ipv6_net_table }, - { .ctl_name = 0 } + { .ctl_name = 0 } }; void ipv6_sysctl_register(void) diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index dcb7b00..f57a9ba 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1,13 +1,13 @@ /* * TCP over IPv6 - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * $Id: tcp_ipv6.c,v 1.144 2002/02/01 22:01:04 davem Exp $ * - * Based on: + * Based on: * linux/net/ipv4/tcp.c * linux/net/ipv4/tcp_input.c * linux/net/ipv4/tcp_output.c @@ -74,7 +74,7 @@ static struct socket *tcp6_socket; static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb); static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); -static void tcp_v6_send_check(struct sock *sk, int len, +static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb); static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); @@ -106,8 +106,8 @@ static void tcp_v6_hash(struct sock *sk) } static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len, - struct in6_addr *saddr, - struct in6_addr *daddr, + struct in6_addr *saddr, + struct in6_addr *daddr, __wsum base) { return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); @@ -121,11 +121,11 @@ static __u32 tcp_v6_init_sequence(struct sk_buff *skb) skb->h.th->source); } -static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, +static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; - struct inet_sock *inet = inet_sk(sk); + struct inet_sock *inet = inet_sk(sk); struct inet_connection_sock *icsk = inet_csk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct tcp_sock *tp = tcp_sk(sk); @@ -135,10 +135,10 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_type; int err; - if (addr_len < SIN6_LEN_RFC2133) + if (addr_len < SIN6_LEN_RFC2133) return -EINVAL; - if (usin->sin6_family != AF_INET6) + if (usin->sin6_family != AF_INET6) return(-EAFNOSUPPORT); memset(&fl, 0, sizeof(fl)); @@ -157,11 +157,11 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, } /* - * connect() to INADDR_ANY means loopback (BSD'ism). - */ - - if(ipv6_addr_any(&usin->sin6_addr)) - usin->sin6_addr.s6_addr[15] = 0x1; + * connect() to INADDR_ANY means loopback (BSD'ism). + */ + + if(ipv6_addr_any(&usin->sin6_addr)) + usin->sin6_addr.s6_addr[15] = 0x1; addr_type = ipv6_addr_type(&usin->sin6_addr); @@ -323,7 +323,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, struct ipv6_pinfo *np; struct sock *sk; int err; - struct tcp_sock *tp; + struct tcp_sock *tp; __u32 seq; sk = inet6_lookup(&tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr, @@ -347,7 +347,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, goto out; tp = tcp_sk(sk); - seq = ntohl(th->seq); + seq = ntohl(th->seq); if (sk->sk_state != TCP_LISTEN && !between(seq, tp->snd_una, tp->snd_nxt)) { NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); @@ -434,7 +434,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, case TCP_SYN_SENT: case TCP_SYN_RECV: /* Cannot happen. - It can, it SYNs are crossed. --ANK */ + It can, it SYNs are crossed. --ANK */ if (!sock_owned_by_user(sk)) { sk->sk_err = err; sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ @@ -519,7 +519,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, } done: - if (opt && opt != np->opt) + if (opt && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); dst_release(dst); return err; @@ -950,8 +950,8 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb) th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); skb->csum_offset = offsetof(struct tcphdr, check); } else { - th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, - csum_partial((char *)th, th->doff<<2, + th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, + csum_partial((char *)th, th->doff<<2, skb->csum)); } } @@ -977,7 +977,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) { - struct tcphdr *th = skb->h.th, *t1; + struct tcphdr *th = skb->h.th, *t1; struct sk_buff *buff; struct flowi fl; int tot_len = sizeof(*th); @@ -989,7 +989,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) return; if (!ipv6_unicast_destination(skb)) - return; + return; #ifdef CONFIG_TCP_MD5SIG if (sk) @@ -1008,8 +1008,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len, GFP_ATOMIC); - if (buff == NULL) - return; + if (buff == NULL) + return; skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); @@ -1021,9 +1021,9 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) t1->source = th->dest; t1->doff = tot_len / 4; t1->rst = 1; - + if(th->ack) { - t1->seq = th->ack_seq; + t1->seq = th->ack_seq; } else { t1->ack = 1; t1->ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin @@ -1128,7 +1128,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, t1->window = htons(win); topt = (__be32 *)(t1 + 1); - + if (ts) { *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); @@ -1243,15 +1243,15 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) return tcp_v4_conn_request(sk, skb); if (!ipv6_unicast_destination(skb)) - goto drop; + goto drop; /* - * There are no SYN attacks on IPv6, yet... + * There are no SYN attacks on IPv6, yet... */ if (inet_csk_reqsk_queue_is_full(sk) && !isn) { if (net_ratelimit()) printk(KERN_INFO "TCPv6: dropping request, synflood is possible\n"); - goto drop; + goto drop; } if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) @@ -1292,7 +1292,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) treq->iif = inet6_iif(skb); - if (isn == 0) + if (isn == 0) isn = tcp_v6_init_sequence(skb); tcp_rsk(req)->snt_isn = isn; @@ -1334,7 +1334,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst); - if (newsk == NULL) + if (newsk == NULL) return NULL; newtcp6sk = (struct tcp6_sock *)newsk; @@ -1419,7 +1419,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0) goto out; - } + } newsk = tcp_create_openreq_child(sk, req, skb); if (newsk == NULL) @@ -1448,7 +1448,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr); newsk->sk_bound_dev_if = treq->iif; - /* Now IPv6 options... + /* Now IPv6 options... First: no IPv4 options. */ @@ -1592,7 +1592,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) looks not very well thought. For now we latch options, received in the last packet, enqueued by tcp. Feel free to propose better solution. - --ANK (980728) + --ANK (980728) */ if (np->rxopt.all) opt_skb = skb_clone(skb, GFP_ATOMIC); @@ -1610,7 +1610,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) if (skb->len < (skb->h.th->doff<<2) || tcp_checksum_complete(skb)) goto csum_err; - if (sk->sk_state == TCP_LISTEN) { + if (sk->sk_state == TCP_LISTEN) { struct sock *nsk = tcp_v6_hnd_req(sk, skb); if (!nsk) goto discard; @@ -1620,7 +1620,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) * otherwise we just shortcircuit this and continue with * the new socket.. */ - if(nsk != sk) { + if(nsk != sk) { if (tcp_child_process(sk, nsk, skb)) goto reset; if (opt_skb) @@ -1681,7 +1681,7 @@ ipv6_pktoptions: static int tcp_v6_rcv(struct sk_buff **pskb) { struct sk_buff *skb = *pskb; - struct tcphdr *th; + struct tcphdr *th; struct sock *sk; int ret; @@ -1739,10 +1739,10 @@ process: ret = 0; if (!sock_owned_by_user(sk)) { #ifdef CONFIG_NET_DMA - struct tcp_sock *tp = tcp_sk(sk); - if (tp->ucopy.dma_chan) - ret = tcp_v6_do_rcv(sk, skb); - else + struct tcp_sock *tp = tcp_sk(sk); + if (tp->ucopy.dma_chan) + ret = tcp_v6_do_rcv(sk, skb); + else #endif { if (!tcp_prequeue(sk, skb)) @@ -1945,7 +1945,7 @@ static int tcp_v6_destroy_sock(struct sock *sk) } /* Proc filesystem TCPv6 sock list dumping. */ -static void get_openreq6(struct seq_file *seq, +static void get_openreq6(struct seq_file *seq, struct sock *sk, struct request_sock *req, int i, int uid) { int ttd = req->expires - jiffies; @@ -1967,11 +1967,11 @@ static void get_openreq6(struct seq_file *seq, ntohs(inet_rsk(req)->rmt_port), TCP_SYN_RECV, 0,0, /* could print option size, but that is af dependent. */ - 1, /* timers active (only the expire timer) */ - jiffies_to_clock_t(ttd), + 1, /* timers active (only the expire timer) */ + jiffies_to_clock_t(ttd), req->retrans, uid, - 0, /* non standard timer */ + 0, /* non standard timer */ 0, /* open_requests have no inode */ 0, req); } @@ -2014,7 +2014,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) src->s6_addr32[2], src->s6_addr32[3], srcp, dest->s6_addr32[0], dest->s6_addr32[1], dest->s6_addr32[2], dest->s6_addr32[3], destp, - sp->sk_state, + sp->sk_state, tp->write_seq-tp->snd_una, (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), timer_active, @@ -2031,7 +2031,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) ); } -static void get_timewait6_sock(struct seq_file *seq, +static void get_timewait6_sock(struct seq_file *seq, struct inet_timewait_sock *tw, int i) { struct in6_addr *dest, *src; diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 15e5195..ccf2f4d 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1,9 +1,9 @@ /* * UDP over IPv6 - * Linux INET6 implementation + * Linux INET6 implementation * * Authors: - * Pedro Roque <roque@di.fc.ul.pt> + * Pedro Roque <roque@di.fc.ul.pt> * * Based on linux/ipv4/udp.c * @@ -67,11 +67,11 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport, unsigned short hnum = ntohs(dport); int badness = -1; - read_lock(&udp_hash_lock); + read_lock(&udp_hash_lock); sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { struct inet_sock *inet = inet_sk(sk); - if (inet->num == hnum && sk->sk_family == PF_INET6) { + if (sk->sk_hash == hnum && sk->sk_family == PF_INET6) { struct ipv6_pinfo *np = inet6_sk(sk); int score = 0; if (inet->dport) { @@ -105,7 +105,7 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport, } if (result) sock_hold(result); - read_unlock(&udp_hash_lock); + read_unlock(&udp_hash_lock); return result; } @@ -120,13 +120,13 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, { struct ipv6_pinfo *np = inet6_sk(sk); struct inet_sock *inet = inet_sk(sk); - struct sk_buff *skb; + struct sk_buff *skb; size_t copied; int err, copy_only, is_udplite = IS_UDPLITE(sk); - if (addr_len) - *addr_len=sizeof(struct sockaddr_in6); - + if (addr_len) + *addr_len=sizeof(struct sockaddr_in6); + if (flags & MSG_ERRQUEUE) return ipv6_recv_error(sk, msg, len); @@ -135,11 +135,11 @@ try_again: if (!skb) goto out; - copied = skb->len - sizeof(struct udphdr); - if (copied > len) { - copied = len; - msg->msg_flags |= MSG_TRUNC; - } + copied = skb->len - sizeof(struct udphdr); + if (copied > len) { + copied = len; + msg->msg_flags |= MSG_TRUNC; + } /* * Decide whether to checksum and/or copy data. @@ -168,7 +168,7 @@ try_again: /* Copy the address. */ if (msg->msg_name) { struct sockaddr_in6 *sin6; - + sin6 = (struct sockaddr_in6 *) msg->msg_name; sin6->sin6_family = AF_INET6; sin6->sin6_port = skb->h.uh->source; @@ -191,7 +191,7 @@ try_again: } else { if (np->rxopt.all) datagram_recv_ctl(sk, msg, skb); - } + } err = copied; if (flags & MSG_TRUNC) @@ -309,7 +309,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk, sk_for_each_from(s, node) { struct inet_sock *inet = inet_sk(s); - if (inet->num == num && s->sk_family == PF_INET6) { + if (s->sk_hash == num && s->sk_family == PF_INET6) { struct ipv6_pinfo *np = inet6_sk(s); if (inet->dport) { if (inet->dport != rmt_port) @@ -339,7 +339,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk, * so we don't need to lock the hashes. */ static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr, - struct in6_addr *daddr, struct hlist_head udptable[]) + struct in6_addr *daddr, struct hlist_head udptable[]) { struct sock *sk, *sk2; const struct udphdr *uh = skb->h.uh; @@ -379,7 +379,7 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh) } if (skb->ip_summed == CHECKSUM_COMPLETE && !csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, - skb->len, IPPROTO_UDP, skb->csum )) + skb->len, IPPROTO_UDP, skb->csum )) skb->ip_summed = CHECKSUM_UNNECESSARY; if (skb->ip_summed != CHECKSUM_UNNECESSARY) @@ -396,7 +396,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[], { struct sk_buff *skb = *pskb; struct sock *sk; - struct udphdr *uh; + struct udphdr *uh; struct net_device *dev = skb->dev; struct in6_addr *saddr, *daddr; u32 ulen = 0; @@ -437,15 +437,15 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[], goto discard; } - /* - * Multicast receive code + /* + * Multicast receive code */ if (ipv6_addr_is_multicast(daddr)) return __udp6_lib_mcast_deliver(skb, saddr, daddr, udptable); /* Unicast */ - /* + /* * check socket cache ... must talk to Alan about his plans * for sock caches... i'll skip this for now. */ @@ -465,21 +465,21 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[], kfree_skb(skb); return(0); } - + /* deliver */ - + udpv6_queue_rcv_skb(sk, skb); sock_put(sk); return(0); -short_packet: +short_packet: LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: %d/%u\n", is_udplite? "-Lite" : "", ulen, skb->len); discard: UDP6_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite); kfree_skb(skb); - return(0); + return(0); } static __inline__ int udpv6_rcv(struct sk_buff **pskb) @@ -498,7 +498,7 @@ static void udp_v6_flush_pending_frames(struct sock *sk) up->len = 0; up->pending = 0; ip6_flush_pending_frames(sk); - } + } } /* @@ -594,7 +594,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; daddr = &np->daddr; - } else + } else daddr = NULL; if (daddr) { @@ -620,7 +620,7 @@ do_udp_sendmsg: */ if (len > INT_MAX - sizeof(struct udphdr)) return -EMSGSIZE; - + if (up->pending) { /* * There are pending frames. @@ -713,7 +713,7 @@ do_udp_sendmsg: if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) ipv6_addr_copy(&fl.fl6_src, &np->saddr); fl.fl_ip_sport = inet->sport; - + /* merge ip6_build_xmit from ip6_output */ if (opt && opt->srcrt) { struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; @@ -911,7 +911,7 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket src->s6_addr32[2], src->s6_addr32[3], srcp, dest->s6_addr32[0], dest->s6_addr32[1], dest->s6_addr32[2], dest->s6_addr32[3], destp, - sp->sk_state, + sp->sk_state, atomic_read(&sp->sk_wmem_alloc), atomic_read(&sp->sk_rmem_alloc), 0, 0L, 0, diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h index ec98788..6e252f3 100644 --- a/net/ipv6/udp_impl.h +++ b/net/ipv6/udp_impl.h @@ -11,9 +11,9 @@ extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, int , int , int , __be32 , struct hlist_head []); extern int udpv6_getsockopt(struct sock *sk, int level, int optname, - char __user *optval, int __user *optlen); + char __user *optval, int __user *optlen); extern int udpv6_setsockopt(struct sock *sk, int level, int optname, - char __user *optval, int optlen); + char __user *optval, int optlen); #ifdef CONFIG_COMPAT extern int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); @@ -24,7 +24,7 @@ extern int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len); extern int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len, - int noblock, int flags, int *addr_len); + int noblock, int flags, int *addr_len); extern int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb); extern int udpv6_destroy_sock(struct sock *sk); diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 5c8b7a5..2525014 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c @@ -33,7 +33,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi) seq = 0; if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) goto drop; - + do { struct ipv6hdr *iph = skb->nh.ipv6h; @@ -115,7 +115,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi) __skb_push(skb, skb->data - skb->nh.raw); NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, - ip6_rcv_finish); + ip6_rcv_finish); return -1; #else return 1; @@ -142,12 +142,12 @@ int xfrm6_rcv(struct sk_buff **pskb) int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto) { - struct xfrm_state *x = NULL; - int wildcard = 0; + struct xfrm_state *x = NULL; + int wildcard = 0; struct in6_addr any; xfrm_address_t *xany; struct xfrm_state *xfrm_vec_one = NULL; - int nh = 0; + int nh = 0; int i = 0; ipv6_addr_set(&any, 0, 0, 0, 0); @@ -168,12 +168,12 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, break; case 2: default: - /* lookup state with wild-card addresses */ + /* lookup state with wild-card addresses */ wildcard = 1; /* XXX */ dst = xany; src = xany; break; - } + } x = xfrm_state_lookup_byaddr(dst, src, proto, AF_INET6); if (!x) @@ -193,8 +193,8 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, if (unlikely(x->km.state != XFRM_STATE_VALID)) { spin_unlock(&x->lock); xfrm_state_put(x); - x = NULL; - continue; + x = NULL; + continue; } if (xfrm_state_check_expire(x)) { spin_unlock(&x->lock); diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index c260ea1..d6d786b 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c @@ -2,7 +2,7 @@ * xfrm6_output.c - Common IPsec encapsulation code for IPv6. * Copyright (C) 2002 USAGI/WIDE Project * Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au> - * + * * 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 @@ -46,7 +46,7 @@ static int xfrm6_output_one(struct sk_buff *skb) struct dst_entry *dst = skb->dst; struct xfrm_state *x = dst->xfrm; int err; - + if (skb->ip_summed == CHECKSUM_PARTIAL) { err = skb_checksum_help(skb); if (err) @@ -81,7 +81,7 @@ static int xfrm6_output_one(struct sk_buff *skb) spin_unlock_bh(&x->lock); skb->nh.raw = skb->data; - + if (!(skb->dst = dst_pop(dst))) { err = -EHOSTUNREACH; goto error_nolock; @@ -108,7 +108,7 @@ static int xfrm6_output_finish2(struct sk_buff *skb) while (likely((err = xfrm6_output_one(skb)) == 0)) { nf_reset(skb); - + err = nf_hook(PF_INET6, NF_IP6_LOCAL_OUT, &skb, NULL, skb->dst->dev, dst_output); if (unlikely(err != 1)) diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 59480e9..b1133f2 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c @@ -8,7 +8,7 @@ * IPv6 support * YOSHIFUJI Hideaki * Split up af-specific portion - * + * */ #include <linux/compiler.h> @@ -178,7 +178,8 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int __xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]); trailer_len += xfrm[i]->props.trailer_len; - if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL) { + if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL || + xfrm[i]->props.mode == XFRM_MODE_ROUTEOPTIMIZATION) { unsigned short encap_family = xfrm[i]->props.family; switch(encap_family) { case AF_INET: @@ -186,8 +187,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4; break; case AF_INET6: - ipv6_addr_copy(&fl_tunnel.fl6_dst, (struct in6_addr*)&xfrm[i]->id.daddr.a6); - ipv6_addr_copy(&fl_tunnel.fl6_src, (struct in6_addr*)&xfrm[i]->props.saddr.a6); + ipv6_addr_copy(&fl_tunnel.fl6_dst, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_dst)); + + ipv6_addr_copy(&fl_tunnel.fl6_src, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_src)); break; default: BUG_ON(1); @@ -247,9 +249,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int x->u.rt6.rt6i_metric = rt0->rt6i_metric; x->u.rt6.rt6i_node = rt0->rt6i_node; x->u.rt6.rt6i_gateway = rt0->rt6i_gateway; - memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway)); + memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway)); x->u.rt6.rt6i_dst = rt0->rt6i_dst; - x->u.rt6.rt6i_src = rt0->rt6i_src; + x->u.rt6.rt6i_src = rt0->rt6i_src; x->u.rt6.rt6i_idev = rt0->rt6i_idev; in6_dev_hold(rt0->rt6i_idev); __xfrm6_bundle_len_dec(&header_len, &nfheader_len, x->u.dst.xfrm); diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c index 60ad5f0..baa461b 100644 --- a/net/ipv6/xfrm6_state.c +++ b/net/ipv6/xfrm6_state.c @@ -8,7 +8,7 @@ * IPv6 support * YOSHIFUJI Hideaki @USAGI * Split up af-specific portion - * + * */ #include <net/xfrm.h> diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 12e426b..fb02287 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -32,7 +32,7 @@ #include <linux/mutex.h> /* - * xfrm_tunnel_spi things are for allocating unique id ("spi") + * xfrm_tunnel_spi things are for allocating unique id ("spi") * per xfrm_address_t. */ struct xfrm6_tunnel_spi { @@ -155,8 +155,8 @@ static u32 __xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr) for (spi = xfrm6_tunnel_spi; spi <= XFRM6_TUNNEL_SPI_MAX; spi++) { index = xfrm6_tunnel_spi_hash_byspi(spi); - hlist_for_each_entry(x6spi, pos, - &xfrm6_tunnel_spi_byspi[index], + hlist_for_each_entry(x6spi, pos, + &xfrm6_tunnel_spi_byspi[index], list_byspi) { if (x6spi->spi == spi) goto try_next_1; @@ -167,8 +167,8 @@ try_next_1:; } for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tunnel_spi; spi++) { index = xfrm6_tunnel_spi_hash_byspi(spi); - hlist_for_each_entry(x6spi, pos, - &xfrm6_tunnel_spi_byspi[index], + hlist_for_each_entry(x6spi, pos, + &xfrm6_tunnel_spi_byspi[index], list_byspi) { if (x6spi->spi == spi) goto try_next_2; @@ -222,7 +222,7 @@ void xfrm6_tunnel_free_spi(xfrm_address_t *saddr) write_lock_bh(&xfrm6_tunnel_spi_lock); - hlist_for_each_entry_safe(x6spi, pos, n, + hlist_for_each_entry_safe(x6spi, pos, n, &xfrm6_tunnel_spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)], list_byaddr) { @@ -269,9 +269,9 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, { /* xfrm6_tunnel native err handling */ switch (type) { - case ICMPV6_DEST_UNREACH: + case ICMPV6_DEST_UNREACH: switch (code) { - case ICMPV6_NOROUTE: + case ICMPV6_NOROUTE: case ICMPV6_ADM_PROHIBITED: case ICMPV6_NOT_NEIGHBOUR: case ICMPV6_ADDR_UNREACH: @@ -287,7 +287,7 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, case ICMPV6_EXC_HOPLIMIT: break; case ICMPV6_EXC_FRAGTIME: - default: + default: break; } break; diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 89f283c..cac35a7 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -11,7 +11,7 @@ * work I am currently employed to do there. * * All the material in this file is subject to the Gnu license version 2. - * Neither Alan Cox nor the Swansea University Computer Society admit + * Neither Alan Cox nor the Swansea University Computer Society admit * liability nor provide warranty for any of this software. This material * is provided as is and at no charge. * @@ -152,8 +152,8 @@ static void ipx_destroy_socket(struct sock *sk) ipx_remove_socket(sk); skb_queue_purge(&sk->sk_receive_queue); #ifdef IPX_REFCNT_DEBUG - atomic_dec(&ipx_sock_nr); - printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk, + atomic_dec(&ipx_sock_nr); + printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk, atomic_read(&ipx_sock_nr)); if (atomic_read(&sk->sk_refcnt) != 1) printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n", @@ -162,7 +162,7 @@ static void ipx_destroy_socket(struct sock *sk) sock_put(sk); } -/* +/* * The following code is used to support IPX Interfaces (IPXITF). An * IPX interface is defined by a physical device and a frame type. */ @@ -369,7 +369,7 @@ static __exit void ipxitf_cleanup(void) struct ipx_interface *i, *tmp; spin_lock_bh(&ipx_interfaces_lock); - list_for_each_entry_safe(i, tmp, &ipx_interfaces, node) + list_for_each_entry_safe(i, tmp, &ipx_interfaces, node) __ipxitf_put(i); spin_unlock_bh(&ipx_interfaces_lock); } @@ -446,10 +446,10 @@ static struct sock *ncp_connection_hack(struct ipx_interface *intrfc, * You might call this a hack, but believe me, you do not want a * complete NCP layer in the kernel, and this is VERY fast as well. */ struct sock *sk = NULL; - int connection = 0; + int connection = 0; u8 *ncphdr = (u8 *)(ipx + 1); - if (*ncphdr == 0x22 && *(ncphdr + 1) == 0x22) /* NCP request */ + if (*ncphdr == 0x22 && *(ncphdr + 1) == 0x22) /* NCP request */ connection = (((int) *(ncphdr + 5)) << 8) | (int) *(ncphdr + 3); else if (*ncphdr == 0x77 && *(ncphdr + 1) == 0x77) /* BURST packet */ connection = (((int) *(ncphdr + 9)) << 8) | (int) *(ncphdr + 8); @@ -482,7 +482,7 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc, if (intrfc == ipx_primary_net && ntohs(ipx->ipx_dest.sock) == 0x451) sock1 = ncp_connection_hack(intrfc, ipx); - if (!sock1) + if (!sock1) /* No special socket found, forward the packet the normal way */ sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock); @@ -607,22 +607,22 @@ int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node) *last_hop = IPX_SKB_CB(skb)->last_hop.netnum; IPX_SKB_CB(skb)->last_hop.index = -1; } - - /* + + /* * We need to know how many skbuffs it will take to send out this * packet to avoid unnecessary copies. */ - - if (!dl || !dev || dev->flags & IFF_LOOPBACK) + + if (!dl || !dev || dev->flags & IFF_LOOPBACK) send_to_wire = 0; /* No non looped */ /* - * See if this should be demuxed to sockets on this interface + * See if this should be demuxed to sockets on this interface * * We want to ensure the original was eaten or that we only use * up clones. */ - + if (ipx->ipx_dest.net == intrfc->if_netnum) { /* * To our own node, loop and free the original. @@ -709,8 +709,8 @@ static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb) /* See if we should update our network number */ if (!intrfc->if_netnum) /* net number of intrfc not known yet */ - ipxitf_discover_netnum(intrfc, skb); - + ipxitf_discover_netnum(intrfc, skb); + IPX_SKB_CB(skb)->last_hop.index = -1; if (ipx->ipx_type == IPX_TYPE_PPROP) { rc = ipxitf_pprop(intrfc, skb); @@ -756,7 +756,7 @@ out_intrfc: static void ipxitf_discover_netnum(struct ipx_interface *intrfc, struct sk_buff *skb) -{ +{ const struct ipx_cb *cb = IPX_SKB_CB(skb); /* see if this is an intra packet: source_net == dest_net */ @@ -793,7 +793,7 @@ static void ipxitf_discover_netnum(struct ipx_interface *intrfc, * it, not even processing it locally, if it has exact %IPX_MAX_PPROP_HOPS we * don't broadcast it, but process it locally. See chapter 5 of Novell's "IPX * RIP and SAP Router Specification", Part Number 107-000029-001. - * + * * If it is valid, check if we have pprop broadcasting enabled by the user, * if not, just return zero for local processing. * @@ -820,7 +820,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb) * tctrl <= 15, any data payload... */ if (IPX_SKB_CB(skb)->ipx_tctrl > IPX_MAX_PPROP_HOPS || ntohs(ipx->ipx_pktsize) < sizeof(struct ipxhdr) + - IPX_MAX_PPROP_HOPS * sizeof(u32)) + IPX_MAX_PPROP_HOPS * sizeof(u32)) goto out; /* are we broadcasting this damn thing? */ rc = 0; @@ -831,7 +831,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb) * locally. */ if (IPX_SKB_CB(skb)->ipx_tctrl == IPX_MAX_PPROP_HOPS) goto out; - + c = ((u8 *) ipx) + sizeof(struct ipxhdr); l = (__be32 *) c; @@ -851,7 +851,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb) /* Except unconfigured interfaces */ if (!ifcs->if_netnum) continue; - + /* That aren't in the list */ if (ifcs == intrfc) continue; @@ -1003,7 +1003,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef) dlink_type = htons(ETH_P_IPX); datalink = pEII_datalink; break; - } else + } else printk(KERN_WARNING "IPX frame type EtherII over " "token-ring is obsolete. Use SNAP " "instead.\n"); @@ -1208,14 +1208,14 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg) rc = 0; break; } - case SIOCAIPXITFCRT: + case SIOCAIPXITFCRT: rc = -EFAULT; if (get_user(val, (unsigned char __user *) arg)) break; rc = 0; ipxcfg_auto_create_interfaces = val; break; - case SIOCAIPXPRISLT: + case SIOCAIPXPRISLT: rc = -EFAULT; if (get_user(val, (unsigned char __user *) arg)) break; @@ -1230,14 +1230,14 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg) /* * Checksum routine for IPX */ - + /* Note: We assume ipx_tctrl==0 and htons(length)==ipx_pktsize */ /* This functions should *not* mess with packet contents */ __be16 ipx_cksum(struct ipxhdr *packet, int length) { - /* - * NOTE: sum is a net byte order quantity, which optimizes the + /* + * NOTE: sum is a net byte order quantity, which optimizes the * loop. This only works on big and little endian machines. (I * don't know of a machine that isn't.) */ @@ -1342,7 +1342,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname, rc = -EINVAL; if(len < 0) goto out; - + rc = -EFAULT; if (put_user(len, optlen) || copy_to_user(optval, &val, len)) goto out; @@ -1372,13 +1372,13 @@ static int ipx_create(struct socket *sock, int protocol) if (sock->type != SOCK_DGRAM) goto out; - rc = -ENOMEM; + rc = -ENOMEM; sk = sk_alloc(PF_IPX, GFP_KERNEL, &ipx_proto, 1); if (!sk) goto out; #ifdef IPX_REFCNT_DEBUG - atomic_inc(&ipx_sock_nr); - printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk, + atomic_inc(&ipx_sock_nr); + printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk, atomic_read(&ipx_sock_nr)); #endif sock_init_data(sock, sk); @@ -1561,7 +1561,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr, goto out; } - /* We can either connect to primary network or somewhere + /* We can either connect to primary network or somewhere * we can route to */ rt = ipxrtr_lookup(addr->sipx_network); rc = -ENETUNREACH; @@ -1641,10 +1641,10 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty struct ipxhdr *ipx; u16 ipx_pktsize; int rc = 0; - - /* Not ours */ - if (skb->pkt_type == PACKET_OTHERHOST) - goto drop; + + /* Not ours */ + if (skb->pkt_type == PACKET_OTHERHOST) + goto drop; if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) goto out; @@ -1653,12 +1653,12 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty goto drop; ipx_pktsize = ntohs(ipx_hdr(skb)->ipx_pktsize); - + /* Too small or invalid header? */ if (ipx_pktsize < sizeof(struct ipxhdr) || !pskb_may_pull(skb, ipx_pktsize)) goto drop; - + ipx = ipx_hdr(skb); if (ipx->ipx_checksum != IPX_NO_CHECKSUM && ipx->ipx_checksum != ipx_cksum(ipx, ipx_pktsize)) @@ -1786,7 +1786,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, if (rc) goto out; } - + rc = -ENOTCONN; if (sock_flag(sk, SOCK_ZAPPED)) goto out; @@ -1875,15 +1875,15 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) * This socket wants to take care of the NCP connection * handed to us in arg. */ - rc = -EPERM; - if (!capable(CAP_NET_ADMIN)) + rc = -EPERM; + if (!capable(CAP_NET_ADMIN)) break; rc = get_user(ipx_sk(sk)->ipx_ncp_conn, (const unsigned short __user *)argp); break; case SIOCGSTAMP: rc = -EINVAL; - if (sk) + if (sk) rc = sock_get_timestamp(sk, argp); break; case SIOCGIFDSTADDR: diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c index b7463df..811e4ba 100644 --- a/net/ipx/ipx_proc.c +++ b/net/ipx/ipx_proc.c @@ -352,7 +352,7 @@ int __init ipx_proc_init(void) { struct proc_dir_entry *p; int rc = -ENOMEM; - + ipx_proc_dir = proc_mkdir("ipx", proc_net); if (!ipx_proc_dir) diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c index 68560ee..8e1cad9 100644 --- a/net/ipx/ipx_route.c +++ b/net/ipx/ipx_route.c @@ -234,7 +234,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, if (rc) { kfree_skb(skb); goto out_put; - } + } /* Apply checksum. Not allowed on 802.3 links. */ if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023)) @@ -242,7 +242,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, else ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr)); - rc = ipxitf_send(intrfc, skb, (rt && rt->ir_routed) ? + rc = ipxitf_send(intrfc, skb, (rt && rt->ir_routed) ? rt->ir_router_node : ipx->ipx_dest.node); out_put: ipxitf_put(intrfc); diff --git a/net/ipx/sysctl_net_ipx.c b/net/ipx/sysctl_net_ipx.c index fa57473..85ae35f 100644 --- a/net/ipx/sysctl_net_ipx.c +++ b/net/ipx/sysctl_net_ipx.c @@ -34,7 +34,7 @@ static struct ctl_table ipx_dir_table[] = { .procname = "ipx", .mode = 0555, .child = ipx_table, - }, + }, { 0 }, }; diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 7e1aea8..eabd683 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -138,7 +138,7 @@ static void irda_disconnect_indication(void *instance, void *sap, sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); - sock_orphan(sk); + sock_orphan(sk); release_sock(sk); /* Close our TSAP. @@ -158,7 +158,7 @@ static void irda_disconnect_indication(void *instance, void *sap, irttp_close_tsap(self->tsap); self->tsap = NULL; } - } + } /* Note : once we are there, there is not much you want to do * with the socket anymore, apart from closing it. @@ -1211,7 +1211,7 @@ static int irda_release(struct socket *sock) IRDA_DEBUG(2, "%s()\n", __FUNCTION__); - if (sk == NULL) + if (sk == NULL) return 0; lock_sock(sk); @@ -1259,7 +1259,7 @@ static int irda_release(struct socket *sock) * memory leak is now gone... - Jean II */ - return 0; + return 0; } /* @@ -1312,7 +1312,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, len = self->max_data_size; } - skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, + skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) return -ENOBUFS; @@ -1714,7 +1714,7 @@ static int irda_shutdown(struct socket *sock, int how) self->daddr = DEV_ADDR_ANY; /* Until we get re-connected */ self->saddr = 0x0; /* so IrLMP assign us any link */ - return 0; + return 0; } /* diff --git a/net/irda/discovery.c b/net/irda/discovery.c index 89fd2a2..789478b 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: discovery.c * Version: 0.1 * Description: Routines for handling discoveries at the IrLMP layer @@ -10,24 +10,24 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * Modified at: Fri May 28 3:11 CST 1999 * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/string.h> @@ -65,9 +65,9 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) spin_lock_irqsave(&cachelog->hb_spinlock, flags); - /* - * Remove all discoveries of devices that has previously been - * discovered on the same link with the same name (info), or the + /* + * Remove all discoveries of devices that has previously been + * discovered on the same link with the same name (info), or the * same daddr. We do this since some devices (mostly PDAs) change * their device address between every discovery. */ @@ -79,10 +79,10 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) discovery = (discovery_t *) hashbin_get_next(cachelog); if ((node->data.saddr == new->data.saddr) && - ((node->data.daddr == new->data.daddr) || + ((node->data.daddr == new->data.daddr) || (strcmp(node->data.info, new->data.info) == 0))) { - /* This discovery is a previous discovery + /* This discovery is a previous discovery * from the same device, so just remove it */ hashbin_remove_this(cachelog, (irda_queue_t *) node); @@ -134,7 +134,7 @@ void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log) discovery = (discovery_t *) hashbin_remove_first(log); } - + /* Delete the now empty log */ hashbin_delete(log, (FREE_FUNC) kfree); } @@ -232,7 +232,7 @@ void irlmp_dump_discoveries(hashbin_t *log) while (discovery != NULL) { IRDA_DEBUG(0, "Discovery:\n"); IRDA_DEBUG(0, " daddr=%08x\n", discovery->data.daddr); - IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr); + IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr); IRDA_DEBUG(0, " nickname=%s\n", discovery->data.info); discovery = (discovery_t *) hashbin_get_next(log); @@ -321,26 +321,26 @@ static inline discovery_t *discovery_seq_idx(loff_t pos) { discovery_t *discovery; - for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog); + for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog); discovery != NULL; discovery = (discovery_t *) hashbin_get_next(irlmp->cachelog)) { if (pos-- == 0) break; } - + return discovery; } static void *discovery_seq_start(struct seq_file *seq, loff_t *pos) { spin_lock_irq(&irlmp->cachelog->hb_spinlock); - return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN; + return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN; } static void *discovery_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) + return (v == SEQ_START_TOKEN) ? (void *) hashbin_get_first(irlmp->cachelog) : (void *) hashbin_get_next(irlmp->cachelog); } @@ -357,9 +357,9 @@ static int discovery_seq_show(struct seq_file *seq, void *v) else { const discovery_t *discovery = v; - seq_printf(seq, "nickname: %s, hint: 0x%02x%02x", + seq_printf(seq, "nickname: %s, hint: 0x%02x%02x", discovery->data.info, - discovery->data.hints[0], + discovery->data.hints[0], discovery->data.hints[1]); #if 0 if ( discovery->data.hints[0] & HINT_PNP) @@ -376,20 +376,20 @@ static int discovery_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "Fax "); if ( discovery->data.hints[0] & HINT_LAN) seq_puts(seq, "LAN Access "); - + if ( discovery->data.hints[1] & HINT_TELEPHONY) seq_puts(seq, "Telephony "); if ( discovery->data.hints[1] & HINT_FILE_SERVER) - seq_puts(seq, "File Server "); + seq_puts(seq, "File Server "); if ( discovery->data.hints[1] & HINT_COMM) seq_puts(seq, "IrCOMM "); if ( discovery->data.hints[1] & HINT_OBEX) seq_puts(seq, "IrOBEX "); -#endif +#endif seq_printf(seq,", saddr: 0x%08x, daddr: 0x%08x\n\n", discovery->data.saddr, discovery->data.daddr); - + seq_putc(seq, '\n'); } return 0; diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c index ad6b6af..c28ee7b 100644 --- a/net/irda/ircomm/ircomm_core.c +++ b/net/irda/ircomm/ircomm_core.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_core.c * Version: 1.0 * Description: IrCOMM service interface @@ -8,25 +8,25 @@ * Created at: Sun Jun 6 20:37:34 1999 * Modified at: Tue Dec 21 13:26:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/module.h> @@ -49,7 +49,7 @@ #include <net/irda/ircomm_core.h> static int __ircomm_close(struct ircomm_cb *self); -static void ircomm_control_indication(struct ircomm_cb *self, +static void ircomm_control_indication(struct ircomm_cb *self, struct sk_buff *skb, int clen); #ifdef CONFIG_PROC_FS @@ -69,22 +69,22 @@ hashbin_t *ircomm = NULL; static int __init ircomm_init(void) { - ircomm = hashbin_new(HB_LOCK); + ircomm = hashbin_new(HB_LOCK); if (ircomm == NULL) { IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); return -ENOMEM; } - + #ifdef CONFIG_PROC_FS { struct proc_dir_entry *ent; ent = create_proc_entry("ircomm", 0, proc_irda); - if (ent) + if (ent) ent->proc_fops = &ircomm_proc_fops; } #endif /* CONFIG_PROC_FS */ - + IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n"); - + return 0; } @@ -139,7 +139,7 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line) hashbin_insert(ircomm, (irda_queue_t *) self, line, NULL); - ircomm_next_state(self, IRCOMM_IDLE); + ircomm_next_state(self, IRCOMM_IDLE); return self; } @@ -195,8 +195,8 @@ int ircomm_close(struct ircomm_cb *self) entry = hashbin_remove(ircomm, self->line, NULL); IRDA_ASSERT(entry == self, return -1;); - - return __ircomm_close(self); + + return __ircomm_close(self); } EXPORT_SYMBOL(ircomm_close); @@ -206,9 +206,9 @@ EXPORT_SYMBOL(ircomm_close); * * Impl. of this function is differ from one of the reference. This * function does discovery as well as sending connect request - * + * */ -int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, +int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, __u32 saddr, __u32 daddr, struct sk_buff *skb, __u8 service_type) { @@ -243,20 +243,20 @@ void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info) { int clen = 0; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); /* Check if the packet contains data on the control channel */ if (skb->len > 0) clen = skb->data[0]; - - /* - * If there are any data hiding in the control channel, we must - * deliver it first. The side effect is that the control channel + + /* + * If there are any data hiding in the control channel, we must + * deliver it first. The side effect is that the control channel * will be removed from the skb */ if (self->notify.connect_indication) - self->notify.connect_indication(self->notify.instance, self, + self->notify.connect_indication(self->notify.instance, self, info->qos, info->max_data_size, info->max_header_size, skb); else { @@ -282,7 +282,7 @@ int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata) ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL); return ret; -} +} EXPORT_SYMBOL(ircomm_connect_response); @@ -299,7 +299,7 @@ void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb, if (self->notify.connect_confirm ) self->notify.connect_confirm(self->notify.instance, - self, info->qos, + self, info->qos, info->max_data_size, info->max_header_size, skb); else { @@ -322,7 +322,7 @@ int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb) IRDA_ASSERT(self != NULL, return -EFAULT;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); IRDA_ASSERT(skb != NULL, return -EFAULT;); - + ret = ircomm_do_event(self, IRCOMM_DATA_REQUEST, skb, NULL); return ret; @@ -337,7 +337,7 @@ EXPORT_SYMBOL(ircomm_data_request); * */ void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb) -{ +{ IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(skb->len > 0, return;); @@ -363,9 +363,9 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb) clen = skb->data[0]; - /* - * If there are any data hiding in the control channel, we must - * deliver it first. The side effect is that the control channel + /* + * If there are any data hiding in the control channel, we must + * deliver it first. The side effect is that the control channel * will be removed from the skb */ if (clen > 0) @@ -375,7 +375,7 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb) skb_pull(skb, clen+1); if (skb->len) - ircomm_data_indication(self, skb); + ircomm_data_indication(self, skb); else { IRDA_DEBUG(4, "%s(), data was control info only!\n", __FUNCTION__ ); @@ -391,13 +391,13 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb) int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb) { int ret; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -EFAULT;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); IRDA_ASSERT(skb != NULL, return -EFAULT;); - + ret = ircomm_do_event(self, IRCOMM_CONTROL_REQUEST, skb, NULL); return ret; @@ -411,10 +411,10 @@ EXPORT_SYMBOL(ircomm_control_request); * Data has arrived on the control channel * */ -static void ircomm_control_indication(struct ircomm_cb *self, +static void ircomm_control_indication(struct ircomm_cb *self, struct sk_buff *skb, int clen) { - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); /* Use udata for delivering data on the control channel */ if (self->notify.udata_indication) { @@ -427,8 +427,8 @@ static void ircomm_control_indication(struct ircomm_cb *self, /* Remove data channel from control channel */ skb_trim(ctrl_skb, clen+1); - - self->notify.udata_indication(self->notify.instance, self, + + self->notify.udata_indication(self->notify.instance, self, ctrl_skb); /* Drop reference count - @@ -455,7 +455,7 @@ int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); - ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata, + ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata, &info); return ret; } @@ -472,7 +472,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(info != NULL, return;); if (self->notify.disconnect_indication) { @@ -486,7 +486,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb, /* * Function ircomm_flow_request (self, flow) * - * + * * */ void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow) @@ -517,7 +517,7 @@ static void *ircomm_seq_start(struct seq_file *seq, loff_t *pos) self = (struct ircomm_cb *) hashbin_get_next(ircomm)) { if (off++ == *pos) break; - + } return self; } @@ -535,7 +535,7 @@ static void ircomm_seq_stop(struct seq_file *seq, void *v) } static int ircomm_seq_show(struct seq_file *seq, void *v) -{ +{ const struct ircomm_cb *self = v; IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EINVAL; ); @@ -548,7 +548,7 @@ static int ircomm_seq_show(struct seq_file *seq, void *v) seq_printf(seq, " state: %s, slsap_sel: %#02x, dlsap_sel: %#02x, mode:", ircomm_state[ self->state], - self->slsap_sel, self->dlsap_sel); + self->slsap_sel, self->dlsap_sel); if(self->service_type & IRCOMM_3_WIRE_RAW) seq_printf(seq, " 3-wire-raw"); diff --git a/net/irda/ircomm/ircomm_event.c b/net/irda/ircomm/ircomm_event.c index 01f4e80..23d0468 100644 --- a/net/irda/ircomm/ircomm_event.c +++ b/net/irda/ircomm/ircomm_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_event.c * Version: 1.0 * Description: IrCOMM layer state machine @@ -8,24 +8,24 @@ * Created at: Sun Jun 6 20:33:11 1999 * Modified at: Sun Dec 12 13:44:32 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -41,13 +41,13 @@ #include <net/irda/ircomm_core.h> #include <net/irda/ircomm_event.h> -static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); -static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); -static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); -static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); char *ircomm_state[] = { @@ -60,26 +60,26 @@ char *ircomm_state[] = { #ifdef CONFIG_IRDA_DEBUG static char *ircomm_event[] = { "IRCOMM_CONNECT_REQUEST", - "IRCOMM_CONNECT_RESPONSE", - "IRCOMM_TTP_CONNECT_INDICATION", + "IRCOMM_CONNECT_RESPONSE", + "IRCOMM_TTP_CONNECT_INDICATION", "IRCOMM_LMP_CONNECT_INDICATION", - "IRCOMM_TTP_CONNECT_CONFIRM", + "IRCOMM_TTP_CONNECT_CONFIRM", "IRCOMM_LMP_CONNECT_CONFIRM", - "IRCOMM_LMP_DISCONNECT_INDICATION", + "IRCOMM_LMP_DISCONNECT_INDICATION", "IRCOMM_TTP_DISCONNECT_INDICATION", - "IRCOMM_DISCONNECT_REQUEST", + "IRCOMM_DISCONNECT_REQUEST", - "IRCOMM_TTP_DATA_INDICATION", + "IRCOMM_TTP_DATA_INDICATION", "IRCOMM_LMP_DATA_INDICATION", - "IRCOMM_DATA_REQUEST", - "IRCOMM_CONTROL_REQUEST", - "IRCOMM_CONTROL_INDICATION", + "IRCOMM_DATA_REQUEST", + "IRCOMM_CONTROL_REQUEST", + "IRCOMM_CONTROL_INDICATION", }; #endif /* CONFIG_IRDA_DEBUG */ static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event, - struct sk_buff *skb, struct ircomm_info *info) = + struct sk_buff *skb, struct ircomm_info *info) = { ircomm_state_idle, ircomm_state_waiti, @@ -93,14 +93,14 @@ static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event, * IrCOMM is currently idle * */ -static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; switch (event) { case IRCOMM_CONNECT_REQUEST: - ircomm_next_state(self, IRCOMM_WAITI); + ircomm_next_state(self, IRCOMM_WAITI); ret = self->issue.connect_request(self, skb, info); break; case IRCOMM_TTP_CONNECT_INDICATION: @@ -119,10 +119,10 @@ static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, /* * Function ircomm_state_waiti (self, event, skb) * - * The IrCOMM user has requested an IrCOMM connection to the remote + * The IrCOMM user has requested an IrCOMM connection to the remote * device and is awaiting confirmation */ -static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; @@ -152,8 +152,8 @@ static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, * IrCOMM has received an incoming connection request and is awaiting * response from the user */ -static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, - struct sk_buff *skb, struct ircomm_info *info) +static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, + struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; @@ -185,7 +185,7 @@ static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, * IrCOMM is connected to the peer IrCOMM device * */ -static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; @@ -228,7 +228,7 @@ static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, * */ int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event, - struct sk_buff *skb, struct ircomm_info *info) + struct sk_buff *skb, struct ircomm_info *info) { IRDA_DEBUG(4, "%s: state=%s, event=%s\n", __FUNCTION__ , ircomm_state[self->state], ircomm_event[event]); @@ -245,7 +245,7 @@ int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event, void ircomm_next_state(struct ircomm_cb *self, IRCOMM_STATE state) { self->state = state; - - IRDA_DEBUG(4, "%s: next state=%s, service type=%d\n", __FUNCTION__ , + + IRDA_DEBUG(4, "%s: next state=%s, service type=%d\n", __FUNCTION__ , ircomm_state[self->state], self->service_type); } diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c index c8e0d89..22bd752 100644 --- a/net/irda/ircomm/ircomm_lmp.c +++ b/net/irda/ircomm/ircomm_lmp.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_lmp.c * Version: 1.0 * Description: Interface between IrCOMM and IrLMP @@ -9,25 +9,25 @@ * Modified at: Sun Dec 12 13:44:17 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: Previous IrLPT work by Thomas Davis - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -45,11 +45,11 @@ /* * Function ircomm_lmp_connect_request (self, userdata) * - * + * * */ -static int ircomm_lmp_connect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_lmp_connect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { int ret = 0; @@ -61,14 +61,14 @@ static int ircomm_lmp_connect_request(struct ircomm_cb *self, skb_get(userdata); ret = irlmp_connect_request(self->lsap, info->dlsap_sel, - info->saddr, info->daddr, NULL, userdata); + info->saddr, info->daddr, NULL, userdata); return ret; -} +} /* * Function ircomm_lmp_connect_response (self, skb) * - * + * * */ static int ircomm_lmp_connect_response(struct ircomm_cb *self, @@ -78,7 +78,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, int ret; IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - + /* Any userdata supplied? */ if (userdata == NULL) { tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); @@ -88,8 +88,8 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, /* Reserve space for MUX and LAP header */ skb_reserve(tx_skb, LMP_MAX_HEADER); } else { - /* - * Check that the client has reserved enough space for + /* + * Check that the client has reserved enough space for * headers */ IRDA_ASSERT(skb_headroom(userdata) >= LMP_MAX_HEADER, @@ -105,22 +105,22 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, return 0; } -static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { - struct sk_buff *tx_skb; + struct sk_buff *tx_skb; int ret; IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - if (!userdata) { + if (!userdata) { tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); if (!tx_skb) return -ENOMEM; - + /* Reserve space for MUX and LAP header */ - skb_reserve(tx_skb, LMP_MAX_HEADER); + skb_reserve(tx_skb, LMP_MAX_HEADER); userdata = tx_skb; } else { /* Don't forget to refcount it - should be NULL anyway */ @@ -136,7 +136,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, * Function ircomm_lmp_flow_control (skb) * * This function is called when a data frame we have sent to IrLAP has - * been deallocated. We do this to make sure we don't flood IrLAP with + * been deallocated. We do this to make sure we don't flood IrLAP with * frames, since we are not using the IrTTP flow control mechanism */ static void ircomm_lmp_flow_control(struct sk_buff *skb) @@ -150,29 +150,29 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb) cb = (struct irda_skb_cb *) skb->cb; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - - line = cb->line; + + line = cb->line; self = (struct ircomm_cb *) hashbin_lock_find(ircomm, line, NULL); - if (!self) { + if (!self) { IRDA_DEBUG(2, "%s(), didn't find myself\n", __FUNCTION__ ); - return; + return; } - IRDA_ASSERT(self != NULL, return;); + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); self->pkt_count--; - if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) { - IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ ); - self->flow_status = FLOW_START; - if (self->notify.flow_indication) - self->notify.flow_indication(self->notify.instance, + if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) { + IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ ); + self->flow_status = FLOW_START; + if (self->notify.flow_indication) + self->notify.flow_indication(self->notify.instance, self, FLOW_START); - } + } } - + /* * Function ircomm_lmp_data_request (self, userdata) * @@ -180,7 +180,7 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb) * */ static int ircomm_lmp_data_request(struct ircomm_cb *self, - struct sk_buff *skb, + struct sk_buff *skb, int not_used) { struct irda_skb_cb *cb; @@ -189,8 +189,8 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self, IRDA_ASSERT(skb != NULL, return -1;); cb = (struct irda_skb_cb *) skb->cb; - - cb->line = self->line; + + cb->line = self->line; IRDA_DEBUG(4, "%s(), sending frame\n", __FUNCTION__ ); @@ -199,13 +199,13 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self, skb->destructor = ircomm_lmp_flow_control; - if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { + if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { IRDA_DEBUG(2, "%s(), asking TTY to slow down!\n", __FUNCTION__ ); - self->flow_status = FLOW_STOP; - if (self->notify.flow_indication) - self->notify.flow_indication(self->notify.instance, - self, FLOW_STOP); - } + self->flow_status = FLOW_STOP; + if (self->notify.flow_indication) + self->notify.flow_indication(self->notify.instance, + self, FLOW_STOP); + } ret = irlmp_data_request(self->lsap, skb); if (ret) { IRDA_ERROR("%s(), failed\n", __FUNCTION__); @@ -227,11 +227,11 @@ static int ircomm_lmp_data_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); - + ircomm_do_event(self, IRCOMM_LMP_DATA_INDICATION, skb, NULL); /* Drop reference count - see ircomm_tty_data_indication(). */ @@ -241,15 +241,15 @@ static int ircomm_lmp_data_indication(void *instance, void *sap, } /* - * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size, + * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size, * max_header_size, skb) * * Connection has been confirmed by peer device * */ static void ircomm_lmp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_seg_size, + struct qos_info *qos, + __u32 max_seg_size, __u8 max_header_size, struct sk_buff *skb) { @@ -312,7 +312,7 @@ static void ircomm_lmp_connect_indication(void *instance, void *sap, * Peer device has closed the connection, or the link went down for some * other reason */ -static void ircomm_lmp_disconnect_indication(void *instance, void *sap, +static void ircomm_lmp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c index a39f573..fbac13e 100644 --- a/net/irda/ircomm/ircomm_param.c +++ b/net/irda/ircomm/ircomm_param.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_param.c * Version: 1.0 * Description: Parameter handling for the IrCOMM protocol @@ -8,24 +8,24 @@ * Created at: Mon Jun 7 10:25:11 1999 * Modified at: Sun Jan 30 14:32:03 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -41,23 +41,23 @@ #include <net/irda/ircomm_param.h> -static int ircomm_param_service_type(void *instance, irda_param_t *param, +static int ircomm_param_service_type(void *instance, irda_param_t *param, int get); -static int ircomm_param_port_type(void *instance, irda_param_t *param, +static int ircomm_param_port_type(void *instance, irda_param_t *param, int get); -static int ircomm_param_port_name(void *instance, irda_param_t *param, +static int ircomm_param_port_name(void *instance, irda_param_t *param, int get); -static int ircomm_param_service_type(void *instance, irda_param_t *param, +static int ircomm_param_service_type(void *instance, irda_param_t *param, int get); -static int ircomm_param_data_rate(void *instance, irda_param_t *param, +static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get); -static int ircomm_param_data_format(void *instance, irda_param_t *param, +static int ircomm_param_data_format(void *instance, irda_param_t *param, int get); -static int ircomm_param_flow_control(void *instance, irda_param_t *param, +static int ircomm_param_flow_control(void *instance, irda_param_t *param, int get); static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get); static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get); -static int ircomm_param_line_status(void *instance, irda_param_t *param, +static int ircomm_param_line_status(void *instance, irda_param_t *param, int get); static int ircomm_param_dte(void *instance, irda_param_t *param, int get); static int ircomm_param_dce(void *instance, irda_param_t *param, int get); @@ -85,7 +85,7 @@ static pi_minor_info_t pi_minor_call_table_9_wire[] = { static pi_major_info_t pi_major_call_table[] = { { pi_minor_call_table_common, 3 }, { pi_minor_call_table_non_raw, 6 }, - { pi_minor_call_table_9_wire, 3 } + { pi_minor_call_table_9_wire, 3 } /* { pi_minor_call_table_centronics } */ }; @@ -119,20 +119,20 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) spin_lock_irqsave(&self->spinlock, flags); - skb = self->ctrl_skb; + skb = self->ctrl_skb; if (!skb) { skb = alloc_skb(256, GFP_ATOMIC); if (!skb) { spin_unlock_irqrestore(&self->spinlock, flags); return -ENOMEM; } - + skb_reserve(skb, self->max_header_size); self->ctrl_skb = skb; } - /* + /* * Inserting is a little bit tricky since we don't know how much - * room we will need. But this should hopefully work OK + * room we will need. But this should hopefully work OK */ count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), &ircomm_param_info); @@ -162,7 +162,7 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) * query and then the remote device sends its initial parameters * */ -static int ircomm_param_service_type(void *instance, irda_param_t *param, +static int ircomm_param_service_type(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -179,7 +179,7 @@ static int ircomm_param_service_type(void *instance, irda_param_t *param, /* Find all common service types */ service_type &= self->service_type; if (!service_type) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), No common service type to use!\n", __FUNCTION__ ); return -1; } @@ -198,12 +198,12 @@ static int ircomm_param_service_type(void *instance, irda_param_t *param, else if (service_type & IRCOMM_3_WIRE_RAW) self->settings.service_type = IRCOMM_3_WIRE_RAW; - IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ , + IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ , self->settings.service_type); - /* + /* * Now the line is ready for some communication. Check if we are a - * server, and send over some initial parameters. + * server, and send over some initial parameters. * Client do it in ircomm_tty_state_setup(). * Note : we may get called from ircomm_tty_getvalue_confirm(), * therefore before we even have open any socket. And self->client @@ -235,13 +235,13 @@ static int ircomm_param_port_type(void *instance, irda_param_t *param, int get) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) param->pv.i = IRCOMM_SERIAL; else { self->settings.port_type = (__u8) param->pv.i; - IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ , + IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ , self->settings.port_type); } return 0; @@ -256,7 +256,7 @@ static int ircomm_param_port_type(void *instance, irda_param_t *param, int get) static int ircomm_param_port_name(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -279,7 +279,7 @@ static int ircomm_param_port_name(void *instance, irda_param_t *param, int get) static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -287,7 +287,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) param->pv.i = self->settings.data_rate; else self->settings.data_rate = param->pv.i; - + IRDA_DEBUG(2, "%s(), data rate = %d\n", __FUNCTION__ , param->pv.i); return 0; @@ -299,7 +299,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) * Exchange data format to be used in this settings * */ -static int ircomm_param_data_format(void *instance, irda_param_t *param, +static int ircomm_param_data_format(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -311,7 +311,7 @@ static int ircomm_param_data_format(void *instance, irda_param_t *param, param->pv.i = self->settings.data_format; else self->settings.data_format = (__u8) param->pv.i; - + return 0; } @@ -321,14 +321,14 @@ static int ircomm_param_data_format(void *instance, irda_param_t *param, * Exchange flow control settings to be used in this settings * */ -static int ircomm_param_flow_control(void *instance, irda_param_t *param, +static int ircomm_param_flow_control(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) param->pv.i = self->settings.flow_control; else @@ -351,7 +351,7 @@ static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) { param->pv.i = self->settings.xonxoff[0]; param->pv.i |= self->settings.xonxoff[1] << 8; @@ -360,7 +360,7 @@ static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get) self->settings.xonxoff[1] = (__u16) param->pv.i >> 8; } - IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ , + IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ , param->pv.i & 0xff, param->pv.i >> 8); return 0; @@ -378,7 +378,7 @@ static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) { param->pv.i = self->settings.enqack[0]; param->pv.i |= self->settings.enqack[1] << 8; @@ -396,10 +396,10 @@ static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get) /* * Function ircomm_param_line_status (self, param) * - * + * * */ -static int ircomm_param_line_status(void *instance, irda_param_t *param, +static int ircomm_param_line_status(void *instance, irda_param_t *param, int get) { IRDA_DEBUG(2, "%s(), not impl.\n", __FUNCTION__ ); @@ -427,7 +427,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get) dte = (__u8) param->pv.i; self->settings.dce = 0; - + if (dte & IRCOMM_DELTA_DTR) self->settings.dce |= (IRCOMM_DELTA_DSR| IRCOMM_DELTA_RI | @@ -436,7 +436,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get) self->settings.dce |= (IRCOMM_DSR| IRCOMM_RI | IRCOMM_CD); - + if (dte & IRCOMM_DELTA_RTS) self->settings.dce |= IRCOMM_DELTA_CTS; if (dte & IRCOMM_RTS) @@ -455,7 +455,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get) /* * Function ircomm_param_dce (instance, param) * - * + * * */ static int ircomm_param_dce(void *instance, irda_param_t *param, int get) diff --git a/net/irda/ircomm/ircomm_ttp.c b/net/irda/ircomm/ircomm_ttp.c index d98bf35..bb06eba 100644 --- a/net/irda/ircomm/ircomm_ttp.c +++ b/net/irda/ircomm/ircomm_ttp.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_ttp.c * Version: 1.0 * Description: Interface between IrCOMM and IrTTP @@ -8,25 +8,25 @@ * Created at: Sun Jun 6 20:48:27 1999 * Modified at: Mon Dec 13 11:35:13 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -43,8 +43,8 @@ static int ircomm_ttp_data_indication(void *instance, void *sap, struct sk_buff *skb); static void ircomm_ttp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_sdu_size, + struct qos_info *qos, + __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb); static void ircomm_ttp_connect_indication(void *instance, void *sap, @@ -54,25 +54,25 @@ static void ircomm_ttp_connect_indication(void *instance, void *sap, struct sk_buff *skb); static void ircomm_ttp_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd); -static void ircomm_ttp_disconnect_indication(void *instance, void *sap, +static void ircomm_ttp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb); static int ircomm_ttp_data_request(struct ircomm_cb *self, - struct sk_buff *skb, + struct sk_buff *skb, int clen); -static int ircomm_ttp_connect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_connect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info); static int ircomm_ttp_connect_response(struct ircomm_cb *self, struct sk_buff *userdata); -static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info); /* * Function ircomm_open_tsap (self) * - * + * * */ int ircomm_open_tsap(struct ircomm_cb *self) @@ -113,11 +113,11 @@ int ircomm_open_tsap(struct ircomm_cb *self) /* * Function ircomm_ttp_connect_request (self, userdata) * - * + * * */ -static int ircomm_ttp_connect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_connect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { int ret = 0; @@ -129,16 +129,16 @@ static int ircomm_ttp_connect_request(struct ircomm_cb *self, skb_get(userdata); ret = irttp_connect_request(self->tsap, info->dlsap_sel, - info->saddr, info->daddr, NULL, - TTP_SAR_DISABLE, userdata); + info->saddr, info->daddr, NULL, + TTP_SAR_DISABLE, userdata); return ret; -} +} /* * Function ircomm_ttp_connect_response (self, skb) * - * + * * */ static int ircomm_ttp_connect_response(struct ircomm_cb *self, @@ -147,7 +147,7 @@ static int ircomm_ttp_connect_response(struct ircomm_cb *self, int ret; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + /* Don't forget to refcount it - should be NULL anyway */ if(userdata) skb_get(userdata); @@ -160,14 +160,14 @@ static int ircomm_ttp_connect_response(struct ircomm_cb *self, /* * Function ircomm_ttp_data_request (self, userdata) * - * Send IrCOMM data to IrTTP layer. Currently we do not try to combine - * control data with pure data, so they will be sent as separate frames. + * Send IrCOMM data to IrTTP layer. Currently we do not try to combine + * control data with pure data, so they will be sent as separate frames. * Should not be a big problem though, since control frames are rare. But - * some of them are sent after connection establishment, so this can + * some of them are sent after connection establishment, so this can * increase the latency a bit. */ static int ircomm_ttp_data_request(struct ircomm_cb *self, - struct sk_buff *skb, + struct sk_buff *skb, int clen) { int ret; @@ -176,7 +176,7 @@ static int ircomm_ttp_data_request(struct ircomm_cb *self, IRDA_DEBUG(2, "%s(), clen=%d\n", __FUNCTION__ , clen); - /* + /* * Insert clen field, currently we either send data only, or control * only frames, to make things easier and avoid queueing */ @@ -210,7 +210,7 @@ static int ircomm_ttp_data_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); @@ -224,8 +224,8 @@ static int ircomm_ttp_data_indication(void *instance, void *sap, } static void ircomm_ttp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_sdu_size, + struct qos_info *qos, + __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { @@ -261,7 +261,7 @@ out: * Function ircomm_ttp_connect_indication (instance, sap, qos, max_sdu_size, * max_header_size, skb) * - * + * * */ static void ircomm_ttp_connect_indication(void *instance, void *sap, @@ -301,11 +301,11 @@ out: /* * Function ircomm_ttp_disconnect_request (self, userdata, info) * - * + * * */ -static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { int ret; @@ -322,10 +322,10 @@ static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, /* * Function ircomm_ttp_disconnect_indication (instance, sap, reason, skb) * - * + * * */ -static void ircomm_ttp_disconnect_indication(void *instance, void *sap, +static void ircomm_ttp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { @@ -361,7 +361,7 @@ static void ircomm_ttp_flow_indication(void *instance, void *sap, IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); - + if (self->notify.flow_indication) self->notify.flow_indication(self->notify.instance, self, cmd); } diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 262bda8..3d241e4 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_tty.c * Version: 1.0 * Description: IrCOMM serial TTY driver @@ -9,25 +9,25 @@ * Modified at: Wed Feb 23 00:09:02 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: serial.c and previous IrCOMM work by Takahide Higuchi - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/init.h> @@ -69,7 +69,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap, struct sk_buff *skb); static int ircomm_tty_control_indication(void *instance, void *sap, struct sk_buff *skb); -static void ircomm_tty_flow_indication(void *instance, void *sap, +static void ircomm_tty_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd); #ifdef CONFIG_PROC_FS static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, @@ -113,7 +113,7 @@ static int __init ircomm_tty_init(void) driver = alloc_tty_driver(IRCOMM_TTY_PORTS); if (!driver) return -ENOMEM; - ircomm_tty = hashbin_new(HB_LOCK); + ircomm_tty = hashbin_new(HB_LOCK); if (ircomm_tty == NULL) { IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); put_tty_driver(driver); @@ -163,11 +163,11 @@ static void __exit ircomm_tty_cleanup(void) { int ret; - IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); ret = tty_unregister_driver(driver); - if (ret) { - IRDA_ERROR("%s(), failed to unregister driver\n", + if (ret) { + IRDA_ERROR("%s(), failed to unregister driver\n", __FUNCTION__); return; } @@ -179,7 +179,7 @@ static void __exit ircomm_tty_cleanup(void) /* * Function ircomm_startup (self) * - * + * * */ static int ircomm_tty_startup(struct ircomm_tty_cb *self) @@ -203,17 +203,17 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) /* These callbacks we must handle ourselves */ notify.data_indication = ircomm_tty_data_indication; notify.udata_indication = ircomm_tty_control_indication; - notify.flow_indication = ircomm_tty_flow_indication; + notify.flow_indication = ircomm_tty_flow_indication; /* Use the ircomm_tty interface for these ones */ - notify.disconnect_indication = ircomm_tty_disconnect_indication; + notify.disconnect_indication = ircomm_tty_disconnect_indication; notify.connect_confirm = ircomm_tty_connect_confirm; - notify.connect_indication = ircomm_tty_connect_indication; + notify.connect_indication = ircomm_tty_connect_indication; strlcpy(notify.name, "ircomm_tty", sizeof(notify.name)); notify.instance = self; if (!self->ircomm) { - self->ircomm = ircomm_open(¬ify, self->service_type, + self->ircomm = ircomm_open(¬ify, self->service_type, self->line); } if (!self->ircomm) @@ -237,10 +237,10 @@ err: /* * Function ircomm_block_til_ready (self, filp) * - * + * * */ -static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, +static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, struct file *filp) { DECLARE_WAITQUEUE(wait, current); @@ -248,7 +248,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, int do_clocal = 0, extra_count = 0; unsigned long flags; struct tty_struct *tty; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); tty = self->tty; @@ -256,7 +256,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, /* * If non-blocking mode is set, or the port is not enabled, * then make the check up front and then exit. - */ + */ if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ /* nonblock mode is set or port is not enabled */ self->flags |= ASYNC_NORMAL_ACTIVE; @@ -268,17 +268,17 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ ); do_clocal = 1; } - + /* Wait for carrier detect and the line to become * free (i.e., not in use by the callout). While we are in * this loop, self->open_count is dropped by one, so that * mgsl_close() knows when to free things. We restore it upon * exit, either normal or abnormal. */ - + retval = 0; add_wait_queue(&self->open_wait, &wait); - + IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", __FILE__,__LINE__, tty->driver->name, self->open_count ); @@ -290,7 +290,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, } spin_unlock_irqrestore(&self->spinlock, flags); self->blocked_open++; - + while (1) { if (tty->termios->c_cflag & CBAUD) { /* Here, we use to lock those two guys, but @@ -298,45 +298,45 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, * I don't see the point (and I see the deadlock). * Jean II */ self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR; - + ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + current->state = TASK_INTERRUPTIBLE; - + if (tty_hung_up_p(filp) || !test_bit(ASYNC_B_INITIALIZED, &self->flags)) { retval = (self->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS; break; } - - /* + + /* * Check if link is ready now. Even if CLOCAL is * specified, we cannot return before the IrCOMM link is - * ready + * ready */ - if (!test_bit(ASYNC_B_CLOSING, &self->flags) && - (do_clocal || (self->settings.dce & IRCOMM_CD)) && + if (!test_bit(ASYNC_B_CLOSING, &self->flags) && + (do_clocal || (self->settings.dce & IRCOMM_CD)) && self->state == IRCOMM_TTY_READY) { - break; + break; } - + if (signal_pending(current)) { retval = -ERESTARTSYS; break; } - + IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", __FILE__,__LINE__, tty->driver->name, self->open_count ); - + schedule(); } - + __set_current_state(TASK_RUNNING); remove_wait_queue(&self->open_wait, &wait); - + if (extra_count) { /* ++ is not atomic, so this should be protected - Jean II */ spin_lock_irqsave(&self->spinlock, flags); @@ -344,14 +344,14 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, spin_unlock_irqrestore(&self->spinlock, flags); } self->blocked_open--; - + IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", __FILE__,__LINE__, tty->driver->name, self->open_count); - + if (!retval) self->flags |= ASYNC_NORMAL_ACTIVE; - - return retval; + + return retval; } /* @@ -384,7 +384,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) IRDA_ERROR("%s(), kmalloc failed!\n", __FUNCTION__); return -ENOMEM; } - + self->magic = IRCOMM_TTY_MAGIC; self->flow = FLOW_STOP; @@ -398,13 +398,13 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) /* Init some important stuff */ init_timer(&self->watchdog_timer); init_waitqueue_head(&self->open_wait); - init_waitqueue_head(&self->close_wait); + init_waitqueue_head(&self->close_wait); spin_lock_init(&self->spinlock); - /* + /* * Force TTY into raw mode by default which is usually what * we want for IrCOMM and IrLPT. This way applications will - * not have to twiddle with printcap etc. + * not have to twiddle with printcap etc. */ tty->termios->c_iflag = 0; tty->termios->c_oflag = 0; @@ -420,7 +420,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) self->tty = tty; spin_unlock_irqrestore(&self->spinlock, flags); - IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name, + IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name, self->line, self->open_count); /* Not really used by us, but lets do it anyway */ @@ -473,7 +473,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) ret = ircomm_tty_block_til_ready(self, filp); if (ret) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), returning after block_til_ready with %d\n", __FUNCTION__ , ret); @@ -519,7 +519,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) * serial port won't be shutdown. */ IRDA_DEBUG(0, "%s(), bad serial port count; " - "tty->count is 1, state->count is %d\n", __FUNCTION__ , + "tty->count is 1, state->count is %d\n", __FUNCTION__ , self->open_count); self->open_count = 1; } @@ -546,7 +546,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) spin_unlock_irqrestore(&self->spinlock, flags); /* - * Now we wait for the transmit buffer to clear; and we notify + * Now we wait for the transmit buffer to clear; and we notify * the line discipline to only process XON/XOFF characters. */ tty->closing = 1; @@ -576,7 +576,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) /* * Function ircomm_tty_flush_buffer (tty) * - * + * * */ static void ircomm_tty_flush_buffer(struct tty_struct *tty) @@ -586,9 +586,9 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - /* - * Let do_softint() do this to avoid race condition with - * do_softint() ;-) + /* + * Let do_softint() do this to avoid race condition with + * do_softint() ;-) */ schedule_work(&self->tqueue); } @@ -597,7 +597,7 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty) * Function ircomm_tty_do_softint (work) * * We use this routine to give the write wakeup to the user at at a - * safe time (as fast as possible after write have completed). This + * safe time (as fast as possible after write have completed). This * can be compared to the Tx interrupt. */ static void ircomm_tty_do_softint(struct work_struct *work) @@ -638,7 +638,7 @@ static void ircomm_tty_do_softint(struct work_struct *work) /* Unlink transmit buffer */ spin_lock_irqsave(&self->spinlock, flags); - + skb = self->tx_skb; self->tx_skb = NULL; @@ -650,9 +650,9 @@ static void ircomm_tty_do_softint(struct work_struct *work) /* Drop reference count - see ircomm_ttp_data_request(). */ dev_kfree_skb(skb); } - + /* Check if user (still) wants to be waken up */ - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) { (tty->ldisc.write_wakeup)(tty); @@ -717,12 +717,12 @@ static int ircomm_tty_write(struct tty_struct *tty, /* Fetch current transmit buffer */ skb = self->tx_skb; - /* + /* * Send out all the data we get, possibly as multiple fragmented * frames, but this will only happen if the data is larger than the * max data size. The normal case however is just the opposite, and * this function may be called multiple times, and will then actually - * defragment the data and send it out as one packet as soon as + * defragment the data and send it out as one packet as soon as * possible, but at a safer point in time */ while (count) { @@ -731,16 +731,16 @@ static int ircomm_tty_write(struct tty_struct *tty, /* Adjust data size to the max data size */ if (size > self->max_data_size) size = self->max_data_size; - - /* + + /* * Do we already have a buffer ready for transmit, or do - * we need to allocate a new frame + * we need to allocate a new frame */ - if (skb) { - /* - * Any room for more data at the end of the current + if (skb) { + /* + * Any room for more data at the end of the current * transmit buffer? Cannot use skb_tailroom, since - * dev_alloc_skb gives us a larger skb than we + * dev_alloc_skb gives us a larger skb than we * requested * Note : use tx_data_size, because max_data_size * may have changed and we don't want to overwrite @@ -751,8 +751,8 @@ static int ircomm_tty_write(struct tty_struct *tty, if (size > tailroom) size = tailroom; } else { - /* - * Current transmit frame is full, so break + /* + * Current transmit frame is full, so break * out, so we can send it as soon as possible */ break; @@ -782,15 +782,15 @@ static int ircomm_tty_write(struct tty_struct *tty, spin_unlock_irqrestore(&self->spinlock, flags); - /* + /* * Schedule a new thread which will transmit the frame as soon * as possible, but at a safe point in time. We do this so the * "user" can give us data multiple times, as PPP does (because of * its 256 byte tx buffer). We will then defragment and send out - * all this data as one single packet. + * all this data as one single packet. */ schedule_work(&self->tqueue); - + return len; } @@ -846,7 +846,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned long orig_jiffies, poll_time; unsigned long flags; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -876,7 +876,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) * * This routine notifies the tty driver that input buffers for the line * discipline are close to full, and it should somehow signal that no - * more characters should be sent to the tty. + * more characters should be sent to the tty. */ static void ircomm_tty_throttle(struct tty_struct *tty) { @@ -890,16 +890,16 @@ static void ircomm_tty_throttle(struct tty_struct *tty) /* Software flow control? */ if (I_IXOFF(tty)) ircomm_tty_send_xchar(tty, STOP_CHAR(tty)); - + /* Hardware flow control? */ if (tty->termios->c_cflag & CRTSCTS) { self->settings.dte &= ~IRCOMM_RTS; self->settings.dte |= IRCOMM_DELTA_RTS; - + ircomm_param_request(self, IRCOMM_DTE, TRUE); } - ircomm_flow_request(self->ircomm, FLOW_STOP); + ircomm_flow_request(self->ircomm, FLOW_STOP); } /* @@ -930,7 +930,7 @@ static void ircomm_tty_unthrottle(struct tty_struct *tty) ircomm_param_request(self, IRCOMM_DTE, TRUE); IRDA_DEBUG(1, "%s(), FLOW_START\n", __FUNCTION__ ); } - ircomm_flow_request(self->ircomm, FLOW_START); + ircomm_flow_request(self->ircomm, FLOW_START); } /* @@ -975,7 +975,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) spin_lock_irqsave(&self->spinlock, flags); del_timer(&self->watchdog_timer); - + /* Free parameter buffer */ if (self->ctrl_skb) { dev_kfree_skb(self->ctrl_skb); @@ -1001,7 +1001,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) * * This routine notifies the tty driver that it should hangup the tty * device. - * + * */ static void ircomm_tty_hangup(struct tty_struct *tty) { @@ -1044,7 +1044,7 @@ static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch) * Function ircomm_tty_start (tty) * * This routine notifies the tty driver that it resume sending - * characters to the tty device. + * characters to the tty device. */ void ircomm_tty_start(struct tty_struct *tty) { @@ -1057,9 +1057,9 @@ void ircomm_tty_start(struct tty_struct *tty) * Function ircomm_tty_stop (tty) * * This routine notifies the tty driver that it should stop outputting - * characters to the tty device. + * characters to the tty device. */ -static void ircomm_tty_stop(struct tty_struct *tty) +static void ircomm_tty_stop(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; @@ -1094,14 +1094,14 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) /*wake_up_interruptible(&self->delta_msr_wait);*/ } if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), ircomm%d CD now %s...\n", __FUNCTION__ , self->line, (status & IRCOMM_CD) ? "on" : "off"); if (status & IRCOMM_CD) { wake_up_interruptible(&self->open_wait); } else { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), Doing serial hangup..\n", __FUNCTION__ ); if (tty) tty_hangup(tty); @@ -1113,10 +1113,10 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) if (self->flags & ASYNC_CTS_FLOW) { if (tty->hw_stopped) { if (status & IRCOMM_CTS) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), CTS tx start...\n", __FUNCTION__ ); tty->hw_stopped = 0; - + /* Wake up processes blocked on open */ wake_up_interruptible(&self->open_wait); @@ -1125,7 +1125,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) } } else { if (!(status & IRCOMM_CTS)) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), CTS tx stop...\n", __FUNCTION__ ); tty->hw_stopped = 1; } @@ -1145,7 +1145,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap, struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); @@ -1155,10 +1155,10 @@ static int ircomm_tty_data_indication(void *instance, void *sap, return 0; } - /* + /* * If we receive data when hardware is stopped then something is wrong. * We try to poll the peers line settings to check if we are up todate. - * Devices like WinCE can do this, and since they don't send any + * Devices like WinCE can do this, and since they don't send any * params, we can just as well declare the hardware for running. */ if (self->tty->hw_stopped && (self->flow == FLOW_START)) { @@ -1170,9 +1170,9 @@ static int ircomm_tty_data_indication(void *instance, void *sap, ircomm_tty_link_established(self); } - /* + /* * Just give it over to the line discipline. There is no need to - * involve the flip buffers, since we are not running in an interrupt + * involve the flip buffers, since we are not running in an interrupt * handler */ self->tty->ldisc.receive_buf(self->tty, skb->data, NULL, skb->len); @@ -1195,14 +1195,14 @@ static int ircomm_tty_control_indication(void *instance, void *sap, int clen; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); clen = skb->data[0]; - irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen), + irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen), &ircomm_param_info); /* No need to kfree_skb - see ircomm_control_indication() */ @@ -1217,7 +1217,7 @@ static int ircomm_tty_control_indication(void *instance, void *sap, * transmission of data. We just mark the hardware as stopped, and wait * for IrTTP to notify us that things are OK again. */ -static void ircomm_tty_flow_indication(void *instance, void *sap, +static void ircomm_tty_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -1247,7 +1247,7 @@ static void ircomm_tty_flow_indication(void *instance, void *sap, static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) { - int ret=0; + int ret=0; ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]); @@ -1260,37 +1260,37 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) ret += sprintf(buf+ret, "3_WIRE_RAW"); else ret += sprintf(buf+ret, "No common service type!\n"); - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Port name: %s\n", self->settings.port_name); - ret += sprintf(buf+ret, "DTE status: "); - if (self->settings.dte & IRCOMM_RTS) - ret += sprintf(buf+ret, "RTS|"); - if (self->settings.dte & IRCOMM_DTR) - ret += sprintf(buf+ret, "DTR|"); + ret += sprintf(buf+ret, "DTE status: "); + if (self->settings.dte & IRCOMM_RTS) + ret += sprintf(buf+ret, "RTS|"); + if (self->settings.dte & IRCOMM_DTR) + ret += sprintf(buf+ret, "DTR|"); if (self->settings.dte) ret--; /* remove the last | */ - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "DCE status: "); - if (self->settings.dce & IRCOMM_CTS) - ret += sprintf(buf+ret, "CTS|"); - if (self->settings.dce & IRCOMM_DSR) - ret += sprintf(buf+ret, "DSR|"); - if (self->settings.dce & IRCOMM_CD) - ret += sprintf(buf+ret, "CD|"); - if (self->settings.dce & IRCOMM_RI) - ret += sprintf(buf+ret, "RI|"); + if (self->settings.dce & IRCOMM_CTS) + ret += sprintf(buf+ret, "CTS|"); + if (self->settings.dce & IRCOMM_DSR) + ret += sprintf(buf+ret, "DSR|"); + if (self->settings.dce & IRCOMM_CD) + ret += sprintf(buf+ret, "CD|"); + if (self->settings.dce & IRCOMM_RI) + ret += sprintf(buf+ret, "RI|"); if (self->settings.dce) ret--; /* remove the last | */ - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Configuration: "); if (!self->settings.null_modem) ret += sprintf(buf+ret, "DTE <-> DCE\n"); else - ret += sprintf(buf+ret, + ret += sprintf(buf+ret, "DTE <-> DTE (null modem emulation)\n"); ret += sprintf(buf+ret, "Data rate: %d\n", self->settings.data_rate); @@ -1314,7 +1314,7 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) ret += sprintf(buf+ret, "ENQ_ACK_OUT|"); if (self->settings.flow_control) ret--; /* remove the last | */ - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Flags: "); if (self->flags & ASYNC_CTS_FLOW) @@ -1333,25 +1333,25 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) ret--; /* remove the last | */ ret += sprintf(buf+ret, "\n"); - ret += sprintf(buf+ret, "Role: %s\n", self->client ? + ret += sprintf(buf+ret, "Role: %s\n", self->client ? "client" : "server"); ret += sprintf(buf+ret, "Open count: %d\n", self->open_count); ret += sprintf(buf+ret, "Max data size: %d\n", self->max_data_size); ret += sprintf(buf+ret, "Max header size: %d\n", self->max_header_size); - + if (self->tty) - ret += sprintf(buf+ret, "Hardware: %s\n", + ret += sprintf(buf+ret, "Hardware: %s\n", self->tty->hw_stopped ? "Stopped" : "Running"); - ret += sprintf(buf+ret, "\n"); - return ret; + ret += sprintf(buf+ret, "\n"); + return ret; } /* * Function ircomm_tty_read_proc (buf, start, offset, len, eof, unused) * - * + * * */ #ifdef CONFIG_PROC_FS @@ -1359,8 +1359,8 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused) { struct ircomm_tty_cb *self; - int count = 0, l; - off_t begin = 0; + int count = 0, l; + off_t begin = 0; unsigned long flags; spin_lock_irqsave(&ircomm_tty->hb_spinlock, flags); @@ -1370,25 +1370,25 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, if (self->magic != IRCOMM_TTY_MAGIC) break; - l = ircomm_tty_line_info(self, buf + count); - count += l; - if (count+begin > offset+len) - goto done; - if (count+begin < offset) { - begin += count; - count = 0; - } - + l = ircomm_tty_line_info(self, buf + count); + count += l; + if (count+begin > offset+len) + goto done; + if (count+begin < offset) { + begin += count; + count = 0; + } + self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty); - } - *eof = 1; + } + *eof = 1; done: spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags); - if (offset >= count+begin) - return 0; - *start = buf + (offset-begin); - return ((len < begin+count-offset) ? len : begin+count-offset); + if (offset >= count+begin) + return 0; + *start = buf + (offset-begin); + return ((len < begin+count-offset) ? len : begin+count-offset); } #endif /* CONFIG_PROC_FS */ diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c index 99f5edd..8d7ba93 100644 --- a/net/irda/ircomm/ircomm_tty_attach.c +++ b/net/irda/ircomm/ircomm_tty_attach.c @@ -1,32 +1,32 @@ /********************************************************************* - * + * * Filename: ircomm_tty_attach.c - * Version: + * Version: * Description: Code for attaching the serial driver to IrCOMM * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Jun 5 17:42:00 1999 * Modified at: Tue Jan 4 14:20:49 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -50,35 +50,35 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self); static void ircomm_tty_discovery_indication(discinfo_t *discovery, DISCOVERY_MODE mode, void *priv); -static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, +static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, struct ias_value *value, void *priv); static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, int timeout); static void ircomm_tty_watchdog_timer_expired(void *data); -static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_search(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_search(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); char *ircomm_tty_state[] = { @@ -111,7 +111,7 @@ static char *ircomm_tty_event[] = { #endif /* CONFIG_IRDA_DEBUG */ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, - struct sk_buff *skb, struct ircomm_tty_info *info) = + struct sk_buff *skb, struct ircomm_tty_info *info) = { ircomm_tty_state_idle, ircomm_tty_state_search, @@ -125,7 +125,7 @@ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, * Function ircomm_tty_attach_cable (driver) * * Try to attach cable (IrCOMM link). This function will only return - * when the link has been connected, or if an error condition occurs. + * when the link has been connected, or if an error condition occurs. * If success, the return value is the resulting service type. */ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) @@ -135,7 +135,7 @@ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - /* Check if somebody has already connected to us */ + /* Check if somebody has already connected to us */ if (ircomm_is_connected(self->ircomm)) { IRDA_DEBUG(0, "%s(), already connected!\n", __FUNCTION__ ); return 0; @@ -177,7 +177,7 @@ void ircomm_tty_detach_cable(struct ircomm_tty_cb *self) self->skey = NULL; } - if (self->iriap) { + if (self->iriap) { iriap_close(self->iriap); self->iriap = NULL; } @@ -212,7 +212,7 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - + /* Compute hint bits based on service */ hints = irlmp_service_to_hint(S_COMM); if (self->service_type & IRCOMM_3_WIRE_RAW) @@ -234,19 +234,19 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self) if (self->service_type & IRCOMM_3_WIRE_RAW) { /* Register IrLPT with LM-IAS */ self->obj = irias_new_object("IrLPT", IAS_IRLPT_ID); - irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel", + irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel", self->slsap_sel, IAS_KERNEL_ATTR); } else { /* Register IrCOMM with LM-IAS */ self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID); - irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel", + irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel", self->slsap_sel, IAS_KERNEL_ATTR); - + /* Code the parameters into the buffer */ - irda_param_pack(oct_seq, "bbbbbb", + irda_param_pack(oct_seq, "bbbbbb", IRCOMM_SERVICE_TYPE, 1, self->service_type, IRCOMM_PORT_TYPE, 1, IRCOMM_SERIAL); - + /* Register parameters with LM-IAS */ irias_add_octseq_attrib(self->obj, "Parameters", oct_seq, 6, IAS_KERNEL_ATTR); @@ -302,23 +302,23 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - if (self->service_type & IRCOMM_3_WIRE_RAW) + if (self->service_type & IRCOMM_3_WIRE_RAW) return 0; - /* - * Set default values, but only if the application for some reason + /* + * Set default values, but only if the application for some reason * haven't set them already */ - IRDA_DEBUG(2, "%s(), data-rate = %d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), data-rate = %d\n", __FUNCTION__ , self->settings.data_rate); if (!self->settings.data_rate) self->settings.data_rate = 9600; - IRDA_DEBUG(2, "%s(), data-format = %d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), data-format = %d\n", __FUNCTION__ , self->settings.data_format); if (!self->settings.data_format) self->settings.data_format = IRCOMM_WSIZE_8; /* 8N1 */ - IRDA_DEBUG(2, "%s(), flow-control = %d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), flow-control = %d\n", __FUNCTION__ , self->settings.flow_control); /*self->settings.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/ @@ -330,7 +330,7 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self) ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE); ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE); - + /* For a 3 wire service, we just flush the last parameter and return */ if (self->settings.service_type == IRCOMM_3_WIRE) { ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); @@ -342,10 +342,10 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self) #if 0 ircomm_param_request(self, IRCOMM_XON_XOFF, FALSE); ircomm_param_request(self, IRCOMM_ENQ_ACK, FALSE); -#endif +#endif /* Notify peer that we are ready to receive data */ ircomm_param_request(self, IRCOMM_DTE, TRUE); - + return 0; } @@ -388,8 +388,8 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery, self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty); while (self != NULL) { IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - - ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION, + + ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION, NULL, &info); self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty); @@ -402,7 +402,7 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery, * Link disconnected * */ -void ircomm_tty_disconnect_indication(void *instance, void *sap, +void ircomm_tty_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { @@ -422,7 +422,7 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap, /* Stop data transfers */ self->tty->hw_stopped = 1; - ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, + ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, NULL); } @@ -432,8 +432,8 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap, * Got result from the IAS query we make * */ -static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, - struct ias_value *value, +static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, + struct ias_value *value, void *priv) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv; @@ -454,18 +454,18 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, } switch (value->type) { - case IAS_OCT_SEQ: + case IAS_OCT_SEQ: IRDA_DEBUG(2, "%s(), got octet sequence\n", __FUNCTION__ ); irda_param_extract_all(self, value->t.oct_seq, value->len, &ircomm_param_info); - ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL, + ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL, NULL); break; case IAS_INTEGER: - /* Got LSAP selector */ - IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __FUNCTION__ , + /* Got LSAP selector */ + IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __FUNCTION__ , value->t.integer); if (value->t.integer == -1) { @@ -491,10 +491,10 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, * Connection confirmed * */ -void ircomm_tty_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_data_size, - __u8 max_header_size, +void ircomm_tty_connect_confirm(void *instance, void *sap, + struct qos_info *qos, + __u32 max_data_size, + __u8 max_header_size, struct sk_buff *skb) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -515,16 +515,16 @@ void ircomm_tty_connect_confirm(void *instance, void *sap, } /* - * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size, + * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size, * skb) * * we are discovered and being requested to connect by remote device ! * */ -void ircomm_tty_connect_indication(void *instance, void *sap, - struct qos_info *qos, +void ircomm_tty_connect_indication(void *instance, void *sap, + struct qos_info *qos, __u32 max_data_size, - __u8 max_header_size, + __u8 max_header_size, struct sk_buff *skb) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -542,8 +542,8 @@ void ircomm_tty_connect_indication(void *instance, void *sap, clen = skb->data[0]; if (clen) - irda_param_extract_all(self, skb->data+1, - IRDA_MIN(skb->len, clen), + irda_param_extract_all(self, skb->data+1, + IRDA_MIN(skb->len, clen), &ircomm_param_info); ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL); @@ -566,14 +566,14 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) if (!self->tty) return; - + del_timer(&self->watchdog_timer); - /* + /* * IrCOMM link is now up, and if we are not using hardware * flow-control, then declare the hardware as running. Otherwise we * will have to wait for the peer device (DCE) to raise the CTS - * line. + * line. */ if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) { IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __FUNCTION__ ); @@ -582,7 +582,7 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) IRDA_DEBUG(1, "%s(), starting hardware!\n", __FUNCTION__ ); self->tty->hw_stopped = 0; - + /* Wake up processes blocked on open */ wake_up_interruptible(&self->open_wait); } @@ -593,8 +593,8 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) /* * Function ircomm_tty_start_watchdog_timer (self, timeout) * - * Start the watchdog timer. This timer is used to make sure that any - * connection attempt is successful, and if not, we will retry after + * Start the watchdog timer. This timer is used to make sure that any + * connection attempt is successful, and if not, we will retry after * the timeout */ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, @@ -616,7 +616,7 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, static void ircomm_tty_watchdog_timer_expired(void *data) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -633,14 +633,14 @@ static void ircomm_tty_watchdog_timer_expired(void *data) * */ int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, - struct sk_buff *skb, struct ircomm_tty_info *info) + struct sk_buff *skb, struct ircomm_tty_info *info) { IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ , ircomm_tty_state[self->state], ircomm_tty_event[event]); - + return (*state[self->state])(self, event, skb, info); } @@ -656,7 +656,7 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_ IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __FUNCTION__ , ircomm_tty_state[self->state], self->service_type); */ self->state = state; @@ -668,9 +668,9 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_ * Just hanging around * */ -static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -679,10 +679,10 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_ATTACH_CABLE: - /* Try to discover any remote devices */ + /* Try to discover any remote devices */ ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); - + irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); break; case IRCOMM_TTY_DISCOVERY_INDICATION: @@ -701,7 +701,7 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, iriap_getvaluebyclass_request(self->iriap, self->saddr, self->daddr, "IrDA:IrCOMM", "Parameters"); - + ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); break; @@ -732,9 +732,9 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, * Trying to discover an IrCOMM device * */ -static int ircomm_tty_state_search(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_search(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -752,19 +752,19 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, __FUNCTION__); return -EBUSY; } - + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, ircomm_tty_getvalue_confirm); - + if (self->service_type == IRCOMM_3_WIRE_RAW) { iriap_getvaluebyclass_request(self->iriap, self->saddr, - self->daddr, "IrLPT", + self->daddr, "IrLPT", "IrDA:IrLMP:LsapSel"); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL); } else { iriap_getvaluebyclass_request(self->iriap, self->saddr, - self->daddr, - "IrDA:IrCOMM", + self->daddr, + "IrDA:IrCOMM", "Parameters"); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); @@ -783,7 +783,7 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, #if 1 /* Give up */ #else - /* Try to discover any remote devices */ + /* Try to discover any remote devices */ ircomm_tty_start_watchdog_timer(self, 3*HZ); irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); #endif @@ -805,9 +805,9 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, * Querying the remote LM-IAS for IrCOMM parameters * */ -static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -822,12 +822,12 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, __FUNCTION__); return -EBUSY; } - + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, ircomm_tty_getvalue_confirm); - iriap_getvaluebyclass_request(self->iriap, self->saddr, - self->daddr, "IrDA:IrCOMM", + iriap_getvaluebyclass_request(self->iriap, self->saddr, + self->daddr, "IrDA:IrCOMM", "IrDA:TinyTP:LsapSel"); ircomm_tty_start_watchdog_timer(self, 3*HZ); @@ -836,7 +836,7 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, case IRCOMM_TTY_WD_TIMER_EXPIRED: /* Go back to search mode */ ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); - ircomm_tty_start_watchdog_timer(self, 3*HZ); + ircomm_tty_start_watchdog_timer(self, 3*HZ); break; case IRCOMM_TTY_CONNECT_INDICATION: del_timer(&self->watchdog_timer); @@ -863,9 +863,9 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, * Query remote LM-IAS for the LSAP selector which we can connect to * */ -static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -877,7 +877,7 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, case IRCOMM_TTY_GOT_LSAPSEL: /* Connect to remote device */ ret = ircomm_connect_request(self->ircomm, self->dlsap_sel, - self->saddr, self->daddr, + self->saddr, self->daddr, NULL, self->service_type); ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_SETUP); @@ -912,9 +912,9 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, * Trying to connect * */ -static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -926,10 +926,10 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, case IRCOMM_TTY_CONNECT_CONFIRM: del_timer(&self->watchdog_timer); ircomm_tty_ias_unregister(self); - - /* + + /* * Send initial parameters. This will also send out queued - * parameters waiting for the connection to come up + * parameters waiting for the connection to come up */ ircomm_tty_send_initial_parameters(self); ircomm_tty_link_established(self); @@ -938,7 +938,7 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, case IRCOMM_TTY_CONNECT_INDICATION: del_timer(&self->watchdog_timer); ircomm_tty_ias_unregister(self); - + /* Accept connection */ ircomm_connect_response(self->ircomm, NULL); ircomm_tty_next_state(self, IRCOMM_TTY_READY); @@ -966,9 +966,9 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, * IrCOMM is now connected * */ -static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -976,7 +976,7 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, switch (event) { case IRCOMM_TTY_DATA_REQUEST: ret = ircomm_data_request(self->ircomm, skb); - break; + break; case IRCOMM_TTY_DETACH_CABLE: ircomm_disconnect_request(self->ircomm, NULL); ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index 75e39ea..a5174e6 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c @@ -1,31 +1,31 @@ /********************************************************************* - * + * * Filename: ircomm_tty_ioctl.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Jun 10 14:39:09 1999 * Modified at: Wed Jan 5 14:45:43 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/init.h> @@ -75,7 +75,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) } if (cflag & CSTOPB) cval |= IRCOMM_2_STOP_BIT; - + if (cflag & PARENB) cval |= IRCOMM_PARITY_ENABLE; if (!(cflag & PARODD)) @@ -88,7 +88,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) self->settings.data_rate = baud; ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); - + /* CTS flow control flag and modem status interrupts */ if (cflag & CRTSCTS) { self->flags |= ASYNC_CTS_FLOW; @@ -104,7 +104,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) self->flags &= ~ASYNC_CHECK_CD; else self->flags |= ASYNC_CHECK_CD; -#if 0 +#if 0 /* * Set up parity check flag */ @@ -113,7 +113,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) driver->read_status_mask |= LSR_FE | LSR_PE; if (I_BRKINT(driver->tty) || I_PARMRK(driver->tty)) driver->read_status_mask |= LSR_BI; - + /* * Characters to ignore */ @@ -124,17 +124,17 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) if (I_IGNBRK(self->tty)) { self->ignore_status_mask |= LSR_BI; /* - * If we're ignore parity and break indicators, ignore + * If we're ignore parity and break indicators, ignore * overruns too. (For real raw support). */ - if (I_IGNPAR(self->tty)) + if (I_IGNPAR(self->tty)) self->ignore_status_mask |= LSR_OE; } #endif self->settings.data_format = cval; ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE); - ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); + ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); } /* @@ -145,7 +145,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) * should be prepared to accept the case where old == NULL, and try to * do something rational. */ -void ircomm_tty_set_termios(struct tty_struct *tty, +void ircomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; @@ -153,8 +153,8 @@ void ircomm_tty_set_termios(struct tty_struct *tty, IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - if ((cflag == old_termios->c_cflag) && - (RELEVANT_IFLAG(tty->termios->c_iflag) == + if ((cflag == old_termios->c_cflag) && + (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { return; @@ -168,21 +168,21 @@ void ircomm_tty_set_termios(struct tty_struct *tty, self->settings.dte &= ~(IRCOMM_DTR|IRCOMM_RTS); ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + /* Handle transition away from B0 status */ if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { self->settings.dte |= IRCOMM_DTR; - if (!(tty->termios->c_cflag & CRTSCTS) || + if (!(tty->termios->c_cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) { self->settings.dte |= IRCOMM_RTS; } ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && - !(tty->termios->c_cflag & CRTSCTS)) + !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; ircomm_tty_start(tty); @@ -192,7 +192,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty, /* * Function ircomm_tty_tiocmget (tty, file) * - * + * * */ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) @@ -217,12 +217,12 @@ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) /* * Function ircomm_tty_tiocmset (tty, file, set, clear) * - * + * * */ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) -{ +{ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -249,21 +249,21 @@ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, self->settings.dte |= IRCOMM_DELTA_DTR; ircomm_param_request(self, IRCOMM_DTE, TRUE); - + return 0; } /* * Function get_serial_info (driver, retinfo) * - * + * * */ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, struct serial_struct __user *retinfo) { struct serial_struct info; - + if (!retinfo) return -EFAULT; @@ -277,11 +277,11 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, info.closing_wait = self->closing_wait; /* For compatibility */ - info.type = PORT_16550A; - info.port = 0; - info.irq = 0; + info.type = PORT_16550A; + info.port = 0; + info.irq = 0; info.xmit_fifo_size = 0; - info.hub6 = 0; + info.hub6 = 0; info.custom_divisor = 0; if (copy_to_user(retinfo, &info, sizeof(*retinfo))) @@ -293,7 +293,7 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, /* * Function set_serial_info (driver, new_info) * - * + * * */ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, @@ -311,7 +311,7 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, state = self old_state = *self; - + if (!capable(CAP_SYS_ADMIN)) { if ((new_serial.baud_base != state->settings.data_rate) || (new_serial.close_delay != state->close_delay) || @@ -368,10 +368,10 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, /* * Function ircomm_tty_ioctl (tty, file, cmd, arg) * - * + * * */ -int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, +int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; @@ -416,7 +416,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, put_user(cnow.brk, &p_cuser->brk) || put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) return -EFAULT; -#endif +#endif return 0; default: ret = -ENOIOCTLCMD; /* ioctls which we must ignore */ diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 7e7a317..e717801 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -341,11 +341,11 @@ static void irda_task_timer_expired(void *data) */ static void irda_device_setup(struct net_device *dev) { - dev->hard_header_len = 0; - dev->addr_len = LAP_ALEN; + dev->hard_header_len = 0; + dev->addr_len = LAP_ALEN; - dev->type = ARPHRD_IRDA; - dev->tx_queue_len = 8; /* Window size + 1 s-frame */ + dev->type = ARPHRD_IRDA; + dev->tx_queue_len = 8; /* Window size + 1 s-frame */ memset(dev->broadcast, 0xff, LAP_ALEN); @@ -354,7 +354,7 @@ static void irda_device_setup(struct net_device *dev) } /* - * Funciton alloc_irdadev + * Funciton alloc_irdadev * Allocates and sets up an IRDA device in a manner similar to * alloc_etherdev. */ @@ -386,9 +386,9 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type) /* Try to load the module needed */ if (!reg && capable(CAP_SYS_MODULE)) { spin_unlock(&dongles->hb_spinlock); - + request_module("irda-dongle-%d", type); - + spin_lock(&dongles->hb_spinlock); reg = hashbin_find(dongles, type, NULL); } @@ -438,15 +438,15 @@ int irda_device_register_dongle(struct dongle_reg *new) spin_lock(&dongles->hb_spinlock); /* Check if this dongle has been registered before */ if (hashbin_find(dongles, new->type, NULL)) { - IRDA_MESSAGE("%s: Dongle type %x already registered\n", + IRDA_MESSAGE("%s: Dongle type %x already registered\n", __FUNCTION__, new->type); - } else { + } else { /* Insert IrDA dongle into hashbin */ hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL); } spin_unlock(&dongles->hb_spinlock); - return 0; + return 0; } EXPORT_SYMBOL(irda_device_register_dongle); @@ -462,7 +462,7 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle) spin_lock(&dongles->hb_spinlock); node = hashbin_remove(dongles, dongle->type, NULL); - if (!node) + if (!node) IRDA_ERROR("%s: dongle not found!\n", __FUNCTION__); spin_unlock(&dongles->hb_spinlock); } diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 8f1c6d6..98b0fa9 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -79,10 +79,10 @@ static int iriap_data_indication(void *instance, void *sap, static void iriap_watchdog_timer_expired(void *data); -static inline void iriap_start_watchdog_timer(struct iriap_cb *self, - int timeout) +static inline void iriap_start_watchdog_timer(struct iriap_cb *self, + int timeout) { - irda_start_timer(&self->watchdog_timer, timeout, self, + irda_start_timer(&self->watchdog_timer, timeout, self, iriap_watchdog_timer_expired); } @@ -674,7 +674,7 @@ static void iriap_getvaluebyclass_indication(struct iriap_cb *self, if (attrib == NULL) { IRDA_DEBUG(2, "LM-IAS: Attribute %s not found\n", attr); iriap_getvaluebyclass_response(self, obj->id, - IAS_ATTRIB_UNKNOWN, + IAS_ATTRIB_UNKNOWN, &irias_missing); return; } @@ -971,7 +971,7 @@ static const char *ias_value_types[] = { "IAS_STRING" }; -static inline struct ias_object *irias_seq_idx(loff_t pos) +static inline struct ias_object *irias_seq_idx(loff_t pos) { struct ias_object *obj; @@ -980,7 +980,7 @@ static inline struct ias_object *irias_seq_idx(loff_t pos) if (pos-- == 0) break; } - + return obj; } @@ -995,7 +995,7 @@ static void *irias_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) + return (v == SEQ_START_TOKEN) ? (void *) hashbin_get_first(irias_objects) : (void *) hashbin_get_next(irias_objects); } @@ -1027,7 +1027,7 @@ static int irias_seq_show(struct seq_file *seq, void *v) for (attrib = (struct ias_attrib *) hashbin_get_first(obj->attribs); attrib != NULL; attrib = (struct ias_attrib *) hashbin_get_next(obj->attribs)) { - + IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, goto outloop; ); @@ -1046,14 +1046,14 @@ static int irias_seq_show(struct seq_file *seq, void *v) attrib->value->t.string); break; case IAS_OCT_SEQ: - seq_printf(seq, "octet sequence (%d bytes)\n", + seq_printf(seq, "octet sequence (%d bytes)\n", attrib->value->len); break; case IAS_MISSING: seq_puts(seq, "missing\n"); break; default: - seq_printf(seq, "type %d?\n", + seq_printf(seq, "type %d?\n", attrib->value->type); } seq_putc(seq, '\n'); diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c index 2a571b4..4adaae2 100644 --- a/net/irda/irias_object.c +++ b/net/irda/irias_object.c @@ -57,8 +57,8 @@ static char *strndup(char *str, size_t max) len = max; /* Allocate new string */ - new_str = kmalloc(len + 1, GFP_ATOMIC); - if (new_str == NULL) { + new_str = kmalloc(len + 1, GFP_ATOMIC); + if (new_str == NULL) { IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); return NULL; } @@ -78,7 +78,7 @@ static char *strndup(char *str, size_t max) */ struct ias_object *irias_new_object( char *name, int id) { - struct ias_object *obj; + struct ias_object *obj; IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c index 95cf123..a4c1c95 100644 --- a/net/irda/irlan/irlan_client.c +++ b/net/irda/irlan/irlan_client.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_client.c * Version: 0.9 * Description: IrDA LAN Access Protocol (IrLAN) Client @@ -11,17 +11,17 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -54,35 +54,35 @@ #undef CONFIG_IRLAN_GRATUITOUS_ARP -static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, - LM_REASON reason, +static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, + LM_REASON reason, struct sk_buff *); -static int irlan_client_ctrl_data_indication(void *instance, void *sap, +static int irlan_client_ctrl_data_indication(void *instance, void *sap, struct sk_buff *skb); -static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, - struct qos_info *qos, +static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *); -static void irlan_check_response_param(struct irlan_cb *self, char *param, +static void irlan_check_response_param(struct irlan_cb *self, char *param, char *value, int val_len); static void irlan_client_open_ctrl_tsap(struct irlan_cb *self); static void irlan_client_kick_timer_expired(void *data) { struct irlan_cb *self = (struct irlan_cb *) data; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - /* + + /* * If we are in peer mode, the client may not have got the discovery - * indication it needs to make progress. If the client is still in + * indication it needs to make progress. If the client is still in * IDLE state, we must kick it to, but only if the provider is not IDLE - */ - if ((self->provider.access_type == ACCESS_PEER) && + */ + if ((self->provider.access_type == ACCESS_PEER) && (self->client.state == IRLAN_IDLE) && (self->provider.state != IRLAN_IDLE)) { irlan_client_wakeup(self, self->saddr, self->daddr); @@ -92,8 +92,8 @@ static void irlan_client_kick_timer_expired(void *data) static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - - irda_start_timer(&self->client.kick_timer, timeout, (void *) self, + + irda_start_timer(&self->client.kick_timer, timeout, (void *) self, irlan_client_kick_timer_expired); } @@ -110,11 +110,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - /* + /* * Check if we are already awake, or if we are a provider in direct * mode (in that case we must leave the client idle */ - if ((self->client.state != IRLAN_IDLE) || + if ((self->client.state != IRLAN_IDLE) || (self->provider.access_type == ACCESS_DIRECT)) { IRDA_DEBUG(0, "%s(), already awake!\n", __FUNCTION__ ); @@ -135,7 +135,7 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) irlan_open_data_tsap(self); irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); - + /* Start kick timer */ irlan_client_start_kick_timer(self, 2*HZ); } @@ -148,11 +148,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) */ void irlan_client_discovery_indication(discinfo_t *discovery, DISCOVERY_MODE mode, - void *priv) + void *priv) { struct irlan_cb *self; __u32 saddr, daddr; - + IRDA_DEBUG(1, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(discovery != NULL, return;); @@ -177,35 +177,35 @@ void irlan_client_discovery_indication(discinfo_t *discovery, IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , daddr); - + irlan_client_wakeup(self, saddr, daddr); } IRDA_ASSERT_LABEL(out:) rcu_read_unlock(); } - + /* * Function irlan_client_data_indication (handle, skb) * * This function gets the data that is received on the control channel * */ -static int irlan_client_ctrl_data_indication(void *instance, void *sap, +static int irlan_client_ctrl_data_indication(void *instance, void *sap, struct sk_buff *skb) { struct irlan_cb *self; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); - - irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); - /* Ready for a new command */ + irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); + + /* Ready for a new command */ IRDA_DEBUG(2, "%s(), clearing tx_busy\n", __FUNCTION__ ); self->client.tx_busy = FALSE; @@ -215,27 +215,27 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap, return 0; } -static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *userdata) +static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; struct sk_buff *skb; IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->client.tsap_ctrl, return;); - /* Remove frames queued on the control channel */ + /* Remove frames queued on the control channel */ while ((skb = skb_dequeue(&self->client.txq)) != NULL) { dev_kfree_skb(skb); } @@ -272,7 +272,7 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) notify.disconnect_indication = irlan_client_ctrl_disconnect_indication; notify.instance = self; strlcpy(notify.name, "IrLAN ctrl (c)", sizeof(notify.name)); - + tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); if (!tsap) { IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ ); @@ -287,11 +287,11 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) * Connection to peer IrLAN laye confirmed * */ -static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, - struct qos_info *qos, +static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, - struct sk_buff *skb) + struct sk_buff *skb) { struct irlan_cb *self; @@ -316,7 +316,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, * Print return code of request to peer IrLAN layer. * */ -static void print_ret_code(__u8 code) +static void print_ret_code(__u8 code) { switch(code) { case 0: @@ -358,7 +358,7 @@ static void print_ret_code(__u8 code) /* * Function irlan_client_parse_response (self, skb) * - * Extract all parameters from received buffer, then feed them to + * Extract all parameters from received buffer, then feed them to * check_params for parsing */ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) @@ -369,30 +369,30 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) int ret; __u16 val_len; int i; - char *name; - char *value; + char *name; + char *value; + + IRDA_ASSERT(skb != NULL, return;); - IRDA_ASSERT(skb != NULL, return;); - IRDA_DEBUG(4, "%s() skb->len=%d\n", __FUNCTION__ , (int) skb->len); - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + if (!skb) { IRDA_ERROR("%s(), Got NULL skb!\n", __FUNCTION__); return; } frame = skb->data; - - /* - * Check return code and print it if not success + + /* + * Check return code and print it if not success */ if (frame[0]) { print_ret_code(frame[0]); return; } - + name = kmalloc(255, GFP_ATOMIC); if (!name) return; @@ -406,11 +406,11 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) count = frame[1]; IRDA_DEBUG(4, "%s(), got %d parameters\n", __FUNCTION__ , count); - + ptr = frame+2; /* For all parameters */ - for (i=0; i<count;i++) { + for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); @@ -418,7 +418,7 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) } ptr += ret; irlan_check_response_param(self, name, value, val_len); - } + } /* Cleanup */ kfree(name); kfree(value); @@ -430,8 +430,8 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) * Check which parameter is received and update local variables * */ -static void irlan_check_response_param(struct irlan_cb *self, char *param, - char *value, int val_len) +static void irlan_check_response_param(struct irlan_cb *self, char *param, + char *value, int val_len) { __u16 tmp_cpu; /* Temporary value in host order */ __u8 *bytes; @@ -465,7 +465,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, self->client.filter_type |= IRLAN_BROADCAST; else if (strcmp(value, "IPX_SOCKET") == 0) self->client.filter_type |= IRLAN_IPX_SOCKET; - + } if (strcmp(param, "ACCESS_TYPE") == 0) { if (strcmp(value, "DIRECT") == 0) @@ -480,7 +480,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, } /* IRLAN version */ if (strcmp(param, "IRLAN_VER") == 0) { - IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], + IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], (__u8) value[1]); self->version[0] = value[0]; @@ -497,17 +497,17 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.recv_arb_val = tmp_cpu; - IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , self->client.recv_arb_val); } if (strcmp(param, "MAX_FRAME") == 0) { memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.max_frame = tmp_cpu; - IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , + IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , self->client.max_frame); } - + /* RECONNECT_KEY, in case the link goes down! */ if (strcmp(param, "RECONNECT_KEY") == 0) { IRDA_DEBUG(4, "Got reconnect key: "); @@ -521,9 +521,9 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, if (strcmp(param, "FILTER_ENTRY") == 0) { bytes = value; IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", - bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], + bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]); - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++) self->dev->dev_addr[i] = bytes[i]; } } @@ -534,11 +534,11 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, * Got results from remote LM-IAS * */ -void irlan_client_get_value_confirm(int result, __u16 obj_id, - struct ias_value *value, void *priv) +void irlan_client_get_value_confirm(int result, __u16 obj_id, + struct ias_value *value, void *priv) { struct irlan_cb *self; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(priv != NULL, return;); @@ -553,7 +553,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id, /* Check if request succeeded */ if (result != IAS_SUCCESS) { IRDA_DEBUG(2, "%s(), got NULL value!\n", __FUNCTION__ ); - irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, + irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, NULL); return; } diff --git a/net/irda/irlan/irlan_client_event.c b/net/irda/irlan/irlan_client_event.c index ce943b6..843ab6f 100644 --- a/net/irda/irlan/irlan_client_event.c +++ b/net/irda/irlan/irlan_client_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_client_event.c * Version: 0.9 * Description: IrLAN client state machine @@ -8,17 +8,17 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sun Dec 26 21:52:24 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -36,31 +36,31 @@ #include <net/irda/irlan_client.h> #include <net/irda/irlan_event.h> -static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = -{ +{ irlan_client_state_idle, irlan_client_state_query, irlan_client_state_conn, @@ -74,8 +74,8 @@ static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = irlan_client_state_sync }; -void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -89,14 +89,14 @@ void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, * IDLE, We are waiting for an indication that there is a provider * available. */ -static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); - + switch (event) { case IRLAN_DISCOVERY_INDICATION: if (self->client.iriap) { @@ -104,7 +104,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, __FUNCTION__); return -EBUSY; } - + self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irlan_client_get_value_confirm); /* Get some values from peer IAS */ @@ -120,7 +120,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, IRDA_DEBUG(4, "%s(), Unknown event %d\n", __FUNCTION__ , event); break; } - if (skb) + if (skb) dev_kfree_skb(skb); return 0; @@ -133,23 +133,23 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, * to provider, just waiting for the confirm. * */ -static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); - + switch(event) { case IRLAN_IAS_PROVIDER_AVAIL: IRDA_ASSERT(self->dtsap_sel_ctrl != 0, return -1;); self->client.open_retries = 0; - - irttp_connect_request(self->client.tsap_ctrl, - self->dtsap_sel_ctrl, - self->saddr, self->daddr, NULL, + + irttp_connect_request(self->client.tsap_ctrl, + self->dtsap_sel_ctrl, + self->saddr, self->daddr, NULL, IRLAN_MTU, NULL); irlan_next_client_state(self, IRLAN_CONN); break; @@ -158,7 +158,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); /* Give the client a kick! */ - if ((self->provider.access_type == ACCESS_PEER) && + if ((self->provider.access_type == ACCESS_PEER) && (self->provider.state != IRLAN_IDLE)) irlan_client_wakeup(self, self->saddr, self->daddr); break; @@ -175,7 +175,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -186,13 +186,13 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, * commands yet. * */ -static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch (event) { case IRLAN_CONNECT_COMPLETE: /* Send getinfo cmd */ @@ -212,7 +212,7 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -221,24 +221,24 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, * * INFO, We have issued a GetInfo command and is awaiting a reply. */ -static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); - + switch (event) { case IRLAN_DATA_INDICATION: IRDA_ASSERT(skb != NULL, return -1;); - + irlan_client_parse_response(self, skb); - + irlan_next_client_state(self, IRLAN_MEDIA); - + irlan_get_media_char(self); break; - + case IRLAN_LMP_DISCONNECT: case IRLAN_LAP_DISCONNECT: irlan_next_client_state(self, IRLAN_IDLE); @@ -252,7 +252,7 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -263,11 +263,11 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, * reply. * */ -static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { @@ -289,7 +289,7 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -300,47 +300,47 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, * reply * */ -static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { struct qos_info qos; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { case IRLAN_DATA_INDICATION: irlan_client_parse_response(self, skb); - + /* - * Check if we have got the remote TSAP for data + * Check if we have got the remote TSAP for data * communications */ - IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); + IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); /* Check which access type we are dealing with */ switch (self->client.access_type) { case ACCESS_PEER: if (self->provider.state == IRLAN_OPEN) { - + irlan_next_client_state(self, IRLAN_ARB); - irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, + irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, NULL); } else { - + irlan_next_client_state(self, IRLAN_WAIT); } break; case ACCESS_DIRECT: case ACCESS_HOSTED: qos.link_disc_time.bits = 0x01; /* 3 secs */ - - irttp_connect_request(self->tsap_data, - self->dtsap_sel_data, - self->saddr, self->daddr, &qos, + + irttp_connect_request(self->tsap_data, + self->dtsap_sel_data, + self->saddr, self->daddr, &qos, IRLAN_MTU, NULL); - + irlan_next_client_state(self, IRLAN_DATA); break; default: @@ -359,7 +359,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, IRDA_DEBUG(2, "%s(), Unknown event %d\n", __FUNCTION__ , event); break; } - + if (skb) dev_kfree_skb(skb); @@ -373,13 +373,13 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, * provider OPEN state. * */ -static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_PROVIDER_SIGNAL: irlan_next_client_state(self, IRLAN_ARB); @@ -398,36 +398,36 @@ static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } -static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { struct qos_info qos; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_CHECK_CON_ARB: if (self->client.recv_arb_val == self->provider.send_arb_val) { irlan_next_client_state(self, IRLAN_CLOSE); irlan_close_data_channel(self); - } else if (self->client.recv_arb_val < - self->provider.send_arb_val) + } else if (self->client.recv_arb_val < + self->provider.send_arb_val) { qos.link_disc_time.bits = 0x01; /* 3 secs */ irlan_next_client_state(self, IRLAN_DATA); - irttp_connect_request(self->tsap_data, - self->dtsap_sel_data, - self->saddr, self->daddr, &qos, + irttp_connect_request(self->tsap_data, + self->dtsap_sel_data, + self->saddr, self->daddr, &qos, IRLAN_MTU, NULL); } else if (self->client.recv_arb_val > - self->provider.send_arb_val) + self->provider.send_arb_val) { IRDA_DEBUG(2, "%s(), lost the battle :-(\n", __FUNCTION__ ); } @@ -448,7 +448,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -459,8 +459,8 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, * the local and remote machines. * */ -static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -470,7 +470,7 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_DATA_INDICATION: irlan_client_parse_response(self, skb); - break; + break; case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ case IRLAN_LAP_DISCONNECT: irlan_next_client_state(self, IRLAN_IDLE); @@ -481,18 +481,18 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } /* * Function irlan_client_state_close (self, event, skb, info) * - * + * * */ -static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -505,17 +505,17 @@ static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, /* * Function irlan_client_state_sync (self, event, skb, info) * - * + * * */ -static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + if (skb) dev_kfree_skb(skb); - + return 0; } diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 310776d..9c3dc57 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_common.c * Version: 0.9 * Description: IrDA LAN Access Protocol Implementation @@ -8,17 +8,17 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sun Dec 26 21:53:10 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -49,12 +49,12 @@ #include <net/irda/irlan_common.h> #include <net/irda/irlan_client.h> -#include <net/irda/irlan_provider.h> +#include <net/irda/irlan_provider.h> #include <net/irda/irlan_eth.h> #include <net/irda/irlan_filter.h> -/* +/* * Send gratuitous ARP when connected to a new AP or not. May be a clever * thing to do, but for some reason the machine crashes if you use DHCP. So * lets not use it by default. @@ -106,8 +106,8 @@ extern struct proc_dir_entry *proc_irda; static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr); static void __irlan_close(struct irlan_cb *self); -static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, - __u8 value_byte, __u16 value_short, +static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, + __u8 value_byte, __u16 value_short, __u8 *value_array, __u16 value_len); static void irlan_open_unicast_addr(struct irlan_cb *self); static void irlan_get_unicast_addr(struct irlan_cb *self); @@ -177,7 +177,7 @@ err_ckey: return -ENOMEM; } -static void __exit irlan_cleanup(void) +static void __exit irlan_cleanup(void) { struct irlan_cb *self, *next; @@ -201,7 +201,7 @@ static void __exit irlan_cleanup(void) /* * Function irlan_open (void) * - * Open new instance of a client/provider, we should only register the + * Open new instance of a client/provider, we should only register the * network device if this instance is ment for a particular client/provider */ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) @@ -229,9 +229,9 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) /* Provider access can only be PEER, DIRECT, or HOSTED */ self->provider.access_type = access; if (access == ACCESS_DIRECT) { - /* + /* * Since we are emulating an IrLAN sever we will have to - * give ourself an ethernet address! + * give ourself an ethernet address! */ dev->dev_addr[0] = 0x40; dev->dev_addr[1] = 0x00; @@ -245,15 +245,15 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) self->disconnect_reason = LM_USER_REQUEST; init_timer(&self->watchdog_timer); init_timer(&self->client.kick_timer); - init_waitqueue_head(&self->open_wait); - + init_waitqueue_head(&self->open_wait); + skb_queue_head_init(&self->client.txq); - + irlan_next_client_state(self, IRLAN_IDLE); irlan_next_provider_state(self, IRLAN_IDLE); if (register_netdev(dev)) { - IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", + IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", __FUNCTION__ ); self = NULL; free_netdev(dev); @@ -268,14 +268,14 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) /* * Function __irlan_close (self) * - * This function closes and deallocates the IrLAN client instances. Be + * This function closes and deallocates the IrLAN client instances. Be * aware that other functions which calls client_close() must * remove self from irlans list first. */ static void __irlan_close(struct irlan_cb *self) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + ASSERT_RTNL(); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -285,8 +285,8 @@ static void __irlan_close(struct irlan_cb *self) /* Close all open connections and remove TSAPs */ irlan_close_tsaps(self); - - if (self->client.iriap) + + if (self->client.iriap) iriap_close(self->client.iriap); /* Remove frames queued on the control channel */ @@ -316,17 +316,17 @@ struct irlan_cb *irlan_get_any(void) static void irlan_connect_indication(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, + __u8 max_header_size, struct sk_buff *skb) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap == self->tsap_data,return;); @@ -349,9 +349,9 @@ static void irlan_connect_indication(void *instance, void *sap, irlan_do_client_event(self, IRLAN_DATA_CONNECT_INDICATION, NULL); if (self->provider.access_type == ACCESS_PEER) { - /* + /* * Data channel is open, so we are now allowed to - * configure the remote filter + * configure the remote filter */ irlan_get_unicast_addr(self); irlan_open_unicast_addr(self); @@ -361,10 +361,10 @@ static void irlan_connect_indication(void *instance, void *sap, } static void irlan_connect_confirm(void *instance, void *sap, - struct qos_info *qos, + struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, - struct sk_buff *skb) + __u8 max_header_size, + struct sk_buff *skb) { struct irlan_cb *self; @@ -381,16 +381,16 @@ static void irlan_connect_confirm(void *instance, void *sap, IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); del_timer(&self->watchdog_timer); - /* + /* * Data channel is open, so we are now allowed to configure the remote - * filter + * filter */ irlan_get_unicast_addr(self); irlan_open_unicast_addr(self); - + /* Open broadcast and multicast filter by default */ - irlan_set_broadcast_filter(self, TRUE); - irlan_set_multicast_filter(self, TRUE); + irlan_set_broadcast_filter(self, TRUE); + irlan_set_multicast_filter(self, TRUE); /* Ready to transfer Ethernet frames */ netif_start_queue(self->dev); @@ -408,29 +408,29 @@ static void irlan_connect_confirm(void *instance, void *sap, * the specified connection (handle) */ static void irlan_disconnect_indication(void *instance, - void *sap, LM_REASON reason, - struct sk_buff *userdata) + void *sap, LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->tsap_data, return;); IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); /* Save reason so we know if we should try to reconnect or not */ self->disconnect_reason = reason; - + switch (reason) { case LM_USER_REQUEST: /* User request */ IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ ); @@ -451,7 +451,7 @@ static void irlan_disconnect_indication(void *instance, IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__); break; } - + /* If you want to pass the skb to *both* state machines, you will * need to skb_clone() it, so that you don't free it twice. * As the state machines don't need it, git rid of it here... @@ -461,7 +461,7 @@ static void irlan_disconnect_indication(void *instance, irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); - + wake_up_interruptible(&self->open_wait); } @@ -480,12 +480,12 @@ void irlan_open_data_tsap(struct irlan_cb *self) return; irda_notify_init(¬ify); - + notify.data_indication = irlan_eth_receive; notify.udata_indication = irlan_eth_receive; notify.connect_indication = irlan_connect_indication; notify.connect_confirm = irlan_connect_confirm; - notify.flow_indication = irlan_eth_flow_indication; + notify.flow_indication = irlan_eth_flow_indication; notify.disconnect_indication = irlan_disconnect_indication; notify.instance = self; strlcpy(notify.name, "IrLAN data", sizeof(notify.name)); @@ -497,7 +497,7 @@ void irlan_open_data_tsap(struct irlan_cb *self) } self->tsap_data = tsap; - /* + /* * This is the data TSAP selector which we will pass to the client * when the client ask for it. */ @@ -518,13 +518,13 @@ void irlan_close_tsaps(struct irlan_cb *self) self->tsap_data = NULL; } if (self->client.tsap_ctrl) { - irttp_disconnect_request(self->client.tsap_ctrl, NULL, + irttp_disconnect_request(self->client.tsap_ctrl, NULL, P_NORMAL); irttp_close_tsap(self->client.tsap_ctrl); self->client.tsap_ctrl = NULL; } if (self->provider.tsap_ctrl) { - irttp_disconnect_request(self->provider.tsap_ctrl, NULL, + irttp_disconnect_request(self->provider.tsap_ctrl, NULL, P_NORMAL); irttp_close_tsap(self->provider.tsap_ctrl); self->provider.tsap_ctrl = NULL; @@ -545,8 +545,8 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - /* + + /* * Check if object has already been registered by a previous provider. * If that is the case, we just change the value of the attribute */ @@ -560,9 +560,9 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) irias_object_change_attribute("IrLAN", "IrDA:TinyTP:LsapSel", new_value); } - - /* Register PnP object only if not registered before */ - if (!irias_find_object("PnP")) { + + /* Register PnP object only if not registered before */ + if (!irias_find_object("PnP")) { obj = irias_new_object("PnP", IAS_PNP_ID); #if 0 irias_add_string_attrib(obj, "Name", sysctl_devname, @@ -606,10 +606,10 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) self->client.tx_busy = FALSE; return 0; } - + /* Check that it's really possible to send commands */ - if ((self->client.tsap_ctrl == NULL) || - (self->client.state == IRLAN_IDLE)) + if ((self->client.tsap_ctrl == NULL) || + (self->client.state == IRLAN_IDLE)) { self->client.tx_busy = FALSE; dev_kfree_skb(skb); @@ -649,7 +649,7 @@ void irlan_get_provider_info(struct irlan_cb *self) __u8 *frame; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -661,12 +661,12 @@ void irlan_get_provider_info(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_GET_PROVIDER_INFO; + + frame[0] = CMD_GET_PROVIDER_INFO; frame[1] = 0x00; /* Zero parameters */ - + irlan_ctrl_data_request(self, skb); } @@ -676,16 +676,16 @@ void irlan_get_provider_info(struct irlan_cb *self) * Send an Open Data Command to provider * */ -void irlan_open_data_channel(struct irlan_cb *self) +void irlan_open_data_channel(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") + IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"), @@ -695,11 +695,11 @@ void irlan_open_data_channel(struct irlan_cb *self) skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_OPEN_DATA_CHANNEL; + frame[0] = CMD_OPEN_DATA_CHANNEL; frame[1] = 0x02; /* Two parameters */ irlan_insert_string_param(skb, "MEDIA", "802.3"); @@ -711,11 +711,11 @@ void irlan_open_data_channel(struct irlan_cb *self) irlan_ctrl_data_request(self, skb); } -void irlan_close_data_channel(struct irlan_cb *self) +void irlan_close_data_channel(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -733,11 +733,11 @@ void irlan_close_data_channel(struct irlan_cb *self) skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_CLOSE_DATA_CHAN; + frame[0] = CMD_CLOSE_DATA_CHAN; frame[1] = 0x01; /* One parameter */ irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); @@ -748,7 +748,7 @@ void irlan_close_data_channel(struct irlan_cb *self) /* * Function irlan_open_unicast_addr (self) * - * Make IrLAN provider accept ethernet frames addressed to the unicast + * Make IrLAN provider accept ethernet frames addressed to the unicast * address. * */ @@ -756,12 +756,12 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + @@ -773,15 +773,15 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); - irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); - + irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); + irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); + irlan_ctrl_data_request(self, skb); } @@ -794,17 +794,17 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) * one but then _we_ have to initiate all communication with other * hosts, since ARP request for this host will not be answered. */ -void irlan_set_broadcast_filter(struct irlan_cb *self, int status) +void irlan_set_broadcast_filter(struct irlan_cb *self, int status) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + + + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") + /* We may waste one byte here...*/ @@ -816,17 +816,17 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); if (status) - irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); + irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); else - irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); + irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_ctrl_data_request(self, skb); } @@ -835,14 +835,14 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) * Function irlan_set_multicast_filter (self, status) * * Make IrLAN provider accept ethernet frames addressed to the multicast - * address. + * address. * */ -void irlan_set_multicast_filter(struct irlan_cb *self, int status) +void irlan_set_multicast_filter(struct irlan_cb *self, int status) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -856,21 +856,21 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status) GFP_ATOMIC); if (!skb) return; - + /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); if (status) - irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); + irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); else - irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); + irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_ctrl_data_request(self, skb); } @@ -887,12 +887,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + @@ -905,34 +905,34 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); - irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); - + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); + irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); + irlan_ctrl_data_request(self, skb); } /* * Function irlan_get_media_char (self) * - * + * * */ -void irlan_get_media_char(struct irlan_cb *self) +void irlan_get_media_char(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"), GFP_ATOMIC); @@ -943,13 +943,13 @@ void irlan_get_media_char(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_GET_MEDIA_CHAR; + frame[0] = CMD_GET_MEDIA_CHAR; frame[1] = 0x01; /* One parameter */ - + irlan_insert_string_param(skb, "MEDIA", "802.3"); irlan_ctrl_data_request(self, skb); } @@ -980,7 +980,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) { int string_len = strlen(string); - return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, + return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, string_len); } @@ -993,7 +993,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, __u16 array_len) { - return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, + return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, array_len); } @@ -1006,19 +1006,19 @@ int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, * | Name Length[1] | Param Name[1..255] | Val Length[2] | Value[0..1016]| * ----------------------------------------------------------------------- */ -static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, - __u8 value_byte, __u16 value_short, +static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, + __u8 value_byte, __u16 value_short, __u8 *value_array, __u16 value_len) { __u8 *frame; __u8 param_len; __le16 tmp_le; /* Temporary value in little endian format */ int n=0; - + if (skb == NULL) { IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ ); return 0; - } + } param_len = strlen(param); switch (type) { @@ -1037,7 +1037,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, return 0; break; } - + /* Insert at end of sk-buffer */ frame = skb->tail; @@ -1045,15 +1045,15 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, if (skb_tailroom(skb) < (param_len+value_len+3)) { IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ ); return 0; - } + } skb_put(skb, param_len+value_len+3); - + /* Insert parameter length */ frame[n++] = param_len; - + /* Insert parameter */ memcpy(frame+n, param, param_len); n += param_len; - + /* Insert value length (2 byte little endian format, LSB first) */ tmp_le = cpu_to_le16(value_len); memcpy(frame+n, &tmp_le, 2); n += 2; /* To avoid alignment problems */ @@ -1082,36 +1082,36 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, * Function irlan_extract_param (buf, name, value, len) * * Extracts a single parameter name/value pair from buffer and updates - * the buffer pointer to point to the next name/value pair. + * the buffer pointer to point to the next name/value pair. */ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) { __u8 name_len; __u16 val_len; int n=0; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + /* get length of parameter name (1 byte) */ name_len = buf[n++]; - + if (name_len > 254) { IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ ); return -RSP_INVALID_COMMAND_FORMAT; } - + /* get parameter name */ memcpy(name, buf+n, name_len); name[name_len] = '\0'; n+=name_len; - - /* - * Get length of parameter value (2 bytes in little endian - * format) + + /* + * Get length of parameter value (2 bytes in little endian + * format) */ memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */ le16_to_cpus(&val_len); n+=2; - + if (val_len > 1016) { IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ ); return -RSP_INVALID_COMMAND_FORMAT; @@ -1122,9 +1122,9 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) memcpy(value, buf+n, val_len); value[val_len] = '\0'; n+=val_len; - - IRDA_DEBUG(4, "Parameter: %s ", name); - IRDA_DEBUG(4, "Value: %s\n", value); + + IRDA_DEBUG(4, "Parameter: %s ", name); + IRDA_DEBUG(4, "Value: %s\n", value); return n; } @@ -1133,7 +1133,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) /* * Start of reading /proc entries. - * Return entry at pos, + * Return entry at pos, * or start_token to indicate print header line * or NULL if end of file */ @@ -1147,7 +1147,7 @@ static void *irlan_seq_start(struct seq_file *seq, loff_t *pos) return SEQ_START_TOKEN; list_for_each_entry(self, &irlans, dev_list) { - if (*pos == i) + if (*pos == i) return self; ++i; } @@ -1160,12 +1160,12 @@ static void *irlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) struct list_head *nxt; ++*pos; - if (v == SEQ_START_TOKEN) + if (v == SEQ_START_TOKEN) nxt = irlans.next; else nxt = ((struct irlan_cb *)v)->dev_list.next; - return (nxt == &irlans) ? NULL + return (nxt == &irlans) ? NULL : list_entry(nxt, struct irlan_cb, dev_list); } @@ -1185,7 +1185,7 @@ static int irlan_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "IrLAN instances:\n"); else { struct irlan_cb *self = v; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); @@ -1201,17 +1201,17 @@ static int irlan_seq_show(struct seq_file *seq, void *v) self->daddr); seq_printf(seq,"version: %d.%d,\n", self->version[1], self->version[0]); - seq_printf(seq,"access type: %s\n", + seq_printf(seq,"access type: %s\n", irlan_access[self->client.access_type]); - seq_printf(seq,"media: %s\n", + seq_printf(seq,"media: %s\n", irlan_media[self->media]); - + seq_printf(seq,"local filter:\n"); seq_printf(seq,"remote filter: "); irlan_print_filter(seq, self->client.filter_type); - seq_printf(seq,"tx busy: %s\n", + seq_printf(seq,"tx busy: %s\n", netif_queue_stopped(self->dev) ? "TRUE" : "FALSE"); - + seq_putc(seq,'\n'); } return 0; @@ -1231,7 +1231,7 @@ static int irlan_seq_open(struct inode *inode, struct file *file) #endif MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); -MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); +MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); MODULE_LICENSE("GPL"); module_param(eth, bool, 0); diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index b0ccc45..672ab3f 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c @@ -1,8 +1,8 @@ /********************************************************************* - * + * * Filename: irlan_eth.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Oct 15 08:37:58 1998 @@ -11,18 +11,18 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * + * * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/netdevice.h> @@ -55,7 +55,7 @@ static void irlan_eth_setup(struct net_device *dev) { dev->open = irlan_eth_open; dev->stop = irlan_eth_close; - dev->hard_start_xmit = irlan_eth_xmit; + dev->hard_start_xmit = irlan_eth_xmit; dev->get_stats = irlan_eth_get_stats; dev->set_multicast_list = irlan_eth_set_multicast_list; dev->destructor = free_netdev; @@ -63,8 +63,8 @@ static void irlan_eth_setup(struct net_device *dev) SET_MODULE_OWNER(dev); ether_setup(dev); - - /* + + /* * Lets do all queueing in IrTTP instead of this device driver. * Queueing here as well can introduce some strange latency * problems, which we will avoid by setting the queue size to 0. @@ -104,17 +104,17 @@ struct net_device *alloc_irlandev(const char *name) static int irlan_eth_open(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); /* Ready to play! */ - netif_stop_queue(dev); /* Wait until data link is ready */ + netif_stop_queue(dev); /* Wait until data link is ready */ /* We are now open, so time to do some work */ self->disconnect_reason = 0; irlan_client_wakeup(self, self->saddr, self->daddr); - /* Make sure we have a hardware address before we return, + /* Make sure we have a hardware address before we return, so DHCP clients gets happy */ return wait_event_interruptible(self->open_wait, !self->tsap_data->connected); @@ -124,30 +124,30 @@ static int irlan_eth_open(struct net_device *dev) * Function irlan_eth_close (dev) * * Stop the ether network device, his function will usually be called by - * ifconfig down. We should now disconnect the link, We start the + * ifconfig down. We should now disconnect the link, We start the * close timer, so that the instance will be removed if we are unable * to discover the remote device after the disconnect. */ static int irlan_eth_close(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + /* Stop device */ netif_stop_queue(dev); - + irlan_close_data_channel(self); irlan_close_tsaps(self); irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); - irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); - + irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); + /* Remove frames queued on the control channel */ skb_queue_purge(&self->client.txq); self->client.tx_busy = 0; - + return 0; } @@ -164,7 +164,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) /* skb headroom large enough to contain all IrDA-headers? */ if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { - struct sk_buff *new_skb = + struct sk_buff *new_skb = skb_realloc_headroom(skb, self->max_header_size); /* We have to free the original skb anyway */ @@ -176,7 +176,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) /* Use the new skb instead */ skb = new_skb; - } + } dev->trans_start = jiffies; @@ -187,7 +187,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) ret = irttp_data_request(self->tsap_data, skb); if (ret < 0) { - /* + /* * IrTTPs tx queue is full, so we just have to * drop the frame! You might think that we should * just return -1 and don't deallocate the frame, @@ -195,15 +195,15 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) * we have replaced the original skb with a new * one with larger headroom, and that would really * confuse do_dev_queue_xmit() in dev.c! I have - * tried :-) DB + * tried :-) DB */ /* irttp_data_request already free the packet */ self->stats.tx_dropped++; } else { self->stats.tx_packets++; - self->stats.tx_bytes += skb->len; + self->stats.tx_bytes += skb->len; } - + return 0; } @@ -218,37 +218,37 @@ int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) struct irlan_cb *self = instance; if (skb == NULL) { - ++self->stats.rx_dropped; + ++self->stats.rx_dropped; return 0; } if (skb->len < ETH_HLEN) { IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", __FUNCTION__, skb->len); - ++self->stats.rx_dropped; + ++self->stats.rx_dropped; dev_kfree_skb(skb); return 0; } - - /* - * Adopt this frame! Important to set all these fields since they + + /* + * Adopt this frame! Important to set all these fields since they * might have been previously set by the low level IrDA network - * device driver + * device driver */ skb->dev = self->dev; skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */ - + self->stats.rx_packets++; - self->stats.rx_bytes += skb->len; + self->stats.rx_bytes += skb->len; netif_rx(skb); /* Eat it! */ - + return 0; } /* * Function irlan_eth_flow (status) * - * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by + * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by * controlling the queue stop/start. * * The IrDA link layer has the advantage to have flow control, and @@ -268,11 +268,11 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + dev = self->dev; IRDA_ASSERT(dev != NULL, return;); - + IRDA_DEBUG(0, "%s() : flow %s ; running %d\n", __FUNCTION__, flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START", netif_running(dev)); @@ -301,10 +301,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) { struct in_device *in_dev; - /* + /* * When we get a new MAC address do a gratuitous ARP. This * is useful if we have changed access points on the same - * subnet. + * subnet. */ #ifdef CONFIG_INET IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); @@ -313,10 +313,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) if (in_dev == NULL) goto out; if (in_dev->ifa_list) - - arp_send(ARPOP_REQUEST, ETH_P_ARP, + + arp_send(ARPOP_REQUEST, ETH_P_ARP, in_dev->ifa_list->ifa_address, - dev, + dev, in_dev->ifa_list->ifa_address, NULL, dev->dev_addr, NULL); out: @@ -331,9 +331,9 @@ out: * */ #define HW_MAX_ADDRS 4 /* Must query to get it! */ -static void irlan_eth_set_multicast_list(struct net_device *dev) +static void irlan_eth_set_multicast_list(struct net_device *dev) { - struct irlan_cb *self = netdev_priv(dev); + struct irlan_cb *self = netdev_priv(dev); IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -346,7 +346,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) if (dev->flags & IFF_PROMISC) { /* Enable promiscuous mode */ IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n"); - } + } else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { /* Disable promiscuous mode, use normal mode. */ IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __FUNCTION__ ); @@ -378,7 +378,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) * Get the current statistics for this device * */ -static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) +static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c index 2778d8c..623e0fd 100644 --- a/net/irda/irlan/irlan_event.c +++ b/net/irda/irlan/irlan_event.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: irlan_event.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Oct 20 09:10:16 1998 * Modified at: Sat Oct 30 12:59:01 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <net/irda/irlan_event.h> @@ -38,7 +38,7 @@ char *irlan_state[] = { "IRLAN_SYNC", }; -void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) +void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) { IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); @@ -48,7 +48,7 @@ void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) self->client.state = state; } -void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) +void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) { IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c index ca7d358..e6346b8 100644 --- a/net/irda/irlan/irlan_filter.c +++ b/net/irda/irlan/irlan_filter.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: irlan_filter.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Fri Jan 29 11:16:38 1999 * Modified at: Sat Oct 30 12:58:45 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/skbuff.h> @@ -40,7 +40,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - if ((self->provider.filter_type == IRLAN_DIRECTED) && + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_operation == DYNAMIC)) { IRDA_DEBUG(0, "Giving peer a dynamic Ethernet address\n"); @@ -48,12 +48,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) self->provider.mac_address[1] = 0x00; self->provider.mac_address[2] = 0x00; self->provider.mac_address[3] = 0x00; - + /* Use arbitration value to generate MAC address */ if (self->provider.access_type == ACCESS_PEER) { - self->provider.mac_address[4] = + self->provider.mac_address[4] = self->provider.send_arb_val & 0xff; - self->provider.mac_address[5] = + self->provider.mac_address[5] = (self->provider.send_arb_val >> 8) & 0xff; } else { /* Just generate something for now */ @@ -65,12 +65,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x03; irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_insert_short_param(skb, "MAX_ENTRY", 0x0001); - irlan_insert_array_param(skb, "FILTER_ENTRY", + irlan_insert_array_param(skb, "FILTER_ENTRY", self->provider.mac_address, 6); return; } - - if ((self->provider.filter_type == IRLAN_DIRECTED) && + + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Directed filter on\n"); @@ -78,7 +78,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_DIRECTED) && + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Directed filter off\n"); @@ -87,7 +87,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) return; } - if ((self->provider.filter_type == IRLAN_BROADCAST) && + if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Broadcast filter on\n"); @@ -95,7 +95,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_BROADCAST) && + if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Broadcast filter off\n"); @@ -103,7 +103,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Multicast filter on\n"); @@ -111,7 +111,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Multicast filter off\n"); @@ -119,7 +119,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_operation == GET)) { IRDA_DEBUG(0, "Multicast filter get\n"); diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c index 58efde9..aac6643 100644 --- a/net/irda/irlan/irlan_provider.c +++ b/net/irda/irlan/irlan_provider.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_provider.c * Version: 0.9 * Description: IrDA LAN Access Protocol Implementation @@ -11,17 +11,17 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -52,8 +52,8 @@ #include <net/irda/irlan_filter.h> #include <net/irda/irlan_client.h> -static void irlan_provider_connect_indication(void *instance, void *sap, - struct qos_info *qos, +static void irlan_provider_connect_indication(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb); @@ -64,14 +64,14 @@ static void irlan_provider_connect_indication(void *instance, void *sap, * This function gets the data that is received on the control channel * */ -static int irlan_provider_data_indication(void *instance, void *sap, - struct sk_buff *skb) +static int irlan_provider_data_indication(void *instance, void *sap, + struct sk_buff *skb) { struct irlan_cb *self; __u8 code; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; IRDA_ASSERT(self != NULL, return -1;); @@ -83,16 +83,16 @@ static int irlan_provider_data_indication(void *instance, void *sap, switch(code) { case CMD_GET_PROVIDER_INFO: IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); - irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); + irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); break; case CMD_GET_MEDIA_CHAR: IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); - irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); + irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); break; case CMD_OPEN_DATA_CHANNEL: IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); - irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); + irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); break; case CMD_FILTER_OPERATION: IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); @@ -119,9 +119,9 @@ static int irlan_provider_data_indication(void *instance, void *sap, * Got connection from peer IrLAN client * */ -static void irlan_provider_connect_indication(void *instance, void *sap, +static void irlan_provider_connect_indication(void *instance, void *sap, struct qos_info *qos, - __u32 max_sdu_size, + __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { @@ -130,13 +130,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, __u32 saddr, daddr; IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;); IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;); @@ -147,13 +147,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL); - /* + /* * If we are in peer mode, the client may not have got the discovery - * indication it needs to make progress. If the client is still in - * IDLE state, we must kick it. + * indication it needs to make progress. If the client is still in + * IDLE state, we must kick it. */ - if ((self->provider.access_type == ACCESS_PEER) && - (self->client.state == IRLAN_IDLE)) + if ((self->provider.access_type == ACCESS_PEER) && + (self->client.state == IRLAN_IDLE)) { irlan_client_wakeup(self, self->saddr, self->daddr); } @@ -175,38 +175,38 @@ void irlan_provider_connect_response(struct irlan_cb *self, irttp_connect_response(tsap, IRLAN_MTU, NULL); } -static void irlan_provider_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *userdata) +static void irlan_provider_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;); - + irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); } /* * Function irlan_parse_open_data_cmd (self, skb) * - * + * * */ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) { int ret; - + ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb); /* Open data channel */ @@ -218,12 +218,12 @@ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) /* * Function parse_command (skb) * - * Extract all parameters from received buffer, then feed them to + * Extract all parameters from received buffer, then feed them to * check_params for parsing * */ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, - struct sk_buff *skb) + struct sk_buff *skb) { __u8 *frame; __u8 *ptr; @@ -231,16 +231,16 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, __u16 val_len; int i; char *name; - char *value; + char *value; int ret = RSP_SUCCESS; - + IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); - + IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len); IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); - + if (!skb) return -RSP_PROTOCOL_ERROR; @@ -259,11 +259,11 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, count = frame[1]; IRDA_DEBUG(4, "Got %d parameters\n", count); - + ptr = frame+2; - + /* For all parameters */ - for (i=0; i<count;i++) { + for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); @@ -286,7 +286,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, * Send reply to query to peer IrLAN layer * */ -void irlan_provider_send_reply(struct irlan_cb *self, int command, +void irlan_provider_send_reply(struct irlan_cb *self, int command, int ret_code) { struct sk_buff *skb; @@ -310,7 +310,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->provider.max_header_size); skb_put(skb, 2); - + switch (command) { case CMD_GET_PROVIDER_INFO: skb->data[0] = 0x00; /* Success */ @@ -356,7 +356,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, skb->data[0] = 0x00; /* Success */ if (self->provider.send_arb_val) { skb->data[1] = 0x03; /* 3 parameters */ - irlan_insert_short_param(skb, "CON_ARB", + irlan_insert_short_param(skb, "CON_ARB", self->provider.send_arb_val); } else skb->data[1] = 0x02; /* 2 parameters */ @@ -378,13 +378,13 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, * Function irlan_provider_register(void) * * Register provider support so we can accept incoming connections. - * + * */ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) { struct tsap_cb *tsap; notify_t notify; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); @@ -393,7 +393,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) /* Check if already open */ if (self->provider.tsap_ctrl) return -1; - + /* * First register well known control TSAP */ diff --git a/net/irda/irlan/irlan_provider_event.c b/net/irda/irlan/irlan_provider_event.c index 5a086f9..ef401bd 100644 --- a/net/irda/irlan/irlan_provider_event.c +++ b/net/irda/irlan/irlan_provider_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_provider_event.c * Version: 0.9 * Description: IrLAN provider state machine) @@ -8,16 +8,16 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sat Oct 30 12:52:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -30,18 +30,18 @@ #include <net/irda/irlan_provider.h> #include <net/irda/irlan_event.h> -static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) = -{ +static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) = +{ irlan_provider_state_idle, NULL, /* Query */ NULL, /* Info */ @@ -55,8 +55,8 @@ static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, NULL, /* Sync */ }; -void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_ASSERT(*state[ self->provider.state] != NULL, return;); @@ -73,9 +73,9 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_CONNECT_INDICATION: irlan_provider_connect_response( self, self->provider.tsap_ctrl); @@ -96,13 +96,13 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, * * INFO, We have issued a GetInfo command and is awaiting a reply. */ -static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { int ret; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { @@ -110,7 +110,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, /* Be sure to use 802.3 in case of peer mode */ if (self->provider.access_type == ACCESS_PEER) { self->media = MEDIA_802_3; - + /* Check if client has started yet */ if (self->client.state == IRLAN_IDLE) { /* This should get the client going */ @@ -118,15 +118,15 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, } } - irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, + irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, RSP_SUCCESS); /* Keep state */ break; - case IRLAN_GET_MEDIA_CMD: - irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, + case IRLAN_GET_MEDIA_CMD: + irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, RSP_SUCCESS); /* Keep state */ - break; + break; case IRLAN_OPEN_DATA_CMD: ret = irlan_parse_open_data_cmd(self, skb); if (self->provider.access_type == ACCESS_PEER) { @@ -152,7 +152,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -163,7 +163,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, * reply * */ -static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -173,11 +173,11 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_FILTER_CONFIG_CMD: irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); - irlan_provider_send_reply(self, CMD_FILTER_OPERATION, + irlan_provider_send_reply(self, CMD_FILTER_OPERATION, RSP_SUCCESS); /* Keep state */ break; - case IRLAN_DATA_CONNECT_INDICATION: + case IRLAN_DATA_CONNECT_INDICATION: irlan_next_provider_state(self, IRLAN_DATA); irlan_provider_connect_response(self, self->tsap_data); break; @@ -202,8 +202,8 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, * the local and remote machines. * */ -static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -213,7 +213,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_FILTER_CONFIG_CMD: irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); - irlan_provider_send_reply(self, CMD_FILTER_OPERATION, + irlan_provider_send_reply(self, CMD_FILTER_OPERATION, RSP_SUCCESS); break; case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ @@ -226,7 +226,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } diff --git a/net/irda/irlap.c b/net/irda/irlap.c index e7852a0..fd73e4a 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -87,7 +87,7 @@ int __init irlap_init(void) /* Allocate master array */ irlap = hashbin_new(HB_LOCK); if (irlap == NULL) { - IRDA_ERROR("%s: can't allocate irlap hashbin!\n", + IRDA_ERROR("%s: can't allocate irlap hashbin!\n", __FUNCTION__); return -ENOMEM; } @@ -701,8 +701,8 @@ void irlap_update_nr_received(struct irlap_cb *self, int nr) int count = 0; /* - * Remove all the ack-ed frames from the window queue. - */ + * Remove all the ack-ed frames from the window queue. + */ /* * Optimize for the common case. It is most likely that the receiver @@ -1109,13 +1109,13 @@ static void *irlap_seq_start(struct seq_file *seq, loff_t *pos) spin_lock_irq(&irlap->hb_spinlock); iter->id = 0; - for (self = (struct irlap_cb *) hashbin_get_first(irlap); + for (self = (struct irlap_cb *) hashbin_get_first(irlap); self; self = (struct irlap_cb *) hashbin_get_next(irlap)) { if (iter->id == *pos) break; ++iter->id; } - + return self; } @@ -1137,7 +1137,7 @@ static int irlap_seq_show(struct seq_file *seq, void *v) { const struct irlap_iter_state *iter = seq->private; const struct irlap_cb *self = v; - + IRDA_ASSERT(self->magic == LAP_MAGIC, return -EINVAL;); seq_printf(seq, "irlap%d ", iter->id); @@ -1222,7 +1222,7 @@ static int irlap_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c index 99faff6..7b6433f 100644 --- a/net/irda/irlap_event.c +++ b/net/irda/irlap_event.c @@ -827,7 +827,7 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event, irlap_disconnect_indication(self, LAP_DISC_INDICATION); break; default: - IRDA_DEBUG(1, "%s(), Unknown event %d, %s\n", __FUNCTION__, + IRDA_DEBUG(1, "%s(), Unknown event %d, %s\n", __FUNCTION__, event, irlap_event[event]); ret = -1; @@ -864,7 +864,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, * between 15 msecs and 45 msecs. */ irlap_start_backoff_timer(self, msecs_to_jiffies(20 + - (jiffies % 30))); + (jiffies % 30))); } else { /* Always switch state before calling upper layers */ irlap_next_state(self, LAP_NDM); @@ -1377,7 +1377,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, /* Resend rejected frames */ irlap_resend_rejected_frames(self, CMD_FRAME); - /* Give peer some time to retransmit! + /* Give peer some time to retransmit! * But account for our own Tx. */ irlap_start_final_timer(self, 2 * self->final_timeout); diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index dba349c..0b04603 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c @@ -414,7 +414,7 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self, IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); return; } - + xid = (struct xid_frame *) skb->data; info->daddr = le32_to_cpu(xid->saddr); @@ -485,7 +485,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); return; } - + xid = (struct xid_frame *) skb->data; info->daddr = le32_to_cpu(xid->saddr); @@ -524,7 +524,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, */ if (info->s == 0xff) { /* Check if things are sane at this point... */ - if((discovery_info == NULL) || + if((discovery_info == NULL) || !pskb_may_pull(skb, 3)) { IRDA_ERROR("%s: discovery frame to short!\n", __FUNCTION__); diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 7e5d12a..b134c3c 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -116,7 +116,7 @@ int __init irlmp_init(void) * Remove IrLMP layer * */ -void __exit irlmp_cleanup(void) +void __exit irlmp_cleanup(void) { /* Check for main structure */ IRDA_ASSERT(irlmp != NULL, return;); @@ -892,7 +892,7 @@ void irlmp_discovery_request(int nslots) /* * Start a single discovery operation if discovery is not already - * running + * running */ if (!sysctl_discovery) { /* Check if user wants to override the default */ @@ -1528,12 +1528,12 @@ int irlmp_unregister_service(void *handle) /* Refresh current hint bits */ spin_lock_irqsave(&irlmp->services->hb_spinlock, flags); - service = (irlmp_service_t *) hashbin_get_first(irlmp->services); - while (service) { + service = (irlmp_service_t *) hashbin_get_first(irlmp->services); + while (service) { irlmp->hints.word |= service->hints.word; - service = (irlmp_service_t *)hashbin_get_next(irlmp->services); - } + service = (irlmp_service_t *)hashbin_get_next(irlmp->services); + } spin_unlock_irqrestore(&irlmp->services->hb_spinlock, flags); return 0; } @@ -1861,7 +1861,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off) spin_lock_irq(&iter->hashbin->hb_spinlock); for (element = hashbin_get_first(iter->hashbin); - element != NULL; + element != NULL; element = hashbin_get_next(iter->hashbin)) { if (!off || *off-- == 0) { /* NB: hashbin left locked */ @@ -1918,7 +1918,7 @@ static void *irlmp_seq_next(struct seq_file *seq, void *v, loff_t *pos) if (v == NULL) { /* no more in this hash bin */ spin_unlock_irq(&iter->hashbin->hb_spinlock); - if (iter->hashbin == irlmp->unconnected_lsaps) + if (iter->hashbin == irlmp->unconnected_lsaps) v = LINK_START_TOKEN; iter->hashbin = NULL; diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c index 4c90dd1..65ffa98 100644 --- a/net/irda/irlmp_event.c +++ b/net/irda/irlmp_event.c @@ -615,7 +615,7 @@ static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event, default: /* LM_LAP_DISCONNECT_INDICATION : Should never happen, we * are *not* yet bound to the IrLAP link. Jean II */ - IRDA_DEBUG(0, "%s(), Unknown event %s on LSAP %#02x\n", + IRDA_DEBUG(0, "%s(), Unknown event %s on LSAP %#02x\n", __FUNCTION__, irlmp_event[event], self->slsap_sel); break; } diff --git a/net/irda/irlmp_frame.c b/net/irda/irlmp_frame.c index 39761a1..559302d 100644 --- a/net/irda/irlmp_frame.c +++ b/net/irda/irlmp_frame.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlmp_frame.c * Version: 0.9 * Description: IrLMP frame implementation @@ -8,18 +8,18 @@ * Created at: Tue Aug 19 02:09:59 1997 * Modified at: Mon Dec 13 13:41:12 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no> * All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -34,7 +34,7 @@ #include <net/irda/irlmp_frame.h> #include <net/irda/discovery.h> -static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap, +static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap, __u8 slsap, int status, hashbin_t *); inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, @@ -56,18 +56,18 @@ inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, * Send Link Control Frame to IrLAP */ void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, - __u8 opcode, struct sk_buff *skb) + __u8 opcode, struct sk_buff *skb) { __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;); IRDA_ASSERT(skb != NULL, return;); - + frame = skb->data; - + frame[0] = dlsap | CONTROL_BIT; frame[1] = slsap; @@ -87,14 +87,14 @@ void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, * Used by IrLAP to pass received data frames to IrLMP layer * */ -void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, +void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, int unreliable) { struct lsap_cb *lsap; __u8 slsap_sel; /* Source (this) LSAP address */ __u8 dlsap_sel; /* Destination LSAP address */ __u8 *fp; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__); IRDA_ASSERT(self != NULL, return;); @@ -104,11 +104,11 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, fp = skb->data; /* - * The next statements may be confusing, but we do this so that + * The next statements may be confusing, but we do this so that * destination LSAP of received frame is source LSAP in our view */ - slsap_sel = fp[0] & LSAP_MASK; - dlsap_sel = fp[1]; + slsap_sel = fp[0] & LSAP_MASK; + dlsap_sel = fp[1]; /* * Check if this is an incoming connection, since we must deal with @@ -118,11 +118,11 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, IRDA_DEBUG(3, "%s(), incoming connection, " "source LSAP=%d, dest LSAP=%d\n", __FUNCTION__, slsap_sel, dlsap_sel); - + /* Try to find LSAP among the unconnected LSAPs */ lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, CONNECT_CMD, irlmp->unconnected_lsaps); - + /* Maybe LSAP was already connected, so try one more time */ if (!lsap) { IRDA_DEBUG(1, "%s(), incoming connection for LSAP already connected\n", __FUNCTION__); @@ -130,9 +130,9 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, self->lsaps); } } else - lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0, + lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0, self->lsaps); - + if (lsap == NULL) { IRDA_DEBUG(2, "IrLMP, Sorry, no LSAP for received frame!\n"); IRDA_DEBUG(2, "%s(), slsap_sel = %02x, dlsap_sel = %02x\n", @@ -146,8 +146,8 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, return; } - /* - * Check if we received a control frame? + /* + * Check if we received a control frame? */ if (fp[0] & CONTROL_BIT) { switch (fp[2]) { @@ -161,7 +161,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, case DISCONNECT: IRDA_DEBUG(4, "%s(), Disconnect indication!\n", __FUNCTION__); - irlmp_do_lsap_event(lsap, LM_DISCONNECT_INDICATION, + irlmp_do_lsap_event(lsap, LM_DISCONNECT_INDICATION, skb); break; case ACCESSMODE_CMD: @@ -181,7 +181,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, irlmp_udata_indication(lsap, skb); else irlmp_do_lsap_event(lsap, LM_UDATA_INDICATION, skb); - } else { + } else { /* Optimize and bypass the state machine if possible */ if (lsap->lsap_state == LSAP_DATA_TRANSFER_READY) irlmp_data_indication(lsap, skb); @@ -193,7 +193,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, /* * Function irlmp_link_unitdata_indication (self, skb) * - * + * * */ #ifdef CONFIG_IRDA_ULTRA @@ -205,7 +205,7 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) __u8 pid; /* Protocol identifier */ __u8 *fp; unsigned long flags; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__); IRDA_ASSERT(self != NULL, return;); @@ -215,13 +215,13 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) fp = skb->data; /* - * The next statements may be confusing, but we do this so that + * The next statements may be confusing, but we do this so that * destination LSAP of received frame is source LSAP in our view */ - slsap_sel = fp[0] & LSAP_MASK; + slsap_sel = fp[0] & LSAP_MASK; dlsap_sel = fp[1]; pid = fp[2]; - + if (pid & 0x80) { IRDA_DEBUG(0, "%s(), extension in PID not supp!\n", __FUNCTION__); @@ -233,7 +233,7 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) IRDA_DEBUG(0, "%s(), dropping frame!\n", __FUNCTION__); return; } - + /* Search the connectionless LSAP */ spin_lock_irqsave(&irlmp->unconnected_lsaps->hb_spinlock, flags); lsap = (struct lsap_cb *) hashbin_get_first(irlmp->unconnected_lsaps); @@ -241,10 +241,10 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) /* * Check if source LSAP and dest LSAP selectors and PID match. */ - if ((lsap->slsap_sel == slsap_sel) && - (lsap->dlsap_sel == dlsap_sel) && - (lsap->pid == pid)) - { + if ((lsap->slsap_sel == slsap_sel) && + (lsap->dlsap_sel == dlsap_sel) && + (lsap->pid == pid)) + { break; } lsap = (struct lsap_cb *) hashbin_get_next(irlmp->unconnected_lsaps); @@ -262,12 +262,12 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) /* * Function irlmp_link_disconnect_indication (reason, userdata) * - * IrLAP has disconnected + * IrLAP has disconnected * */ -void irlmp_link_disconnect_indication(struct lap_cb *lap, - struct irlap_cb *irlap, - LAP_REASON reason, +void irlmp_link_disconnect_indication(struct lap_cb *lap, + struct irlap_cb *irlap, + LAP_REASON reason, struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__); @@ -278,8 +278,8 @@ void irlmp_link_disconnect_indication(struct lap_cb *lap, lap->reason = reason; lap->daddr = DEV_ADDR_ANY; - /* FIXME: must do something with the skb if any */ - + /* FIXME: must do something with the skb if any */ + /* * Inform station state machine */ @@ -292,9 +292,9 @@ void irlmp_link_disconnect_indication(struct lap_cb *lap, * Incoming LAP connection! * */ -void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr, +void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr, __u32 daddr, struct qos_info *qos, - struct sk_buff *skb) + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__); @@ -314,7 +314,7 @@ void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr, * LAP connection confirmed! * */ -void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, +void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__); @@ -359,7 +359,7 @@ void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, * * Jean II */ -void irlmp_link_discovery_indication(struct lap_cb *self, +void irlmp_link_discovery_indication(struct lap_cb *self, discovery_t *discovery) { IRDA_ASSERT(self != NULL, return;); @@ -367,7 +367,7 @@ void irlmp_link_discovery_indication(struct lap_cb *self, /* Add to main log, cleanup */ irlmp_add_discovery(irlmp->cachelog, discovery); - + /* Just handle it the same way as a discovery confirm, * bypass the LM_LAP state machine (see below) */ irlmp_discovery_confirm(irlmp->cachelog, DISCOVERY_PASSIVE); @@ -387,7 +387,7 @@ void irlmp_link_discovery_confirm(struct lap_cb *self, hashbin_t *log) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;); - + /* Add to main log, cleanup */ irlmp_add_discovery_log(irlmp->cachelog, log); @@ -420,7 +420,7 @@ static inline void irlmp_update_cache(struct lap_cb *lap, * Find handle associated with destination and source LSAP * * Any IrDA connection (LSAP/TSAP) is uniquely identified by - * 3 parameters, the local lsap, the remote lsap and the remote address. + * 3 parameters, the local lsap, the remote lsap and the remote address. * We may initiate multiple connections to the same remote service * (they will have different local lsap), a remote device may initiate * multiple connections to the same local service (they will have @@ -433,20 +433,20 @@ static inline void irlmp_update_cache(struct lap_cb *lap, */ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, __u8 slsap_sel, int status, - hashbin_t *queue) + hashbin_t *queue) { struct lsap_cb *lsap; unsigned long flags; - - /* + + /* * Optimize for the common case. We assume that the last frame * received is in the same connection as the last one, so check in * cache first to avoid the linear search */ #ifdef CONFIG_IRDA_CACHE_LAST_LSAP - if ((self->cache.valid) && - (self->cache.slsap_sel == slsap_sel) && - (self->cache.dlsap_sel == dlsap_sel)) + if ((self->cache.valid) && + (self->cache.slsap_sel == slsap_sel) && + (self->cache.dlsap_sel == dlsap_sel)) { return (self->cache.lsap); } @@ -456,14 +456,14 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, lsap = (struct lsap_cb *) hashbin_get_first(queue); while (lsap != NULL) { - /* - * If this is an incoming connection, then the destination - * LSAP selector may have been specified as LM_ANY so that + /* + * If this is an incoming connection, then the destination + * LSAP selector may have been specified as LM_ANY so that * any client can connect. In that case we only need to check * if the source LSAP (in our view!) match! */ - if ((status == CONNECT_CMD) && - (lsap->slsap_sel == slsap_sel) && + if ((status == CONNECT_CMD) && + (lsap->slsap_sel == slsap_sel) && (lsap->dlsap_sel == LSAP_ANY)) { /* This is where the dest lsap sel is set on incoming * lsaps */ @@ -473,8 +473,8 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, /* * Check if source LSAP and dest LSAP selectors match. */ - if ((lsap->slsap_sel == slsap_sel) && - (lsap->dlsap_sel == dlsap_sel)) + if ((lsap->slsap_sel == slsap_sel) && + (lsap->dlsap_sel == dlsap_sel)) break; lsap = (struct lsap_cb *) hashbin_get_next(queue); diff --git a/net/irda/irmod.c b/net/irda/irmod.c index 2869b16..826e6c4 100644 --- a/net/irda/irmod.c +++ b/net/irda/irmod.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irmod.c * Version: 0.9 * Description: IrDA stack main entry points @@ -8,19 +8,19 @@ * Created at: Mon Dec 15 13:55:39 1997 * Modified at: Wed Jan 5 15:12:41 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1997, 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2004 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ /* @@ -52,7 +52,7 @@ extern void irda_sysctl_unregister(void); extern int irsock_init(void); extern void irsock_cleanup(void); /* irlap_frame.c */ -extern int irlap_driver_rcv(struct sk_buff *, struct net_device *, +extern int irlap_driver_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); /* @@ -104,16 +104,16 @@ static int __init irda_init(void) IRDA_DEBUG(0, "%s()\n", __FUNCTION__); /* Lower layer of the stack */ - irlmp_init(); + irlmp_init(); irlap_init(); - + /* Higher layers of the stack */ iriap_init(); - irttp_init(); + irttp_init(); irsock_init(); - + /* Add IrDA packet type (Start receiving packets) */ - dev_add_pack(&irda_packet_type); + dev_add_pack(&irda_packet_type); /* External APIs */ #ifdef CONFIG_PROC_FS @@ -124,7 +124,7 @@ static int __init irda_init(void) #endif /* Driver/dongle support */ - irda_device_init(); + irda_device_init(); return 0; } @@ -140,14 +140,14 @@ static void __exit irda_cleanup(void) /* Remove External APIs */ #ifdef CONFIG_SYSCTL irda_sysctl_unregister(); -#endif +#endif #ifdef CONFIG_PROC_FS irda_proc_unregister(); #endif /* Remove IrDA packet type (stop receiving packets) */ - dev_remove_pack(&irda_packet_type); - + dev_remove_pack(&irda_packet_type); + /* Remove higher layers */ irsock_cleanup(); irttp_cleanup(); @@ -177,8 +177,8 @@ static void __exit irda_cleanup(void) */ subsys_initcall(irda_init); module_exit(irda_cleanup); - + MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> & Jean Tourrilhes <jt@hpl.hp.com>"); -MODULE_DESCRIPTION("The Linux IrDA Protocol Stack"); +MODULE_DESCRIPTION("The Linux IrDA Protocol Stack"); MODULE_LICENSE("GPL"); MODULE_ALIAS_NETPROTO(PF_IRDA); diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h index 8088752..873ae18 100644 --- a/net/irda/irnet/irnet.h +++ b/net/irda/irnet/irnet.h @@ -44,7 +44,7 @@ * the generic Linux PPP driver. Because IrNET depend on recent * changes of the PPP driver interface, IrNET will work only with very * recent kernel (2.3.99-pre6 and up). - * + * * The present implementation offer the following features : * o simple user interface using pppd * o efficient implementation (interface directly to PPP and IrTTP) @@ -327,7 +327,7 @@ #define DEBUG_ASSERT 0 /* Verify all assertions */ -/* +/* * These are the macros we are using to actually print the debug * statements. Don't look at it, it's ugly... * diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c index f65c7a8..c378e66 100644 --- a/net/irda/irnet/irnet_irda.c +++ b/net/irda/irnet/irnet_irda.c @@ -118,7 +118,7 @@ irnet_open_tsap(irnet_socket * self) /* Open an IrTTP instance */ self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, - ¬ify); + ¬ify); DABORT(self->tsap == NULL, -ENOMEM, IRDA_SR_ERROR, "Unable to allocate TSAP !\n"); @@ -188,7 +188,7 @@ irnet_ias_to_tsap(irnet_socket * self, if(value->t.integer != -1) /* Get the remote TSAP selector */ dtsap_sel = value->t.integer; - else + else self->errno = -EADDRNOTAVAIL; break; default: @@ -280,8 +280,8 @@ irnet_connect_tsap(irnet_socket * self) } /* Connect to remote device */ - err = irttp_connect_request(self->tsap, self->dtsap_sel, - self->rsaddr, self->daddr, NULL, + err = irttp_connect_request(self->tsap, self->dtsap_sel, + self->rsaddr, self->daddr, NULL, self->max_sdu_size_rx, NULL); if(err != 0) { @@ -438,7 +438,7 @@ irnet_dname_to_daddr(irnet_socket * self) if(discoveries == NULL) DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n"); - /* + /* * Now, check all discovered devices (if any), and connect * client only about the services that the client is * interested in... @@ -627,7 +627,7 @@ irda_irnet_destroy(irnet_socket * self) /* Unregister with LM-IAS */ if(self->iriap) - { + { iriap_close(self->iriap); self->iriap = NULL; } @@ -945,7 +945,7 @@ irnet_setup_server(void) /* Register with LM-IAS (so that people can connect to us) */ irnet_server.ias_obj = irias_new_object(IRNET_SERVICE_NAME, jiffies); - irias_add_integer_attrib(irnet_server.ias_obj, IRNET_IAS_VALUE, + irias_add_integer_attrib(irnet_server.ias_obj, IRNET_IAS_VALUE, irnet_server.s.stsap_sel, IAS_KERNEL_ATTR); irias_insert_object(irnet_server.ias_obj); @@ -1076,7 +1076,7 @@ irnet_data_indication(void * instance, */ static void irnet_disconnect_indication(void * instance, - void * sap, + void * sap, LM_REASON reason, struct sk_buff *skb) { @@ -1166,10 +1166,10 @@ irnet_disconnect_indication(void * instance, */ static void irnet_connect_confirm(void * instance, - void * sap, + void * sap, struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, + __u8 max_header_size, struct sk_buff *skb) { irnet_socket * self = (irnet_socket *) instance; @@ -1235,7 +1235,7 @@ irnet_connect_confirm(void * instance, static void irnet_flow_indication(void * instance, void * sap, - LOCAL_FLOW flow) + LOCAL_FLOW flow) { irnet_socket * self = (irnet_socket *) instance; LOCAL_FLOW oldflow = self->tx_flow; @@ -1308,13 +1308,13 @@ irnet_status_indication(void * instance, * Some other node is attempting to connect to the IrNET service, and has * sent a connection request on our server socket. * We just redirect the connection to the relevant IrNET socket. - * + * * Note : we also make sure that between 2 irnet nodes, there can * exist only one irnet connection. */ static void irnet_connect_indication(void * instance, - void * sap, + void * sap, struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, @@ -1463,7 +1463,7 @@ irnet_connect_indication(void * instance, */ static void irnet_getvalue_confirm(int result, - __u16 obj_id, + __u16 obj_id, struct ias_value *value, void * priv) { @@ -1526,7 +1526,7 @@ irnet_getvalue_confirm(int result, */ static void irnet_discovervalue_confirm(int result, - __u16 obj_id, + __u16 obj_id, struct ias_value *value, void * priv) { @@ -1645,7 +1645,7 @@ irnet_discovery_indication(discinfo_t * discovery, void * priv) { irnet_socket * self = &irnet_server.s; - + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, "Invalid instance (0x%p) !!!\n", priv); @@ -1676,7 +1676,7 @@ irnet_expiry_indication(discinfo_t * expiry, void * priv) { irnet_socket * self = &irnet_server.s; - + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, "Invalid instance (0x%p) !!!\n", priv); @@ -1718,7 +1718,7 @@ irnet_proc_read(char * buf, int i = 0; len = 0; - + /* Get the IrNET server information... */ len += sprintf(buf+len, "IrNET server - "); len += sprintf(buf+len, "IrDA state: %s, ", @@ -1811,7 +1811,7 @@ irda_irnet_init(void) memset(&irnet_server, 0, sizeof(struct irnet_root)); /* Setup start of irnet instance list */ - irnet_server.list = hashbin_new(HB_NOLOCK); + irnet_server.list = hashbin_new(HB_NOLOCK); DABORT(irnet_server.list == NULL, -ENOMEM, MODULE_ERROR, "Can't allocate hashbin!\n"); /* Init spinlock for instance list */ diff --git a/net/irda/irnet/irnet_irda.h b/net/irda/irnet/irnet_irda.h index f2fecd3..0ba92d0 100644 --- a/net/irda/irnet/irnet_irda.h +++ b/net/irda/irnet/irnet_irda.h @@ -146,7 +146,7 @@ static void void *); static void irnet_discovervalue_confirm(int, - __u16, + __u16, struct ias_value *, void *); #ifdef DISCOVERY_EVENTS diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c index a1e502f..2f9f8dc 100644 --- a/net/irda/irnet/irnet_ppp.c +++ b/net/irda/irnet/irnet_ppp.c @@ -93,7 +93,7 @@ irnet_ctrl_write(irnet_socket * ap, /* Check if we recognised one of the known command * We can't use "switch" with strings, so hack with "continue" */ - + /* First command : name -> Requested IrDA nickname */ if(!strncmp(start, "name", 4)) { @@ -744,7 +744,7 @@ dev_irnet_ioctl(struct inode * inode, break; /* Set DTR/RTS */ - case TIOCMBIS: + case TIOCMBIS: case TIOCMBIC: /* Set exclusive/non-exclusive mode */ case TIOCEXCL: @@ -941,7 +941,7 @@ ppp_irnet_send(struct ppp_channel * chan, ret = irttp_data_request(self->tsap, skb); if(ret < 0) { - /* + /* * > IrTTPs tx queue is full, so we just have to * > drop the frame! You might think that we should * > just return -1 and don't deallocate the frame, @@ -949,7 +949,7 @@ ppp_irnet_send(struct ppp_channel * chan, * > we have replaced the original skb with a new * > one with larger headroom, and that would really * > confuse do_dev_queue_xmit() in dev.c! I have - * > tried :-) DB + * > tried :-) DB * Correction : we verify the flow control above (self->tx_flow), * so we come here only if IrTTP doesn't like the packet (empty, * too large, IrTTP not connected). In those rare cases, it's ok @@ -1136,6 +1136,6 @@ irnet_cleanup(void) module_init(irnet_init); module_exit(irnet_cleanup); MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>"); -MODULE_DESCRIPTION("IrNET : Synchronous PPP over IrDA"); +MODULE_DESCRIPTION("IrNET : Synchronous PPP over IrDA"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CHARDEV(10, 187); diff --git a/net/irda/irproc.c b/net/irda/irproc.c index 88b9c43..d6f9aba 100644 --- a/net/irda/irproc.c +++ b/net/irda/irproc.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irproc.c * Version: 1.0 * Description: Various entries in the /proc file system @@ -10,17 +10,17 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999, Dag Brattli <dagb@cs.uit.no> - * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, * All Rights Reserved. - * - * 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 + * + * 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 (at your option) any later version. - * - * I, Thomas Davis, provide no warranty for any of this software. - * This material is provided "AS-IS" and at no charge. - * + * + * I, Thomas Davis, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. + * ********************************************************************/ #include <linux/miscdevice.h> @@ -46,7 +46,7 @@ struct irda_entry { struct proc_dir_entry *proc_irda; EXPORT_SYMBOL(proc_irda); - + static struct irda_entry irda_dirs[] = { {"discovery", &discovery_seq_fops}, {"irttp", &irttp_seq_fops}, @@ -61,7 +61,7 @@ static struct irda_entry irda_dirs[] = { * Register irda entry in /proc file system * */ -void __init irda_proc_register(void) +void __init irda_proc_register(void) { int i; struct proc_dir_entry *d; @@ -73,7 +73,7 @@ void __init irda_proc_register(void) for (i=0; i<ARRAY_SIZE(irda_dirs); i++) { d = create_proc_entry(irda_dirs[i].name, 0, proc_irda); - if (d) + if (d) d->proc_fops = irda_dirs[i].fops; } } @@ -84,17 +84,17 @@ void __init irda_proc_register(void) * Unregister irda entry in /proc file system * */ -void __exit irda_proc_unregister(void) +void __exit irda_proc_unregister(void) { int i; - if (proc_irda) { - for (i=0; i<ARRAY_SIZE(irda_dirs); i++) - remove_proc_entry(irda_dirs[i].name, proc_irda); + if (proc_irda) { + for (i=0; i<ARRAY_SIZE(irda_dirs); i++) + remove_proc_entry(irda_dirs[i].name, proc_irda); - remove_proc_entry("irda", proc_net); - proc_irda = NULL; - } + remove_proc_entry("irda", proc_net); + proc_irda = NULL; + } } diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c index 1d26cd3..9266233 100644 --- a/net/irda/irqueue.c +++ b/net/irda/irqueue.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irqueue.c * Version: 0.3 * Description: General queue implementation @@ -10,28 +10,28 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * Modified at: Thu Jan 4 14:29:10 CET 2001 * Modified by: Marc Zyngier <mzyngier@freesurf.fr> - * + * * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no> - * Copyright (C) 1998, Dag Brattli, + * Copyright (C) 1998, Dag Brattli, * All Rights Reserved. * * This code is taken from the Vortex Operating System written by Aage * Kvalnes. Aage has agreed that this code can use the GPL licence, * although he does not use that licence in his own code. - * + * * This copyright does however _not_ include the ELF hash() function * which I currently don't know which licence or copyright it * has. Please inform me if you know. - * - * 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 + * + * 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 (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ /* @@ -213,7 +213,7 @@ static __u32 hash( const char* name) { __u32 h = 0; __u32 g; - + while(*name) { h = (h<<4) + *name++; if ((g = (h & 0xf0000000))) @@ -231,7 +231,7 @@ static __u32 hash( const char* name) */ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element) { - + IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); /* @@ -242,7 +242,7 @@ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element) * Queue is empty. Insert one element into the queue. */ element->q_next = element->q_prev = *queue = element; - + } else { /* * Queue is not empty. Insert element into front of queue. @@ -267,20 +267,20 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue) irda_queue_t *ret; IRDA_DEBUG( 4, "dequeue_first()\n"); - + /* * Set return value */ ret = *queue; - + if ( *queue == NULL ) { /* * Queue was empty. */ } else if ( (*queue)->q_next == *queue ) { - /* + /* * Queue only contained a single element. It will now be - * empty. + * empty. */ *queue = NULL; } else { @@ -291,7 +291,7 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue) (*queue)->q_next->q_prev = (*queue)->q_prev; *queue = (*queue)->q_next; } - + /* * Return the removed entry (or NULL of queue was empty). */ @@ -306,25 +306,25 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue) static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element) { irda_queue_t *ret; - + IRDA_DEBUG( 4, "dequeue_general()\n"); - + /* * Set return value */ ret = *queue; - + if ( *queue == NULL ) { /* * Queue was empty. */ } else if ( (*queue)->q_next == *queue ) { - /* + /* * Queue only contained a single element. It will now be - * empty. + * empty. */ *queue = NULL; - + } else { /* * Remove specific element. @@ -334,7 +334,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element if ( (*queue) == element) (*queue) = element->q_next; } - + /* * Return the removed entry (or NULL of queue was empty). */ @@ -352,7 +352,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element hashbin_t *hashbin_new(int type) { hashbin_t* hashbin; - + /* * Allocate new hashbin */ @@ -380,8 +380,8 @@ EXPORT_SYMBOL(hashbin_new); /* * Function hashbin_delete (hashbin, free_func) * - * Destroy hashbin, the free_func can be a user supplied special routine - * for deallocating this structure if it's complex. If not the user can + * Destroy hashbin, the free_func can be a user supplied special routine + * for deallocating this structure if it's complex. If not the user can * just supply kfree, which should take care of the job. */ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) @@ -392,7 +392,7 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) IRDA_ASSERT(hashbin != NULL, return -1;); IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;); - + /* Synchronize */ if ( hashbin->hb_type & HB_LOCK ) { spin_lock_irqsave(&hashbin->hb_spinlock, flags); @@ -407,11 +407,11 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) while (queue ) { if (free_func) (*free_func)(queue); - queue = dequeue_first( + queue = dequeue_first( (irda_queue_t**) &hashbin->hb_queue[i]); } } - + /* Cleanup local data */ hashbin->hb_current = NULL; hashbin->magic = ~HB_MAGIC; @@ -438,7 +438,7 @@ EXPORT_SYMBOL(hashbin_delete); * Insert an entry into the hashbin * */ -void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, +void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, const char* name) { unsigned long flags = 0; @@ -460,14 +460,14 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, if ( hashbin->hb_type & HB_LOCK ) { spin_lock_irqsave(&hashbin->hb_spinlock, flags); } /* Default is no-lock */ - + /* * Store name and key */ entry->q_hash = hashv; if ( name ) strlcpy( entry->q_name, name, sizeof(entry->q_name)); - + /* * Insert new entry first */ @@ -482,7 +482,7 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, } EXPORT_SYMBOL(hashbin_insert); -/* +/* * Function hashbin_remove_first (hashbin) * * Remove first entry of the hashbin @@ -537,7 +537,7 @@ void *hashbin_remove_first( hashbin_t *hashbin) } -/* +/* * Function hashbin_remove (hashbin, hashv, name) * * Remove entry with the given name @@ -561,7 +561,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name) IRDA_ASSERT( hashbin != NULL, return NULL;); IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); - + /* * Locate hashbin */ @@ -601,7 +601,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name) entry = entry->q_next; } while ( entry != hashbin->hb_queue[ bin ] ); } - + /* * If entry was found, dequeue it */ @@ -622,18 +622,18 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name) if ( hashbin->hb_type & HB_LOCK ) { spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); } /* Default is no-lock */ - - + + /* Return */ - if ( found ) + if ( found ) return entry; else return NULL; - + } EXPORT_SYMBOL(hashbin_remove); -/* +/* * Function hashbin_remove_this (hashbin, entry) * * Remove entry with the given name @@ -655,7 +655,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry) IRDA_ASSERT( hashbin != NULL, return NULL;); IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); IRDA_ASSERT( entry != NULL, return NULL;); - + /* Synchronize */ if ( hashbin->hb_type & HB_LOCK ) { spin_lock_irqsave(&hashbin->hb_spinlock, flags); @@ -722,7 +722,7 @@ void* hashbin_find( hashbin_t* hashbin, long hashv, const char* name ) if ( name ) hashv = hash( name ); bin = GET_HASHBIN( hashv ); - + /* * Search for entry */ @@ -829,7 +829,7 @@ void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name, * called before any calls to hashbin_get_next()! * */ -irda_queue_t *hashbin_get_first( hashbin_t* hashbin) +irda_queue_t *hashbin_get_first( hashbin_t* hashbin) { irda_queue_t *entry; int i; @@ -860,7 +860,7 @@ EXPORT_SYMBOL(hashbin_get_first); * Get next item in hashbin. A series of hashbin_get_next() calls must * be started by a call to hashbin_get_first(). The function returns * NULL when all items have been traversed - * + * * The context of the search is stored within the hashbin, so you must * protect yourself from concurrent enumerations. - Jean II */ @@ -876,13 +876,13 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin) if ( hashbin->hb_current == NULL) { IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;); return NULL; - } + } entry = hashbin->hb_current->q_next; bin = GET_HASHBIN( entry->q_hash); - /* + /* * Make sure that we are not back at the beginning of the queue - * again + * again */ if ( entry != hashbin->hb_queue[ bin ]) { hashbin->hb_current = entry; @@ -895,7 +895,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin) */ if ( bin >= HASHBIN_SIZE) return NULL; - + /* * Move to next queue in hashbin */ @@ -904,7 +904,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin) entry = hashbin->hb_queue[ i]; if ( entry) { hashbin->hb_current = entry; - + return entry; } } diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c index 86805c3..bb53ba0 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irsysctl.c * Version: 1.0 * Description: Sysctl interface for IrDA @@ -8,19 +8,19 @@ * Created at: Sun May 24 22:12:06 1998 * Modified at: Fri Jun 4 02:50:15 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/mm.h> @@ -111,7 +111,7 @@ static ctl_table irda_table[] = { .strategy = &sysctl_string }, #ifdef CONFIG_IRDA_DEBUG - { + { .ctl_name = DEBUG, .procname = "debug", .data = &irda_debug, @@ -121,7 +121,7 @@ static ctl_table irda_table[] = { }, #endif #ifdef CONFIG_IRDA_FAST_RR - { + { .ctl_name = FAST_POLL, .procname = "fast_poll_increase", .data = &sysctl_fast_poll_increase, @@ -287,7 +287,7 @@ int __init irda_sysctl_register(void) * Unregister our sysctl interface * */ -void __exit irda_sysctl_unregister(void) +void __exit irda_sysctl_unregister(void) { unregister_sysctl_table(irda_table_header); } diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 03504f3..6883635 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irttp.c * Version: 1.2 * Description: Tiny Transport Protocol (TTP) implementation @@ -8,18 +8,18 @@ * Created at: Sun Aug 31 20:14:31 1997 * Modified at: Wed Jan 5 11:31:27 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -42,17 +42,17 @@ static struct irttp_cb *irttp; static void __irttp_close_tsap(struct tsap_cb *self); -static int irttp_data_indication(void *instance, void *sap, +static int irttp_data_indication(void *instance, void *sap, struct sk_buff *skb); -static int irttp_udata_indication(void *instance, void *sap, +static int irttp_udata_indication(void *instance, void *sap, struct sk_buff *skb); -static void irttp_disconnect_indication(void *instance, void *sap, +static void irttp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *); -static void irttp_connect_indication(void *instance, void *sap, +static void irttp_connect_indication(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, __u8 header_size, struct sk_buff *skb); -static void irttp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, __u32 max_sdu_size, +static void irttp_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 header_size, struct sk_buff *skb); static void irttp_run_tx_queue(struct tsap_cb *self); static void irttp_run_rx_queue(struct tsap_cb *self); @@ -61,7 +61,7 @@ static void irttp_flush_queues(struct tsap_cb *self); static void irttp_fragment_skb(struct tsap_cb *self, struct sk_buff *skb); static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self); static void irttp_todo_expired(unsigned long data); -static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, +static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, int get); static void irttp_flow_indication(void *instance, void *sap, LOCAL_FLOW flow); @@ -109,7 +109,7 @@ int __init irttp_init(void) * Called by module destruction/cleanup code * */ -void __exit irttp_cleanup(void) +void __exit irttp_cleanup(void) { /* Check for main structure */ IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;); @@ -865,7 +865,7 @@ static int irttp_udata_indication(void *instance, void *sap, err = self->notify.udata_indication(self->notify.instance, self,skb); /* Same comment as in irttp_do_data_indication() */ - if (!err) + if (!err) return 0; } /* Either no handler, or handler returns an error */ @@ -940,7 +940,7 @@ static int irttp_data_indication(void *instance, void *sap, /* * If the peer device has given us some credits and we didn't have - * anyone from before, then we need to shedule the tx queue. + * anyone from before, then we need to shedule the tx queue. * We need to do that because our Tx have stopped (so we may not * get any LAP flow indication) and the user may be stopped as * well. - Jean II @@ -1798,14 +1798,14 @@ static void *irttp_seq_start(struct seq_file *seq, loff_t *pos) spin_lock_irq(&irttp->tsaps->hb_spinlock); iter->id = 0; - for (self = (struct tsap_cb *) hashbin_get_first(irttp->tsaps); + for (self = (struct tsap_cb *) hashbin_get_first(irttp->tsaps); self != NULL; self = (struct tsap_cb *) hashbin_get_next(irttp->tsaps)) { if (iter->id == *pos) break; ++iter->id; } - + return self; } diff --git a/net/irda/parameters.c b/net/irda/parameters.c index 1324942..75a72d2 100644 --- a/net/irda/parameters.c +++ b/net/irda/parameters.c @@ -563,7 +563,7 @@ static int irda_param_extract(void *self, __u8 *buf, int len, * safe. Returns the number of bytes that was parsed * */ -int irda_param_extract_all(void *self, __u8 *buf, int len, +int irda_param_extract_all(void *self, __u8 *buf, int len, pi_param_info_t *info) { int ret = -1; diff --git a/net/irda/qos.c b/net/irda/qos.c index 95a69c0..349012c 100644 --- a/net/irda/qos.c +++ b/net/irda/qos.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: qos.c * Version: 1.0 * Description: IrLAP QoS parameter negotiation @@ -8,26 +8,26 @@ * Created at: Tue Sep 9 00:00:26 1997 * Modified at: Sun Jan 30 14:29:16 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include <asm/byteorder.h> @@ -84,16 +84,16 @@ unsigned sysctl_max_tx_data_size = 2042; unsigned sysctl_max_tx_window = 7; static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get); -static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, +static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, int get); -static int irlap_param_max_turn_time(void *instance, irda_param_t *param, +static int irlap_param_max_turn_time(void *instance, irda_param_t *param, int get); static int irlap_param_data_size(void *instance, irda_param_t *param, int get); -static int irlap_param_window_size(void *instance, irda_param_t *param, +static int irlap_param_window_size(void *instance, irda_param_t *param, int get); -static int irlap_param_additional_bofs(void *instance, irda_param_t *parm, +static int irlap_param_additional_bofs(void *instance, irda_param_t *parm, int get); -static int irlap_param_min_turn_time(void *instance, irda_param_t *param, +static int irlap_param_min_turn_time(void *instance, irda_param_t *param, int get); #ifndef CONFIG_IRDA_DYNAMIC_WINDOW @@ -101,7 +101,7 @@ static __u32 irlap_requested_line_capacity(struct qos_info *qos); #endif static __u32 min_turn_times[] = { 10000, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */ -static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, +static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, 1152000, 4000000, 16000000 }; /* bps */ static __u32 data_sizes[] = { 64, 128, 256, 512, 1024, 2048 }; /* bytes */ static __u32 add_bofs[] = { 48, 24, 12, 5, 3, 2, 1, 0 }; /* bytes */ @@ -165,7 +165,7 @@ static pi_param_info_t irlap_param_info = { pi_major_call_table, 2, 0x7f, 7 }; static inline int value_index(__u32 value, __u32 *array, int size) { int i; - + for (i=0; i < size; i++) if (array[i] == value) break; @@ -178,7 +178,7 @@ static inline int value_index(__u32 value, __u32 *array, int size) * Returns value to index in array, easy! * */ -static inline __u32 index_value(int index, __u32 *array) +static inline __u32 index_value(int index, __u32 *array) { return array[index]; } @@ -189,7 +189,7 @@ static inline __u32 index_value(int index, __u32 *array) * Returns index to most significant bit (MSB) in word * */ -static int msb_index (__u16 word) +static int msb_index (__u16 word) { __u16 msb = 0x8000; int index = 15; /* Current MSB */ @@ -298,12 +298,12 @@ void irda_qos_compute_intersection(struct qos_info *qos, struct qos_info *new) * * The purpose of this function is for layers and drivers to be able to * set the maximum QoS possible and then "and in" their own limitations - * + * */ void irda_init_max_qos_capabilies(struct qos_info *qos) { int i; - /* + /* * These are the maximum supported values as specified on pages * 39-43 in IrLAP */ @@ -361,25 +361,25 @@ static void irlap_adjust_qos_settings(struct qos_info *qos) qos->min_turn_time.value = sysctl_min_tx_turn_time; } - /* + /* * Not allowed to use a max turn time less than 500 ms if the baudrate * is less than 115200 */ - if ((qos->baud_rate.value < 115200) && + if ((qos->baud_rate.value < 115200) && (qos->max_turn_time.value < 500)) { - IRDA_DEBUG(0, + IRDA_DEBUG(0, "%s(), adjusting max turn time from %d to 500 ms\n", __FUNCTION__, qos->max_turn_time.value); qos->max_turn_time.value = 500; } - + /* - * The data size must be adjusted according to the baud rate and max + * The data size must be adjusted according to the baud rate and max * turn time */ index = value_index(qos->data_size.value, data_sizes, 6); - line_capacity = irlap_max_line_capacity(qos->baud_rate.value, + line_capacity = irlap_max_line_capacity(qos->baud_rate.value, qos->max_turn_time.value); #ifdef CONFIG_IRDA_DYNAMIC_WINDOW @@ -427,32 +427,32 @@ static void irlap_adjust_qos_settings(struct qos_info *qos) * We just set the QoS capabilities for the peer station * */ -int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb) +int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb) { int ret; - - ret = irda_param_extract_all(self, skb->data, skb->len, + + ret = irda_param_extract_all(self, skb->data, skb->len, &irlap_param_info); - + /* Convert the negotiated bits to values */ irda_qos_bits_to_value(&self->qos_tx); irda_qos_bits_to_value(&self->qos_rx); irlap_adjust_qos_settings(&self->qos_tx); - IRDA_DEBUG(2, "Setting BAUD_RATE to %d bps.\n", + IRDA_DEBUG(2, "Setting BAUD_RATE to %d bps.\n", self->qos_tx.baud_rate.value); IRDA_DEBUG(2, "Setting DATA_SIZE to %d bytes\n", self->qos_tx.data_size.value); - IRDA_DEBUG(2, "Setting WINDOW_SIZE to %d\n", + IRDA_DEBUG(2, "Setting WINDOW_SIZE to %d\n", self->qos_tx.window_size.value); - IRDA_DEBUG(2, "Setting XBOFS to %d\n", + IRDA_DEBUG(2, "Setting XBOFS to %d\n", self->qos_tx.additional_bofs.value); IRDA_DEBUG(2, "Setting MAX_TURN_TIME to %d ms.\n", self->qos_tx.max_turn_time.value); IRDA_DEBUG(2, "Setting MIN_TURN_TIME to %d usecs.\n", self->qos_tx.min_turn_time.value); - IRDA_DEBUG(2, "Setting LINK_DISC to %d secs.\n", + IRDA_DEBUG(2, "Setting LINK_DISC to %d secs.\n", self->qos_tx.link_disc_time.value); return ret; } @@ -463,55 +463,55 @@ int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb) * Insert QoS negotiaion pararameters into frame * */ -int irlap_insert_qos_negotiation_params(struct irlap_cb *self, +int irlap_insert_qos_negotiation_params(struct irlap_cb *self, struct sk_buff *skb) { int ret; /* Insert data rate */ - ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, + ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert max turnaround time */ - ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, + ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert data size */ - ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, + ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert window size */ - ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, + ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert additional BOFs */ - ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, + ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert minimum turnaround time */ - ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, + ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert link disconnect/threshold time */ - ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, + ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; @@ -537,12 +537,12 @@ static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get) if (get) { param->pv.i = self->qos_rx.baud_rate.bits; - IRDA_DEBUG(2, "%s(), baud rate = 0x%02x\n", - __FUNCTION__, param->pv.i); + IRDA_DEBUG(2, "%s(), baud rate = 0x%02x\n", + __FUNCTION__, param->pv.i); } else { - /* + /* * Stations must agree on baud rate, so calculate - * intersection + * intersection */ IRDA_DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", (__u16) param->pv.i); final = (__u16) param->pv.i & self->qos_rx.baud_rate.bits; @@ -558,24 +558,24 @@ static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get) /* * Function irlap_param_link_disconnect (instance, param, get) * - * Negotiate link disconnect/threshold time. + * Negotiate link disconnect/threshold time. * */ -static int irlap_param_link_disconnect(void *instance, irda_param_t *param, +static int irlap_param_link_disconnect(void *instance, irda_param_t *param, int get) { __u16 final; - + struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.link_disc_time.bits; else { - /* - * Stations must agree on link disconnect/threshold + /* + * Stations must agree on link disconnect/threshold * time. */ IRDA_DEBUG(2, "LINK_DISC: %02x\n", (__u8) param->pv.i); @@ -595,14 +595,14 @@ static int irlap_param_link_disconnect(void *instance, irda_param_t *param, * will be negotiated independently for each station * */ -static int irlap_param_max_turn_time(void *instance, irda_param_t *param, +static int irlap_param_max_turn_time(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.max_turn_time.bits; else @@ -621,10 +621,10 @@ static int irlap_param_max_turn_time(void *instance, irda_param_t *param, static int irlap_param_data_size(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.data_size.bits; else @@ -640,14 +640,14 @@ static int irlap_param_data_size(void *instance, irda_param_t *param, int get) * will be negotiated independently for each station * */ -static int irlap_param_window_size(void *instance, irda_param_t *param, +static int irlap_param_window_size(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.window_size.bits; else @@ -665,10 +665,10 @@ static int irlap_param_window_size(void *instance, irda_param_t *param, static int irlap_param_additional_bofs(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.additional_bofs.bits; else @@ -683,14 +683,14 @@ static int irlap_param_additional_bofs(void *instance, irda_param_t *param, int * Negotiate the minimum turn around time. This is a type 1 parameter and * will be negotiated independently for each station */ -static int irlap_param_min_turn_time(void *instance, irda_param_t *param, +static int irlap_param_min_turn_time(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.min_turn_time.bits; else @@ -721,9 +721,9 @@ __u32 irlap_max_line_capacity(__u32 speed, __u32 max_turn_time) line_capacity = max_line_capacities[i][j]; - IRDA_DEBUG(2, "%s(), line capacity=%d bytes\n", + IRDA_DEBUG(2, "%s(), line capacity=%d bytes\n", __FUNCTION__, line_capacity); - + return line_capacity; } @@ -749,7 +749,7 @@ void irda_qos_bits_to_value(struct qos_info *qos) int index; IRDA_ASSERT(qos != NULL, return;); - + index = msb_index(qos->baud_rate.bits); qos->baud_rate.value = baud_rates[index]; @@ -761,13 +761,13 @@ void irda_qos_bits_to_value(struct qos_info *qos) index = msb_index(qos->min_turn_time.bits); qos->min_turn_time.value = min_turn_times[index]; - + index = msb_index(qos->max_turn_time.bits); qos->max_turn_time.value = max_turn_times[index]; index = msb_index(qos->link_disc_time.bits); qos->link_disc_time.value = link_disc_times[index]; - + index = msb_index(qos->additional_bofs.bits); qos->additional_bofs.value = add_bofs[index]; } diff --git a/net/irda/timer.c b/net/irda/timer.c index 3871a2b..d3a6ee8 100644 --- a/net/irda/timer.c +++ b/net/irda/timer.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: timer.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Aug 16 00:59:29 1997 * Modified at: Wed Dec 8 12:50:34 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.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 + * + * 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 (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -40,11 +40,11 @@ static void irlap_query_timer_expired(void* data); static void irlap_final_timer_expired(void* data); static void irlap_wd_timer_expired(void* data); static void irlap_backoff_timer_expired(void* data); -static void irlap_media_busy_expired(void* data); +static void irlap_media_busy_expired(void* data); void irlap_start_slot_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->slot_timer, timeout, (void *) self, + irda_start_timer(&self->slot_timer, timeout, (void *) self, irlap_slot_timer_expired); } @@ -67,31 +67,31 @@ void irlap_start_query_timer(struct irlap_cb *self, int S, int s) /* Set or re-set the timer. We reset the timer for each received * discovery query, which allow us to automatically adjust to * the speed of the peer discovery (faster or slower). Jean II */ - irda_start_timer( &self->query_timer, timeout, (void *) self, + irda_start_timer( &self->query_timer, timeout, (void *) self, irlap_query_timer_expired); } void irlap_start_final_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->final_timer, timeout, (void *) self, + irda_start_timer(&self->final_timer, timeout, (void *) self, irlap_final_timer_expired); } void irlap_start_wd_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->wd_timer, timeout, (void *) self, + irda_start_timer(&self->wd_timer, timeout, (void *) self, irlap_wd_timer_expired); } void irlap_start_backoff_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->backoff_timer, timeout, (void *) self, + irda_start_timer(&self->backoff_timer, timeout, (void *) self, irlap_backoff_timer_expired); } void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->media_busy_timer, timeout, + irda_start_timer(&self->media_busy_timer, timeout, (void *) self, irlap_media_busy_expired); } @@ -109,25 +109,25 @@ void irlap_stop_mbusy_timer(struct irlap_cb *self) irlap_do_event(self, MEDIA_BUSY_TIMER_EXPIRED, NULL, NULL); } -void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout) +void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout) { irda_start_timer(&self->watchdog_timer, timeout, (void *) self, irlmp_watchdog_timer_expired); } -void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout) +void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout) { irda_start_timer(&self->discovery_timer, timeout, (void *) self, irlmp_discovery_timer_expired); } -void irlmp_start_idle_timer(struct lap_cb *self, int timeout) +void irlmp_start_idle_timer(struct lap_cb *self, int timeout) { irda_start_timer(&self->idle_timer, timeout, (void *) self, irlmp_idle_timer_expired); } -void irlmp_stop_idle_timer(struct lap_cb *self) +void irlmp_stop_idle_timer(struct lap_cb *self) { /* If timer is activated, kill it! */ del_timer(&self->idle_timer); @@ -147,7 +147,7 @@ static void irlap_slot_timer_expired(void *data) IRDA_ASSERT(self->magic == LAP_MAGIC, return;); irlap_do_event(self, SLOT_TIMER_EXPIRED, NULL, NULL); -} +} /* * Function irlap_query_timer_expired (data) @@ -163,12 +163,12 @@ static void irlap_query_timer_expired(void *data) IRDA_ASSERT(self->magic == LAP_MAGIC, return;); irlap_do_event(self, QUERY_TIMER_EXPIRED, NULL, NULL); -} +} /* * Function irda_final_timer_expired (data) * - * + * * */ static void irlap_final_timer_expired(void *data) @@ -184,32 +184,32 @@ static void irlap_final_timer_expired(void *data) /* * Function irda_wd_timer_expired (data) * - * + * * */ static void irlap_wd_timer_expired(void *data) { struct irlap_cb *self = (struct irlap_cb *) data; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); - + irlap_do_event(self, WD_TIMER_EXPIRED, NULL, NULL); } /* * Function irda_backoff_timer_expired (data) * - * + * * */ static void irlap_backoff_timer_expired(void *data) { struct irlap_cb *self = (struct irlap_cb *) data; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); - + irlap_do_event(self, BACKOFF_TIMER_EXPIRED, NULL, NULL); } @@ -217,7 +217,7 @@ static void irlap_backoff_timer_expired(void *data) /* * Function irtty_media_busy_expired (data) * - * + * */ void irlap_media_busy_expired(void* data) { diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c index 87130c1..5abfb71 100644 --- a/net/irda/wrapper.c +++ b/net/irda/wrapper.c @@ -295,7 +295,7 @@ async_unwrap_bof(struct net_device *dev, case OUTSIDE_FRAME: case BEGIN_FRAME: default: - /* We may receive multiple BOF at the start of frame */ + /* We may receive multiple BOF at the start of frame */ break; } diff --git a/net/key/af_key.c b/net/key/af_key.c index b4e4440..f3a026f 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -152,7 +152,7 @@ static int pfkey_create(struct socket *sock, int protocol) sk = sk_alloc(PF_KEY, GFP_KERNEL, &key_proto, 1); if (sk == NULL) goto out; - + sock->ops = &pfkey_ops; sock_init_data(sock, sk); @@ -487,7 +487,7 @@ static int parse_exthdrs(struct sk_buff *skb, struct sadb_msg *hdr, void **ext_h ext_type == SADB_X_EXT_NAT_T_OA) { if (verify_address_len(p)) return -EINVAL; - } + } if (ext_type == SADB_X_EXT_SEC_CTX) { if (verify_sec_ctx_len(p)) return -EINVAL; @@ -556,12 +556,12 @@ static int pfkey_sadb_addr2xfrm_addr(struct sadb_address *addr, { switch (((struct sockaddr*)(addr + 1))->sa_family) { case AF_INET: - xaddr->a4 = + xaddr->a4 = ((struct sockaddr_in *)(addr + 1))->sin_addr.s_addr; return AF_INET; #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) case AF_INET6: - memcpy(xaddr->a6, + memcpy(xaddr->a6, &((struct sockaddr_in6 *)(addr + 1))->sin6_addr, sizeof(struct in6_addr)); return AF_INET6; @@ -659,11 +659,11 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, /* base, SA, (lifetime (HSC),) address(SD), (address(P),) key(AE), (identity(SD),) (sensitivity)> */ - size = sizeof(struct sadb_msg) +sizeof(struct sadb_sa) + + size = sizeof(struct sadb_msg) +sizeof(struct sadb_sa) + sizeof(struct sadb_lifetime) + ((hsc & 1) ? sizeof(struct sadb_lifetime) : 0) + ((hsc & 2) ? sizeof(struct sadb_lifetime) : 0) + - sizeof(struct sadb_address)*2 + + sizeof(struct sadb_address)*2 + sockaddr_size*2 + sizeof(struct sadb_x_sa2); @@ -685,13 +685,13 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, if (add_keys) { if (x->aalg && x->aalg->alg_key_len) { - auth_key_size = - PFKEY_ALIGN8((x->aalg->alg_key_len + 7) / 8); + auth_key_size = + PFKEY_ALIGN8((x->aalg->alg_key_len + 7) / 8); size += sizeof(struct sadb_key) + auth_key_size; } if (x->ealg && x->ealg->alg_key_len) { - encrypt_key_size = - PFKEY_ALIGN8((x->ealg->alg_key_len+7) / 8); + encrypt_key_size = + PFKEY_ALIGN8((x->ealg->alg_key_len+7) / 8); size += sizeof(struct sadb_key) + encrypt_key_size; } } @@ -758,7 +758,7 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, /* hard time */ if (hsc & 2) { - lifetime = (struct sadb_lifetime *) skb_put(skb, + lifetime = (struct sadb_lifetime *) skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); @@ -770,7 +770,7 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, } /* soft time */ if (hsc & 1) { - lifetime = (struct sadb_lifetime *) skb_put(skb, + lifetime = (struct sadb_lifetime *) skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); @@ -791,16 +791,16 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, lifetime->sadb_lifetime_addtime = x->curlft.add_time; lifetime->sadb_lifetime_usetime = x->curlft.use_time; /* src address */ - addr = (struct sadb_address*) skb_put(skb, + addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC; - /* "if the ports are non-zero, then the sadb_address_proto field, - normally zero, MUST be filled in with the transport + /* "if the ports are non-zero, then the sadb_address_proto field, + normally zero, MUST be filled in with the transport protocol's number." - RFC2367 */ - addr->sadb_address_proto = 0; + addr->sadb_address_proto = 0; addr->sadb_address_reserved = 0; if (x->props.family == AF_INET) { addr->sadb_address_prefixlen = 32; @@ -813,29 +813,29 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, } #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) else if (x->props.family == AF_INET6) { - addr->sadb_address_prefixlen = 128; + addr->sadb_address_prefixlen = 128; sin6 = (struct sockaddr_in6 *) (addr + 1); sin6->sin6_family = AF_INET6; sin6->sin6_port = 0; sin6->sin6_flowinfo = 0; - memcpy(&sin6->sin6_addr, x->props.saddr.a6, + memcpy(&sin6->sin6_addr, x->props.saddr.a6, sizeof(struct in6_addr)); sin6->sin6_scope_id = 0; - } + } #endif else BUG(); /* dst address */ - addr = (struct sadb_address*) skb_put(skb, + addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_DST; - addr->sadb_address_proto = 0; - addr->sadb_address_prefixlen = 32; /* XXX */ + addr->sadb_address_proto = 0; + addr->sadb_address_prefixlen = 32; /* XXX */ addr->sadb_address_reserved = 0; if (x->props.family == AF_INET) { sin = (struct sockaddr_in *) (addr + 1); @@ -845,9 +845,9 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); if (x->sel.saddr.a4 != x->props.saddr.a4) { - addr = (struct sadb_address*) skb_put(skb, + addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_PROXY; @@ -876,9 +876,9 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, if (memcmp (x->sel.saddr.a6, x->props.saddr.a6, sizeof(struct in6_addr))) { - addr = (struct sadb_address *) skb_put(skb, + addr = (struct sadb_address *) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_PROXY; @@ -902,7 +902,7 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, /* auth key */ if (add_keys && auth_key_size) { - key = (struct sadb_key *) skb_put(skb, + key = (struct sadb_key *) skb_put(skb, sizeof(struct sadb_key)+auth_key_size); key->sadb_key_len = (sizeof(struct sadb_key) + auth_key_size) / sizeof(uint64_t); @@ -913,14 +913,14 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, } /* encrypt key */ if (add_keys && encrypt_key_size) { - key = (struct sadb_key *) skb_put(skb, + key = (struct sadb_key *) skb_put(skb, sizeof(struct sadb_key)+encrypt_key_size); - key->sadb_key_len = (sizeof(struct sadb_key) + + key->sadb_key_len = (sizeof(struct sadb_key) + encrypt_key_size) / sizeof(uint64_t); key->sadb_key_exttype = SADB_EXT_KEY_ENCRYPT; key->sadb_key_bits = x->ealg->alg_key_len; key->sadb_key_reserved = 0; - memcpy(key + 1, x->ealg->alg_key, + memcpy(key + 1, x->ealg->alg_key, (x->ealg->alg_key_len+7)/8); } @@ -979,17 +979,17 @@ static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int add_keys, return skb; } -static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr, +static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr, void **ext_hdrs) { - struct xfrm_state *x; + struct xfrm_state *x; struct sadb_lifetime *lifetime; struct sadb_sa *sa; struct sadb_key *key; struct sadb_x_sec_ctx *sec_ctx; uint16_t proto; int err; - + sa = (struct sadb_sa *) ext_hdrs[SADB_EXT_SA-1]; if (!sa || @@ -1022,7 +1022,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr, SADB_SASTATE_MATURE and the kernel MUST return an error if this is not true. - However, KAME setkey always uses SADB_SASTATE_LARVAL. + However, KAME setkey always uses SADB_SASTATE_LARVAL. Hence, we have to _ignore_ sadb_sa_state, which is also reasonable. */ if (sa->sadb_sa_auth > SADB_AALG_MAX || @@ -1144,13 +1144,13 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr, } /* x->algo.flags = sa->sadb_sa_flags; */ - x->props.family = pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_SRC-1], + x->props.family = pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_SRC-1], &x->props.saddr); if (!x->props.family) { err = -EAFNOSUPPORT; goto out; } - pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST-1], + pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST-1], &x->id.daddr); if (ext_hdrs[SADB_X_EXT_SA2-1]) { @@ -1410,7 +1410,7 @@ static int pfkey_add(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, struct km_event c; xfrm_probe_algs(); - + x = pfkey_msg2xfrm_state(hdr, ext_hdrs); if (IS_ERR(x)) return PTR_ERR(x); @@ -1530,13 +1530,13 @@ static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, auth_len *= sizeof(struct sadb_alg); auth_len += sizeof(struct sadb_supported); } - + enc_len = xfrm_count_enc_supported(); if (enc_len) { enc_len *= sizeof(struct sadb_alg); enc_len += sizeof(struct sadb_supported); } - + len = enc_len + auth_len + sizeof(struct sadb_msg); skb = alloc_skb(len + 16, allocation); @@ -1605,7 +1605,7 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, struct sadb_msg } xfrm_probe_algs(); - + supp_skb = compose_sadb_supported(hdr, GFP_KERNEL); if (!supp_skb) { if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) @@ -1856,7 +1856,7 @@ static int pfkey_xfrm_policy2msg_size(struct xfrm_policy *xp) return sizeof(struct sadb_msg) + (sizeof(struct sadb_lifetime) * 3) + - (sizeof(struct sadb_address) * 2) + + (sizeof(struct sadb_address) * 2) + (sockaddr_size * 2) + sizeof(struct sadb_x_policy) + (xp->xfrm_nr * sizeof(struct sadb_x_ipsecrequest)) + @@ -1904,9 +1904,9 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i memset(hdr, 0, size); /* XXX do we need this ? */ /* src address */ - addr = (struct sadb_address*) skb_put(skb, + addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC; @@ -1936,14 +1936,14 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i BUG(); /* dst address */ - addr = (struct sadb_address*) skb_put(skb, + addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_DST; addr->sadb_address_proto = pfkey_proto_from_xfrm(xp->selector.proto); - addr->sadb_address_prefixlen = xp->selector.prefixlen_d; + addr->sadb_address_prefixlen = xp->selector.prefixlen_d; addr->sadb_address_reserved = 0; if (xp->family == AF_INET) { sin = (struct sockaddr_in *) (addr + 1); @@ -1967,7 +1967,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i BUG(); /* hard time */ - lifetime = (struct sadb_lifetime *) skb_put(skb, + lifetime = (struct sadb_lifetime *) skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); @@ -1977,7 +1977,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i lifetime->sadb_lifetime_addtime = xp->lft.hard_add_expires_seconds; lifetime->sadb_lifetime_usetime = xp->lft.hard_use_expires_seconds; /* soft time */ - lifetime = (struct sadb_lifetime *) skb_put(skb, + lifetime = (struct sadb_lifetime *) skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); @@ -1987,7 +1987,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i lifetime->sadb_lifetime_addtime = xp->lft.soft_add_expires_seconds; lifetime->sadb_lifetime_usetime = xp->lft.soft_use_expires_seconds; /* current time */ - lifetime = (struct sadb_lifetime *) skb_put(skb, + lifetime = (struct sadb_lifetime *) skb_put(skb, sizeof(struct sadb_lifetime)); lifetime->sadb_lifetime_len = sizeof(struct sadb_lifetime)/sizeof(uint64_t); @@ -2019,8 +2019,8 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i req_size = sizeof(struct sadb_x_ipsecrequest); if (t->mode == XFRM_MODE_TUNNEL) req_size += ((t->encap_family == AF_INET ? - sizeof(struct sockaddr_in) : - sizeof(struct sockaddr_in6)) * 2); + sizeof(struct sockaddr_in) : + sizeof(struct sockaddr_in6)) * 2); else size -= 2*socklen; rq = (void*)skb_put(skb, req_size); @@ -2150,7 +2150,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h XFRM_POLICY_BLOCK : XFRM_POLICY_ALLOW); xp->priority = pol->sadb_x_policy_priority; - sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], + sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr); if (!xp->family) { err = -EINVAL; @@ -2163,7 +2163,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h if (xp->selector.sport) xp->selector.sport_mask = htons(0xffff); - sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], + sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr); xp->selector.prefixlen_d = sa->sadb_address_prefixlen; @@ -2224,7 +2224,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h if (hdr->sadb_msg_type == SADB_X_SPDUPDATE) c.event = XFRM_MSG_UPDPOLICY; - else + else c.event = XFRM_MSG_NEWPOLICY; c.seq = hdr->sadb_msg_seq; @@ -2261,7 +2261,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg memset(&sel, 0, sizeof(sel)); - sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], + sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], sel.family = pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr); sel.prefixlen_s = sa->sadb_address_prefixlen; sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); @@ -2269,7 +2269,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg if (sel.sport) sel.sport_mask = htons(0xffff); - sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], + sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr); sel.prefixlen_d = sa->sadb_address_prefixlen; sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); @@ -2743,15 +2743,15 @@ static int count_esp_combs(struct xfrm_tmpl *t) struct xfrm_algo_desc *ealg = xfrm_ealg_get_byidx(i); if (!ealg) break; - + if (!(ealg_tmpl_set(t, ealg) && ealg->available)) continue; - + for (k = 1; ; k++) { struct xfrm_algo_desc *aalg = xfrm_aalg_get_byidx(k); if (!aalg) break; - + if (aalg_tmpl_set(t, aalg) && aalg->available) sz += sizeof(struct sadb_comb); } @@ -2806,10 +2806,10 @@ static void dump_esp_combs(struct sk_buff *skb, struct xfrm_tmpl *t) struct xfrm_algo_desc *ealg = xfrm_ealg_get_byidx(i); if (!ealg) break; - + if (!(ealg_tmpl_set(t, ealg) && ealg->available)) continue; - + for (k = 1; ; k++) { struct sadb_comb *c; struct xfrm_algo_desc *aalg = xfrm_aalg_get_byidx(k); @@ -2941,7 +2941,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct struct sadb_x_sec_ctx *sec_ctx; struct xfrm_sec_ctx *xfrm_ctx; int ctx_size = 0; - + sockaddr_size = pfkey_sockaddr_size(x->props.family); if (!sockaddr_size) return -EINVAL; @@ -2950,7 +2950,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct (sizeof(struct sadb_address) * 2) + (sockaddr_size * 2) + sizeof(struct sadb_x_policy); - + if (x->id.proto == IPPROTO_AH) size += count_ah_combs(t); else if (x->id.proto == IPPROTO_ESP) @@ -2964,7 +2964,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct skb = alloc_skb(size + 16, GFP_ATOMIC); if (skb == NULL) return -ENOMEM; - + hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); hdr->sadb_msg_version = PF_KEY_V2; hdr->sadb_msg_type = SADB_ACQUIRE; @@ -2976,9 +2976,9 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct hdr->sadb_msg_pid = 0; /* src address */ - addr = (struct sadb_address*) skb_put(skb, + addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC; @@ -3008,9 +3008,9 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct #endif else BUG(); - + /* dst address */ - addr = (struct sadb_address*) skb_put(skb, + addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ @@ -3019,7 +3019,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct addr->sadb_address_proto = 0; addr->sadb_address_reserved = 0; if (x->props.family == AF_INET) { - addr->sadb_address_prefixlen = 32; + addr->sadb_address_prefixlen = 32; sin = (struct sockaddr_in *) (addr + 1); sin->sin_family = AF_INET; @@ -3029,7 +3029,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct } #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) else if (x->props.family == AF_INET6) { - addr->sadb_address_prefixlen = 128; + addr->sadb_address_prefixlen = 128; sin6 = (struct sockaddr_in6 *) (addr + 1); sin6->sin6_family = AF_INET6; @@ -3074,7 +3074,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct } static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt, - u8 *data, int len, int *dir) + u8 *data, int len, int *dir) { struct xfrm_policy *xp; struct sadb_x_policy *pol = (struct sadb_x_policy*)data; @@ -3193,17 +3193,17 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, * HDR | SA | ADDRESS_SRC (old addr) | NAT_T_SPORT (old port) | * ADDRESS_DST (new addr) | NAT_T_DPORT (new port) */ - + size = sizeof(struct sadb_msg) + sizeof(struct sadb_sa) + (sizeof(struct sadb_address) * 2) + (sockaddr_size * 2) + (sizeof(struct sadb_x_nat_t_port) * 2); - + skb = alloc_skb(size + 16, GFP_ATOMIC); if (skb == NULL) return -ENOMEM; - + hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); hdr->sadb_msg_version = PF_KEY_V2; hdr->sadb_msg_type = SADB_X_NAT_T_NEW_MAPPING; @@ -3228,7 +3228,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, /* ADDRESS_SRC (old addr) */ addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC; @@ -3269,7 +3269,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, /* ADDRESS_DST (new addr) */ addr = (struct sadb_address*) skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); - addr->sadb_address_len = + addr->sadb_address_len = (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_DST; @@ -3674,7 +3674,7 @@ static int pfkey_read_proc(char *buffer, char **start, off_t offset, ); buffer[len++] = '\n'; - + pos = begin + len; if (pos < offset) { len = 0; diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index 7e6bc41..a2e7aa6 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c @@ -14,7 +14,7 @@ * LAPB 002 Jonathan Naylor New timer architecture. * 2000-10-29 Henner Eisen lapb_data_indication() return status. */ - + #include <linux/module.h> #include <linux/errno.h> #include <linux/types.h> @@ -43,7 +43,7 @@ static struct list_head lapb_list = LIST_HEAD_INIT(lapb_list); static DEFINE_RWLOCK(lapb_list_lock); /* - * Free an allocated lapb control block. + * Free an allocated lapb control block. */ static void lapb_free_cb(struct lapb_cb *lapb) { @@ -407,7 +407,7 @@ int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *skb) return lapb->callbacks.data_indication(lapb->dev, skb); kfree_skb(skb); - return NET_RX_CN_HIGH; /* For now; must be != NET_RX_DROP */ + return NET_RX_CN_HIGH; /* For now; must be != NET_RX_DROP */ } int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *skb) diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c index 49a761b..981beb5 100644 --- a/net/lapb/lapb_out.c +++ b/net/lapb/lapb_out.c @@ -34,7 +34,7 @@ #include <linux/interrupt.h> #include <net/lapb.h> -/* +/* * This procedure is passed a buffer descriptor for an iframe. It builds * the rest of the control part of the frame and then writes it out. */ @@ -66,7 +66,7 @@ static void lapb_send_iframe(struct lapb_cb *lapb, struct sk_buff *skb, int poll lapb->dev, lapb->state, poll_bit, lapb->vs, lapb->vr); #endif - lapb_transmit_buffer(lapb, skb, LAPB_COMMAND); + lapb_transmit_buffer(lapb, skb, LAPB_COMMAND); } void lapb_kick(struct lapb_cb *lapb) diff --git a/net/lapb/lapb_subr.c b/net/lapb/lapb_subr.c index 8b5eefd..b8739cf 100644 --- a/net/lapb/lapb_subr.c +++ b/net/lapb/lapb_subr.c @@ -59,7 +59,7 @@ void lapb_frames_acked(struct lapb_cb *lapb, unsigned short nr) */ if (lapb->va != nr) while (skb_peek(&lapb->ack_queue) && lapb->va != nr) { - skb = skb_dequeue(&lapb->ack_queue); + skb = skb_dequeue(&lapb->ack_queue); kfree_skb(skb); lapb->va = (lapb->va + 1) % modulus; } @@ -67,7 +67,7 @@ void lapb_frames_acked(struct lapb_cb *lapb, unsigned short nr) void lapb_requeue_frames(struct lapb_cb *lapb) { - struct sk_buff *skb, *skb_prev = NULL; + struct sk_buff *skb, *skb_prev = NULL; /* * Requeue all the un-ack-ed frames on the output queue to be picked @@ -91,7 +91,7 @@ int lapb_validate_nr(struct lapb_cb *lapb, unsigned short nr) { unsigned short vc = lapb->va; int modulus; - + modulus = (lapb->mode & LAPB_EXTENDED) ? LAPB_EMODULUS : LAPB_SMODULUS; while (vc != lapb->vs) { @@ -99,7 +99,7 @@ int lapb_validate_nr(struct lapb_cb *lapb, unsigned short nr) return 1; vc = (vc + 1) % modulus; } - + return nr == lapb->vs; } @@ -149,7 +149,7 @@ int lapb_decode(struct lapb_cb *lapb, struct sk_buff *skb, frame->cr = LAPB_RESPONSE; } } - + skb_pull(skb, 1); if (lapb->mode & LAPB_EXTENDED) { @@ -220,9 +220,9 @@ int lapb_decode(struct lapb_cb *lapb, struct sk_buff *skb, return 0; } -/* +/* * This routine is called when the HDLC layer internally generates a - * command or response for the remote machine ( eg. RR, UA etc. ). + * command or response for the remote machine ( eg. RR, UA etc. ). * Only supervisory or unnumbered frames are processed, FRMRs are handled * by lapb_transmit_frmr below. */ @@ -259,7 +259,7 @@ void lapb_send_control(struct lapb_cb *lapb, int frametype, lapb_transmit_buffer(lapb, skb, type); } -/* +/* * This routine generates FRMRs based on information previously stored in * the LAPB control block. */ diff --git a/net/lapb/lapb_timer.c b/net/lapb/lapb_timer.c index 2c8f0f8..af6d14b 100644 --- a/net/lapb/lapb_timer.c +++ b/net/lapb/lapb_timer.c @@ -101,7 +101,7 @@ static void lapb_t1timer_expiry(unsigned long param) /* * Awaiting connection state, send SABM(E), up to N2 times. */ - case LAPB_STATE_1: + case LAPB_STATE_1: if (lapb->n2count == lapb->n2) { lapb_clear_queues(lapb); lapb->state = LAPB_STATE_0; diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 190bb3e..7d9fa38 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c @@ -67,7 +67,7 @@ static inline u16 llc_ui_next_link_no(int sap) static inline __be16 llc_proto_type(u16 arphrd) { return arphrd == ARPHRD_IEEE802_TR ? - htons(ETH_P_TR_802_2) : htons(ETH_P_802_2); + htons(ETH_P_TR_802_2) : htons(ETH_P_802_2); } /** @@ -114,7 +114,7 @@ static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) struct llc_sock* llc = llc_sk(sk); int rc = 0; - if (unlikely(llc_data_accept_state(llc->state) || + if (unlikely(llc_data_accept_state(llc->state) || llc->remote_busy_flag || llc->p_flag)) { long timeout = sock_sndtimeo(sk, noblock); @@ -602,7 +602,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) int rc = -EOPNOTSUPP; dprintk("%s: accepting on %02X\n", __FUNCTION__, - llc_sk(sk)->laddr.lsap); + llc_sk(sk)->laddr.lsap); lock_sock(sk); if (unlikely(sk->sk_type != SOCK_STREAM)) goto out; @@ -617,7 +617,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) goto out; } dprintk("%s: got a new connection on %02X\n", __FUNCTION__, - llc_sk(sk)->laddr.lsap); + llc_sk(sk)->laddr.lsap); skb = skb_dequeue(&sk->sk_receive_queue); rc = -EINVAL; if (!skb->sk) @@ -682,7 +682,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, if (flags & MSG_PEEK) { peek_seq = llc->copied_seq; seq = &peek_seq; - } + } target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); copied = 0; @@ -860,7 +860,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock, goto release; skb->dev = llc->dev; skb->protocol = llc_proto_type(addr->sllc_arphrd); - skb_reserve(skb, hdrlen); + skb_reserve(skb, hdrlen); rc = memcpy_fromiovec(skb_put(skb, copied), msg->msg_iov, copied); if (rc) goto out; @@ -1116,11 +1116,11 @@ static const struct proto_ops llc_ui_ops = { }; static char llc_proc_err_msg[] __initdata = - KERN_CRIT "LLC: Unable to register the proc_fs entries\n"; + KERN_CRIT "LLC: Unable to register the proc_fs entries\n"; static char llc_sysctl_err_msg[] __initdata = - KERN_CRIT "LLC: Unable to register the sysctl entries\n"; + KERN_CRIT "LLC: Unable to register the sysctl entries\n"; static char llc_sock_err_msg[] __initdata = - KERN_CRIT "LLC: Unable to register the network family\n"; + KERN_CRIT "LLC: Unable to register the network family\n"; static int __init llc2_init(void) { diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index c761c15..3b8cfbe 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c @@ -854,7 +854,7 @@ static void llc_sk_init(struct sock* sk) llc->n2 = 2; /* max retransmit */ llc->k = 2; /* tx win size, will adjust dynam */ llc->rw = 128; /* rx win size (opt and equal to - * tx_win of remote LLC) */ + * tx_win of remote LLC) */ skb_queue_head_init(&llc->pdu_unack_q); sk->sk_backlog_rcv = llc_backlog_rcv; } diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c index db82aff..b3f65d1 100644 --- a/net/llc/llc_input.c +++ b/net/llc/llc_input.c @@ -164,7 +164,7 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, sap = llc_sap_find(pdu->dsap); if (unlikely(!sap)) {/* unknown SAP */ dprintk("%s: llc_sap_find(%02X) failed!\n", __FUNCTION__, - pdu->dsap); + pdu->dsap); goto drop; } /* @@ -173,9 +173,9 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, */ rcv = rcu_dereference(sap->rcv_func); if (rcv) { - struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC); - if (cskb) - rcv(cskb, dev, pt, orig_dev); + struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC); + if (cskb) + rcv(cskb, dev, pt, orig_dev); } dest = llc_pdu_type(skb); if (unlikely(!dest || !llc_type_handlers[dest - 1])) diff --git a/net/llc/llc_output.c b/net/llc/llc_output.c index b4e668e..f4291f3 100644 --- a/net/llc/llc_output.c +++ b/net/llc/llc_output.c @@ -40,7 +40,7 @@ int llc_mac_hdr_init(struct sk_buff *skb, case ARPHRD_IEEE802_TR: { struct net_device *dev = skb->dev; struct trh_hdr *trh; - + skb->mac.raw = skb_push(skb, sizeof(*trh)); trh = tr_hdr(skb); trh->ac = AC; diff --git a/net/llc/llc_pdu.c b/net/llc/llc_pdu.c index a28ce52..fa83243 100644 --- a/net/llc/llc_pdu.c +++ b/net/llc/llc_pdu.c @@ -39,7 +39,7 @@ void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value) llc_pdu_decode_pdu_type(skb, &pdu_type); pdu = llc_pdu_sn_hdr(skb); - + switch (pdu_type) { case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_S: diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c index 19308fe..dcfe6c7 100644 --- a/net/llc/llc_proc.c +++ b/net/llc/llc_proc.c @@ -142,18 +142,18 @@ out: } static char *llc_conn_state_names[] = { - [LLC_CONN_STATE_ADM] = "adm", - [LLC_CONN_STATE_SETUP] = "setup", + [LLC_CONN_STATE_ADM] = "adm", + [LLC_CONN_STATE_SETUP] = "setup", [LLC_CONN_STATE_NORMAL] = "normal", - [LLC_CONN_STATE_BUSY] = "busy", - [LLC_CONN_STATE_REJ] = "rej", - [LLC_CONN_STATE_AWAIT] = "await", + [LLC_CONN_STATE_BUSY] = "busy", + [LLC_CONN_STATE_REJ] = "rej", + [LLC_CONN_STATE_AWAIT] = "await", [LLC_CONN_STATE_AWAIT_BUSY] = "await_busy", [LLC_CONN_STATE_AWAIT_REJ] = "await_rej", [LLC_CONN_STATE_D_CONN] = "d_conn", - [LLC_CONN_STATE_RESET] = "reset", - [LLC_CONN_STATE_ERROR] = "error", - [LLC_CONN_STATE_TEMP] = "temp", + [LLC_CONN_STATE_RESET] = "reset", + [LLC_CONN_STATE_ERROR] = "error", + [LLC_CONN_STATE_TEMP] = "temp", }; static int llc_seq_core_show(struct seq_file *seq, void *v) diff --git a/net/llc/llc_s_st.c b/net/llc/llc_s_st.c index 6a43201..135f7d8 100644 --- a/net/llc/llc_s_st.c +++ b/net/llc/llc_s_st.c @@ -175,7 +175,7 @@ struct llc_sap_state llc_sap_state_table[LLC_NR_SAP_STATES] = { [LLC_SAP_STATE_INACTIVE - 1] = { .curr_state = LLC_SAP_STATE_INACTIVE, .transitions = llc_sap_inactive_state_transitions, - }, + }, [LLC_SAP_STATE_ACTIVE - 1] = { .curr_state = LLC_SAP_STATE_ACTIVE, .transitions = llc_sap_active_state_transitions, diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 61cb8cf..2615dc8 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c @@ -201,7 +201,7 @@ static void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb) if (sock_queue_rcv_skb(skb->sk, skb)) kfree_skb(skb); } - } + } kfree_skb(skb); } @@ -215,7 +215,7 @@ static void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb) * This function is called when upper layer wants to send a TEST pdu. * Returns 0 for success, 1 otherwise. */ -void llc_build_and_send_test_pkt(struct llc_sap *sap, +void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); @@ -224,7 +224,7 @@ void llc_build_and_send_test_pkt(struct llc_sap *sap, ev->daddr.lsap = dsap; memcpy(ev->saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); memcpy(ev->daddr.mac, dmac, IFHWADDRLEN); - + ev->type = LLC_SAP_EV_TYPE_PRIM; ev->prim = LLC_TEST_PRIM; ev->prim_type = LLC_PRIM_TYPE_REQ; diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c index 8275bd3..576355a 100644 --- a/net/llc/llc_station.c +++ b/net/llc/llc_station.c @@ -112,17 +112,17 @@ static struct llc_station llc_main_station; static int llc_stat_ev_enable_with_dup_addr_check(struct sk_buff *skb) { - struct llc_station_state_ev *ev = llc_station_ev(skb); - + struct llc_station_state_ev *ev = llc_station_ev(skb); + return ev->type == LLC_STATION_EV_TYPE_SIMPLE && ev->prim_type == - LLC_STATION_EV_ENABLE_WITH_DUP_ADDR_CHECK ? 0 : 1; + LLC_STATION_EV_ENABLE_WITH_DUP_ADDR_CHECK ? 0 : 1; } static int llc_stat_ev_enable_without_dup_addr_check(struct sk_buff *skb) { - struct llc_station_state_ev *ev = llc_station_ev(skb); - + struct llc_station_state_ev *ev = llc_station_ev(skb); + return ev->type == LLC_STATION_EV_TYPE_SIMPLE && ev->prim_type == LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK ? 0 : 1; @@ -130,8 +130,8 @@ static int llc_stat_ev_enable_without_dup_addr_check(struct sk_buff *skb) static int llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry(struct sk_buff *skb) { - struct llc_station_state_ev *ev = llc_station_ev(skb); - + struct llc_station_state_ev *ev = llc_station_ev(skb); + return ev->type == LLC_STATION_EV_TYPE_ACK_TMR && llc_main_station.retry_count < llc_main_station.maximum_retry ? 0 : 1; @@ -139,8 +139,8 @@ static int llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry(struct sk_buff *skb) static int llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry(struct sk_buff *skb) { - struct llc_station_state_ev *ev = llc_station_ev(skb); - + struct llc_station_state_ev *ev = llc_station_ev(skb); + return ev->type == LLC_STATION_EV_TYPE_ACK_TMR && llc_main_station.retry_count == llc_main_station.maximum_retry ? 0 : 1; @@ -148,7 +148,7 @@ static int llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry(struct sk_buff *skb) static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb) { - struct llc_station_state_ev *ev = llc_station_ev(skb); + struct llc_station_state_ev *ev = llc_station_ev(skb); struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); return ev->type == LLC_STATION_EV_TYPE_PDU && @@ -306,7 +306,7 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb) llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_ssap(skb, &dsap); llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); - llc_pdu_init_as_test_rsp(nskb, skb); + llc_pdu_init_as_test_rsp(nskb, skb); rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); if (unlikely(rc)) goto free; diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c index 45d7dd9..d047a3e 100644 --- a/net/llc/sysctl_net_llc.c +++ b/net/llc/sysctl_net_llc.c @@ -1,6 +1,6 @@ /* * sysctl_net_llc.c: sysctl interface to LLC net subsystem. - * + * * Arnaldo Carvalho de Melo <acme@conectiva.com.br> */ @@ -72,7 +72,7 @@ static struct ctl_table llc2_dir_timeout_table[] = { .procname = "timeout", .mode = 0555, .child = llc2_timeout_table, - }, + }, { 0 }, }; @@ -82,7 +82,7 @@ static struct ctl_table llc_table[] = { .procname = "llc2", .mode = 0555, .child = llc2_dir_timeout_table, - }, + }, { .ctl_name = NET_LLC_STATION, .procname = "station", @@ -98,7 +98,7 @@ static struct ctl_table llc_dir_table[] = { .procname = "llc", .mode = 0555, .child = llc_table, - }, + }, { 0 }, }; diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index 73e0ff4..07e47db 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c @@ -292,7 +292,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info) } } doi_def->map.std->cat.local = kcalloc( - doi_def->map.std->cat.local_size, + doi_def->map.std->cat.local_size, sizeof(u32), GFP_KERNEL); if (doi_def->map.std->cat.local == NULL) { @@ -300,7 +300,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info) goto add_std_failure; } doi_def->map.std->cat.cipso = kcalloc( - doi_def->map.std->cat.cipso_size, + doi_def->map.std->cat.cipso_size, sizeof(u32), GFP_KERNEL); if (doi_def->map.std->cat.cipso == NULL) { @@ -325,10 +325,10 @@ static int netlbl_cipsov4_add_std(struct genl_info *info) if (cat_loc == NULL || cat_rem == NULL) goto add_std_failure; doi_def->map.std->cat.local[ - nla_get_u32(cat_loc)] = + nla_get_u32(cat_loc)] = nla_get_u32(cat_rem); doi_def->map.std->cat.cipso[ - nla_get_u32(cat_rem)] = + nla_get_u32(cat_rem)] = nla_get_u32(cat_loc); } } diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 383dd4e..f6ee9b4 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -8,7 +8,7 @@ * 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 (at your option) any later version. - * + * * Tue Jun 26 14:36:48 MEST 2001 Herbert "herp" Rosmanith * added netlink_proto_exit * Tue Jan 22 18:32:44 BRST 2002 Arnaldo C. de Melo <acme@conectiva.com.br> @@ -470,7 +470,7 @@ static int netlink_release(struct socket *sock) }; atomic_notifier_call_chain(&netlink_chain, NETLINK_URELEASE, &n); - } + } module_put(nlk->module); @@ -528,11 +528,11 @@ retry: return err; } -static inline int netlink_capable(struct socket *sock, unsigned int flag) -{ +static inline int netlink_capable(struct socket *sock, unsigned int flag) +{ return (nl_table[sock->sk->sk_protocol].nl_nonroot & flag) || capable(CAP_NET_ADMIN); -} +} static void netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions) @@ -574,7 +574,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len struct netlink_sock *nlk = nlk_sk(sk); struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; int err; - + if (nladdr->nl_family != AF_NETLINK) return -EINVAL; @@ -605,9 +605,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len netlink_table_grab(); netlink_update_subscriptions(sk, nlk->subscriptions + - hweight32(nladdr->nl_groups) - - hweight32(nlk->groups[0])); - nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | nladdr->nl_groups; + hweight32(nladdr->nl_groups) - + hweight32(nlk->groups[0])); + nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | nladdr->nl_groups; netlink_update_listeners(sk); netlink_table_ungrab(); @@ -652,7 +652,7 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr, int *addr struct sock *sk = sock->sk; struct netlink_sock *nlk = nlk_sk(sk); struct sockaddr_nl *nladdr=(struct sockaddr_nl *)addr; - + nladdr->nl_family = AF_NETLINK; nladdr->nl_pad = 0; *addr_len = sizeof(*nladdr); @@ -999,7 +999,7 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code) } static int netlink_setsockopt(struct socket *sock, int level, int optname, - char __user *optval, int optlen) + char __user *optval, int optlen) { struct sock *sk = sock->sk; struct netlink_sock *nlk = nlk_sk(sk); @@ -1054,7 +1054,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, } static int netlink_getsockopt(struct socket *sock, int level, int optname, - char __user *optval, int __user *optlen) + char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; struct netlink_sock *nlk = nlk_sk(sk); @@ -1257,15 +1257,15 @@ static void netlink_data_ready(struct sock *sk, int len) } /* - * We export these functions to other modules. They provide a + * We export these functions to other modules. They provide a * complete set of kernel non-blocking support for message * queueing. */ struct sock * netlink_kernel_create(int unit, unsigned int groups, - void (*input)(struct sock *sk, int len), - struct module *module) + void (*input)(struct sock *sk, int len), + struct module *module) { struct socket *sock; struct sock *sk; @@ -1317,10 +1317,10 @@ out_sock_release: } void netlink_set_nonroot(int protocol, unsigned int flags) -{ - if ((unsigned int)protocol < MAX_LINKS) +{ + if ((unsigned int)protocol < MAX_LINKS) nl_table[protocol].nl_nonroot = flags; -} +} static void netlink_destroy_callback(struct netlink_callback *cb) { @@ -1341,7 +1341,7 @@ static int netlink_dump(struct sock *sk) struct sk_buff *skb; struct nlmsghdr *nlh; int len, err = -ENOBUFS; - + skb = sock_rmalloc(sk, NLMSG_GOODSIZE, 0, GFP_KERNEL); if (!skb) goto errout; @@ -1626,7 +1626,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) if (v == SEQ_START_TOKEN) return netlink_seq_socket_idx(seq, 0); - + s = sk_next(v); if (s) return s; @@ -1732,7 +1732,7 @@ int netlink_unregister_notifier(struct notifier_block *nb) { return atomic_notifier_chain_unregister(&netlink_chain, nb); } - + static const struct proto_ops netlink_ops = { .family = PF_NETLINK, .owner = THIS_MODULE, @@ -1808,7 +1808,7 @@ static int __init netlink_proto_init(void) #ifdef CONFIG_PROC_FS proc_net_fops_create("netlink", 0, &netlink_seq_fops); #endif - /* The netlink device handler may be needed early. */ + /* The netlink device handler may be needed early. */ rtnetlink_init(); out: return err; diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 548e4e6..c299679 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -310,7 +310,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, if (nlh->nlmsg_type < NLMSG_MIN_TYPE) goto ignore; - family = genl_family_find_byid(nlh->nlmsg_type); + family = genl_family_find_byid(nlh->nlmsg_type); if (family == NULL) { err = -ENOENT; goto errout; diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 43bbe2c..799b768 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -110,7 +110,7 @@ static int nr_device_event(struct notifier_block *this, unsigned long event, voi nr_kill_by_device(dev); nr_rt_device_down(dev); - + return NOTIFY_DONE; } @@ -137,7 +137,7 @@ static struct sock *nr_find_listener(ax25_address *addr) sk_for_each(s, node, &nr_list) if (!ax25cmp(&nr_sk(s)->source_addr, addr) && s->sk_state == TCP_LISTEN) { - bh_lock_sock(s); + bh_lock_sock(s); goto found; } s = NULL; @@ -157,7 +157,7 @@ static struct sock *nr_find_socket(unsigned char index, unsigned char id) spin_lock_bh(&nr_list_lock); sk_for_each(s, node, &nr_list) { struct nr_sock *nr = nr_sk(s); - + if (nr->my_index == index && nr->my_id == id) { bh_lock_sock(s); goto found; @@ -181,10 +181,10 @@ static struct sock *nr_find_peer(unsigned char index, unsigned char id, spin_lock_bh(&nr_list_lock); sk_for_each(s, node, &nr_list) { struct nr_sock *nr = nr_sk(s); - + if (nr->your_index == index && nr->your_id == id && !ax25cmp(&nr->dest_addr, dest)) { - bh_lock_sock(s); + bh_lock_sock(s); goto found; } } @@ -341,17 +341,17 @@ static int nr_getsockopt(struct socket *sock, int level, int optname, struct sock *sk = sock->sk; struct nr_sock *nr = nr_sk(sk); int val = 0; - int len; + int len; if (level != SOL_NETROM) return -ENOPROTOOPT; - + if (get_user(len, optlen)) return -EFAULT; if (len < 0) return -EINVAL; - + switch (optname) { case NETROM_T1: val = nr->t1 / HZ; @@ -537,7 +537,7 @@ static int nr_release(struct socket *sock) break; } - sock->sk = NULL; + sock->sk = NULL; release_sock(sk); sock_put(sk); @@ -644,7 +644,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr, return -EISCONN; /* No reconnect on a seqpacket socket */ } - sk->sk_state = TCP_CLOSE; + sk->sk_state = TCP_CLOSE; sock->state = SS_UNCONNECTED; if (addr_len != sizeof(struct sockaddr_ax25) && addr_len != sizeof(struct full_sockaddr_ax25)) { @@ -710,7 +710,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr, release_sock(sk); return -EINPROGRESS; } - + /* * A Connect Ack with Choke or timeout or failed routing will go to * closed. @@ -848,7 +848,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr, int nr_rx_frame(struct sk_buff *skb, struct net_device *dev) { struct sock *sk; - struct sock *make; + struct sock *make; struct nr_sock *nr_make; ax25_address *src, *dest, *user; unsigned short circuit_index, circuit_id; @@ -1258,10 +1258,10 @@ static void *nr_info_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) ? sk_head(&nr_list) + return (v == SEQ_START_TOKEN) ? sk_head(&nr_list) : sk_next((struct sock *)v); } - + static void nr_info_stop(struct seq_file *seq, void *v) { spin_unlock_bh(&nr_list_lock); @@ -1291,7 +1291,7 @@ static int nr_info_show(struct seq_file *seq, void *v) seq_printf(seq, "%-9s ", ax2asc(buf, &nr->user_addr)); seq_printf(seq, "%-9s ", ax2asc(buf, &nr->dest_addr)); - seq_printf(seq, + seq_printf(seq, "%-9s %-3s %02X/%02X %02X/%02X %2d %3d %3d %3d %3lu/%03lu %2lu/%02lu %3lu/%03lu %3lu/%03lu %2d/%02d %3d %5d %5d %ld\n", ax2asc(buf, &nr->source_addr), devname, @@ -1329,12 +1329,12 @@ static struct seq_operations nr_info_seqops = { .stop = nr_info_stop, .show = nr_info_show, }; - + static int nr_info_open(struct inode *inode, struct file *file) { return seq_open(file, &nr_info_seqops); } - + static struct file_operations nr_info_fops = { .owner = THIS_MODULE, .open = nr_info_open, @@ -1415,7 +1415,7 @@ static int __init nr_proto_init(void) printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); goto fail; } - + dev->base_addr = i; if (register_netdev(dev)) { printk(KERN_ERR "NET/ROM: nr_proto_init - unable to register network device\n"); @@ -1430,7 +1430,7 @@ static int __init nr_proto_init(void) printk(KERN_ERR "NET/ROM: nr_proto_init - unable to register socket family\n"); goto fail; } - + register_netdevice_notifier(&nr_dev_notifier); ax25_register_pid(&nr_pid); diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index 8f88964..e9909ae 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c @@ -781,8 +781,8 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) if (ax25 != NULL) { ret = nr_add_node(nr_src, "", &ax25->dest_addr, ax25->digipeat, - ax25->ax25_dev->dev, 0, - sysctl_netrom_obsolescence_count_initialiser); + ax25->ax25_dev->dev, 0, + sysctl_netrom_obsolescence_count_initialiser); if (ret) return ret; } @@ -861,8 +861,8 @@ static void *nr_node_start(struct seq_file *seq, loff_t *pos) struct nr_node *nr_node; struct hlist_node *node; int i = 1; - - spin_lock_bh(&nr_node_list_lock); + + spin_lock_bh(&nr_node_list_lock); if (*pos == 0) return SEQ_START_TOKEN; @@ -879,8 +879,8 @@ static void *nr_node_next(struct seq_file *seq, void *v, loff_t *pos) { struct hlist_node *node; ++*pos; - - node = (v == SEQ_START_TOKEN) + + node = (v == SEQ_START_TOKEN) ? nr_node_list.first : ((struct nr_node *)v)->node_node.next; @@ -963,8 +963,8 @@ static void *nr_neigh_next(struct seq_file *seq, void *v, loff_t *pos) { struct hlist_node *node; ++*pos; - - node = (v == SEQ_START_TOKEN) + + node = (v == SEQ_START_TOKEN) ? nr_neigh_list.first : ((struct nr_neigh *)v)->neigh_node.next; @@ -997,7 +997,7 @@ static int nr_neigh_show(struct seq_file *seq, void *v) if (nr_neigh->digipeat != NULL) { for (i = 0; i < nr_neigh->digipeat->ndigi; i++) - seq_printf(seq, " %s", + seq_printf(seq, " %s", ax2asc(buf, &nr_neigh->digipeat->calls[i])); } diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c index bcb9946..cfab572 100644 --- a/net/netrom/nr_subr.c +++ b/net/netrom/nr_subr.c @@ -57,7 +57,7 @@ void nr_frames_acked(struct sock *sk, unsigned short nr) */ if (nrom->va != nr) { while (skb_peek(&nrom->ack_queue) != NULL && nrom->va != nr) { - skb = skb_dequeue(&nrom->ack_queue); + skb = skb_dequeue(&nrom->ack_queue); kfree_skb(skb); nrom->va = (nrom->va + 1) % NR_MODULUS; } diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c index ddba1c1..6cfaad9 100644 --- a/net/netrom/nr_timer.c +++ b/net/netrom/nr_timer.c @@ -43,7 +43,7 @@ void nr_init_timers(struct sock *sk) init_timer(&nr->t1timer); nr->t1timer.data = (unsigned long)sk; nr->t1timer.function = &nr_t1timer_expiry; - + init_timer(&nr->t2timer); nr->t2timer.data = (unsigned long)sk; nr->t2timer.function = &nr_t2timer_expiry; diff --git a/net/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c index 6bb8dda..e4b27d7 100644 --- a/net/netrom/sysctl_net_netrom.c +++ b/net/netrom/sysctl_net_netrom.c @@ -35,7 +35,7 @@ static int min_reset[] = {0}, max_reset[] = {1}; static struct ctl_table_header *nr_table_header; static ctl_table nr_table[] = { - { + { .ctl_name = NET_NETROM_DEFAULT_PATH_QUALITY, .procname = "default_path_quality", .data = &sysctl_netrom_default_path_quality, @@ -46,18 +46,18 @@ static ctl_table nr_table[] = { .extra1 = &min_quality, .extra2 = &max_quality }, - { + { .ctl_name = NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, .procname = "obsolescence_count_initialiser", .data = &sysctl_netrom_obsolescence_count_initialiser, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_dointvec_minmax, + .proc_handler = &proc_dointvec_minmax, .strategy = &sysctl_intvec, .extra1 = &min_obs, .extra2 = &max_obs }, - { + { .ctl_name = NET_NETROM_NETWORK_TTL_INITIALISER, .procname = "network_ttl_initialiser", .data = &sysctl_netrom_network_ttl_initialiser, @@ -68,7 +68,7 @@ static ctl_table nr_table[] = { .extra1 = &min_ttl, .extra2 = &max_ttl }, - { + { .ctl_name = NET_NETROM_TRANSPORT_TIMEOUT, .procname = "transport_timeout", .data = &sysctl_netrom_transport_timeout, @@ -79,7 +79,7 @@ static ctl_table nr_table[] = { .extra1 = &min_t1, .extra2 = &max_t1 }, - { + { .ctl_name = NET_NETROM_TRANSPORT_MAXIMUM_TRIES, .procname = "transport_maximum_tries", .data = &sysctl_netrom_transport_maximum_tries, @@ -90,7 +90,7 @@ static ctl_table nr_table[] = { .extra1 = &min_n2, .extra2 = &max_n2 }, - { + { .ctl_name = NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, .procname = "transport_acknowledge_delay", .data = &sysctl_netrom_transport_acknowledge_delay, @@ -101,7 +101,7 @@ static ctl_table nr_table[] = { .extra1 = &min_t2, .extra2 = &max_t2 }, - { + { .ctl_name = NET_NETROM_TRANSPORT_BUSY_DELAY, .procname = "transport_busy_delay", .data = &sysctl_netrom_transport_busy_delay, @@ -112,7 +112,7 @@ static ctl_table nr_table[] = { .extra1 = &min_t4, .extra2 = &max_t4 }, - { + { .ctl_name = NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, .procname = "transport_requested_window_size", .data = &sysctl_netrom_transport_requested_window_size, @@ -123,7 +123,7 @@ static ctl_table nr_table[] = { .extra1 = &min_window, .extra2 = &max_window }, - { + { .ctl_name = NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, .procname = "transport_no_activity_timeout", .data = &sysctl_netrom_transport_no_activity_timeout, @@ -134,7 +134,7 @@ static ctl_table nr_table[] = { .extra1 = &min_idle, .extra2 = &max_idle }, - { + { .ctl_name = NET_NETROM_ROUTING_CONTROL, .procname = "routing_control", .data = &sysctl_netrom_routing_control, @@ -145,7 +145,7 @@ static ctl_table nr_table[] = { .extra1 = &min_route, .extra2 = &max_route }, - { + { .ctl_name = NET_NETROM_LINK_FAILS_COUNT, .procname = "link_fails_count", .data = &sysctl_netrom_link_fails_count, @@ -156,7 +156,7 @@ static ctl_table nr_table[] = { .extra1 = &min_fails, .extra2 = &max_fails }, - { + { .ctl_name = NET_NETROM_RESET, .procname = "reset", .data = &sysctl_netrom_reset_circuit, diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index a6fa487..4445509 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -11,7 +11,7 @@ * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Alan Cox, <gw4pts@gw4pts.ampr.org> * - * Fixes: + * Fixes: * Alan Cox : verify_area() now used correctly * Alan Cox : new skbuff lists, look ma no backlogs! * Alan Cox : tidied skbuff lists. @@ -34,12 +34,12 @@ * Alexey Kuznetsov : Untied from IPv4 stack. * Cyrus Durgin : Fixed kerneld for kmod. * Michal Ostrowski : Module initialization cleanup. - * Ulises Alonso : Frame number limit removal and + * Ulises Alonso : Frame number limit removal and * packet_set_ring memory leak. * Eric Biederman : Allow for > 8 byte hardware addresses. * The convention is that longer addresses * will simply extend the hardware address - * byte arrays at the end of sockaddr_ll + * byte arrays at the end of sockaddr_ll * and packet_mreq. * * This program is free software; you can redistribute it and/or @@ -48,7 +48,7 @@ * 2 of the License, or (at your option) any later version. * */ - + #include <linux/types.h> #include <linux/sched.h> #include <linux/mm.h> @@ -124,7 +124,7 @@ Outgoing, dev->hard_header!=NULL Incoming, dev->hard_header==NULL mac.raw -> UNKNOWN position. It is very likely, that it points to ll header. - PPP makes it, that is wrong, because introduce assymetry + PPP makes it, that is wrong, because introduce assymetry between rx and tx paths. data -> data @@ -237,7 +237,7 @@ static inline char *packet_lookup_frame(struct packet_sock *po, unsigned int pos frame_offset = position % po->frames_per_block; frame = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size); - + return frame; } #endif @@ -280,7 +280,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct */ sk = pt->af_packet_priv; - + /* * Yank back the headers [hope the device set this * right or kerboom...] @@ -336,7 +336,7 @@ oom: * Output a raw packet to a device layer. This bypasses all the other * protocol layers and you must therefore supply it with a complete frame */ - + static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { @@ -346,9 +346,9 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, struct net_device *dev; __be16 proto=0; int err; - + /* - * Get and verify the address. + * Get and verify the address. */ if (saddr) @@ -362,7 +362,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, return(-ENOTCONN); /* SOCK_PACKET must be sent giving an address */ /* - * Find the device first to size check it + * Find the device first to size check it */ saddr->spkt_device[13] = 0; @@ -370,7 +370,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, err = -ENODEV; if (dev == NULL) goto out_unlock; - + err = -ENETDOWN; if (!(dev->flags & IFF_UP)) goto out_unlock; @@ -379,7 +379,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, * You may not queue a frame bigger than the mtu. This is the lowest level * raw protocol and you must do your own fragmentation at this level. */ - + err = -EMSGSIZE; if (len > dev->mtu + dev->hard_header_len) goto out_unlock; @@ -392,14 +392,14 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, * deal with the problem - do your own algorithmic backoffs. That's far * more flexible. */ - - if (skb == NULL) + + if (skb == NULL) goto out_unlock; /* - * Fill it in + * Fill it in */ - + /* FIXME: Save some space for broken drivers that write a * hard header at transmission time by themselves. PPP is the * notable one here. This should really be fixed at the driver level. @@ -641,7 +641,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe spin_lock(&sk->sk_receive_queue.lock); h = (struct tpacket_hdr *)packet_lookup_frame(po, po->head); - + if (h->tp_status) goto ring_is_full; po->head = po->head != po->frame_max ? po->head+1 : 0; @@ -660,7 +660,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe h->tp_snaplen = snaplen; h->tp_mac = macoff; h->tp_net = netoff; - if (skb->tstamp.off_sec == 0) { + if (skb->tstamp.off_sec == 0) { __net_timestamp(skb); sock_enable_timestamp(sk); } @@ -700,7 +700,7 @@ drop_n_restore: skb->len = skb_len; } drop: - kfree_skb(skb); + kfree_skb(skb); return 0; ring_is_full: @@ -728,9 +728,9 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, int ifindex, err, reserve = 0; /* - * Get and verify the address. + * Get and verify the address. */ - + if (saddr == NULL) { struct packet_sock *po = pkt_sk(sk); @@ -939,11 +939,11 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add char name[15]; struct net_device *dev; int err = -ENODEV; - + /* * Check legality */ - + if (addr_len != sizeof(struct sockaddr)) return -EINVAL; strlcpy(name,uaddr->sa_data,sizeof(name)); @@ -968,7 +968,7 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len /* * Check legality */ - + if (addr_len < sizeof(struct sockaddr_ll)) return -EINVAL; if (sll->sll_family != AF_PACKET) @@ -995,7 +995,7 @@ static struct proto packet_proto = { }; /* - * Create a packet of type SOCK_PACKET. + * Create a packet of type SOCK_PACKET. */ static int packet_create(struct socket *sock, int protocol) @@ -1097,7 +1097,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, skb=skb_recv_datagram(sk,flags,flags&MSG_DONTWAIT,&err); /* - * An error occurred so return it. Because skb_recv_datagram() + * An error occurred so return it. Because skb_recv_datagram() * handles the blocking we don't see and worry about blocking * retries. */ @@ -1358,7 +1358,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv switch(optname) { #ifdef CONFIG_PACKET_MULTICAST - case PACKET_ADD_MEMBERSHIP: + case PACKET_ADD_MEMBERSHIP: case PACKET_DROP_MEMBERSHIP: { struct packet_mreq_max mreq; @@ -1438,7 +1438,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, if (len < 0) return -EINVAL; - + switch(optname) { case PACKET_STATISTICS: if (len > sizeof(struct tpacket_stats)) @@ -1547,7 +1547,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, } case SIOCGSTAMP: return sock_get_timestamp(sk, (struct timeval __user *)arg); - + #ifdef CONFIG_INET case SIOCADDRT: case SIOCDELRT: @@ -1608,7 +1608,7 @@ static void packet_mm_open(struct vm_area_struct *vma) struct file *file = vma->vm_file; struct socket * sock = file->private_data; struct sock *sk = sock->sk; - + if (sk) atomic_inc(&pkt_sk(sk)->mapped); } @@ -1618,7 +1618,7 @@ static void packet_mm_close(struct vm_area_struct *vma) struct file *file = vma->vm_file; struct socket * sock = file->private_data; struct sock *sk = sock->sk; - + if (sk) atomic_dec(&pkt_sk(sk)->mapped); } @@ -1682,7 +1682,7 @@ static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing int was_running, order = 0; __be16 num; int err = 0; - + if (req->tp_block_nr) { int i, l; @@ -1744,7 +1744,7 @@ static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing __sock_put(sk); } spin_unlock(&po->bind_lock); - + synchronize_net(); err = -EBUSY; @@ -1861,7 +1861,7 @@ static const struct proto_ops packet_ops = { .connect = sock_no_connect, .socketpair = sock_no_socketpair, .accept = sock_no_accept, - .getname = packet_getname, + .getname = packet_getname, .poll = packet_poll, .ioctl = packet_ioctl, .listen = sock_no_listen, @@ -1906,17 +1906,17 @@ static void *packet_seq_start(struct seq_file *seq, loff_t *pos) static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) - ? sk_head(&packet_sklist) + return (v == SEQ_START_TOKEN) + ? sk_head(&packet_sklist) : sk_next((struct sock*)v) ; } static void packet_seq_stop(struct seq_file *seq, void *v) { - read_unlock(&packet_sklist_lock); + read_unlock(&packet_sklist_lock); } -static int packet_seq_show(struct seq_file *seq, void *v) +static int packet_seq_show(struct seq_file *seq, void *v) { if (v == SEQ_START_TOKEN) seq_puts(seq, "sk RefCnt Type Proto Iface R Rmem User Inode\n"); diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 9e27946..7a81a8e 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -1351,7 +1351,7 @@ static void *rose_info_start(struct seq_file *seq, loff_t *pos) spin_lock_bh(&rose_list_lock); if (*pos == 0) return SEQ_START_TOKEN; - + i = 1; sk_for_each(s, node, &rose_list) { if (i == *pos) @@ -1365,10 +1365,10 @@ static void *rose_info_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) ? sk_head(&rose_list) + return (v == SEQ_START_TOKEN) ? sk_head(&rose_list) : sk_next((struct sock *)v); } - + static void rose_info_stop(struct seq_file *seq, void *v) { spin_unlock_bh(&rose_list_lock); @@ -1379,7 +1379,7 @@ static int rose_info_show(struct seq_file *seq, void *v) char buf[11]; if (v == SEQ_START_TOKEN) - seq_puts(seq, + seq_puts(seq, "dest_addr dest_call src_addr src_call dev lci neigh st vs vr va t t1 t2 t3 hb idle Snd-Q Rcv-Q inode\n"); else { @@ -1392,7 +1392,7 @@ static int rose_info_show(struct seq_file *seq, void *v) devname = "???"; else devname = dev->name; - + seq_printf(seq, "%-10s %-9s ", rose2asc(&rose->dest_addr), ax2asc(buf, &rose->dest_call)); @@ -1520,7 +1520,7 @@ static int __init rose_proto_init(void) char name[IFNAMSIZ]; sprintf(name, "rose%d", i); - dev = alloc_netdev(sizeof(struct net_device_stats), + dev = alloc_netdev(sizeof(struct net_device_stats), name, rose_setup); if (!dev) { printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n"); diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index 8028c0d..0dcca42 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -66,7 +66,7 @@ static int __must_check rose_add_node(struct rose_route_struct *rose_route, while (rose_node != NULL) { if ((rose_node->mask == rose_route->mask) && (rosecmpm(&rose_route->address, &rose_node->address, - rose_route->mask) == 0)) + rose_route->mask) == 0)) break; rose_node = rose_node->next; } @@ -300,7 +300,7 @@ static int rose_del_node(struct rose_route_struct *rose_route, while (rose_node != NULL) { if ((rose_node->mask == rose_route->mask) && (rosecmpm(&rose_route->address, &rose_node->address, - rose_route->mask) == 0)) + rose_route->mask) == 0)) break; rose_node = rose_node->next; } @@ -1070,7 +1070,7 @@ static void *rose_node_start(struct seq_file *seq, loff_t *pos) if (*pos == 0) return SEQ_START_TOKEN; - for (rose_node = rose_node_list; rose_node && i < *pos; + for (rose_node = rose_node_list; rose_node && i < *pos; rose_node = rose_node->next, ++i); return (i == *pos) ? rose_node : NULL; @@ -1079,8 +1079,8 @@ static void *rose_node_start(struct seq_file *seq, loff_t *pos) static void *rose_node_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - - return (v == SEQ_START_TOKEN) ? rose_node_list + + return (v == SEQ_START_TOKEN) ? rose_node_list : ((struct rose_node *)v)->next; } @@ -1146,7 +1146,7 @@ static void *rose_neigh_start(struct seq_file *seq, loff_t *pos) if (*pos == 0) return SEQ_START_TOKEN; - for (rose_neigh = rose_neigh_list; rose_neigh && i < *pos; + for (rose_neigh = rose_neigh_list; rose_neigh && i < *pos; rose_neigh = rose_neigh->next, ++i); return (i == *pos) ? rose_neigh : NULL; @@ -1155,8 +1155,8 @@ static void *rose_neigh_start(struct seq_file *seq, loff_t *pos) static void *rose_neigh_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - - return (v == SEQ_START_TOKEN) ? rose_neigh_list + + return (v == SEQ_START_TOKEN) ? rose_neigh_list : ((struct rose_neigh *)v)->next; } @@ -1171,7 +1171,7 @@ static int rose_neigh_show(struct seq_file *seq, void *v) int i; if (v == SEQ_START_TOKEN) - seq_puts(seq, + seq_puts(seq, "addr callsign dev count use mode restart t0 tf digipeaters\n"); else { struct rose_neigh *rose_neigh = v; @@ -1229,7 +1229,7 @@ static void *rose_route_start(struct seq_file *seq, loff_t *pos) if (*pos == 0) return SEQ_START_TOKEN; - for (rose_route = rose_route_list; rose_route && i < *pos; + for (rose_route = rose_route_list; rose_route && i < *pos; rose_route = rose_route->next, ++i); return (i == *pos) ? rose_route : NULL; @@ -1238,8 +1238,8 @@ static void *rose_route_start(struct seq_file *seq, loff_t *pos) static void *rose_route_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - - return (v == SEQ_START_TOKEN) ? rose_route_list + + return (v == SEQ_START_TOKEN) ? rose_route_list : ((struct rose_route *)v)->next; } @@ -1253,30 +1253,30 @@ static int rose_route_show(struct seq_file *seq, void *v) char buf[11]; if (v == SEQ_START_TOKEN) - seq_puts(seq, + seq_puts(seq, "lci address callsign neigh <-> lci address callsign neigh\n"); else { struct rose_route *rose_route = v; - if (rose_route->neigh1) + if (rose_route->neigh1) seq_printf(seq, "%3.3X %-10s %-9s %05d ", rose_route->lci1, rose2asc(&rose_route->src_addr), ax2asc(buf, &rose_route->src_call), rose_route->neigh1->number); - else - seq_puts(seq, + else + seq_puts(seq, "000 * * 00000 "); - if (rose_route->neigh2) + if (rose_route->neigh2) seq_printf(seq, "%3.3X %-10s %-9s %05d\n", rose_route->lci2, rose2asc(&rose_route->dest_addr), ax2asc(buf, &rose_route->dest_call), rose_route->neigh2->number); - else + else seq_puts(seq, "000 * * 00000\n"); } diff --git a/net/rose/sysctl_net_rose.c b/net/rose/sysctl_net_rose.c index 8548c7c..27a452b 100644 --- a/net/rose/sysctl_net_rose.c +++ b/net/rose/sysctl_net_rose.c @@ -25,7 +25,7 @@ static int min_window[] = {1}, max_window[] = {7}; static struct ctl_table_header *rose_table_header; static ctl_table rose_table[] = { - { + { .ctl_name = NET_ROSE_RESTART_REQUEST_TIMEOUT, .procname = "restart_request_timeout", .data = &sysctl_rose_restart_request_timeout, @@ -36,7 +36,7 @@ static ctl_table rose_table[] = { .extra1 = &min_timer, .extra2 = &max_timer }, - { + { .ctl_name = NET_ROSE_CALL_REQUEST_TIMEOUT, .procname = "call_request_timeout", .data = &sysctl_rose_call_request_timeout, @@ -47,7 +47,7 @@ static ctl_table rose_table[] = { .extra1 = &min_timer, .extra2 = &max_timer }, - { + { .ctl_name = NET_ROSE_RESET_REQUEST_TIMEOUT, .procname = "reset_request_timeout", .data = &sysctl_rose_reset_request_timeout, @@ -58,7 +58,7 @@ static ctl_table rose_table[] = { .extra1 = &min_timer, .extra2 = &max_timer }, - { + { .ctl_name = NET_ROSE_CLEAR_REQUEST_TIMEOUT, .procname = "clear_request_timeout", .data = &sysctl_rose_clear_request_timeout, @@ -69,7 +69,7 @@ static ctl_table rose_table[] = { .extra1 = &min_timer, .extra2 = &max_timer }, - { + { .ctl_name = NET_ROSE_NO_ACTIVITY_TIMEOUT, .procname = "no_activity_timeout", .data = &sysctl_rose_no_activity_timeout, @@ -80,7 +80,7 @@ static ctl_table rose_table[] = { .extra1 = &min_idle, .extra2 = &max_idle }, - { + { .ctl_name = NET_ROSE_ACK_HOLD_BACK_TIMEOUT, .procname = "acknowledge_hold_back_timeout", .data = &sysctl_rose_ack_hold_back_timeout, @@ -91,7 +91,7 @@ static ctl_table rose_table[] = { .extra1 = &min_timer, .extra2 = &max_timer }, - { + { .ctl_name = NET_ROSE_ROUTING_CONTROL, .procname = "routing_control", .data = &sysctl_rose_routing_control, @@ -102,7 +102,7 @@ static ctl_table rose_table[] = { .extra1 = &min_route, .extra2 = &max_route }, - { + { .ctl_name = NET_ROSE_LINK_FAIL_TIMEOUT, .procname = "link_fail_timeout", .data = &sysctl_rose_link_fail_timeout, @@ -113,7 +113,7 @@ static ctl_table rose_table[] = { .extra1 = &min_ftimer, .extra2 = &max_ftimer }, - { + { .ctl_name = NET_ROSE_MAX_VCS, .procname = "maximum_virtual_circuits", .data = &sysctl_rose_maximum_vcs, @@ -124,7 +124,7 @@ static ctl_table rose_table[] = { .extra1 = &min_maxvcs, .extra2 = &max_maxvcs }, - { + { .ctl_name = NET_ROSE_WINDOW_SIZE, .procname = "window_size", .data = &sysctl_rose_window_size, diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c index 93d2c55..a7c929a 100644 --- a/net/rxrpc/connection.c +++ b/net/rxrpc/connection.c @@ -163,7 +163,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans, conn = list_entry(_p, struct rxrpc_connection, link); if (conn->addr.sin_port == candidate->addr.sin_port && conn->security_ix == candidate->security_ix && - conn->service_id == candidate->service_id && + conn->service_id == candidate->service_id && conn->in_clientflag == 0) goto found_in_graveyard; } @@ -247,13 +247,13 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer, conn->in_epoch == x_epoch && conn->conn_id == x_connid && conn->security_ix == x_secix && - conn->service_id == x_servid && + conn->service_id == x_servid && conn->in_clientflag == x_clflag) goto found_active; } read_unlock(&peer->conn_lock); - /* [uncommon case] not active + /* [uncommon case] not active * - create a candidate for a new record if an inbound connection * - only examine the graveyard for an outbound connection */ @@ -286,7 +286,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer, conn->in_epoch == x_epoch && conn->conn_id == x_connid && conn->security_ix == x_secix && - conn->service_id == x_servid && + conn->service_id == x_servid && conn->in_clientflag == x_clflag) goto found_active_second_chance; } @@ -299,7 +299,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer, conn->in_epoch == x_epoch && conn->conn_id == x_connid && conn->security_ix == x_secix && - conn->service_id == x_servid && + conn->service_id == x_servid && conn->in_clientflag == x_clflag) goto found_in_graveyard; } diff --git a/net/rxrpc/internal.h b/net/rxrpc/internal.h index 70e52f6..cc0c579 100644 --- a/net/rxrpc/internal.h +++ b/net/rxrpc/internal.h @@ -14,7 +14,7 @@ */ #if 1 #define __RXACCT_DECL(X) X -#define __RXACCT(X) do { X; } while(0) +#define __RXACCT(X) do { X; } while(0) #else #define __RXACCT_DECL(X) #define __RXACCT(X) do { } while(0) diff --git a/net/rxrpc/krxiod.c b/net/rxrpc/krxiod.c index 49effd9..bbbcd6c 100644 --- a/net/rxrpc/krxiod.c +++ b/net/rxrpc/krxiod.c @@ -141,7 +141,7 @@ static int rxrpc_krxiod(void *arg) try_to_freeze(); - /* discard pending signals */ + /* discard pending signals */ rxrpc_discard_my_signals(); } while (!rxrpc_krxiod_die); diff --git a/net/rxrpc/krxsecd.c b/net/rxrpc/krxsecd.c index 3ab0f77..9a1e7f5 100644 --- a/net/rxrpc/krxsecd.c +++ b/net/rxrpc/krxsecd.c @@ -110,7 +110,7 @@ static int rxrpc_krxsecd(void *arg) try_to_freeze(); - /* discard pending signals */ + /* discard pending signals */ rxrpc_discard_my_signals(); } while (!die); diff --git a/net/rxrpc/main.c b/net/rxrpc/main.c index 48cbd06..baec1f7 100644 --- a/net/rxrpc/main.c +++ b/net/rxrpc/main.c @@ -146,17 +146,17 @@ __attribute__((no_instrument_function)); void __cyg_profile_func_enter (void *this_fn, void *call_site) { asm volatile(" movl %%esp,%%edi \n" - " andl %0,%%edi \n" - " addl %1,%%edi \n" - " movl %%esp,%%ecx \n" - " subl %%edi,%%ecx \n" - " shrl $2,%%ecx \n" - " movl $0xedededed,%%eax \n" - " rep stosl \n" - : - : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info)) - : "eax", "ecx", "edi", "memory", "cc" - ); + " andl %0,%%edi \n" + " addl %1,%%edi \n" + " movl %%esp,%%ecx \n" + " subl %%edi,%%ecx \n" + " shrl $2,%%ecx \n" + " movl $0xedededed,%%eax \n" + " rep stosl \n" + : + : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info)) + : "eax", "ecx", "edi", "memory", "cc" + ); } void __cyg_profile_func_exit(void *this_fn, void *call_site) @@ -165,16 +165,16 @@ __attribute__((no_instrument_function)); void __cyg_profile_func_exit(void *this_fn, void *call_site) { asm volatile(" movl %%esp,%%edi \n" - " andl %0,%%edi \n" - " addl %1,%%edi \n" - " movl %%esp,%%ecx \n" - " subl %%edi,%%ecx \n" - " shrl $2,%%ecx \n" - " movl $0xdadadada,%%eax \n" - " rep stosl \n" - : - : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info)) - : "eax", "ecx", "edi", "memory", "cc" - ); + " andl %0,%%edi \n" + " addl %1,%%edi \n" + " movl %%esp,%%ecx \n" + " subl %%edi,%%ecx \n" + " shrl $2,%%ecx \n" + " movl $0xdadadada,%%eax \n" + " rep stosl \n" + : + : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info)) + : "eax", "ecx", "edi", "memory", "cc" + ); } #endif diff --git a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c index 6374df7..0755ae0 100644 --- a/net/rxrpc/sysctl.c +++ b/net/rxrpc/sysctl.c @@ -27,7 +27,7 @@ int rxrpc_knet; static struct ctl_table_header *rxrpc_sysctl = NULL; static ctl_table rxrpc_sysctl_table[] = { - { + { .ctl_name = 1, .procname = "kdebug", .data = &rxrpc_kdebug, @@ -35,7 +35,7 @@ static ctl_table rxrpc_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = 2, .procname = "ktrace", .data = &rxrpc_ktrace, @@ -43,7 +43,7 @@ static ctl_table rxrpc_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = 3, .procname = "kproto", .data = &rxrpc_kproto, @@ -51,7 +51,7 @@ static ctl_table rxrpc_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = 4, .procname = "knet", .data = &rxrpc_knet, @@ -59,7 +59,7 @@ static ctl_table rxrpc_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_dointvec }, - { + { .ctl_name = 5, .procname = "peertimo", .data = &rxrpc_peer_timeout, @@ -67,7 +67,7 @@ static ctl_table rxrpc_sysctl_table[] = { .mode = 0644, .proc_handler = &proc_doulongvec_minmax }, - { + { .ctl_name = 6, .procname = "conntimo", .data = &rxrpc_conn_timeout, diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c index 4268b38..ff5f4f3 100644 --- a/net/rxrpc/transport.c +++ b/net/rxrpc/transport.c @@ -330,10 +330,10 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans, msg->state = RXRPC_MSG_RECEIVED; skb_get_timestamp(pkt, &msg->stamp); if (msg->stamp.tv_sec == 0) { - do_gettimeofday(&msg->stamp); - if (pkt->sk) + do_gettimeofday(&msg->stamp); + if (pkt->sk) sock_enable_timestamp(pkt->sk); - } + } msg->seq = ntohl(msg->hdr.seq); /* attach the packet */ diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 835070e..dd0868d 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -65,7 +65,7 @@ int tcf_hash_release(struct tcf_common *p, int bind, p->tcfc_bindcnt--; p->tcfc_refcnt--; - if (p->tcfc_bindcnt <= 0 && p->tcfc_refcnt <= 0) { + if (p->tcfc_bindcnt <= 0 && p->tcfc_refcnt <= 0) { tcf_hash_destroy(p, hinfo); ret = 1; } @@ -362,7 +362,7 @@ static struct tc_action_ops *tc_lookup_action_id(u32 type) #endif int tcf_action_exec(struct sk_buff *skb, struct tc_action *act, - struct tcf_result *res) + struct tcf_result *res) { struct tc_action *a; int ret = -1; @@ -473,7 +473,7 @@ errout: } struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, - char *name, int ovr, int bind, int *err) + char *name, int ovr, int bind, int *err) { struct tc_action *a; struct tc_action_ops *a_o; @@ -553,7 +553,7 @@ err_out: } struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est, - char *name, int ovr, int bind, int *err) + char *name, int ovr, int bind, int *err) { struct rtattr *tb[TCA_ACT_MAX_PRIO+1]; struct tc_action *head = NULL, *act, *act_prev = NULL; @@ -590,7 +590,7 @@ int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a, int err = 0; struct gnet_dump d; struct tcf_act_hdr *h = a->priv; - + if (h == NULL) goto errout; @@ -632,7 +632,7 @@ errout: static int tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, - u16 flags, int event, int bind, int ref) + u16 flags, int event, int bind, int ref) { struct tcamsg *t; struct nlmsghdr *nlh; @@ -645,7 +645,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, t->tca_family = AF_UNSPEC; t->tca__pad1 = 0; t->tca__pad2 = 0; - + x = (struct rtattr*) skb->tail; RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); @@ -653,7 +653,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, goto rtattr_failure; x->rta_len = skb->tail - (u8*)x; - + nlh->nlmsg_len = skb->tail - b; return skb->len; @@ -852,7 +852,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event) } if (tca_get_fill(skb, head, pid, n->nlmsg_seq, 0, event, - 0, 1) <= 0) { + 0, 1) <= 0) { kfree_skb(skb); ret = -EINVAL; goto err; @@ -861,7 +861,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event) /* now do the delete */ tcf_action_destroy(head, 0); ret = rtnetlink_send(skb, pid, RTNLGRP_TC, - n->nlmsg_flags&NLM_F_ECHO); + n->nlmsg_flags&NLM_F_ECHO); if (ret > 0) return 0; return ret; @@ -872,7 +872,7 @@ err: } static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, - u16 flags) + u16 flags) { struct tcamsg *t; struct nlmsghdr *nlh; @@ -900,10 +900,10 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, goto rtattr_failure; x->rta_len = skb->tail - (u8*)x; - + nlh->nlmsg_len = skb->tail - b; NETLINK_CB(skb).dst_group = RTNLGRP_TC; - + err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO); if (err > 0) err = 0; @@ -915,7 +915,7 @@ nlmsg_failure: return -1; } - + static int tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr) { @@ -999,13 +999,13 @@ find_dump_kind(struct nlmsghdr *n) return NULL; if (rtattr_parse(tb, TCA_ACT_MAX_PRIO, RTA_DATA(tb1), - NLMSG_ALIGN(RTA_PAYLOAD(tb1))) < 0) + NLMSG_ALIGN(RTA_PAYLOAD(tb1))) < 0) return NULL; if (tb[0] == NULL) return NULL; if (rtattr_parse(tb2, TCA_ACT_MAX, RTA_DATA(tb[0]), - RTA_PAYLOAD(tb[0])) < 0) + RTA_PAYLOAD(tb[0])) < 0) return NULL; kind = tb2[TCA_ACT_KIND-1]; @@ -1043,7 +1043,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) } nlh = NLMSG_PUT(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, - cb->nlh->nlmsg_type, sizeof(*t)); + cb->nlh->nlmsg_type, sizeof(*t)); t = NLMSG_DATA(nlh); t->tca_family = AF_UNSPEC; t->tca__pad1 = 0; diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 85de7ef..60095d8 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -65,7 +65,7 @@ static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ }; #endif /* CONFIG_GACT_PROB */ static int tcf_gact_init(struct rtattr *rta, struct rtattr *est, - struct tc_action *a, int ovr, int bind) + struct tc_action *a, int ovr, int bind) { struct rtattr *tb[TCA_GACT_MAX]; struct tc_gact *parm; diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 4c68c71..0fdabfa 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -70,7 +70,7 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int } if (t->u.kernel.target->checkentry && !t->u.kernel.target->checkentry(table, NULL, - t->u.kernel.target, t->data, + t->u.kernel.target, t->data, hook)) { module_put(t->u.kernel.target->me); ret = -EINVAL; @@ -83,7 +83,7 @@ static void ipt_destroy_target(struct ipt_entry_target *t) { if (t->u.kernel.target->destroy) t->u.kernel.target->destroy(t->u.kernel.target, t->data); - module_put(t->u.kernel.target->me); + module_put(t->u.kernel.target->me); } static int tcf_ipt_release(struct tcf_ipt *ipt, int bind) diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 8ac65c2..53aa96c 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -153,8 +153,8 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, if (tkey->offmask) { if (skb->len > tkey->at) { char *j = pptr + tkey->at; - offset += ((*j & tkey->offmask) >> - tkey->shift); + offset += ((*j & tkey->offmask) >> + tkey->shift); } else { goto bad; } @@ -176,7 +176,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, *ptr = ((*ptr & tkey->mask) ^ tkey->val); munged++; } - + if (munged) skb->tc_verd = SET_TC_MUNGED(skb->tc_verd); goto done; @@ -200,8 +200,8 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, struct tcf_pedit *p = a->priv; struct tc_pedit *opt; struct tcf_t t; - int s; - + int s; + s = sizeof(*opt) + p->tcfp_nkeys * sizeof(struct tc_pedit_key); /* netlink spinlocks held above us - must use ATOMIC */ diff --git a/net/sched/act_police.c b/net/sched/act_police.c index af68e1e..6ffe35d 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -62,7 +62,7 @@ struct tc_police_compat #ifdef CONFIG_NET_CLS_ACT static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *cb, - int type, struct tc_action *a) + int type, struct tc_action *a) { struct tcf_common *p; int err = 0, index = -1, i = 0, s_i = 0, n_i = 0; @@ -112,7 +112,7 @@ void tcf_police_destroy(struct tcf_police *p) { unsigned int h = tcf_hash(p->tcf_index, POL_TAB_MASK); struct tcf_common **p1p; - + for (p1p = &tcf_police_ht[h]; *p1p; p1p = &(*p1p)->tcfc_next) { if (*p1p == &p->common) { write_lock_bh(&police_lock); @@ -135,7 +135,7 @@ void tcf_police_destroy(struct tcf_police *p) #ifdef CONFIG_NET_CLS_ACT static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est, - struct tc_action *a, int ovr, int bind) + struct tc_action *a, int ovr, int bind) { unsigned h; int ret = 0, err; @@ -269,7 +269,7 @@ static int tcf_act_police_cleanup(struct tc_action *a, int bind) } static int tcf_act_police(struct sk_buff *skb, struct tc_action *a, - struct tcf_result *res) + struct tcf_result *res) { struct tcf_police *police = a->priv; psched_time_t now; @@ -606,12 +606,12 @@ rtattr_failure: int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *police) { struct gnet_dump d; - + if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, police->tcf_stats_lock, &d) < 0) goto errout; - + if (gnet_stats_copy_basic(&d, &police->tcf_bstats) < 0 || #ifdef CONFIG_NET_ESTIMATOR gnet_stats_copy_rate_est(&d, &police->tcf_rate_est) < 0 || diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 5fe8085..c797118 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -43,9 +43,9 @@ static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result d->tcf_bstats.bytes += skb->len; d->tcf_bstats.packets++; - /* print policy string followed by _ then packet count - * Example if this was the 3rd packet and the string was "hello" - * then it would look like "hello_3" (without quotes) + /* print policy string followed by _ then packet count + * Example if this was the 3rd packet and the string was "hello" + * then it would look like "hello_3" (without quotes) **/ printk("simple: %s_%d\n", (char *)d->tcfd_defdata, d->tcf_bstats.packets); diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index edb8fc9..f41f4ee 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -286,7 +286,7 @@ replay: goto errout; } else { switch (n->nlmsg_type) { - case RTM_NEWTFILTER: + case RTM_NEWTFILTER: err = -EEXIST; if (n->nlmsg_flags&NLM_F_EXCL) goto errout; @@ -481,11 +481,11 @@ tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts) int tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, - struct rtattr *rate_tlv, struct tcf_exts *exts, - struct tcf_ext_map *map) + struct rtattr *rate_tlv, struct tcf_exts *exts, + struct tcf_ext_map *map) { memset(exts, 0, sizeof(*exts)); - + #ifdef CONFIG_NET_CLS_ACT { int err; @@ -511,7 +511,7 @@ tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, #elif defined CONFIG_NET_CLS_POLICE if (map->police && tb[map->police-1]) { struct tcf_police *p; - + p = tcf_police_locate(tb[map->police-1], rate_tlv); if (p == NULL) return -EINVAL; @@ -530,7 +530,7 @@ tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, - struct tcf_exts *src) + struct tcf_exts *src) { #ifdef CONFIG_NET_CLS_ACT if (src->action) { @@ -597,7 +597,7 @@ rtattr_failure: __attribute__ ((unused)) int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, - struct tcf_ext_map *map) + struct tcf_ext_map *map) { #ifdef CONFIG_NET_CLS_ACT if (exts->action) diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 09fda68..ea13c2c 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c @@ -98,7 +98,7 @@ static void basic_destroy(struct tcf_proto *tp) { struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL); struct basic_filter *f, *n; - + list_for_each_entry_safe(f, n, &head->flist, link) { list_del(&f->link); basic_delete_filter(tp, f); @@ -157,7 +157,7 @@ errout: } static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle, - struct rtattr **tca, unsigned long *arg) + struct rtattr **tca, unsigned long *arg) { int err = -EINVAL; struct basic_head *head = (struct basic_head *) tp->root; @@ -292,7 +292,7 @@ static int __init init_basic(void) return register_tcf_proto_ops(&cls_basic_ops); } -static void __exit exit_basic(void) +static void __exit exit_basic(void) { unregister_tcf_proto_ops(&cls_basic_ops); } diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index c797d6a..2ce3ce5 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c @@ -91,7 +91,7 @@ static __inline__ int fw_hash(u32 handle) else if (HTSIZE == 256) { u8 *t = (u8 *) &handle; return t[0] ^ t[1] ^ t[2] ^ t[3]; - } else + } else return handle & (HTSIZE - 1); } @@ -407,7 +407,7 @@ static int __init init_fw(void) return register_tcf_proto_ops(&cls_fw_ops); } -static void __exit exit_fw(void) +static void __exit exit_fw(void) { unregister_tcf_proto_ops(&cls_fw_ops); } diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 587b9ad..7853621 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h @@ -130,7 +130,7 @@ static struct tcf_ext_map rsvp_ext_map = { else if (r > 0) \ return r; \ } - + static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res) { @@ -347,7 +347,7 @@ static int tunnel_bts(struct rsvp_head *data) { int n = data->tgenerator>>5; u32 b = 1<<(data->tgenerator&0x1F); - + if (data->tmap[n]&b) return 0; data->tmap[n] |= b; @@ -547,7 +547,7 @@ insert: s->next = *sp; wmb(); *sp = s; - + goto insert; errout: @@ -654,7 +654,7 @@ static int __init init_rsvp(void) return register_tcf_proto_ops(&RSVP_OPS); } -static void __exit exit_rsvp(void) +static void __exit exit_rsvp(void) { unregister_tcf_proto_ops(&RSVP_OPS); } diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 5af8a59e..040e2d2 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c @@ -222,7 +222,7 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, err = tcf_exts_validate(tp, tb, est, &e, &tcindex_ext_map); if (err < 0) return err; - + memcpy(&cp, p, sizeof(cp)); memset(&new_filter_result, 0, sizeof(new_filter_result)); @@ -316,12 +316,12 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, f = kzalloc(sizeof(*f), GFP_KERNEL); if (!f) goto errout_alloc; - } + } if (tb[TCA_TCINDEX_CLASSID-1]) { cr.res.classid = *(u32 *) RTA_DATA(tb[TCA_TCINDEX_CLASSID-1]); tcf_bind_filter(tp, &cr.res, base); - } + } tcf_exts_change(tp, &cr.exts, &e); @@ -341,7 +341,7 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, for (fp = p->h+(handle % p->hash); *fp; fp = &(*fp)->next) /* nothing */; *fp = f; - } + } tcf_tree_unlock(tp); return 0; @@ -491,7 +491,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) goto rtattr_failure; } - + return skb->len; rtattr_failure: @@ -519,7 +519,7 @@ static int __init init_tcindex(void) return register_tcf_proto_ops(&cls_tcindex_ops); } -static void __exit exit_tcindex(void) +static void __exit exit_tcindex(void) { unregister_tcf_proto_ops(&cls_tcindex_ops); } diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 8b51948..a232671 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -760,7 +760,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, RTA_PUT(skb, TCA_U32_INDEV, IFNAMSIZ, n->indev); #endif #ifdef CONFIG_CLS_U32_PERF - RTA_PUT(skb, TCA_U32_PCNT, + RTA_PUT(skb, TCA_U32_PCNT, sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(u64), n->pf); #endif @@ -810,7 +810,7 @@ static int __init init_u32(void) return register_tcf_proto_ops(&cls_u32_ops); } -static void __exit exit_u32(void) +static void __exit exit_u32(void) { unregister_tcf_proto_ops(&cls_u32_ops); } diff --git a/net/sched/em_cmp.c b/net/sched/em_cmp.c index 8ed93c3..8d6dacd 100644 --- a/net/sched/em_cmp.c +++ b/net/sched/em_cmp.c @@ -88,7 +88,7 @@ static int __init init_em_cmp(void) return tcf_em_register(&em_cmp_ops); } -static void __exit exit_em_cmp(void) +static void __exit exit_em_cmp(void) { tcf_em_unregister(&em_cmp_ops); } diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index 45d47d3..60acf8c 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c @@ -9,7 +9,7 @@ * Authors: Thomas Graf <tgraf@suug.ch> * * ========================================================================== - * + * * The metadata ematch compares two meta objects where each object * represents either a meta value stored in the kernel or a static * value provided by userspace. The objects are not provided by @@ -290,7 +290,7 @@ META_COLLECTOR(var_sk_bound_if) dst->len = 3; } else { struct net_device *dev; - + dev = dev_get_by_index(skb->sk->sk_bound_dev_if); *err = var_dev(dev, dst); if (dev) @@ -671,7 +671,7 @@ static inline struct meta_type_ops * meta_type_ops(struct meta_value *v) * Core **************************************************************************/ -static inline int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info, +static inline int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info, struct meta_value *v, struct meta_obj *dst) { int err = 0; @@ -753,7 +753,7 @@ static int em_meta_change(struct tcf_proto *tp, void *data, int len, struct rtattr *tb[TCA_EM_META_MAX]; struct tcf_meta_hdr *hdr; struct meta_match *meta = NULL; - + if (rtattr_parse(tb, TCA_EM_META_MAX, data, len) < 0) goto errout; @@ -822,7 +822,7 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em) rtattr_failure: return -1; -} +} static struct tcf_ematch_ops em_meta_ops = { .kind = TCF_EM_META, @@ -839,7 +839,7 @@ static int __init init_em_meta(void) return tcf_em_register(&em_meta_ops); } -static void __exit exit_em_meta(void) +static void __exit exit_em_meta(void) { tcf_em_unregister(&em_meta_ops); } diff --git a/net/sched/em_nbyte.c b/net/sched/em_nbyte.c index 005db40..42103b2 100644 --- a/net/sched/em_nbyte.c +++ b/net/sched/em_nbyte.c @@ -23,7 +23,7 @@ struct nbyte_data struct tcf_em_nbyte hdr; char pattern[0]; }; - + static int em_nbyte_change(struct tcf_proto *tp, void *data, int data_len, struct tcf_ematch *em) { @@ -68,7 +68,7 @@ static int __init init_em_nbyte(void) return tcf_em_register(&em_nbyte_ops); } -static void __exit exit_em_nbyte(void) +static void __exit exit_em_nbyte(void) { tcf_em_unregister(&em_nbyte_ops); } diff --git a/net/sched/em_text.c b/net/sched/em_text.c index aa17d8f..8ad894b 100644 --- a/net/sched/em_text.c +++ b/net/sched/em_text.c @@ -125,7 +125,7 @@ static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m) rtattr_failure: return -1; -} +} static struct tcf_ematch_ops em_text_ops = { .kind = TCF_EM_TEXT, @@ -142,7 +142,7 @@ static int __init init_em_text(void) return tcf_em_register(&em_text_ops); } -static void __exit exit_em_text(void) +static void __exit exit_em_text(void) { tcf_em_unregister(&em_text_ops); } diff --git a/net/sched/em_u32.c b/net/sched/em_u32.c index e3ddfce..cd0600c 100644 --- a/net/sched/em_u32.c +++ b/net/sched/em_u32.c @@ -23,7 +23,7 @@ static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em, { struct tc_u32_key *key = (struct tc_u32_key *) em->data; unsigned char *ptr = skb->nh.raw; - + if (info) { if (info->ptr) ptr = info->ptr; @@ -34,7 +34,7 @@ static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em, if (!tcf_valid_offset(skb, ptr, sizeof(u32))) return 0; - + return !(((*(u32*) ptr) ^ key->val) & key->mask); } @@ -51,7 +51,7 @@ static int __init init_em_u32(void) return tcf_em_register(&em_u32_ops); } -static void __exit exit_em_u32(void) +static void __exit exit_em_u32(void) { tcf_em_unregister(&em_u32_ops); } diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 8f8a16d..d3ad36b 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c @@ -37,12 +37,12 @@ * --------<-POP--------- * * where B is a virtual ematch referencing to sequence starting with B1. - * + * * ========================================================================== * * How to write an ematch in 60 seconds * ------------------------------------ - * + * * 1) Provide a matcher function: * static int my_match(struct sk_buff *skb, struct tcf_ematch *m, * struct tcf_pkt_info *info) @@ -115,7 +115,7 @@ static inline struct tcf_ematch_ops * tcf_em_lookup(u16 kind) /** * tcf_em_register - register an extended match - * + * * @ops: ematch operations lookup table * * This function must be called by ematches to announce their presence. @@ -211,7 +211,7 @@ static int tcf_em_validate(struct tcf_proto *tp, if (ref <= idx) goto errout; - + em->data = ref; } else { /* Note: This lookup will increase the module refcnt @@ -327,7 +327,7 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct rtattr *rta, /* We do not use rtattr_parse_nested here because the maximum * number of attributes is unknown. This saves us the allocation * for a tb buffer which would serve no purpose at all. - * + * * The array of rt attributes is parsed in the order as they are * provided, their type must be incremental from 1 to n. Even * if it does not serve any real purpose, a failure of sticking @@ -399,7 +399,7 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) module_put(em->ops->owner); } } - + tree->hdr.nmatches = 0; kfree(tree->matches); } diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 65825f4..60b92fc 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -389,7 +389,7 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, struct Qdisc *q = *old; - if (parent == NULL) { + if (parent == NULL) { if (q && q->flags&TCQ_F_INGRESS) { *old = dev_graft_qdisc(dev, q); } else { @@ -596,7 +596,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) q = qdisc_leaf(p, clid); } else { /* ingress */ q = dev->qdisc_ingress; - } + } } else { q = dev->qdisc_sleeping; } @@ -743,7 +743,7 @@ create_n_graft: return -ENOENT; if (clid == TC_H_INGRESS) q = qdisc_create(dev, tcm->tcm_parent, tca, &err); - else + else q = qdisc_create(dev, tcm->tcm_handle, tca, &err); if (q == NULL) { if (err == -EAGAIN) @@ -808,10 +808,10 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, #endif gnet_stats_copy_queue(&d, &q->qstats) < 0) goto rtattr_failure; - + if (gnet_stats_finish_copy(&d) < 0) goto rtattr_failure; - + nlh->nlmsg_len = skb->tail - b; return skb->len; @@ -954,7 +954,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) } /* OK. Locate qdisc */ - if ((q = qdisc_lookup(dev, qid)) == NULL) + if ((q = qdisc_lookup(dev, qid)) == NULL) return -ENOENT; /* An check that it supports classes */ @@ -978,7 +978,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) goto out; } else { switch (n->nlmsg_type) { - case RTM_NEWTCLASS: + case RTM_NEWTCLASS: err = -EEXIST; if (n->nlmsg_flags&NLM_F_EXCL) goto out; @@ -1162,7 +1162,7 @@ reclassify: skb->tc_verd = SET_TC_VERD(skb->tc_verd,verd); goto reclassify; } else { - if (skb->tc_verd) + if (skb->tc_verd) skb->tc_verd = SET_TC_VERD(skb->tc_verd,0); return err; } @@ -1200,7 +1200,7 @@ static struct file_operations psched_fops = { .read = seq_read, .llseek = seq_lseek, .release = single_release, -}; +}; #endif #ifdef CONFIG_NET_SCH_CLK_CPU diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index edc7bb0..afb3bbd 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c @@ -107,7 +107,7 @@ static __inline__ struct atm_flow_data *lookup_flow(struct Qdisc *sch, struct atm_qdisc_data *p = PRIV(sch); struct atm_flow_data *flow; - for (flow = p->flows; flow; flow = flow->next) + for (flow = p->flows; flow; flow = flow->next) if (flow->classid == classid) break; return flow; } @@ -125,7 +125,7 @@ static int atm_tc_graft(struct Qdisc *sch,unsigned long arg, if (!new) new = &noop_qdisc; *old = xchg(&flow->q,new); if (*old) qdisc_reset(*old); - return 0; + return 0; } @@ -145,7 +145,7 @@ static unsigned long atm_tc_get(struct Qdisc *sch,u32 classid) DPRINTK("atm_tc_get(sch %p,[qdisc %p],classid %x)\n",sch,p,classid); flow = lookup_flow(sch,classid); - if (flow) flow->ref++; + if (flow) flow->ref++; DPRINTK("atm_tc_get: flow %p\n",flow); return (unsigned long) flow; } @@ -280,9 +280,9 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, opt->rta_type,RTA_PAYLOAD(opt),hdr_len); if (!(sock = sockfd_lookup(fd,&error))) return error; /* f_count++ */ DPRINTK("atm_tc_change: f_count %d\n",file_count(sock->file)); - if (sock->ops->family != PF_ATMSVC && sock->ops->family != PF_ATMPVC) { + if (sock->ops->family != PF_ATMSVC && sock->ops->family != PF_ATMPVC) { error = -EPROTOTYPE; - goto err_out; + goto err_out; } /* @@@ should check if the socket is really operational or we'll crash on vcc->send */ @@ -320,9 +320,9 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, flow->q = &noop_qdisc; DPRINTK("atm_tc_change: qdisc %p\n",flow->q); flow->sock = sock; - flow->vcc = ATM_SD(sock); /* speedup */ + flow->vcc = ATM_SD(sock); /* speedup */ flow->vcc->user_back = flow; - DPRINTK("atm_tc_change: vcc %p\n",flow->vcc); + DPRINTK("atm_tc_change: vcc %p\n",flow->vcc); flow->old_pop = flow->vcc->pop; flow->parent = p; flow->vcc->pop = sch_atm_pop; @@ -391,7 +391,7 @@ static struct tcf_proto **atm_tc_find_tcf(struct Qdisc *sch,unsigned long cl) struct atm_flow_data *flow = (struct atm_flow_data *) cl; DPRINTK("atm_tc_find_tcf(sch %p,[qdisc %p],flow %p)\n",sch,p,flow); - return flow ? &flow->filter_list : &p->link.filter_list; + return flow ? &flow->filter_list : &p->link.filter_list; } @@ -546,8 +546,8 @@ static int atm_tc_requeue(struct sk_buff *skb,struct Qdisc *sch) D2PRINTK("atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n",skb,sch,p); ret = p->link.q->ops->requeue(skb,p->link.q); if (!ret) { - sch->q.qlen++; - sch->qstats.requeues++; + sch->q.qlen++; + sch->qstats.requeues++; } else { sch->qstats.drops++; p->link.qstats.drops++; @@ -726,7 +726,7 @@ static int __init atm_init(void) return register_qdisc(&atm_qdisc_ops); } -static void __exit atm_exit(void) +static void __exit atm_exit(void) { unregister_qdisc(&atm_qdisc_ops); } diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index f79a4f3..48830ca 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c @@ -40,12 +40,12 @@ ======================================= Sources: [1] Sally Floyd and Van Jacobson, "Link-sharing and Resource - Management Models for Packet Networks", + Management Models for Packet Networks", IEEE/ACM Transactions on Networking, Vol.3, No.4, 1995 - [2] Sally Floyd, "Notes on CBQ and Guaranteed Service", 1995 + [2] Sally Floyd, "Notes on CBQ and Guaranteed Service", 1995 - [3] Sally Floyd, "Notes on Class-Based Queueing: Setting + [3] Sally Floyd, "Notes on Class-Based Queueing: Setting Parameters", 1996 [4] Sally Floyd and Michael Speer, "Experimental Results @@ -59,12 +59,12 @@ the implementation is different. Particularly: --- The WRR algorithm is different. Our version looks more - reasonable (I hope) and works when quanta are allowed to be - less than MTU, which is always the case when real time classes - have small rates. Note, that the statement of [3] is - incomplete, delay may actually be estimated even if class - per-round allotment is less than MTU. Namely, if per-round - allotment is W*r_i, and r_1+...+r_k = r < 1 + reasonable (I hope) and works when quanta are allowed to be + less than MTU, which is always the case when real time classes + have small rates. Note, that the statement of [3] is + incomplete, delay may actually be estimated even if class + per-round allotment is less than MTU. Namely, if per-round + allotment is W*r_i, and r_1+...+r_k = r < 1 delay_i <= ([MTU/(W*r_i)]*W*r + W*r + k*MTU)/B @@ -280,7 +280,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) #ifdef CONFIG_NET_CLS_ACT switch (result) { case TC_ACT_QUEUED: - case TC_ACT_STOLEN: + case TC_ACT_STOLEN: *qerr = NET_XMIT_SUCCESS; case TC_ACT_SHOT: return NULL; @@ -479,7 +479,7 @@ static void cbq_ovl_classic(struct cbq_class *cl) if (!cl->delayed) { delay += cl->offtime; - /* + /* Class goes to sleep, so that it will have no chance to work avgidle. Let's forgive it 8) @@ -717,7 +717,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) } #endif -/* +/* It is mission critical procedure. We "regenerate" toplevel cutoff, if transmitting class @@ -739,7 +739,7 @@ cbq_update_toplevel(struct cbq_sched_data *q, struct cbq_class *cl, } } while ((borrowed=borrowed->borrow) != NULL); } -#if 0 +#if 0 /* It is not necessary now. Uncommenting it will save CPU cycles, but decrease fairness. */ @@ -768,7 +768,7 @@ cbq_update(struct cbq_sched_data *q) (now - last) is total time between packet right edges. (last_pktlen/rate) is "virtual" busy time, so that - idle = (now - last) - last_pktlen/rate + idle = (now - last) - last_pktlen/rate */ idle = PSCHED_TDIFF(q->now, cl->last); @@ -907,7 +907,7 @@ cbq_dequeue_prio(struct Qdisc *sch, int prio) skb = cl->q->dequeue(cl->q); /* Class did not give us any skb :-( - It could occur even if cl->q->q.qlen != 0 + It could occur even if cl->q->q.qlen != 0 f.e. if cl->q == "tbf" */ if (skb == NULL) @@ -2131,7 +2131,7 @@ static int __init cbq_module_init(void) { return register_qdisc(&cbq_qdisc_ops); } -static void __exit cbq_module_exit(void) +static void __exit cbq_module_exit(void) { unregister_qdisc(&cbq_qdisc_ops); } diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index d542181..96324cf 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c @@ -68,7 +68,7 @@ static inline int dsmark_valid_indices(u16 indices) return 0; indices >>= 1; } - + return 1; } @@ -100,7 +100,7 @@ static int dsmark_graft(struct Qdisc *sch, unsigned long arg, qdisc_reset(*old); sch_tree_unlock(sch); - return 0; + return 0; } static struct Qdisc *dsmark_leaf(struct Qdisc *sch, unsigned long arg) @@ -151,7 +151,7 @@ static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent, if (tb[TCA_DSMARK_VALUE-1]) p->value[*arg-1] = RTA_GET_U8(tb[TCA_DSMARK_VALUE-1]); - + if (tb[TCA_DSMARK_MASK-1]) p->mask[*arg-1] = mask; @@ -167,7 +167,7 @@ static int dsmark_delete(struct Qdisc *sch, unsigned long arg) if (!dsmark_valid_index(p, arg)) return -EINVAL; - + p->mask[arg-1] = 0xff; p->value[arg-1] = 0; @@ -193,9 +193,9 @@ static void dsmark_walk(struct Qdisc *sch,struct qdisc_walker *walker) break; } } -ignore: +ignore: walker->count++; - } + } } static struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long cl) @@ -338,7 +338,7 @@ static unsigned int dsmark_drop(struct Qdisc *sch) { struct dsmark_qdisc_data *p = PRIV(sch); unsigned int len; - + DPRINTK("dsmark_reset(sch %p,[qdisc %p])\n", sch, p); if (p->q->ops->drop == NULL) @@ -506,7 +506,7 @@ static int __init dsmark_module_init(void) return register_qdisc(&dsmark_qdisc_ops); } -static void __exit dsmark_module_exit(void) +static void __exit dsmark_module_exit(void) { unregister_qdisc(&dsmark_qdisc_ops); } diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 3b6e6a7..52eb343 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -36,7 +36,7 @@ /* Main transmission queue. */ -/* Main qdisc structure lock. +/* Main qdisc structure lock. However, modifications to data, participating in scheduling must be additionally @@ -66,7 +66,7 @@ void qdisc_unlock_tree(struct net_device *dev) write_unlock(&qdisc_tree_lock); } -/* +/* dev->queue_lock serializes queue accesses for this device AND dev->qdisc pointer itself. @@ -82,7 +82,7 @@ void qdisc_unlock_tree(struct net_device *dev) we do not check dev->tbusy flag here. Returns: 0 - queue is empty. - >0 - queue is not empty, but throttled. + >0 - queue is not empty, but throttled. <0 - queue is not empty. Device is throttled, if dev->tbusy != 0. NOTE: Called under dev->queue_lock with locally disabled BH. @@ -112,7 +112,7 @@ static inline int qdisc_restart(struct net_device *dev) if (!netif_tx_trylock(dev)) { collision: /* So, someone grabbed the driver. */ - + /* It may be transient configuration error, when hard_start_xmit() recurses. We detect it by checking xmit owner and drop the @@ -128,7 +128,7 @@ static inline int qdisc_restart(struct net_device *dev) goto requeue; } } - + { /* And release queue */ spin_unlock(&dev->queue_lock); @@ -137,7 +137,7 @@ static inline int qdisc_restart(struct net_device *dev) int ret; ret = dev_hard_start_xmit(skb, dev); - if (ret == NETDEV_TX_OK) { + if (ret == NETDEV_TX_OK) { if (!nolock) { netif_tx_unlock(dev); } @@ -146,15 +146,15 @@ static inline int qdisc_restart(struct net_device *dev) } if (ret == NETDEV_TX_LOCKED && nolock) { spin_lock(&dev->queue_lock); - goto collision; + goto collision; } } /* NETDEV_TX_BUSY - we need to requeue */ /* Release the driver */ - if (!nolock) { + if (!nolock) { netif_tx_unlock(dev); - } + } spin_lock(&dev->queue_lock); q = dev->qdisc; } @@ -300,7 +300,7 @@ struct Qdisc noop_qdisc = { .enqueue = noop_enqueue, .dequeue = noop_dequeue, .flags = TCQ_F_BUILTIN, - .ops = &noop_qdisc_ops, + .ops = &noop_qdisc_ops, .list = LIST_HEAD_INIT(noop_qdisc.list), }; @@ -454,7 +454,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops, unsigned int parentid) { struct Qdisc *sch; - + sch = qdisc_alloc(dev, ops); if (IS_ERR(sch)) goto errout; @@ -478,7 +478,7 @@ void qdisc_reset(struct Qdisc *qdisc) ops->reset(qdisc); } -/* this is the rcu callback function to clean up a qdisc when there +/* this is the rcu callback function to clean up a qdisc when there * are no further references to it */ static void __qdisc_destroy(struct rcu_head *head) @@ -600,10 +600,10 @@ void dev_shutdown(struct net_device *dev) dev->qdisc_sleeping = &noop_qdisc; qdisc_destroy(qdisc); #if defined(CONFIG_NET_SCH_INGRESS) || defined(CONFIG_NET_SCH_INGRESS_MODULE) - if ((qdisc = dev->qdisc_ingress) != NULL) { + if ((qdisc = dev->qdisc_ingress) != NULL) { dev->qdisc_ingress = NULL; qdisc_destroy(qdisc); - } + } #endif BUG_TRAP(!timer_pending(&dev->watchdog_timer)); qdisc_unlock_tree(dev); diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 18e81a8..fa1b4fe 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c @@ -335,7 +335,7 @@ static void gred_reset(struct Qdisc* sch) qdisc_reset_queue(sch); - for (i = 0; i < t->DPs; i++) { + for (i = 0; i < t->DPs; i++) { struct gred_sched_data *q = t->tab[i]; if (!q) @@ -393,7 +393,7 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct rtattr *dps) "shadowed VQ 0x%x\n", i); gred_destroy_vq(table->tab[i]); table->tab[i] = NULL; - } + } } return 0; diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 6eefa69..135087d 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -284,7 +284,7 @@ static inline struct hfsc_class * eltree_get_minel(struct hfsc_sched *q) { struct rb_node *n; - + n = rb_first(&q->eligible); if (n == NULL) return NULL; @@ -773,7 +773,7 @@ init_vf(struct hfsc_class *cl, unsigned int len) /* update the virtual curve */ vt = cl->cl_vt + cl->cl_vtoff; rtsc_min(&cl->cl_virtual, &cl->cl_fsc, vt, - cl->cl_total); + cl->cl_total); if (cl->cl_virtual.x == vt) { cl->cl_virtual.x -= cl->cl_vtoff; cl->cl_vtoff = 0; @@ -796,10 +796,10 @@ init_vf(struct hfsc_class *cl, unsigned int len) /* update the ulimit curve */ rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time, - cl->cl_total); + cl->cl_total); /* compute myf */ cl->cl_myf = rtsc_y2x(&cl->cl_ulimit, - cl->cl_total); + cl->cl_total); cl->cl_myfadj = 0; } } @@ -853,7 +853,7 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time) * update vt and f */ cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total) - - cl->cl_vtoff + cl->cl_vtadj; + - cl->cl_vtoff + cl->cl_vtadj; /* * if vt of the class is smaller than cvtmin, @@ -870,7 +870,7 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time) if (cl->cl_flags & HFSC_USC) { cl->cl_myf = cl->cl_myfadj + rtsc_y2x(&cl->cl_ulimit, - cl->cl_total); + cl->cl_total); #if 0 /* * This code causes classes to stay way under their @@ -1001,7 +1001,7 @@ hfsc_find_class(u32 classid, struct Qdisc *sch) static void hfsc_change_rsc(struct hfsc_class *cl, struct tc_service_curve *rsc, - u64 cur_time) + u64 cur_time) { sc2isc(rsc, &cl->cl_rsc); rtsc_init(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul); @@ -1023,7 +1023,7 @@ hfsc_change_fsc(struct hfsc_class *cl, struct tc_service_curve *fsc) static void hfsc_change_usc(struct hfsc_class *cl, struct tc_service_curve *usc, - u64 cur_time) + u64 cur_time) { sc2isc(usc, &cl->cl_usc); rtsc_init(&cl->cl_ulimit, &cl->cl_usc, cur_time, cl->cl_total); @@ -1032,7 +1032,7 @@ hfsc_change_usc(struct hfsc_class *cl, struct tc_service_curve *usc, static int hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, - struct rtattr **tca, unsigned long *arg) + struct rtattr **tca, unsigned long *arg) { struct hfsc_sched *q = qdisc_priv(sch); struct hfsc_class *cl = (struct hfsc_class *)*arg; @@ -1228,9 +1228,9 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) #ifdef CONFIG_NET_CLS_ACT switch (result) { case TC_ACT_QUEUED: - case TC_ACT_STOLEN: + case TC_ACT_STOLEN: *qerr = NET_XMIT_SUCCESS; - case TC_ACT_SHOT: + case TC_ACT_SHOT: return NULL; } #elif defined(CONFIG_NET_CLS_POLICE) @@ -1259,7 +1259,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) static int hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, - struct Qdisc **old) + struct Qdisc **old) { struct hfsc_class *cl = (struct hfsc_class *)arg; @@ -1397,7 +1397,7 @@ hfsc_dump_curves(struct sk_buff *skb, struct hfsc_class *cl) static int hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, - struct tcmsg *tcm) + struct tcmsg *tcm) { struct hfsc_class *cl = (struct hfsc_class *)arg; unsigned char *b = skb->tail; diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 15f23c5..1f098d8 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -11,7 +11,7 @@ * Credits (in time order) for older HTB versions: * Stef Coene <stef.coene@docum.org> * HTB support at LARTC mailing list - * Ondrej Kraus, <krauso@barr.cz> + * Ondrej Kraus, <krauso@barr.cz> * found missing INIT_QDISC(htb) * Vladimir Smelhaus, Aamer Akhter, Bert Hubert * helped a lot to locate nasty class stall bug @@ -59,11 +59,11 @@ Author: devik@cdi.cz ======================================================================== HTB is like TBF with multiple classes. It is also similar to CBQ because - it allows to assign priority to each class in hierarchy. + it allows to assign priority to each class in hierarchy. In fact it is another implementation of Floyd's formal sharing. Levels: - Each class is assigned level. Leaf has ALWAYS level 0 and root + Each class is assigned level. Leaf has ALWAYS level 0 and root classes have level TC_HTB_MAXDEPTH-1. Interior nodes has level one less than their parent. */ @@ -245,7 +245,7 @@ static inline struct htb_class *htb_find(u32 handle, struct Qdisc *sch) * We allow direct class selection by classid in priority. The we examine * filters in qdisc and in inner nodes (if higher filter points to the inner * node). If we end up with classid MAJOR:0 we enqueue the skb into special - * internal fifo (direct). These packets then go directly thru. If we still + * internal fifo (direct). These packets then go directly thru. If we still * have no valid leaf we try to use MAJOR:default leaf. It still unsuccessfull * then finish and return direct queue. */ @@ -433,7 +433,7 @@ static inline void htb_remove_class_from_row(struct htb_sched *q, * htb_activate_prios - creates active classe's feed chain * * The class is connected to ancestors and/or appropriate rows - * for priorities it is participating on. cl->cmode must be new + * for priorities it is participating on. cl->cmode must be new * (activated) mode. It does nothing if cl->prio_activity == 0. */ static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl) @@ -466,7 +466,7 @@ static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl) /** * htb_deactivate_prios - remove class from feed chain * - * cl->cmode must represent old mode (before deactivation). It does + * cl->cmode must represent old mode (before deactivation). It does * nothing if cl->prio_activity == 0. Class is removed from all feed * chains and rows. */ @@ -524,9 +524,9 @@ static inline long htb_hiwater(const struct htb_class *cl) * * It computes cl's mode at time cl->t_c+diff and returns it. If mode * is not HTB_CAN_SEND then cl->pq_key is updated to time difference - * from now to time when cl will change its state. + * from now to time when cl will change its state. * Also it is worth to note that class mode doesn't change simply - * at cl->{c,}tokens == 0 but there can rather be hysteresis of + * at cl->{c,}tokens == 0 but there can rather be hysteresis of * 0 .. -cl->{c,}buffer range. It is meant to limit number of * mode transitions per time unit. The speed gain is about 1/6. */ @@ -575,7 +575,7 @@ htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, long *diff) } /** - * htb_activate - inserts leaf cl into appropriate active feeds + * htb_activate - inserts leaf cl into appropriate active feeds * * Routine learns (new) priority of leaf and activates feed chain * for the prio. It can be called on already active leaf safely. @@ -594,7 +594,7 @@ static inline void htb_activate(struct htb_sched *q, struct htb_class *cl) } /** - * htb_deactivate - remove leaf cl from active feeds + * htb_deactivate - remove leaf cl from active feeds * * Make sure that leaf is active. In the other words it can't be called * with non-active leaf. It also removes class from the drop list. @@ -854,7 +854,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio, for (i = 0; i < 65535; i++) { if (!*sp->pptr && *sp->pid) { - /* ptr was invalidated but id is valid - try to recover + /* ptr was invalidated but id is valid - try to recover the original or next ptr */ *sp->pptr = htb_id_find_next_upper(prio, sp->root, *sp->pid); @@ -906,7 +906,7 @@ next: /* class can be empty - it is unlikely but can be true if leaf qdisc drops packets in enqueue routine or if someone used - graft operation on the leaf since last dequeue; + graft operation on the leaf since last dequeue; simply deactivate and skip such class */ if (unlikely(cl->un.leaf.q->q.qlen == 0)) { struct htb_class *next; @@ -1229,7 +1229,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, if (cl && !cl->level) { if (new == NULL && (new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, - cl->classid)) + cl->classid)) == NULL) return -ENOBUFS; sch_tree_lock(sch); @@ -1347,7 +1347,7 @@ static void htb_destroy(struct Qdisc *sch) del_timer_sync(&q->rttim); #endif /* This line used to be after htb_destroy_class call below - and surprisingly it worked in 2.4. But it must precede it + and surprisingly it worked in 2.4. But it must precede it because filter need its target class alive to be able to call unbind_filter on it (without Oops). */ htb_destroy_filters(&q->filter_list); diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index c3242f7..cfe070e 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c @@ -1,4 +1,4 @@ -/* net/sched/sch_ingress.c - Ingress qdisc +/* net/sched/sch_ingress.c - Ingress qdisc * 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 @@ -47,7 +47,7 @@ */ #ifndef CONFIG_NET_CLS_ACT #ifdef CONFIG_NETFILTER -static int nf_registered; +static int nf_registered; #endif #endif @@ -70,7 +70,7 @@ static int ingress_graft(struct Qdisc *sch,unsigned long arg, DPRINTK("ingress_graft(sch %p,[qdisc %p],new %p,old %p)\n", sch, p, new, old); DPRINTK("\n ingress_graft: You cannot add qdiscs to classes"); - return 1; + return 1; } @@ -162,7 +162,7 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch) case TC_ACT_QUEUED: result = TC_ACT_STOLEN; break; - case TC_ACT_RECLASSIFY: + case TC_ACT_RECLASSIFY: case TC_ACT_OK: case TC_ACT_UNSPEC: default: @@ -172,7 +172,7 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch) }; /* backward compat */ #else -#ifdef CONFIG_NET_CLS_POLICE +#ifdef CONFIG_NET_CLS_POLICE switch (result) { case TC_POLICE_SHOT: result = NF_DROP; @@ -232,14 +232,14 @@ static unsigned int ingress_drop(struct Qdisc *sch) #ifdef CONFIG_NETFILTER static unsigned int ing_hook(unsigned int hook, struct sk_buff **pskb, - const struct net_device *indev, - const struct net_device *outdev, - int (*okfn)(struct sk_buff *)) + const struct net_device *indev, + const struct net_device *outdev, + int (*okfn)(struct sk_buff *)) { - + struct Qdisc *q; struct sk_buff *skb = *pskb; - struct net_device *dev = skb->dev; + struct net_device *dev = skb->dev; int fwres=NF_ACCEPT; DPRINTK("ing_hook: skb %s dev=%s len=%u\n", @@ -247,7 +247,7 @@ ing_hook(unsigned int hook, struct sk_buff **pskb, skb->dev ? (*pskb)->dev->name : "(no dev)", skb->len); -/* +/* revisit later: Use a private since lock dev->queue_lock is also used on the egress (might slow things for an iota) */ @@ -257,8 +257,8 @@ used on the egress (might slow things for an iota) if ((q = dev->qdisc_ingress) != NULL) fwres = q->enqueue(skb, q); spin_unlock(&dev->queue_lock); - } - + } + return fwres; } @@ -296,7 +296,7 @@ static int ingress_init(struct Qdisc *sch,struct rtattr *opt) printk("Ingress scheduler: Classifier actions prefered over netfilter\n"); #endif #endif - + #ifndef CONFIG_NET_CLS_ACT #ifdef CONFIG_NETFILTER if (!nf_registered) { @@ -417,7 +417,7 @@ static int __init ingress_module_init(void) return ret; } -static void __exit ingress_module_exit(void) +static void __exit ingress_module_exit(void) { unregister_qdisc(&ingress_qdisc_ops); #ifndef CONFIG_NET_CLS_ACT diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 79542af..1ccbfb5 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -7,7 +7,7 @@ * 2 of the License. * * Many of the algorithms and ideas for this came from - * NIST Net which is not copyrighted. + * NIST Net which is not copyrighted. * * Authors: Stephen Hemminger <shemminger@osdl.org> * Catalin(ux aka Dino) BOIE <catab at umbrella dot ro> @@ -114,7 +114,7 @@ static unsigned long get_crandom(struct crndstate *state) * std deviation sigma. Uses table lookup to approximate the desired * distribution, and a uniformly-distributed pseudo-random source. */ -static long tabledist(unsigned long mu, long sigma, +static long tabledist(unsigned long mu, long sigma, struct crndstate *state, const struct disttable *dist) { long t, x; @@ -126,7 +126,7 @@ static long tabledist(unsigned long mu, long sigma, rnd = get_crandom(state); /* default uniform distribution */ - if (dist == NULL) + if (dist == NULL) return (rnd % (2*sigma)) - sigma + mu; t = dist->table[rnd % dist->size]; @@ -218,7 +218,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) ++q->counter; ret = q->qdisc->enqueue(skb, q->qdisc); } else { - /* + /* * Do re-ordering by putting one out of N packets at the front * of the queue. */ @@ -323,7 +323,7 @@ static void netem_reset(struct Qdisc *sch) /* Pass size change message down to embedded FIFO */ static int set_fifo_limit(struct Qdisc *q, int limit) { - struct rtattr *rta; + struct rtattr *rta; int ret = -ENOMEM; /* Hack to avoid sending change message to non-FIFO */ @@ -333,9 +333,9 @@ static int set_fifo_limit(struct Qdisc *q, int limit) rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL); if (rta) { rta->rta_type = RTM_NEWQDISC; - rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); + rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); ((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit; - + ret = q->ops->change(q, rta); kfree(rta); } @@ -364,7 +364,7 @@ static int get_dist_table(struct Qdisc *sch, const struct rtattr *attr) d->size = n; for (i = 0; i < n; i++) d->table[i] = data[i]; - + spin_lock_bh(&sch->dev->queue_lock); d = xchg(&q->delay_dist, d); spin_unlock_bh(&sch->dev->queue_lock); @@ -419,7 +419,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt) struct netem_sched_data *q = qdisc_priv(sch); struct tc_netem_qopt *qopt; int ret; - + if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt)) return -EINVAL; @@ -429,7 +429,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt) pr_debug("netem: can't set fifo limit\n"); return ret; } - + q->latency = qopt->latency; q->jitter = qopt->jitter; q->limit = qopt->limit; @@ -445,10 +445,10 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt) /* Handle nested options after initial queue options. * Should have put all options in nested format but too late now. - */ + */ if (RTA_PAYLOAD(opt) > sizeof(*qopt)) { struct rtattr *tb[TCA_NETEM_MAX]; - if (rtattr_parse(tb, TCA_NETEM_MAX, + if (rtattr_parse(tb, TCA_NETEM_MAX, RTA_DATA(opt) + sizeof(*qopt), RTA_PAYLOAD(opt) - sizeof(*qopt))) return -EINVAL; @@ -681,7 +681,7 @@ static void netem_put(struct Qdisc *sch, unsigned long arg) { } -static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid, +static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **tca, unsigned long *arg) { return -ENOSYS; diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 000e043..9f957ca 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c @@ -7,7 +7,7 @@ * 2 of the License, or (at your option) any later version. * * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> - * Fixes: 19990609: J Hadi Salim <hadi@nortelnetworks.com>: + * Fixes: 19990609: J Hadi Salim <hadi@nortelnetworks.com>: * Init -- EINVAL when opt undefined */ @@ -105,7 +105,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) return NET_XMIT_SUCCESS; } sch->qstats.drops++; - return ret; + return ret; } @@ -453,7 +453,7 @@ static int __init prio_module_init(void) return register_qdisc(&prio_qdisc_ops); } -static void __exit prio_module_exit(void) +static void __exit prio_module_exit(void) { unregister_qdisc(&prio_qdisc_ops); } diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index acddad0..00db53e 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c @@ -185,7 +185,7 @@ static struct Qdisc *red_create_dflt(struct Qdisc *sch, u32 limit) TC_H_MAKE(sch->handle, 1)); if (q) { rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), - GFP_KERNEL); + GFP_KERNEL); if (rta) { rta->rta_type = RTM_NEWQDISC; rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 8284480..66f3205 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c @@ -53,7 +53,7 @@ Queuing using Deficit Round Robin", Proc. SIGCOMM 95. - This is not the thing that is usually called (W)FQ nowadays. + This is not the thing that is usually called (W)FQ nowadays. It does not use any timestamp mechanism, but instead processes queues in round-robin order. @@ -63,7 +63,7 @@ DRAWBACKS: - - "Stochastic" -> It is not 100% fair. + - "Stochastic" -> It is not 100% fair. When hash collisions occur, several flows are considered as one. - "Round-robin" -> It introduces larger delays than virtual clock @@ -501,7 +501,7 @@ static int __init sfq_module_init(void) { return register_qdisc(&sfq_qdisc_ops); } -static void __exit sfq_module_exit(void) +static void __exit sfq_module_exit(void) { unregister_qdisc(&sfq_qdisc_ops); } diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index ed9b6d9..85da8da 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -276,7 +276,7 @@ static void tbf_reset(struct Qdisc* sch) static struct Qdisc *tbf_create_dflt_qdisc(struct Qdisc *sch, u32 limit) { struct Qdisc *q; - struct rtattr *rta; + struct rtattr *rta; int ret; q = qdisc_create_dflt(sch->dev, &bfifo_qdisc_ops, @@ -285,7 +285,7 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct Qdisc *sch, u32 limit) rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL); if (rta) { rta->rta_type = RTM_NEWQDISC; - rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); + rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); ((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit; ret = q->ops->change(q, rta); @@ -475,7 +475,7 @@ static void tbf_put(struct Qdisc *sch, unsigned long arg) { } -static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid, +static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **tca, unsigned long *arg) { return -ENOSYS; diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 4c16ad5..6a66037 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c @@ -178,7 +178,7 @@ teql_destroy(struct Qdisc* sch) teql_neigh_release(xchg(&dat->ncache, NULL)); break; } - + } while ((prev = q) != master->slaves); } } @@ -292,7 +292,7 @@ restart: do { struct net_device *slave = q->dev; - + if (slave->qdisc_sleeping != q) continue; if (netif_queue_stopped(slave) || ! netif_running(slave)) { @@ -425,7 +425,7 @@ static __init void teql_master_setup(struct net_device *dev) master->dev = dev; ops->priv_size = sizeof(struct teql_sched_data); - + ops->enqueue = teql_enqueue; ops->dequeue = teql_dequeue; ops->requeue = teql_requeue; @@ -489,7 +489,7 @@ static int __init teql_init(void) return i ? 0 : err; } -static void __exit teql_exit(void) +static void __exit teql_exit(void) { struct teql_master *master, *nxt; diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 5db95ca..fca6f75 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -158,14 +158,14 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the * recommended value of 5 times 'RTO.Max'. */ - asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD] + asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD] = 5 * asoc->rto_max; asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ; - + /* Initilizes the timers */ for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) { init_timer(&asoc->timers[i]); @@ -1334,8 +1334,8 @@ int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc, asoc->ep->base.bind_addr.port, gfp); } -/* Lookup laddr in the bind address list of an association. */ -int sctp_assoc_lookup_laddr(struct sctp_association *asoc, +/* Lookup laddr in the bind address list of an association. */ +int sctp_assoc_lookup_laddr(struct sctp_association *asoc, const union sctp_addr *laddr) { int found; @@ -1343,7 +1343,7 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc, sctp_read_lock(&asoc->base.addr_lock); if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) && sctp_bind_addr_match(&asoc->base.bind_addr, laddr, - sctp_sk(asoc->base.sk))) { + sctp_sk(asoc->base.sk))) { found = 1; goto out; } diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index 0099415..80294cb 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c @@ -62,7 +62,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *); /* Copy 'src' to 'dest' taking 'scope' into account. Omit addresses * in 'src' which have a broader scope than 'scope'. */ -int sctp_bind_addr_copy(struct sctp_bind_addr *dest, +int sctp_bind_addr_copy(struct sctp_bind_addr *dest, const struct sctp_bind_addr *src, sctp_scope_t scope, gfp_t gfp, int flags) @@ -296,7 +296,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, ********************************************************************/ /* Does this contain a specified address? Allow wildcarding. */ -int sctp_bind_addr_match(struct sctp_bind_addr *bp, +int sctp_bind_addr_match(struct sctp_bind_addr *bp, const union sctp_addr *addr, struct sctp_sock *opt) { @@ -306,7 +306,7 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp, list_for_each(pos, &bp->address_list) { laddr = list_entry(pos, struct sctp_sockaddr_entry, list); if (opt->pf->cmp_addr(&laddr->a, addr, opt)) - return 1; + return 1; } return 0; @@ -329,12 +329,12 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, list_for_each(pos, &bp->address_list) { laddr = list_entry(pos, struct sctp_sockaddr_entry, list); - + addr_buf = (union sctp_addr *)addrs; for (i = 0; i < addrcnt; i++) { addr = (union sctp_addr *)addr_buf; af = sctp_get_af_specific(addr->v4.sin_family); - if (!af) + if (!af) return NULL; if (opt->pf->cmp_addr(&laddr->a, addr, opt)) @@ -350,7 +350,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, } /* Copy out addresses from the global local address list. */ -static int sctp_copy_one_addr(struct sctp_bind_addr *dest, +static int sctp_copy_one_addr(struct sctp_bind_addr *dest, union sctp_addr *addr, sctp_scope_t scope, gfp_t gfp, int flags) diff --git a/net/sctp/crc32c.c b/net/sctp/crc32c.c index 31f05ec..59cf7b0 100644 --- a/net/sctp/crc32c.c +++ b/net/sctp/crc32c.c @@ -1,40 +1,40 @@ /* SCTP kernel reference Implementation * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001-2003 International Business Machines, Corp. - * + * * This file is part of the SCTP kernel reference Implementation - * + * * SCTP Checksum functions - * - * The SCTP reference implementation is free software; - * you can redistribute it and/or modify it under the terms of + * + * The SCTP reference implementation 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, or (at your option) * any later version. - * - * The SCTP reference implementation is distributed in the hope that it + * + * The SCTP reference implementation is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * + * Boston, MA 02111-1307, USA. + * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <lksctp-developers@lists.sourceforge.net> - * + * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * - * Written or modified by: - * Dinakaran Joseph + * Written or modified by: + * Dinakaran Joseph * Jon Grimm <jgrimm@us.ibm.com> * Sridhar Samudrala <sri@us.ibm.com> - * + * * Any bugs reported given to us we will try to fix... any fixes shared will * be incorporated into the next SCTP release. */ @@ -135,10 +135,10 @@ static const __u32 crc_c[256] = { 0x79B737BA, 0x8BDCB4B9, 0x988C474D, 0x6AE7C44E, 0xBE2DA0A5, 0x4C4623A6, 0x5F16D052, 0xAD7D5351, }; - + __u32 sctp_start_cksum(__u8 *buffer, __u16 length) { - __u32 crc32 = ~(__u32) 0; + __u32 crc32 = ~(__u32) 0; __u32 i; /* Optimize this routine to be SCTP specific, knowing how @@ -147,7 +147,7 @@ __u32 sctp_start_cksum(__u8 *buffer, __u16 length) /* Calculate CRC up to the checksum. */ for (i = 0; i < (sizeof(struct sctphdr) - sizeof(__u32)); i++) - CRC32C(crc32, buffer[i]); + CRC32C(crc32, buffer[i]); /* Skip checksum field of the header. */ for (i = 0; i < sizeof(__u32); i++) @@ -175,13 +175,13 @@ __u32 sctp_update_copy_cksum(__u8 *to, __u8 *from, __u16 length, __u32 crc32) __u32 i; __u32 *_to = (__u32 *)to; __u32 *_from = (__u32 *)from; - + for (i = 0; i < (length/4); i++) { _to[i] = _from[i]; CRC32C(crc32, from[i*4]); CRC32C(crc32, from[i*4+1]); CRC32C(crc32, from[i*4+2]); - CRC32C(crc32, from[i*4+3]); + CRC32C(crc32, from[i*4+3]); } return crc32; diff --git a/net/sctp/debug.c b/net/sctp/debug.c index aa83403..5f5ab28 100644 --- a/net/sctp/debug.c +++ b/net/sctp/debug.c @@ -3,48 +3,48 @@ * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001 Intel Corp. - * + * * This file is part of the SCTP kernel reference Implementation - * + * * This file is part of the implementation of the add-IP extension, * based on <draft-ietf-tsvwg-addip-sctp-02.txt> June 29, 2001, * for the SCTP kernel reference Implementation. - * + * * This file converts numerical ID value to alphabetical names for SCTP * terms such as chunk type, parameter time, event type, etc. - * - * The SCTP reference implementation is free software; - * you can redistribute it and/or modify it under the terms of + * + * The SCTP reference implementation 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, or (at your option) * any later version. - * - * The SCTP reference implementation is distributed in the hope that it + * + * The SCTP reference implementation is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * + * Boston, MA 02111-1307, USA. + * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <lksctp-developers@lists.sourceforge.net> - * + * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * - * Written or modified by: + * Written or modified by: * La Monte H.P. Yarroll <piggy@acm.org> * Karl Knutson <karl@athena.chicago.il.us> * Xingang Guo <xingang.guo@intel.com> * Jon Grimm <jgrimm@us.ibm.com> * Daisy Chang <daisyc@us.ibm.com> * Sridhar Samudrala <sri@us.ibm.com> - * + * * Any bugs reported given to us we will try to fix... any fixes shared will * be incorporated into the next SCTP release. */ @@ -81,7 +81,7 @@ const char *sctp_cname(const sctp_subtype_t cid) return "illegal chunk id"; if (cid.chunk <= SCTP_CID_BASE_MAX) return sctp_cid_tbl[cid.chunk]; - + switch (cid.chunk) { case SCTP_CID_ASCONF: return "ASCONF"; @@ -154,7 +154,7 @@ const char *sctp_pname(const sctp_subtype_t id) static const char *sctp_other_tbl[] = { "NO_PENDING_TSN", - "ICMP_PROTO_UNREACH", + "ICMP_PROTO_UNREACH", }; /* Lookup "other" debug name. */ diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 1297569..286a8db 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c @@ -369,7 +369,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work) chunk->transport->last_time_heard = jiffies; error = sctp_do_sm(SCTP_EVENT_T_CHUNK, subtype, state, - ep, asoc, chunk, GFP_ATOMIC); + ep, asoc, chunk, GFP_ATOMIC); if (error && chunk) chunk->pdiscard = 1; diff --git a/net/sctp/input.c b/net/sctp/input.c index 3311187..71db668 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -226,7 +226,7 @@ int sctp_rcv(struct sk_buff *skb) nf_reset(skb); if (sk_filter(sk, skb)) - goto discard_release; + goto discard_release; /* Create an SCTP packet structure. */ chunk = sctp_chunkify(skb, asoc, sk); @@ -293,11 +293,11 @@ discard_release: int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) { struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk; - struct sctp_inq *inqueue = &chunk->rcvr->inqueue; - struct sctp_ep_common *rcvr = NULL; + struct sctp_inq *inqueue = &chunk->rcvr->inqueue; + struct sctp_ep_common *rcvr = NULL; int backloged = 0; - rcvr = chunk->rcvr; + rcvr = chunk->rcvr; /* If the rcvr is dead then the association or endpoint * has been deleted and we can safely drop the chunk @@ -347,7 +347,7 @@ done: else BUG(); - return 0; + return 0; } static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb) @@ -399,7 +399,7 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc, * Normally, if PMTU discovery is disabled, an ICMP Fragmentation * Needed will never be sent, but if a message was sent before * PMTU discovery was disabled that was larger than the PMTU, it - * would not be fragmented, so it must be re-transmitted fragmented. + * would not be fragmented, so it must be re-transmitted fragmented. */ sctp_retransmit(&asoc->outqueue, t, SCTP_RTXR_PMTUD); } @@ -416,8 +416,8 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc, * */ void sctp_icmp_proto_unreachable(struct sock *sk, - struct sctp_association *asoc, - struct sctp_transport *t) + struct sctp_association *asoc, + struct sctp_transport *t) { SCTP_DEBUG_PRINTK("%s\n", __FUNCTION__); diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c index 71b0746..c30629e 100644 --- a/net/sctp/inqueue.c +++ b/net/sctp/inqueue.c @@ -2,43 +2,43 @@ * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2002 International Business Machines, Corp. - * + * * This file is part of the SCTP kernel reference Implementation - * + * * These functions are the methods for accessing the SCTP inqueue. * * An SCTP inqueue is a queue into which you push SCTP packets * (which might be bundles or fragments of chunks) and out of which you * pop SCTP whole chunks. - * - * The SCTP reference implementation is free software; - * you can redistribute it and/or modify it under the terms of + * + * The SCTP reference implementation 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, or (at your option) * any later version. - * - * The SCTP reference implementation is distributed in the hope that it + * + * The SCTP reference implementation is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * + * Boston, MA 02111-1307, USA. + * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <lksctp-developers@lists.sourceforge.net> - * + * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * - * Written or modified by: + * Written or modified by: * La Monte H.P. Yarroll <piggy@acm.org> * Karl Knutson <karl@athena.chicago.il.us> - * + * * Any bugs reported given to us we will try to fix... any fixes shared will * be incorporated into the next SCTP release. */ @@ -152,8 +152,8 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) chunk->data_accepted = 0; } - chunk->chunk_hdr = ch; - chunk->chunk_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); + chunk->chunk_hdr = ch; + chunk->chunk_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); /* In the unlikely case of an IP reassembly, the skb could be * non-linear. If so, update chunk_end so that it doesn't go past * the skb->tail. @@ -169,11 +169,11 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) /* This is not a singleton */ chunk->singleton = 0; } else if (chunk->chunk_end > chunk->skb->tail) { - /* RFC 2960, Section 6.10 Bundling + /* RFC 2960, Section 6.10 Bundling * * Partial chunks MUST NOT be placed in an SCTP packet. * If the receiver detects a partial chunk, it MUST drop - * the chunk. + * the chunk. * * Since the end of the chunk is past the end of our buffer * (which contains the whole packet, we can freely discard diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index ef36be07..01b27fb 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c @@ -236,7 +236,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, ipv6_addr_copy(&fl.fl6_dst, &daddr->v6.sin6_addr); if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) fl.oif = daddr->v6.sin6_scope_id; - + SCTP_DEBUG_PRINTK("%s: DST=" NIP6_FMT " ", __FUNCTION__, NIP6(fl.fl6_dst)); diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c index 8ff588f..fcfb9d8 100644 --- a/net/sctp/objcnt.c +++ b/net/sctp/objcnt.c @@ -1,39 +1,39 @@ /* SCTP kernel reference Implementation * (C) Copyright IBM Corp. 2001, 2004 - * + * * This file is part of the SCTP kernel reference Implementation - * + * * Support for memory object debugging. This allows one to monitor the - * object allocations/deallocations for types instrumented for this - * via the proc fs. - * - * The SCTP reference implementation is free software; - * you can redistribute it and/or modify it under the terms of + * object allocations/deallocations for types instrumented for this + * via the proc fs. + * + * The SCTP reference implementation 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, or (at your option) * any later version. - * - * The SCTP reference implementation is distributed in the hope that it + * + * The SCTP reference implementation is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * + * Boston, MA 02111-1307, USA. + * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <lksctp-developers@lists.sourceforge.net> - * + * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * - * Written or modified by: + * Written or modified by: * Jon Grimm <jgrimm@us.ibm.com> - * + * * Any bugs reported given to us we will try to fix... any fixes shared will * be incorporated into the next SCTP release. */ @@ -121,7 +121,7 @@ done: if (len > length) len = length; - return len; + return len; } /* Initialize the objcount in the proc filesystem. */ @@ -131,7 +131,7 @@ void sctp_dbg_objcnt_init(void) ent = create_proc_read_entry("sctp_dbg_objcnt", 0, proc_net_sctp, sctp_dbg_objcnt_read, NULL); if (!ent) - printk(KERN_WARNING + printk(KERN_WARNING "sctp_dbg_objcnt: Unable to create /proc entry.\n"); } diff --git a/net/sctp/output.c b/net/sctp/output.c index 3ef4351..f875fc3 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -85,8 +85,8 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet, chunk = sctp_get_ecne_prepend(packet->transport->asoc); /* If there a is a prepend chunk stick it on the list before - * any other chunks get appended. - */ + * any other chunks get appended. + */ if (chunk) sctp_packet_append_chunk(packet, chunk); } @@ -110,8 +110,8 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *packet, packet->destination_port = dport; INIT_LIST_HEAD(&packet->chunk_list); if (asoc) { - struct sctp_sock *sp = sctp_sk(asoc->base.sk); - overhead = sp->pf->af->net_header_len; + struct sctp_sock *sp = sctp_sk(asoc->base.sk); + overhead = sp->pf->af->net_header_len; } else { overhead = sizeof(struct ipv6hdr); } @@ -442,7 +442,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) * acknowledged or have failed. */ if (!sctp_chunk_is_data(chunk)) - sctp_chunk_free(chunk); + sctp_chunk_free(chunk); } /* Perform final transformation on checksum. */ @@ -528,7 +528,7 @@ err: list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { list_del_init(&chunk->list); if (!sctp_chunk_is_data(chunk)) - sctp_chunk_free(chunk); + sctp_chunk_free(chunk); } goto out; nomem: diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index fba567a..5c2ddd1 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c @@ -376,7 +376,7 @@ static void sctp_insert_list(struct list_head *head, struct list_head *new) } } if (!done) - list_add_tail(new, head); + list_add_tail(new, head); } /* Mark all the eligible packets on a transport for retransmission. */ @@ -578,7 +578,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, break; case SCTP_XMIT_RWND_FULL: - /* Send this packet. */ + /* Send this packet. */ if ((error = sctp_packet_transmit(pkt)) == 0) *start_timer = 1; @@ -590,7 +590,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, break; case SCTP_XMIT_NAGLE_DELAY: - /* Send this packet. */ + /* Send this packet. */ if ((error = sctp_packet_transmit(pkt)) == 0) *start_timer = 1; @@ -605,7 +605,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, */ list_add_tail(lchunk, &transport->transmitted); - /* Mark the chunk as ineligible for fast retransmit + /* Mark the chunk as ineligible for fast retransmit * after it is retransmitted. */ if (chunk->fast_retransmit > 0) @@ -703,11 +703,11 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) * inactive. * * 3.3.6 Heartbeat Acknowledgement: - * ... + * ... * A HEARTBEAT ACK is always sent to the source IP * address of the IP datagram containing the * HEARTBEAT chunk to which this ack is responding. - * ... + * ... */ if (chunk->chunk_hdr->type != SCTP_CID_HEARTBEAT && chunk->chunk_hdr->type != SCTP_CID_HEARTBEAT_ACK) @@ -914,7 +914,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) BUG(); } - /* BUG: We assume that the sctp_packet_transmit() + /* BUG: We assume that the sctp_packet_transmit() * call below will succeed all the time and add the * chunk to the transmitted list and restart the * timers. @@ -1266,7 +1266,7 @@ static void sctp_check_transmitted(struct sctp_outq *q, * first instance of the packet or a later * instance). */ - if (!tchunk->tsn_gap_acked && + if (!tchunk->tsn_gap_acked && !tchunk->resent && tchunk->rtt_in_progress) { tchunk->rtt_in_progress = 0; @@ -1275,7 +1275,7 @@ static void sctp_check_transmitted(struct sctp_outq *q, rtt); } } - if (TSN_lte(tsn, sack_ctsn)) { + if (TSN_lte(tsn, sack_ctsn)) { /* RFC 2960 6.3.2 Retransmission Timer Rules * * R3) Whenever a SACK is received @@ -1590,7 +1590,7 @@ static void sctp_mark_missing(struct sctp_outq *q, SCTP_DEBUG_PRINTK("%s: transport: %p, cwnd: %d, " "ssthresh: %d, flight_size: %d, pba: %d\n", __FUNCTION__, transport, transport->cwnd, - transport->ssthresh, transport->flight_size, + transport->ssthresh, transport->flight_size, transport->partial_bytes_acked); } } @@ -1603,7 +1603,7 @@ static int sctp_acked(struct sctp_sackhdr *sack, __u32 tsn) __u16 gap; __u32 ctsn = ntohl(sack->cum_tsn_ack); - if (TSN_lte(tsn, ctsn)) + if (TSN_lte(tsn, ctsn)) goto pass; /* 3.3.4 Selective Acknowledgement (SACK) (3): @@ -1657,7 +1657,7 @@ static void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 ctsn) /* PR-SCTP C1) Let SackCumAck be the Cumulative TSN ACK carried in the * received SACK. - * + * * If (Advanced.Peer.Ack.Point < SackCumAck), then update * Advanced.Peer.Ack.Point to be equal to SackCumAck. */ @@ -1671,7 +1671,7 @@ static void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 ctsn) * * Assuming that a SACK arrived with the Cumulative TSN ACK 102 * and the Advanced.Peer.Ack.Point is updated to this value: - * + * * out-queue at the end of ==> out-queue after Adv.Ack.Point * normal SACK processing local advancement * ... ... @@ -1692,7 +1692,7 @@ static void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 ctsn) /* Remove any chunks in the abandoned queue that are acked by * the ctsn. - */ + */ if (TSN_lte(tsn, ctsn)) { list_del_init(lchunk); if (!chunk->tsn_gap_acked) { @@ -1743,7 +1743,7 @@ static void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 ctsn) */ if (asoc->adv_peer_ack_point > ctsn) ftsn_chunk = sctp_make_fwdtsn(asoc, asoc->adv_peer_ack_point, - nskips, &ftsn_skip_arr[0]); + nskips, &ftsn_skip_arr[0]); if (ftsn_chunk) { list_add_tail(&ftsn_chunk->list, &q->control_chunk_list); diff --git a/net/sctp/primitive.c b/net/sctp/primitive.c index 3a7ebfc..1b2976d 100644 --- a/net/sctp/primitive.c +++ b/net/sctp/primitive.c @@ -70,7 +70,7 @@ int sctp_primitive_ ## name(struct sctp_association *asoc, \ \ error = sctp_do_sm(event_type, subtype, state, ep, asoc, \ arg, GFP_KERNEL); \ - return error; \ + return error; \ } /* 10.1 ULP-to-SCTP @@ -207,7 +207,7 @@ DECLARE_PRIMITIVE(REQUESTHEARTBEAT); /* ADDIP * 3.1.1 Address Configuration Change Chunk (ASCONF) -* +* * This chunk is used to communicate to the remote endpoint one of the * configuration change requests that MUST be acknowledged. The * information carried in the ASCONF Chunk uses the form of a diff --git a/net/sctp/proc.c b/net/sctp/proc.c index b3493bd..e93fc1c 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c @@ -77,7 +77,7 @@ static struct snmp_mib sctp_snmp_list[] = { /* Return the current value of a particular entry in the mib by adding its * per cpu counters. - */ + */ static unsigned long fold_field(void *mib[], int nr) { @@ -102,7 +102,7 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v) for (i = 0; sctp_snmp_list[i].name != NULL; i++) seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name, - fold_field((void **)sctp_statistics, + fold_field((void **)sctp_statistics, sctp_snmp_list[i].entry)); return 0; diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 0ef4812..e17a823 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -102,11 +102,11 @@ static __init int sctp_proc_init(void) } if (sctp_snmp_proc_init()) - goto out_nomem; + goto out_nomem; if (sctp_eps_proc_init()) - goto out_nomem; + goto out_nomem; if (sctp_assocs_proc_init()) - goto out_nomem; + goto out_nomem; return 0; @@ -114,7 +114,7 @@ out_nomem: return -ENOMEM; } -/* Clean up the proc fs entry for the SCTP protocol. +/* Clean up the proc fs entry for the SCTP protocol. * Note: Do not make this __exit as it is used in the init error * path. */ @@ -286,7 +286,7 @@ static int sctp_v4_to_addr_param(const union sctp_addr *addr, param->v4.param_hdr.type = SCTP_PARAM_IPV4_ADDRESS; param->v4.param_hdr.length = htons(length); - param->v4.addr.s_addr = addr->v4.sin_addr.s_addr; + param->v4.addr.s_addr = addr->v4.sin_addr.s_addr; return length; } @@ -344,9 +344,9 @@ static int sctp_v4_addr_valid(union sctp_addr *addr, if (IS_IPV4_UNUSABLE_ADDRESS(&addr->v4.sin_addr.s_addr)) return 0; - /* Is this a broadcast address? */ - if (skb && ((struct rtable *)skb->dst)->rt_flags & RTCF_BROADCAST) - return 0; + /* Is this a broadcast address? */ + if (skb && ((struct rtable *)skb->dst)->rt_flags & RTCF_BROADCAST) + return 0; return 1; } @@ -494,7 +494,7 @@ out_unlock: out: if (dst) SCTP_DEBUG_PRINTK("rt_dst:%u.%u.%u.%u, rt_src:%u.%u.%u.%u\n", - NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_src)); + NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_src)); else SCTP_DEBUG_PRINTK("NO ROUTE\n"); @@ -517,14 +517,14 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc, if (rt) { saddr->v4.sin_family = AF_INET; saddr->v4.sin_port = htons(asoc->base.bind_addr.port); - saddr->v4.sin_addr.s_addr = rt->rt_src; + saddr->v4.sin_addr.s_addr = rt->rt_src; } } /* What interface did this skb arrive on? */ static int sctp_v4_skb_iif(const struct sk_buff *skb) { - return ((struct rtable *)skb->dst)->rt_iif; + return ((struct rtable *)skb->dst)->rt_iif; } /* Was this packet marked by Explicit Congestion Notification? */ @@ -569,7 +569,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk, newinet->dport = htons(asoc->peer.port); newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr; newinet->pmtudisc = inet->pmtudisc; - newinet->id = asoc->next_tsn ^ jiffies; + newinet->id = asoc->next_tsn ^ jiffies; newinet->uc_ttl = -1; newinet->mc_loop = 1; diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 7834818..f7fb29d 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -118,7 +118,7 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, int padlen; __u16 len; - /* Cause code constants are now defined in network order. */ + /* Cause code constants are now defined in network order. */ err.cause = cause_code; len = sizeof(sctp_errhdr_t) + paylen; padlen = len % 4; @@ -295,11 +295,11 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, */ chunksize = sizeof(initack) + addrs_len + cookie_len + unkparam_len; - /* Tell peer that we'll do ECN only if peer advertised such cap. */ + /* Tell peer that we'll do ECN only if peer advertised such cap. */ if (asoc->peer.ecn_capable) chunksize += sizeof(ecap_param); - /* Tell peer that we'll do PR-SCTP only if peer advertised. */ + /* Tell peer that we'll do PR-SCTP only if peer advertised. */ if (asoc->peer.prsctp_capable) chunksize += sizeof(prsctp_param); @@ -728,7 +728,7 @@ struct sctp_chunk *sctp_make_shutdown_complete( if (retval && chunk) retval->transport = chunk->transport; - return retval; + return retval; } /* Create an ABORT. Note that we set the T bit if we have no @@ -844,7 +844,7 @@ err_chunk: return retval; } -/* Make an ABORT chunk with a PROTOCOL VIOLATION cause code. */ +/* Make an ABORT chunk with a PROTOCOL VIOLATION cause code. */ struct sctp_chunk *sctp_make_abort_violation( const struct sctp_association *asoc, const struct sctp_chunk *chunk, @@ -1264,8 +1264,8 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, /* Header size is static data prior to the actual cookie, including * any padding. */ - headersize = sizeof(sctp_paramhdr_t) + - (sizeof(struct sctp_signed_cookie) - + headersize = sizeof(sctp_paramhdr_t) + + (sizeof(struct sctp_signed_cookie) - sizeof(struct sctp_cookie)); bodysize = sizeof(struct sctp_cookie) + ntohs(init_chunk->chunk_hdr->length) + addrs_len; @@ -1314,7 +1314,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, memcpy((__u8 *)&cookie->c.peer_init[0] + ntohs(init_chunk->chunk_hdr->length), raw_addrs, addrs_len); - if (sctp_sk(ep->base.sk)->hmac) { + if (sctp_sk(ep->base.sk)->hmac) { struct hash_desc desc; /* Sign the message. */ @@ -1323,8 +1323,8 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, sg.length = bodysize; keylen = SCTP_SECRET_SIZE; key = (char *)ep->secret_key[ep->current_key]; - desc.tfm = sctp_sk(ep->base.sk)->hmac; - desc.flags = 0; + desc.tfm = sctp_sk(ep->base.sk)->hmac; + desc.flags = 0; if (crypto_hash_setkey(desc.tfm, key, keylen) || crypto_hash_digest(&desc, &sg, bodysize, cookie->signature)) @@ -1364,7 +1364,7 @@ struct sctp_association *sctp_unpack_cookie( * any padding. */ headersize = sizeof(sctp_chunkhdr_t) + - (sizeof(struct sctp_signed_cookie) - + (sizeof(struct sctp_signed_cookie) - sizeof(struct sctp_cookie)); bodysize = ntohs(chunk->chunk_hdr->length) - headersize; fixed_size = headersize + sizeof(struct sctp_cookie); @@ -1592,7 +1592,7 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc, struct sctp_chunk **errp) { char error[] = "The following parameter had invalid length:"; - size_t payload_len = WORD_ROUND(sizeof(error)) + + size_t payload_len = WORD_ROUND(sizeof(error)) + sizeof(sctp_paramhdr_t); @@ -1751,7 +1751,7 @@ static int sctp_verify_param(const struct sctp_association *asoc, case SCTP_PARAM_FWD_TSN_SUPPORT: if (sctp_prsctp_enable) break; - /* Fall Through */ + /* Fall Through */ default: SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", ntohs(param.p->type), cid); @@ -1860,7 +1860,7 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, sctp_walk_params(param, peer_init, init_hdr.params) { if (!sctp_process_param(asoc, param, peer_addr, gfp)) - goto clean_up; + goto clean_up; } /* Walk list of transports, removing transports in the UNKNOWN state. */ @@ -1936,7 +1936,7 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, */ /* Allocate storage for the negotiated streams if it is not a temporary - * association. + * association. */ if (!asoc->temp) { int assoc_id; @@ -2108,7 +2108,7 @@ static int sctp_process_param(struct sctp_association *asoc, asoc->peer.prsctp_capable = 1; break; } - /* Fall Through */ + /* Fall Through */ default: /* Any unrecognized parameters should have been caught * and handled by sctp_verify_param() which should be @@ -2167,7 +2167,7 @@ __u32 sctp_generate_tsn(const struct sctp_endpoint *ep) * | ASCONF Parameter #N | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * Address Parameter and other parameter will not be wrapped in this function + * Address Parameter and other parameter will not be wrapped in this function */ static struct sctp_chunk *sctp_make_asconf(struct sctp_association *asoc, union sctp_addr *addr, @@ -2289,7 +2289,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, * | Address Parameter | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * Create an ASCONF chunk with Set Primary IP address parameter. + * Create an ASCONF chunk with Set Primary IP address parameter. */ struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, union sctp_addr *addr) @@ -2338,7 +2338,7 @@ struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, * | ASCONF Parameter Response#N | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * Create an ASCONF_ACK chunk with enough space for the parameter responses. + * Create an ASCONF_ACK chunk with enough space for the parameter responses. */ static struct sctp_chunk *sctp_make_asconf_ack(const struct sctp_association *asoc, __u32 serial, int vparam_len) @@ -2380,7 +2380,7 @@ static void sctp_add_asconf_response(struct sctp_chunk *chunk, __be32 crr_id, ntohs(asconf_param->param_hdr.length); } - /* Add Success Indication or Error Cause Indication parameter. */ + /* Add Success Indication or Error Cause Indication parameter. */ ack_param.param_hdr.type = response_type; ack_param.param_hdr.length = htons(sizeof(ack_param) + err_param_len + @@ -2423,11 +2423,11 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, switch (asconf_param->param_hdr.type) { case SCTP_PARAM_ADD_IP: /* ADDIP 4.3 D9) If an endpoint receives an ADD IP address - * request and does not have the local resources to add this - * new address to the association, it MUST return an Error - * Cause TLV set to the new error code 'Operation Refused - * Due to Resource Shortage'. - */ + * request and does not have the local resources to add this + * new address to the association, it MUST return an Error + * Cause TLV set to the new error code 'Operation Refused + * Due to Resource Shortage'. + */ peer = sctp_assoc_add_peer(asoc, &addr, GFP_ATOMIC, SCTP_UNCONFIRMED); if (!peer) @@ -2439,10 +2439,10 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, break; case SCTP_PARAM_DEL_IP: /* ADDIP 4.3 D7) If a request is received to delete the - * last remaining IP address of a peer endpoint, the receiver - * MUST send an Error Cause TLV with the error cause set to the - * new error code 'Request to Delete Last Remaining IP Address'. - */ + * last remaining IP address of a peer endpoint, the receiver + * MUST send an Error Cause TLV with the error cause set to the + * new error code 'Request to Delete Last Remaining IP Address'. + */ pos = asoc->peer.transport_addr_list.next; if (pos->next == &asoc->peer.transport_addr_list) return SCTP_ERROR_DEL_LAST_IP; @@ -2474,7 +2474,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, return SCTP_ERROR_NO_ERROR; } -/* Process an incoming ASCONF chunk with the next expected serial no. and +/* Process an incoming ASCONF chunk with the next expected serial no. and * return an ASCONF_ACK chunk to be sent in response. */ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, @@ -2494,19 +2494,19 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, hdr = (sctp_addiphdr_t *)asconf->skb->data; serial = ntohl(hdr->serial); - /* Skip the addiphdr and store a pointer to address parameter. */ + /* Skip the addiphdr and store a pointer to address parameter. */ length = sizeof(sctp_addiphdr_t); addr_param = (union sctp_addr_param *)(asconf->skb->data + length); chunk_len -= length; /* Skip the address parameter and store a pointer to the first * asconf paramter. - */ + */ length = ntohs(addr_param->v4.param_hdr.length); asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); chunk_len -= length; - /* create an ASCONF_ACK chunk. + /* create an ASCONF_ACK chunk. * Based on the definitions of parameters, we know that the size of * ASCONF_ACK parameters are less than or equal to the twice of ASCONF * paramters. @@ -2537,7 +2537,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, /* ADDIP 4.3 D11) When an endpoint receiving an ASCONF to add * an IP address sends an 'Out of Resource' in its response, it * MUST also fail any subsequent add or delete requests bundled - * in the ASCONF. + * in the ASCONF. */ if (SCTP_ERROR_RSRC_LOW == err_code) goto done; @@ -2548,12 +2548,12 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, length); chunk_len -= length; } - + done: asoc->peer.addip_serial++; /* If we are sending a new ASCONF_ACK hold a reference to it in assoc - * after freeing the reference to old asconf ack if any. + * after freeing the reference to old asconf ack if any. */ if (asconf_ack) { if (asoc->addip_last_asconf_ack) @@ -2621,7 +2621,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc, /* Get the corresponding ASCONF response error code from the ASCONF_ACK chunk * for the given asconf parameter. If there is no response for this parameter, - * return the error code based on the third argument 'no_err'. + * return the error code based on the third argument 'no_err'. * ADDIP 4.1 * A7) If an error response is received for a TLV parameter, all TLVs with no * response before the failed TLV are considered successful if not reported. @@ -2645,7 +2645,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, /* Skip the addiphdr from the asconf_ack chunk and store a pointer to * the first asconf_ack parameter. - */ + */ length = sizeof(sctp_addiphdr_t); asconf_ack_param = (sctp_addip_param_t *)(asconf_ack->skb->data + length); @@ -2696,14 +2696,14 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, /* Skip the chunkhdr and addiphdr from the last asconf sent and store * a pointer to address parameter. - */ + */ length = sizeof(sctp_addip_chunk_t); addr_param = (union sctp_addr_param *)(asconf->skb->data + length); asconf_len -= length; /* Skip the address parameter in the last asconf sent and store a * pointer to the first asconf paramter. - */ + */ length = ntohs(addr_param->v4.param_hdr.length); asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); asconf_len -= length; @@ -2740,7 +2740,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, case SCTP_ERROR_INV_PARAM: /* Disable sending this type of asconf parameter in * future. - */ + */ asoc->peer.addip_disabled_mask |= asconf_param->param_hdr.type; break; @@ -2754,7 +2754,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, /* Skip the processed asconf parameter and move to the next * one. - */ + */ length = ntohs(asconf_param->param_hdr.length); asconf_param = (sctp_addip_param_t *)((void *)asconf_param + length); @@ -2783,14 +2783,14 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, return retval; } -/* Make a FWD TSN chunk. */ +/* Make a FWD TSN chunk. */ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, __u32 new_cum_tsn, size_t nstreams, struct sctp_fwdtsn_skip *skiplist) { struct sctp_chunk *retval = NULL; struct sctp_fwdtsn_chunk *ftsn_chunk; - struct sctp_fwdtsn_hdr ftsn_hdr; + struct sctp_fwdtsn_hdr ftsn_hdr; struct sctp_fwdtsn_skip skip; size_t hint; int i; diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 6db77d1..1355674 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -61,7 +61,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, struct sctp_endpoint *ep, struct sctp_association *asoc, void *event_arg, - sctp_disposition_t status, + sctp_disposition_t status, sctp_cmd_seq_t *commands, gfp_t gfp); static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, @@ -78,7 +78,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, ********************************************************************/ /* A helper function for delayed processing of INET ECN CE bit. */ -static void sctp_do_ecn_ce_work(struct sctp_association *asoc, +static void sctp_do_ecn_ce_work(struct sctp_association *asoc, __u32 lowest_tsn) { /* Save the TSN away for comparison when we receive CWR */ @@ -160,7 +160,7 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force, struct sctp_transport *trans = asoc->peer.last_data_from; int error = 0; - if (force || + if (force || (!trans && (asoc->param_flags & SPP_SACKDELAY_DISABLE)) || (trans && (trans->param_flags & SPP_SACKDELAY_DISABLE))) asoc->peer.sack_needed = 1; @@ -178,7 +178,7 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force, * [This is actually not mentioned in Section 6, but we * implement it here anyway. --piggy] */ - if (max_tsn_seen != ctsn) + if (max_tsn_seen != ctsn) asoc->peer.sack_needed = 1; /* From 6.2 Acknowledgement on Reception of DATA Chunks: @@ -199,10 +199,10 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force, * for the association. */ if (trans) - asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = + asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = trans->sackdelay; else - asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = + asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; /* Restart the SACK timer. */ @@ -338,8 +338,8 @@ static void sctp_generate_t4_rto_event(unsigned long data) static void sctp_generate_t5_shutdown_guard_event(unsigned long data) { - struct sctp_association *asoc = (struct sctp_association *)data; - sctp_generate_timeout_event(asoc, + struct sctp_association *asoc = (struct sctp_association *)data; + sctp_generate_timeout_event(asoc, SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD); } /* sctp_generate_t5_shutdown_guard_event() */ @@ -380,7 +380,7 @@ void sctp_generate_heartbeat_event(unsigned long data) asoc->state, asoc->ep, asoc, transport, GFP_ATOMIC); - if (error) + if (error) asoc->base.sk->sk_err = -error; out_unlock: @@ -570,7 +570,7 @@ static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds, /* Helper function to stop any pending T3-RTX timers */ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds, - struct sctp_association *asoc) + struct sctp_association *asoc) { struct sctp_transport *t; struct list_head *pos; @@ -675,7 +675,7 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds, /* Helper function to set the timeout value for T2-SHUTDOWN timer and to set * the transport for a shutdown chunk. */ -static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds, +static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds, struct sctp_association *asoc, struct sctp_chunk *chunk) { @@ -688,7 +688,7 @@ static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds, } /* Helper function to change the state of an association. */ -static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, +static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, struct sctp_association *asoc, sctp_state_t state) { @@ -727,7 +727,7 @@ static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, sctp_state(asoc, SHUTDOWN_RECEIVED)) { /* Wake up any processes waiting in the asoc's wait queue in * sctp_wait_for_connect() or sctp_wait_for_sndbuf(). - */ + */ if (waitqueue_active(&asoc->wait)) wake_up_interruptible(&asoc->wait); @@ -749,9 +749,9 @@ static void sctp_cmd_delete_tcb(sctp_cmd_seq_t *cmds, struct sock *sk = asoc->base.sk; /* If it is a non-temporary association belonging to a TCP-style - * listening socket that is not closed, do not free it so that accept() + * listening socket that is not closed, do not free it so that accept() * can pick it up later. - */ + */ if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING) && (!asoc->temp) && (sk->sk_shutdown != SHUTDOWN_MASK)) return; @@ -764,7 +764,7 @@ static void sctp_cmd_delete_tcb(sctp_cmd_seq_t *cmds, * ADDIP Section 4.1 ASCONF Chunk Procedures * A4) Start a T-4 RTO timer, using the RTO value of the selected * destination address (we use active path instead of primary path just - * because primary path may be inactive. + * because primary path may be inactive. */ static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds, struct sctp_association *asoc, @@ -777,7 +777,7 @@ static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds, chunk->transport = t; } -/* Process an incoming Operation Error Chunk. */ +/* Process an incoming Operation Error Chunk. */ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds, struct sctp_association *asoc, struct sctp_chunk *chunk) @@ -816,7 +816,7 @@ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds, } /* Process variable FWDTSN chunk information. */ -static void sctp_cmd_process_fwdtsn(struct sctp_ulpq *ulpq, +static void sctp_cmd_process_fwdtsn(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk) { struct sctp_fwdtsn_skip *skip; @@ -828,9 +828,9 @@ static void sctp_cmd_process_fwdtsn(struct sctp_ulpq *ulpq, return; } -/* Helper function to remove the association non-primary peer +/* Helper function to remove the association non-primary peer * transports. - */ + */ static void sctp_cmd_del_non_primary(struct sctp_association *asoc) { struct sctp_transport *t; @@ -840,7 +840,7 @@ static void sctp_cmd_del_non_primary(struct sctp_association *asoc) list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { t = list_entry(pos, struct sctp_transport, transports); if (!sctp_cmp_addr_exact(&t->ipaddr, - &asoc->peer.primary_addr)) { + &asoc->peer.primary_addr)) { sctp_assoc_del_peer(asoc, &t->ipaddr); } } @@ -915,7 +915,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, DEBUG_POST; error = sctp_side_effects(event_type, subtype, state, - ep, asoc, event_arg, status, + ep, asoc, event_arg, status, &commands, gfp); DEBUG_POST_SFX; @@ -968,7 +968,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, error = -ENOMEM; break; - case SCTP_DISPOSITION_DELETE_TCB: + case SCTP_DISPOSITION_DELETE_TCB: /* This should now be a command. */ break; @@ -1021,7 +1021,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, struct sctp_endpoint *ep, struct sctp_association *asoc, void *event_arg, - sctp_disposition_t status, + sctp_disposition_t status, sctp_cmd_seq_t *commands, gfp_t gfp) { @@ -1057,7 +1057,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, case SCTP_CMD_NEW_ASOC: /* Register a new association. */ if (local_cork) { - sctp_outq_uncork(&asoc->outqueue); + sctp_outq_uncork(&asoc->outqueue); local_cork = 0; } asoc = cmd->obj.ptr; @@ -1074,7 +1074,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, sctp_outq_teardown(&asoc->outqueue); break; - case SCTP_CMD_DELETE_TCB: + case SCTP_CMD_DELETE_TCB: if (local_cork) { sctp_outq_uncork(&asoc->outqueue); local_cork = 0; @@ -1104,7 +1104,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, case SCTP_CMD_PROCESS_FWDTSN: sctp_cmd_process_fwdtsn(&asoc->ulpq, cmd->obj.ptr); - break; + break; case SCTP_CMD_GEN_SACK: /* Generate a Selective ACK. @@ -1162,12 +1162,12 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, SCTP_CHUNK(cmd->obj.ptr)); /* FIXME - Eventually come up with a cleaner way to - * enabling COOKIE-ECHO + DATA bundling during - * multihoming stale cookie scenarios, the following - * command plays with asoc->peer.retran_path to - * avoid the problem of sending the COOKIE-ECHO and - * DATA in different paths, which could result - * in the association being ABORTed if the DATA chunk + * enabling COOKIE-ECHO + DATA bundling during + * multihoming stale cookie scenarios, the following + * command plays with asoc->peer.retran_path to + * avoid the problem of sending the COOKIE-ECHO and + * DATA in different paths, which could result + * in the association being ABORTed if the DATA chunk * is processed first by the server. Checking the * init error counter simply causes this command * to be executed only during failed attempts of @@ -1177,7 +1177,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, asoc->peer.primary_path) && (asoc->init_err_counter > 0)) { sctp_add_cmd_sf(commands, - SCTP_CMD_FORCE_PRIM_RETRAN, + SCTP_CMD_FORCE_PRIM_RETRAN, SCTP_NULL()); } diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index fbbc9e6..b3cad8a 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -189,7 +189,7 @@ sctp_disposition_t sctp_sf_do_4_C(const struct sctp_endpoint *ep, 0, 0, 0, GFP_ATOMIC); if (ev) sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, - SCTP_ULPEVENT(ev)); + SCTP_ULPEVENT(ev)); /* Upon reception of the SHUTDOWN COMPLETE chunk the endpoint * will verify that it is in SHUTDOWN-ACK-SENT state, if it is @@ -228,7 +228,7 @@ sctp_disposition_t sctp_sf_do_4_C(const struct sctp_endpoint *ep, * Verification Tag field to Tag_A, and also provide its own * Verification Tag (Tag_Z) in the Initiate Tag field. * - * Verification Tag: Must be 0. + * Verification Tag: Must be 0. * * Inputs * (endpoint, asoc, chunk) @@ -256,7 +256,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep, /* 6.10 Bundling * An endpoint MUST NOT bundle INIT, INIT ACK or * SHUTDOWN COMPLETE with any other chunks. - * + * * IG Section 2.11.2 * Furthermore, we require that the receiver of an INIT chunk MUST * enforce these rules by silently discarding an arriving packet @@ -282,7 +282,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep, return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); /* 3.1 A packet containing an INIT chunk MUST have a zero Verification - * Tag. + * Tag. */ if (chunk->sctp_hdr->vtag != 0) return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); @@ -326,7 +326,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep, } } - /* Grab the INIT header. */ + /* Grab the INIT header. */ chunk->subh.init_hdr = (sctp_inithdr_t *)chunk->skb->data; /* Tag the variable length parameters. */ @@ -594,7 +594,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, /* "Decode" the chunk. We have no optional parameters so we * are in good shape. */ - chunk->subh.cookie_hdr = + chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t))) @@ -665,7 +665,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, if (!ev) goto nomem_ev; - /* Sockets API Draft Section 5.3.1.6 + /* Sockets API Draft Section 5.3.1.6 * When a peer sends a Adaptation Layer Indication parameter , SCTP * delivers this notification to inform the application that of the * peers requested adaptation layer. @@ -891,7 +891,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE, SCTP_TRANSPORT(transport)); - return SCTP_DISPOSITION_CONSUME; + return SCTP_DISPOSITION_CONSUME; } /* @@ -1280,7 +1280,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( return sctp_sf_pdiscard(ep, asoc, type, arg, commands); /* 3.1 A packet containing an INIT chunk MUST have a zero Verification - * Tag. + * Tag. */ if (chunk->sctp_hdr->vtag != 0) return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); @@ -1548,7 +1548,7 @@ sctp_disposition_t sctp_sf_do_5_2_3_initack(const struct sctp_endpoint *ep, /* Per the above section, we'll discard the chunk if we have an * endpoint. If this is an OOTB INIT-ACK, treat it as such. */ - if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) + if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) return sctp_sf_ootb(ep, asoc, type, arg, commands); else return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); @@ -1760,9 +1760,9 @@ static sctp_disposition_t sctp_sf_do_dupcook_d(const struct sctp_endpoint *ep, /* Clarification from Implementor's Guide: * D) When both local and remote tags match the endpoint should - * enter the ESTABLISHED state, if it is in the COOKIE-ECHOED state. - * It should stop any cookie timer that may be running and send - * a COOKIE ACK. + * enter the ESTABLISHED state, if it is in the COOKIE-ECHOED state. + * It should stop any cookie timer that may be running and send + * a COOKIE ACK. */ /* Don't accidentally move back into established state. */ @@ -1786,7 +1786,7 @@ static sctp_disposition_t sctp_sf_do_dupcook_d(const struct sctp_endpoint *ep, SCTP_COMM_UP, 0, asoc->c.sinit_num_ostreams, asoc->c.sinit_max_instreams, - GFP_ATOMIC); + GFP_ATOMIC); if (!ev) goto nomem; @@ -1870,7 +1870,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep, /* "Decode" the chunk. We have no optional parameters so we * are in good shape. */ - chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; + chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t))) goto nomem; @@ -1936,7 +1936,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep, default: /* Discard packet for all others. */ retval = sctp_sf_pdiscard(ep, asoc, type, arg, commands); break; - }; + }; /* Delete the tempory new association. */ sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc)); @@ -2083,7 +2083,7 @@ sctp_disposition_t sctp_sf_cookie_echoed_err(const struct sctp_endpoint *ep, */ sctp_walk_errors(err, chunk->chunk_hdr) { if (SCTP_ERROR_STALE_COOKIE == err->cause) - return sctp_sf_do_5_2_6_stale(ep, asoc, type, + return sctp_sf_do_5_2_6_stale(ep, asoc, type, arg, commands); } @@ -2185,10 +2185,10 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep, */ sctp_add_cmd_sf(commands, SCTP_CMD_DEL_NON_PRIMARY, SCTP_NULL()); - /* If we've sent any data bundled with COOKIE-ECHO we will need to - * resend + /* If we've sent any data bundled with COOKIE-ECHO we will need to + * resend */ - sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, + sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, SCTP_TRANSPORT(asoc->peer.primary_path)); /* Cast away the const modifier, as we want to just @@ -2274,7 +2274,7 @@ sctp_disposition_t sctp_sf_do_9_1_abort(const struct sctp_endpoint *ep, error = ((sctp_errhdr_t *)chunk->skb->data)->cause; sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET)); - /* ASSOC_FAILED will DELETE_TCB. */ + /* ASSOC_FAILED will DELETE_TCB. */ sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(error)); SCTP_INC_STATS(SCTP_MIB_ABORTEDS); SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); @@ -2439,7 +2439,7 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown(const struct sctp_endpoint *ep, ev = sctp_ulpevent_make_shutdown_event(asoc, 0, GFP_ATOMIC); if (!ev) { disposition = SCTP_DISPOSITION_NOMEM; - goto out; + goto out; } sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); @@ -2553,7 +2553,7 @@ sctp_disposition_t sctp_sf_do_ecn_cwr(const struct sctp_endpoint *ep, if (!sctp_chunk_length_valid(chunk, sizeof(sctp_ecne_chunk_t))) return sctp_sf_violation_chunklen(ep, asoc, type, arg, commands); - + cwr = (sctp_cwrhdr_t *) chunk->skb->data; skb_pull(chunk->skb, sizeof(sctp_cwrhdr_t)); @@ -2661,7 +2661,7 @@ sctp_disposition_t sctp_sf_eat_data_6_2(const struct sctp_endpoint *ep, sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(ep, asoc, type, arg, commands); - } + } if (!sctp_chunk_length_valid(chunk, sizeof(sctp_data_chunk_t))) return sctp_sf_violation_chunklen(ep, asoc, type, arg, @@ -2743,7 +2743,7 @@ discard_noforce: return SCTP_DISPOSITION_DISCARD; consume: return SCTP_DISPOSITION_CONSUME; - + } /* @@ -2930,7 +2930,7 @@ sctp_disposition_t sctp_sf_tabort_8_4_8(const struct sctp_endpoint *ep, /* Make an ABORT. The T bit will be set if the asoc * is NULL. */ - abort = sctp_make_abort(asoc, chunk, 0); + abort = sctp_make_abort(asoc, chunk, 0); if (!abort) { sctp_ootb_pkt_free(packet); return SCTP_DISPOSITION_NOMEM; @@ -2994,7 +2994,7 @@ sctp_disposition_t sctp_sf_operr_notify(const struct sctp_endpoint *ep, } sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_OPERR, - SCTP_CHUNK(chunk)); + SCTP_CHUNK(chunk)); } return SCTP_DISPOSITION_CONSUME; @@ -3128,7 +3128,7 @@ sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep, */ if (SCTP_CID_ABORT == ch->type) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); - + ch = (sctp_chunkhdr_t *) ch_end; } while (ch_end < skb->tail); @@ -3175,8 +3175,8 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(const struct sctp_endpoint *ep, if (packet) { /* Make an SHUTDOWN_COMPLETE. - * The T bit will be set if the asoc is NULL. - */ + * The T bit will be set if the asoc is NULL. + */ shut = sctp_make_shutdown_complete(asoc, chunk); if (!shut) { sctp_ootb_pkt_free(packet); @@ -3261,10 +3261,10 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep, /* ADDIP 4.2 C1) Compare the value of the serial number to the value * the endpoint stored in a new association variable - * 'Peer-Serial-Number'. + * 'Peer-Serial-Number'. */ if (serial == asoc->peer.addip_serial + 1) { - /* ADDIP 4.2 C2) If the value found in the serial number is + /* ADDIP 4.2 C2) If the value found in the serial number is * equal to the ('Peer-Serial-Number' + 1), the endpoint MUST * do V1-V5. */ @@ -3285,9 +3285,9 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep, else return SCTP_DISPOSITION_DISCARD; } else { - /* ADDIP 4.2 C4) Otherwise, the ASCONF Chunk is discarded since + /* ADDIP 4.2 C4) Otherwise, the ASCONF Chunk is discarded since * it must be either a stale packet or from an attacker. - */ + */ return SCTP_DISPOSITION_DISCARD; } @@ -3296,7 +3296,7 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep, * being responded to. */ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(asconf_ack)); - + return SCTP_DISPOSITION_CONSUME; } @@ -3307,7 +3307,7 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep, */ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, const struct sctp_association *asoc, - const sctp_subtype_t type, void *arg, + const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *asconf_ack = arg; @@ -3359,7 +3359,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, - SCTP_ERROR(ECONNABORTED)); + SCTP_ERROR(ECONNABORTED)); sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_ASCONF_ACK)); SCTP_INC_STATS(SCTP_MIB_ABORTEDS); @@ -3387,7 +3387,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, */ sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, - SCTP_ERROR(ECONNABORTED)); + SCTP_ERROR(ECONNABORTED)); sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_ASCONF_ACK)); SCTP_INC_STATS(SCTP_MIB_ABORTEDS); @@ -3451,17 +3451,17 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep, sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); if (len > sizeof(struct sctp_fwdtsn_hdr)) - sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, + sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, SCTP_CHUNK(chunk)); - + /* Count this as receiving DATA. */ if (asoc->autoclose) { sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); } - + /* FIXME: For now send a SACK, but DATA processing may - * send another. + * send another. */ sctp_add_cmd_sf(commands, SCTP_CMD_GEN_SACK, SCTP_NOFORCE()); @@ -3511,9 +3511,9 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast( sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); if (len > sizeof(struct sctp_fwdtsn_hdr)) - sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, + sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, SCTP_CHUNK(chunk)); - + /* Go a head and force a SACK, since we are shutting down. */ gen_shutdown: /* Implementor's Guide. @@ -3527,7 +3527,7 @@ gen_shutdown: sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN)); - return SCTP_DISPOSITION_CONSUME; + return SCTP_DISPOSITION_CONSUME; } /* @@ -3706,7 +3706,7 @@ sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep, * if it's length is set to be smaller then the size of sctp_sack_chunk_t. * * We inform the other end by sending an ABORT with a Protocol Violation - * error code. + * error code. * * Section: Not specified * Verification Tag: Nothing to do @@ -3747,7 +3747,7 @@ static sctp_disposition_t sctp_sf_violation_chunklen( SCTP_PERR(SCTP_ERROR_PROTO_VIOLATION)); } else { sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, - SCTP_ERROR(ECONNABORTED)); + SCTP_ERROR(ECONNABORTED)); sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_PROTO_VIOLATION)); SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); @@ -3756,7 +3756,7 @@ static sctp_disposition_t sctp_sf_violation_chunklen( sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL()); SCTP_INC_STATS(SCTP_MIB_ABORTEDS); - + return SCTP_DISPOSITION_ABORT; nomem: @@ -4437,7 +4437,7 @@ sctp_disposition_t sctp_sf_do_9_2_start_shutdown( /* sctp-implguide 2.10 Issues with Heartbeating and failover * * HEARTBEAT ... is discontinued after sending either SHUTDOWN - * or SHUTDOWN-ACK. + * or SHUTDOWN-ACK. */ sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_STOP, SCTP_NULL()); @@ -4515,7 +4515,7 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown_ack( /* sctp-implguide 2.10 Issues with Heartbeating and failover * * HEARTBEAT ... is discontinued after sending either SHUTDOWN - * or SHUTDOWN-ACK. + * or SHUTDOWN-ACK. */ sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_STOP, SCTP_NULL()); @@ -4874,7 +4874,7 @@ sctp_disposition_t sctp_sf_t4_timer_expire( /* ADDIP 4.1 B4) Re-transmit the ASCONF Chunk last sent and if possible * choose an alternate destination address (please refer to RFC2960 * [5] section 6.4.1). An endpoint MUST NOT add new parameters to this - * chunk, it MUST be the same (including its serial number) as the last + * chunk, it MUST be the same (including its serial number) as the last * ASCONF sent. */ sctp_chunk_hold(asoc->addip_last_asconf); @@ -4953,7 +4953,7 @@ sctp_disposition_t sctp_sf_autoclose_timer_expire( /* sctpimpguide-05 Section 2.12.2 * The sender of the SHUTDOWN MAY also start an overall guard timer * 'T5-shutdown-guard' to bound the overall time for shutdown sequence. - */ + */ sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD)); disposition = SCTP_DISPOSITION_CONSUME; @@ -5127,7 +5127,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc vtag = ntohl(init->init_hdr.init_tag); break; } - default: + default: vtag = ntohl(chunk->sctp_hdr->vtag); break; } @@ -5176,7 +5176,7 @@ static void sctp_send_stale_cookie_err(const struct sctp_endpoint *ep, /* Override the OOTB vtag from the cookie. */ cookie = chunk->subh.cookie_hdr; packet->vtag = cookie->c.peer_vtag; - + /* Set the skb to the belonging sock for accounting. */ err_chunk->skb->sk = ep->base.sk; sctp_packet_append_chunk(packet, err_chunk); @@ -5310,7 +5310,7 @@ static int sctp_eat_data(const struct sctp_association *asoc, sctp_add_cmd_sf(commands, SCTP_CMD_PART_DELIVER, SCTP_NULL()); } - /* Spill over rwnd a little bit. Note: While allowed, this spill over + /* Spill over rwnd a little bit. Note: While allowed, this spill over * seems a bit troublesome in that frag_point varies based on * PMTU. In cases, such as loopback, this might be a rather * large spill over. diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index 5f6cc7a..5e54b17 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c @@ -954,7 +954,7 @@ static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][S TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE, }; -static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, +static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, sctp_state_t state) { if (state > SCTP_STATE_MAX) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 388d0fb..536298c 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -381,12 +381,12 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) /* ADDIP Section 4.1.1 Congestion Control of ASCONF Chunks * - * R1) One and only one ASCONF Chunk MAY be in transit and unacknowledged + * R1) One and only one ASCONF Chunk MAY be in transit and unacknowledged * at any one time. If a sender, after sending an ASCONF chunk, decides - * it needs to transfer another ASCONF Chunk, it MUST wait until the + * it needs to transfer another ASCONF Chunk, it MUST wait until the * ASCONF-ACK Chunk returns from the previous ASCONF Chunk before sending a - * subsequent ASCONF. Note this restriction binds each side, so at any - * time two ASCONF may be in-transit on any given association (one sent + * subsequent ASCONF. Note this restriction binds each side, so at any + * time two ASCONF may be in-transit on any given association (one sent * from each endpoint). */ static int sctp_send_asconf(struct sctp_association *asoc, @@ -396,10 +396,10 @@ static int sctp_send_asconf(struct sctp_association *asoc, /* If there is an outstanding ASCONF chunk, queue it for later * transmission. - */ + */ if (asoc->addip_last_asconf) { list_add_tail(&chunk->list, &asoc->addip_chunk_list); - goto out; + goto out; } /* Hold the chunk until an ASCONF_ACK is received. */ @@ -449,7 +449,7 @@ int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) goto err_bindx_add; } - retval = sctp_do_bind(sk, (union sctp_addr *)sa_addr, + retval = sctp_do_bind(sk, (union sctp_addr *)sa_addr, af->sockaddr_len); addr_buf += af->sockaddr_len; @@ -470,13 +470,13 @@ err_bindx_add: * associations that are part of the endpoint indicating that a list of local * addresses are added to the endpoint. * - * If any of the addresses is already in the bind address list of the + * If any of the addresses is already in the bind address list of the * association, we do not send the chunk for that association. But it will not * affect other associations. * * Only sctp_setsockopt_bindx() is supposed to call this function. */ -static int sctp_send_asconf_add_ip(struct sock *sk, +static int sctp_send_asconf_add_ip(struct sock *sk, struct sockaddr *addrs, int addrcnt) { @@ -517,8 +517,8 @@ static int sctp_send_asconf_add_ip(struct sock *sk, continue; /* Check if any address in the packed array of addresses is - * in the bind address list of the association. If so, - * do not send the asconf chunk to its peer, but continue with + * in the bind address list of the association. If so, + * do not send the asconf chunk to its peer, but continue with * other associations. */ addr_buf = addrs; @@ -664,7 +664,7 @@ err_bindx_rem: * the associations that are part of the endpoint indicating that a list of * local addresses are removed from the endpoint. * - * If any of the addresses is already in the bind address list of the + * If any of the addresses is already in the bind address list of the * association, we do not send the chunk for that association. But it will not * affect other associations. * @@ -710,7 +710,7 @@ static int sctp_send_asconf_del_ip(struct sock *sk, continue; /* Check if any address in the packed array of addresses is - * not present in the bind address list of the association. + * not present in the bind address list of the association. * If so, do not send the asconf chunk to its peer, but * continue with other associations. */ @@ -898,7 +898,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, return -EFAULT; } - /* Walk through the addrs buffer and count the number of addresses. */ + /* Walk through the addrs buffer and count the number of addresses. */ addr_buf = kaddrs; while (walk_size < addrs_size) { sa_addr = (struct sockaddr *)addr_buf; @@ -906,7 +906,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, /* If the address family is not supported or if this address * causes the address buffer to overflow return EINVAL. - */ + */ if (!af || (walk_size + af->sockaddr_len) > addrs_size) { kfree(kaddrs); return -EINVAL; @@ -935,7 +935,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, default: err = -EINVAL; break; - }; + }; out: kfree(kaddrs); @@ -1035,10 +1035,10 @@ static int __sctp_connect(struct sock* sk, } } else { /* - * If an unprivileged user inherits a 1-many - * style socket with open associations on a - * privileged port, it MAY be permitted to - * accept new associations, but it SHOULD NOT + * If an unprivileged user inherits a 1-many + * style socket with open associations on a + * privileged port, it MAY be permitted to + * accept new associations, but it SHOULD NOT * be permitted to open new associations. */ if (ep->base.bind_addr.port < PROT_SOCK && @@ -1094,8 +1094,8 @@ static int __sctp_connect(struct sock* sk, out_free: SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p" - " kaddrs: %p err: %d\n", - asoc, kaddrs, err); + " kaddrs: %p err: %d\n", + asoc, kaddrs, err); if (asoc) sctp_association_free(asoc); return err; @@ -1435,7 +1435,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, * length messages when SCTP_EOF|SCTP_ABORT is not set. * If SCTP_ABORT is set, the message length could be non zero with * the msg_iov set to the user abort reason. - */ + */ if (((sinfo_flags & SCTP_EOF) && (msg_len > 0)) || (!(sinfo_flags & (SCTP_EOF|SCTP_ABORT)) && (msg_len == 0))) { err = -EINVAL; @@ -1599,7 +1599,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, = sinit->sinit_max_attempts; } if (sinit->sinit_max_init_timeo) { - asoc->max_init_timeo = + asoc->max_init_timeo = msecs_to_jiffies(sinit->sinit_max_init_timeo); } } @@ -2298,7 +2298,7 @@ static int sctp_setsockopt_delayed_ack_time(struct sock *sk, /* Get association, if assoc_id != 0 and the socket is a one * to many style socket, and an association was not found, then * the id was invalid. - */ + */ asoc = sctp_id2assoc(sk, params.assoc_id); if (!asoc && params.assoc_id && sctp_style(sk, UDP)) return -EINVAL; @@ -2307,22 +2307,22 @@ static int sctp_setsockopt_delayed_ack_time(struct sock *sk, if (asoc) { asoc->sackdelay = msecs_to_jiffies(params.assoc_value); - asoc->param_flags = + asoc->param_flags = (asoc->param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_ENABLE; } else { sp->sackdelay = params.assoc_value; - sp->param_flags = + sp->param_flags = (sp->param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_ENABLE; } } else { if (asoc) { - asoc->param_flags = + asoc->param_flags = (asoc->param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_DISABLE; } else { - sp->param_flags = + sp->param_flags = (sp->param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_DISABLE; } @@ -2338,17 +2338,17 @@ static int sctp_setsockopt_delayed_ack_time(struct sock *sk, if (params.assoc_value) { trans->sackdelay = msecs_to_jiffies(params.assoc_value); - trans->param_flags = + trans->param_flags = (trans->param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_ENABLE; } else { - trans->param_flags = + trans->param_flags = (trans->param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_DISABLE; } } } - + return 0; } @@ -2374,13 +2374,13 @@ static int sctp_setsockopt_initmsg(struct sock *sk, char __user *optval, int opt return -EFAULT; if (sinit.sinit_num_ostreams) - sp->initmsg.sinit_num_ostreams = sinit.sinit_num_ostreams; + sp->initmsg.sinit_num_ostreams = sinit.sinit_num_ostreams; if (sinit.sinit_max_instreams) - sp->initmsg.sinit_max_instreams = sinit.sinit_max_instreams; + sp->initmsg.sinit_max_instreams = sinit.sinit_max_instreams; if (sinit.sinit_max_attempts) - sp->initmsg.sinit_max_attempts = sinit.sinit_max_attempts; + sp->initmsg.sinit_max_attempts = sinit.sinit_max_attempts; if (sinit.sinit_max_init_timeo) - sp->initmsg.sinit_max_init_timeo = sinit.sinit_max_init_timeo; + sp->initmsg.sinit_max_init_timeo = sinit.sinit_max_init_timeo; return 0; } @@ -2511,7 +2511,7 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, int opt if (asoc) { if (rtoinfo.srto_initial != 0) - asoc->rto_initial = + asoc->rto_initial = msecs_to_jiffies(rtoinfo.srto_initial); if (rtoinfo.srto_max != 0) asoc->rto_max = msecs_to_jiffies(rtoinfo.srto_max); @@ -2665,7 +2665,7 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optl /* Update the frag_point of the existing associations. */ list_for_each(pos, &(sp->ep->asocs)) { asoc = list_entry(pos, struct sctp_association, asocs); - asoc->frag_point = sctp_frag_point(sp, asoc->pathmtu); + asoc->frag_point = sctp_frag_point(sp, asoc->pathmtu); } return 0; @@ -2703,7 +2703,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva return -EFAULT; asoc = sctp_id2assoc(sk, prim.sspp_assoc_id); - if (!asoc) + if (!asoc) return -EINVAL; if (!asoc->peer.asconf_capable) @@ -3015,7 +3015,7 @@ SCTP_STATIC struct sock *sctp_accept(struct sock *sk, int flags, int *err) out: sctp_release_sock(sk); - *err = error; + *err = error; return newsk; } @@ -3087,7 +3087,7 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) sp->assocparams.sasoc_cookie_life = sctp_valid_cookie_life; /* Initialize default event subscriptions. By default, all the - * options are off. + * options are off. */ memset(&sp->subscribe, 0, sizeof(struct sctp_event_subscribe)); @@ -3099,8 +3099,8 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) sp->pathmtu = 0; // allow default discovery sp->sackdelay = sctp_sack_timeout; sp->param_flags = SPP_HB_ENABLE | - SPP_PMTUD_ENABLE | - SPP_SACKDELAY_ENABLE; + SPP_PMTUD_ENABLE | + SPP_SACKDELAY_ENABLE; /* If enabled no SCTP message fragmentation will be performed. * Configure through SCTP_DISABLE_FRAGMENTS socket option. @@ -3680,7 +3680,7 @@ static int sctp_getsockopt_delayed_ack_time(struct sock *sk, int len, /* Get association, if assoc_id != 0 and the socket is a one * to many style socket, and an association was not found, then * the id was invalid. - */ + */ asoc = sctp_id2assoc(sk, params.assoc_id); if (!asoc && params.assoc_id && sctp_style(sk, UDP)) return -EINVAL; @@ -3756,7 +3756,7 @@ static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len, return cnt; } -/* +/* * Old API for getting list of peer addresses. Does not work for 32-bit * programs running on a 64-bit kernel */ @@ -3833,7 +3833,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, return -EINVAL; to = optval + offsetof(struct sctp_getaddrs,addrs); - space_left = len - sizeof(struct sctp_getaddrs) - + space_left = len - sizeof(struct sctp_getaddrs) - offsetof(struct sctp_getaddrs,addrs); list_for_each(pos, &asoc->peer.transport_addr_list) { @@ -3907,7 +3907,7 @@ static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len, addr = list_entry(pos, struct sctp_sockaddr_entry, list); - if ((PF_INET == sk->sk_family) && + if ((PF_INET == sk->sk_family) && (AF_INET6 == addr->a.sa.sa_family)) continue; cnt++; @@ -3941,7 +3941,7 @@ static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_add list_for_each_safe(pos, next, &sctp_local_addr_list) { addr = list_entry(pos, struct sctp_sockaddr_entry, list); - if ((PF_INET == sk->sk_family) && + if ((PF_INET == sk->sk_family) && (AF_INET6 == addr->a.sa.sa_family)) continue; memcpy(&temp, &addr->a, sizeof(temp)); @@ -3970,7 +3970,7 @@ static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, list_for_each_safe(pos, next, &sctp_local_addr_list) { addr = list_entry(pos, struct sctp_sockaddr_entry, list); - if ((PF_INET == sk->sk_family) && + if ((PF_INET == sk->sk_family) && (AF_INET6 == addr->a.sa.sa_family)) continue; memcpy(&temp, &addr->a, sizeof(temp)); @@ -4051,7 +4051,7 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, err = cnt; goto unlock; } - goto copy_getaddrs; + goto copy_getaddrs; } } @@ -4139,7 +4139,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, err = cnt; goto unlock; } - goto copy_getaddrs; + goto copy_getaddrs; } } @@ -4196,7 +4196,7 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len, if (!asoc->peer.primary_path) return -ENOTCONN; - + memcpy(&prim.ssp_addr, &asoc->peer.primary_path->ipaddr, asoc->peer.primary_path->af_specific->sockaddr_len); @@ -4864,7 +4864,7 @@ SCTP_STATIC int sctp_seqpacket_listen(struct sock *sk, int backlog) if (!backlog) { if (sctp_sstate(sk, CLOSED)) return 0; - + sctp_unhash_endpoint(ep); sk->sk_state = SCTP_SS_CLOSED; } @@ -4872,7 +4872,7 @@ SCTP_STATIC int sctp_seqpacket_listen(struct sock *sk, int backlog) /* Return if we are already listening. */ if (sctp_sstate(sk, LISTENING)) return 0; - + /* * If a bind() or sctp_bindx() is not called prior to a listen() * call that allows new associations to be accepted, the system @@ -4907,7 +4907,7 @@ SCTP_STATIC int sctp_stream_listen(struct sock *sk, int backlog) if (!backlog) { if (sctp_sstate(sk, CLOSED)) return 0; - + sctp_unhash_endpoint(ep); sk->sk_state = SCTP_SS_CLOSED; } @@ -5010,7 +5010,7 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait) */ if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) return (!list_empty(&sp->ep->asocs)) ? - (POLLIN | POLLRDNORM) : 0; + (POLLIN | POLLRDNORM) : 0; mask = 0; @@ -5430,7 +5430,7 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, DEFINE_WAIT(wait); SCTP_DEBUG_PRINTK("wait_for_sndbuf: asoc=%p, timeo=%ld, msg_len=%zu\n", - asoc, (long)(*timeo_p), msg_len); + asoc, (long)(*timeo_p), msg_len); /* Increment the association's refcnt. */ sctp_association_hold(asoc); diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 3e5936a..a596f53 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c @@ -130,9 +130,9 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, struct sctp_transport *sctp_transport_new(const union sctp_addr *addr, gfp_t gfp) { - struct sctp_transport *transport; + struct sctp_transport *transport; - transport = t_new(struct sctp_transport, gfp); + transport = t_new(struct sctp_transport, gfp); if (!transport) goto fail; @@ -185,7 +185,7 @@ static void sctp_transport_destroy(struct sctp_transport *transport) if (transport->asoc) sctp_association_put(transport->asoc); - sctp_packet_free(&transport->packet); + sctp_packet_free(&transport->packet); dst_release(transport->dst); kfree(transport); @@ -268,7 +268,7 @@ void sctp_transport_route(struct sctp_transport *transport, /* Initialize sk->sk_rcv_saddr, if the transport is the * association's active path for getsockname(). - */ + */ if (asoc && (transport == asoc->peer.active_path)) opt->pf->af->to_sk_saddr(&transport->saddr, asoc->base.sk); @@ -459,8 +459,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, * destination address(es) to which the missing DATA chunks * were last sent, according to the formula described in * Section 7.2.3. - * - * RFC 2960 7.2.3, sctpimpguide Upon detection of packet + * + * RFC 2960 7.2.3, sctpimpguide Upon detection of packet * losses from SACK (see Section 7.2.4), An endpoint * should do the following: * ssthresh = max(cwnd/2, 4*MTU) @@ -488,7 +488,7 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, if ((jiffies - transport->last_time_ecne_reduced) > transport->rtt) { transport->ssthresh = max(transport->cwnd/2, - 4*transport->asoc->pathmtu); + 4*transport->asoc->pathmtu); transport->cwnd = transport->ssthresh; transport->last_time_ecne_reduced = jiffies; } diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c index 42d9498..d3192a1 100644 --- a/net/sctp/tsnmap.c +++ b/net/sctp/tsnmap.c @@ -277,7 +277,7 @@ static void sctp_tsnmap_update(struct sctp_tsnmap *map) /* Now tsn_map must have been all '1's, * so we swap the map and check the overflow table */ - __u8 *tmp = map->tsn_map; + __u8 *tmp = map->tsn_map; memset(tmp, 0, map->len); map->tsn_map = map->overflow_map; map->overflow_map = tmp; diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 445e07a..2e11bc8 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c @@ -749,7 +749,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_pdapi( */ pd->pdapi_length = sizeof(struct sctp_pdapi_event); - /* pdapi_indication: 32 bits (unsigned integer) + /* pdapi_indication: 32 bits (unsigned integer) * * This field holds the indication being sent to the application. */ @@ -790,13 +790,13 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, return; /* Sockets API Extensions for SCTP - * Section 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) - * - * sinfo_stream: 16 bits (unsigned integer) - * - * For recvmsg() the SCTP stack places the message's stream number in - * this value. - */ + * Section 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) + * + * sinfo_stream: 16 bits (unsigned integer) + * + * For recvmsg() the SCTP stack places the message's stream number in + * this value. + */ sinfo.sinfo_stream = event->stream; /* sinfo_ssn: 16 bits (unsigned integer) * @@ -828,7 +828,7 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, sinfo.sinfo_flags = event->flags; /* sinfo_tsn: 32 bit (unsigned integer) * - * For the receiving side, this field holds a TSN that was + * For the receiving side, this field holds a TSN that was * assigned to one of the SCTP Data Chunks. */ sinfo.sinfo_tsn = event->tsn; @@ -879,7 +879,7 @@ static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event, * fragment of the real event. However, we still need to do rwnd * accounting. * In general, the skb passed from IP can have only 1 level of - * fragments. But we allow multiple levels of fragments. + * fragments. But we allow multiple levels of fragments. */ for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next) { sctp_ulpevent_receive_data(sctp_skb2event(frag), asoc); @@ -888,7 +888,7 @@ static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event, /* Do accounting for bytes just read by user and release the references to * the association. - */ + */ static void sctp_ulpevent_release_data(struct sctp_ulpevent *event) { struct sk_buff *skb, *frag; diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c index e1d1442..f4759a9 100644 --- a/net/sctp/ulpqueue.c +++ b/net/sctp/ulpqueue.c @@ -191,7 +191,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event) queue = &sk->sk_receive_queue; } else if (ulpq->pd_mode) { if (event->msg_flags & MSG_NOTIFICATION) - queue = &sctp_sk(sk)->pd_lobby; + queue = &sctp_sk(sk)->pd_lobby; else { clear_pd = event->msg_flags & MSG_EOR; queue = &sk->sk_receive_queue; @@ -298,32 +298,32 @@ static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *qu */ if (last) last->next = pos; - else { - if (skb_cloned(f_frag)) { - /* This is a cloned skb, we can't just modify - * the frag_list. We need a new skb to do that. - * Instead of calling skb_unshare(), we'll do it - * ourselves since we need to delay the free. - */ - new = skb_copy(f_frag, GFP_ATOMIC); - if (!new) - return NULL; /* try again later */ - - sctp_skb_set_owner_r(new, f_frag->sk); - - skb_shinfo(new)->frag_list = pos; - } else - skb_shinfo(f_frag)->frag_list = pos; - } + else { + if (skb_cloned(f_frag)) { + /* This is a cloned skb, we can't just modify + * the frag_list. We need a new skb to do that. + * Instead of calling skb_unshare(), we'll do it + * ourselves since we need to delay the free. + */ + new = skb_copy(f_frag, GFP_ATOMIC); + if (!new) + return NULL; /* try again later */ + + sctp_skb_set_owner_r(new, f_frag->sk); + + skb_shinfo(new)->frag_list = pos; + } else + skb_shinfo(f_frag)->frag_list = pos; + } /* Remove the first fragment from the reassembly queue. */ __skb_unlink(f_frag, queue); - /* if we did unshare, then free the old skb and re-assign */ - if (new) { - kfree_skb(f_frag); - f_frag = new; - } + /* if we did unshare, then free the old skb and re-assign */ + if (new) { + kfree_skb(f_frag); + f_frag = new; + } while (pos) { @@ -335,7 +335,7 @@ static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *qu /* Remove the fragment from the reassembly queue. */ __skb_unlink(pos, queue); - + /* Break if we have reached the last fragment. */ if (pos == l_frag) break; @@ -624,7 +624,7 @@ static inline void sctp_ulpq_store_ordered(struct sctp_ulpq *ulpq, sid = event->stream; ssn = event->ssn; - + cevent = (struct sctp_ulpevent *) pos->cb; csid = cevent->stream; cssn = cevent->ssn; @@ -718,11 +718,11 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq) if (cssn != sctp_ssn_peek(in, csid)) break; - /* Found it, so mark in the ssnmap. */ + /* Found it, so mark in the ssnmap. */ sctp_ssn_next(in, csid); __skb_unlink(pos, &ulpq->lobby); - if (!event) { + if (!event) { /* Create a temporary list to collect chunks on. */ event = sctp_skb2event(pos); __skb_queue_tail(&temp, sctp_event2skb(event)); @@ -755,7 +755,7 @@ void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn) sctp_ssn_skip(in, sid, ssn); /* Go find any other chunks that were waiting for - * ordering and deliver them if needed. + * ordering and deliver them if needed. */ sctp_ulpq_reap_ordered(ulpq); return; @@ -849,7 +849,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, if (chunk) { needed = ntohs(chunk->chunk_hdr->length); needed -= sizeof(sctp_data_chunk_t); - } else + } else needed = SCTP_DEFAULT_MAXWINDOW; freed = 0; @@ -866,7 +866,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, tsn = ntohl(chunk->subh.data_hdr->tsn); sctp_tsnmap_mark(&asoc->peer.tsn_map, tsn); sctp_ulpq_tail_data(ulpq, chunk, gfp); - + sctp_ulpq_partial_delivery(ulpq, chunk, gfp); } diff --git a/net/socket.c b/net/socket.c index 5f374e1..a92f595 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2180,7 +2180,7 @@ done: } int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, - int flags) + int flags) { return sock->ops->connect(sock, addr, addrlen, flags); } diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 993ff1a..76f7eac 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -213,7 +213,7 @@ retry: rpcauth_gc_credcache(auth, &free); hlist_for_each_safe(pos, next, &cache->hashtable[nr]) { struct rpc_cred *entry; - entry = hlist_entry(pos, struct rpc_cred, cr_hash); + entry = hlist_entry(pos, struct rpc_cred, cr_hash); if (entry->cr_ops->crmatch(acred, entry, flags)) { hlist_del(&entry->cr_hash); cred = entry; diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index e1a104a..718fb94 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -2,7 +2,7 @@ * linux/net/sunrpc/auth_gss/auth_gss.c * * RPCSEC_GSS client authentication. - * + * * Copyright (c) 2000 The Regents of the University of Michigan. * All rights reserved. * @@ -74,7 +74,7 @@ static struct rpc_credops gss_credops; * as it is passed to gssd to signal the use of * machine creds should be part of the shared rpc interface */ -#define CA_RUN_AS_MACHINE 0x00000200 +#define CA_RUN_AS_MACHINE 0x00000200 /* dump the buffer in `emacs-hexl' style */ #define isprint(c) ((c > 0x1f) && (c < 0x7f)) @@ -607,8 +607,8 @@ gss_pipe_destroy_msg(struct rpc_pipe_msg *msg) } } -/* - * NOTE: we have the opportunity to use different +/* + * NOTE: we have the opportunity to use different * parameters based on the input flavor (which must be a pseudoflavor) */ static struct rpc_auth * @@ -869,7 +869,7 @@ gss_validate(struct rpc_task *task, __be32 *p) flav = ntohl(*p++); if ((len = ntohl(*p++)) > RPC_MAX_AUTH_SIZE) - goto out_bad; + goto out_bad; if (flav != RPC_AUTH_GSS) goto out_bad; seq = htonl(task->tk_rqstp->rq_seqno); @@ -925,7 +925,7 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, *integ_len = htonl(integ_buf.len); /* guess whether we're in the head or the tail: */ - if (snd_buf->page_len || snd_buf->tail[0].iov_len) + if (snd_buf->page_len || snd_buf->tail[0].iov_len) iov = snd_buf->tail; else iov = snd_buf->head; @@ -1030,7 +1030,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, maj_stat = gss_wrap(ctx->gc_gss_ctx, offset, snd_buf, inpages); /* RPC_SLACK_SPACE should prevent this ever happening: */ BUG_ON(snd_buf->len > snd_buf->buflen); - status = -EIO; + status = -EIO; /* We're assuming that when GSS_S_CONTEXT_EXPIRED, the encryption was * done anyway, so it's safe to put the request on the wire: */ if (maj_stat == GSS_S_CONTEXT_EXPIRED) @@ -1079,7 +1079,7 @@ gss_wrap_req(struct rpc_task *task, status = gss_wrap_req_integ(cred, ctx, encode, rqstp, p, obj); break; - case RPC_GSS_SVC_PRIVACY: + case RPC_GSS_SVC_PRIVACY: status = gss_wrap_req_priv(cred, ctx, encode, rqstp, p, obj); break; @@ -1179,7 +1179,7 @@ gss_unwrap_resp(struct rpc_task *task, if (status) goto out; break; - case RPC_GSS_SVC_PRIVACY: + case RPC_GSS_SVC_PRIVACY: status = gss_unwrap_resp_priv(cred, ctx, rqstp, &p); if (status) goto out; @@ -1196,7 +1196,7 @@ out: status); return status; } - + static struct rpc_authops authgss_ops = { .owner = THIS_MODULE, .au_flavor = RPC_AUTH_GSS, diff --git a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c index 826df44..ea8c92e 100644 --- a/net/sunrpc/auth_gss/gss_generic_token.c +++ b/net/sunrpc/auth_gss/gss_generic_token.c @@ -11,7 +11,7 @@ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -21,7 +21,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -201,7 +201,7 @@ g_verify_token_header(struct xdr_netobj *mech, int *body_size, return(G_BAD_TOK_HEADER); if (*buf++ != 0x06) return(G_BAD_TOK_HEADER); - + if ((toksize-=1) < 0) return(G_BAD_TOK_HEADER); toid.len = *buf++; @@ -211,9 +211,9 @@ g_verify_token_header(struct xdr_netobj *mech, int *body_size, toid.data = buf; buf+=toid.len; - if (! g_OID_equal(&toid, mech)) + if (! g_OID_equal(&toid, mech)) ret = G_WRONG_MECH; - + /* G_WRONG_MECH is not returned immediately because it's more important to return G_BAD_TOK_HEADER if the token header is in fact bad */ diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index d926cda..0a9948d 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -58,7 +58,7 @@ krb5_encrypt( int length) { u32 ret = -EINVAL; - struct scatterlist sg[1]; + struct scatterlist sg[1]; u8 local_iv[16] = {0}; struct blkcipher_desc desc = { .tfm = tfm, .info = local_iv }; @@ -67,7 +67,7 @@ krb5_encrypt( if (crypto_blkcipher_ivsize(tfm) > 16) { dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n", - crypto_blkcipher_ivsize(tfm)); + crypto_blkcipher_ivsize(tfm)); goto out; } diff --git a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c index c604baf..3e315a6 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c +++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c @@ -11,7 +11,7 @@ /* * Copyright 1993 by OpenVision Technologies, Inc. - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and @@ -21,7 +21,7 @@ * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - * + * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index 3db7453..3423890 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c @@ -6,14 +6,14 @@ * * J. Bruce Fields <bfields@umich.edu> * - * Redistribution and use in source and binary forms, with or without + * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the + * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its * contributors may be used to endorse or promote products derived diff --git a/net/sunrpc/auth_gss/gss_spkm3_token.c b/net/sunrpc/auth_gss/gss_spkm3_token.c index 35188b6..8400b62 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_token.c +++ b/net/sunrpc/auth_gss/gss_spkm3_token.c @@ -59,7 +59,7 @@ asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits) /* count trailing 0's */ for(i = in->len; i > 0; i--) { - if (*ptr == 0) { + if (*ptr == 0) { ptr--; elen--; } else @@ -82,7 +82,7 @@ asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits) /* * decode_asn1_bitstring() - * + * * decode a bitstring into a buffer of the expected length. * enclen = bit string length * explen = expected length (define in rfc) @@ -97,9 +97,9 @@ decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen) return 1; } -/* +/* * SPKMInnerContextToken choice SPKM_MIC asn1 token layout - * + * * contextid is always 16 bytes plain data. max asn1 bitstring len = 17. * * tokenlen = pos[0] to end of token (max pos[45] with MD5 cksum) @@ -107,21 +107,21 @@ decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen) * pos value * ---------- * [0] a4 SPKM-MIC tag - * [1] ?? innertoken length (max 44) - * - * - * tok_hdr piece of checksum data starts here + * [1] ?? innertoken length (max 44) + * + * + * tok_hdr piece of checksum data starts here * - * the maximum mic-header len = 9 + 17 = 26 + * the maximum mic-header len = 9 + 17 = 26 * mic-header * ---------- - * [2] 30 SEQUENCE tag - * [3] ?? mic-header length: (max 23) = TokenID + ContextID + * [2] 30 SEQUENCE tag + * [3] ?? mic-header length: (max 23) = TokenID + ContextID * * TokenID - all fields constant and can be hardcoded * ------- * [4] 02 Type 2 - * [5] 02 Length 2 + * [5] 02 Length 2 * [6][7] 01 01 TokenID (SPKM_MIC_TOK) * * ContextID - encoded length not constant, calculated @@ -131,17 +131,17 @@ decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen) * [10] ?? ctxzbit * [11] contextid * - * mic_header piece of checksum data ends here. + * mic_header piece of checksum data ends here. * * int-cksum - encoded length not constant, calculated * --------- * [??] 03 Type 3 - * [??] ?? encoded length - * [??] ?? md5zbit + * [??] ?? encoded length + * [??] ?? md5zbit * [??] int-cksum (NID_md5 = 16) * - * maximum SPKM-MIC innercontext token length = - * 10 + encoded contextid_size(17 max) + 2 + encoded + * maximum SPKM-MIC innercontext token length = + * 10 + encoded contextid_size(17 max) + 2 + encoded * cksum_size (17 maxfor NID_md5) = 46 */ @@ -178,8 +178,8 @@ spkm3_mic_header(unsigned char **hdrbuf, unsigned int *hdrlen, unsigned char *ct /* * spkm3_mic_innercontext_token() * - * *tokp points to the beginning of the SPKM_MIC token described - * in rfc 2025, section 3.2.1: + * *tokp points to the beginning of the SPKM_MIC token described + * in rfc 2025, section 3.2.1: * * toklen is the inner token length */ @@ -209,7 +209,7 @@ spkm3_verify_mic_token(unsigned char **tokp, int *mic_hdrlen, unsigned char **ck /* spkm3 innercontext token preamble */ if ((ptr[0] != 0xa4) || (ptr[2] != 0x30)) { - dprintk("RPC: BAD SPKM ictoken preamble\n"); + dprintk("RPC: BAD SPKM ictoken preamble\n"); goto out; } @@ -245,9 +245,9 @@ spkm3_verify_mic_token(unsigned char **tokp, int *mic_hdrlen, unsigned char **ck goto out; /* - * in the current implementation: the optional int-alg is not present - * so the default int-alg (md5) is used the optional snd-seq field is - * also not present + * in the current implementation: the optional int-alg is not present + * so the default int-alg (md5) is used the optional snd-seq field is + * also not present */ if (*mic_hdrlen != 6 + ctxelen) { @@ -255,7 +255,7 @@ spkm3_verify_mic_token(unsigned char **tokp, int *mic_hdrlen, unsigned char **ck goto out; } /* checksum */ - *cksum = (&ptr[10] + ctxelen); /* ctxelen includes ptr[10] */ + *cksum = (&ptr[10] + ctxelen); /* ctxelen includes ptr[10] */ ret = GSS_S_COMPLETE; out: diff --git a/net/sunrpc/auth_gss/gss_spkm3_unseal.c b/net/sunrpc/auth_gss/gss_spkm3_unseal.c index e54581c..35a1b34 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_unseal.c +++ b/net/sunrpc/auth_gss/gss_spkm3_unseal.c @@ -45,7 +45,7 @@ /* * spkm3_read_token() - * + * * only SPKM_MIC_TOK with md5 intg-alg is supported */ u32 diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 066c64a..8fde38e 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -172,8 +172,8 @@ static struct cache_head *rsi_alloc(void) } static void rsi_request(struct cache_detail *cd, - struct cache_head *h, - char **bpp, int *blen) + struct cache_head *h, + char **bpp, int *blen) { struct rsi *rsii = container_of(h, struct rsi, h); @@ -184,7 +184,7 @@ static void rsi_request(struct cache_detail *cd, static int rsi_parse(struct cache_detail *cd, - char *mesg, int mlen) + char *mesg, int mlen) { /* context token expiry major minor context token */ char *buf = mesg; diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 1427449..c80df45 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -274,7 +274,7 @@ int cache_check(struct cache_detail *detail, * * A table is then only scanned if the current time is at least * the nextcheck time. - * + * */ static LIST_HEAD(cache_list); @@ -296,16 +296,16 @@ void cache_register(struct cache_detail *cd) struct proc_dir_entry *p; cd->proc_ent->owner = cd->owner; cd->channel_ent = cd->content_ent = NULL; - - p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR, - cd->proc_ent); + + p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR, + cd->proc_ent); cd->flush_ent = p; - if (p) { - p->proc_fops = &cache_flush_operations; - p->owner = cd->owner; - p->data = cd; - } - + if (p) { + p->proc_fops = &cache_flush_operations; + p->owner = cd->owner; + p->data = cd; + } + if (cd->cache_request || cd->cache_parse) { p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR, cd->proc_ent); @@ -316,16 +316,16 @@ void cache_register(struct cache_detail *cd) p->data = cd; } } - if (cd->cache_show) { - p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR, - cd->proc_ent); + if (cd->cache_show) { + p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR, + cd->proc_ent); cd->content_ent = p; - if (p) { - p->proc_fops = &content_file_operations; - p->owner = cd->owner; - p->data = cd; - } - } + if (p) { + p->proc_fops = &content_file_operations; + p->owner = cd->owner; + p->data = cd; + } + } } rwlock_init(&cd->hash_lock); INIT_LIST_HEAD(&cd->queue); @@ -417,15 +417,15 @@ static int cache_clean(void) current_index++; /* find a cleanable entry in the bucket and clean it, or set to next bucket */ - + if (current_detail && current_index < current_detail->hash_size) { struct cache_head *ch, **cp; struct cache_detail *d; - + write_lock(¤t_detail->hash_lock); /* Ok, now to clean this strand */ - + cp = & current_detail->hash_table[current_index]; ch = *cp; for (; ch; cp= & ch->next, ch= *cp) { @@ -477,9 +477,9 @@ static void do_cache_clean(struct work_struct *work) } -/* +/* * Clean all caches promptly. This just calls cache_clean - * repeatedly until we are sure that every cache has had a chance to + * repeatedly until we are sure that every cache has had a chance to * be fully cleaned */ void cache_flush(void) @@ -508,7 +508,7 @@ void cache_purge(struct cache_detail *detail) * All deferred requests are stored in a hash table, * indexed by "struct cache_head *". * As it may be wasteful to store a whole request - * structure, we allow the request to provide a + * structure, we allow the request to provide a * deferred form, which must contain a * 'struct cache_deferred_req' * This cache_deferred_req contains a method to allow @@ -584,7 +584,7 @@ static void cache_revisit_request(struct cache_head *item) INIT_LIST_HEAD(&pending); spin_lock(&cache_defer_lock); - + lp = cache_defer_hash[hash].next; if (lp) { while (lp != &cache_defer_hash[hash]) { @@ -614,7 +614,7 @@ void cache_clean_deferred(void *owner) INIT_LIST_HEAD(&pending); spin_lock(&cache_defer_lock); - + list_for_each_entry_safe(dreq, tmp, &cache_defer_list, recent) { if (dreq->owner == owner) { list_del(&dreq->hash); @@ -639,7 +639,7 @@ void cache_clean_deferred(void *owner) * On write, an update request is processed * Poll works if anything to read, and always allows write * - * Implemented by linked list of requests. Each open file has + * Implemented by linked list of requests. Each open file has * a ->private that also exists in this list. New request are added * to the end and may wakeup and preceding readers. * New readers are added to the head. If, on read, an item is found with @@ -1059,10 +1059,10 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h) * Messages are, like requests, separated into fields by * spaces and dequotes as \xHEXSTRING or embedded \nnn octal * - * Message is + * Message is * reply cachename expiry key ... content.... * - * key and content are both parsed by cache + * key and content are both parsed by cache */ #define isodigit(c) (isdigit(c) && c <= '7') @@ -1132,7 +1132,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) unsigned hash, entry; struct cache_head *ch; struct cache_detail *cd = ((struct handle*)m->private)->cd; - + read_lock(&cd->hash_lock); if (!n--) @@ -1147,7 +1147,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) do { hash++; n += 1LL<<32; - } while(hash < cd->hash_size && + } while(hash < cd->hash_size && cd->hash_table[hash]==NULL); if (hash >= cd->hash_size) return NULL; diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 16c9fbc..c95a617 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -410,7 +410,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, rpc_shutdown_client(clnt); clnt = ERR_PTR(err); } -out: +out: return clnt; } @@ -431,7 +431,7 @@ static const struct rpc_call_ops rpc_default_ops = { * sleeps on RPC calls */ #define RPC_INTR_SIGNALS (sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTERM)) - + static void rpc_save_sigmask(sigset_t *oldset, int intr) { unsigned long sigallow = sigmask(SIGKILL); @@ -474,7 +474,7 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) int status; /* If this client is slain all further I/O fails */ - if (clnt->cl_dead) + if (clnt->cl_dead) return -EIO; BUG_ON(flags & RPC_TASK_ASYNC); @@ -515,7 +515,7 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, /* If this client is slain all further I/O fails */ status = -EIO; - if (clnt->cl_dead) + if (clnt->cl_dead) goto out_release; flags |= RPC_TASK_ASYNC; @@ -526,7 +526,7 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, goto out_release; /* Mask signals on GSS_AUTH upcalls */ - rpc_task_sigmask(task, &oldset); + rpc_task_sigmask(task, &oldset); rpc_call_setup(task, msg, 0); @@ -537,7 +537,7 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, else rpc_put_task(task); - rpc_restore_sigmask(&oldset); + rpc_restore_sigmask(&oldset); return status; out_release: rpc_release_calldata(tk_ops, data); @@ -749,7 +749,7 @@ call_allocate(struct rpc_task *task) struct rpc_xprt *xprt = task->tk_xprt; unsigned int bufsiz; - dprintk("RPC: %4d call_allocate (status %d)\n", + dprintk("RPC: %4d call_allocate (status %d)\n", task->tk_pid, task->tk_status); task->tk_action = call_bind; if (req->rq_buffer) @@ -761,7 +761,7 @@ call_allocate(struct rpc_task *task) if (xprt->ops->buf_alloc(task, bufsiz << 1) != NULL) return; - printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task); + printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task); if (RPC_IS_ASYNC(task) || !signalled()) { xprt_release(task); @@ -798,7 +798,7 @@ call_encode(struct rpc_task *task) kxdrproc_t encode; __be32 *p; - dprintk("RPC: %4d call_encode (status %d)\n", + dprintk("RPC: %4d call_encode (status %d)\n", task->tk_pid, task->tk_status); /* Default buffer setup */ @@ -933,7 +933,7 @@ call_connect_status(struct rpc_task *task) struct rpc_clnt *clnt = task->tk_client; int status = task->tk_status; - dprintk("RPC: %5u call_connect_status (status %d)\n", + dprintk("RPC: %5u call_connect_status (status %d)\n", task->tk_pid, task->tk_status); task->tk_status = 0; @@ -966,7 +966,7 @@ call_connect_status(struct rpc_task *task) static void call_transmit(struct rpc_task *task) { - dprintk("RPC: %4d call_transmit (status %d)\n", + dprintk("RPC: %4d call_transmit (status %d)\n", task->tk_pid, task->tk_status); task->tk_action = call_status; @@ -1028,7 +1028,7 @@ call_status(struct rpc_task *task) if (req->rq_received > 0 && !req->rq_bytes_sent) task->tk_status = req->rq_received; - dprintk("RPC: %4d call_status (status %d)\n", + dprintk("RPC: %4d call_status (status %d)\n", task->tk_pid, task->tk_status); status = task->tk_status; @@ -1118,7 +1118,7 @@ call_decode(struct rpc_task *task) kxdrproc_t decode = task->tk_msg.rpc_proc->p_decode; __be32 *p; - dprintk("RPC: %4d call_decode (status %d)\n", + dprintk("RPC: %4d call_decode (status %d)\n", task->tk_pid, task->tk_status); if (task->tk_flags & RPC_CALL_MAJORSEEN) { @@ -1196,7 +1196,7 @@ static void call_refreshresult(struct rpc_task *task) { int status = task->tk_status; - dprintk("RPC: %4d call_refreshresult (status %d)\n", + dprintk("RPC: %4d call_refreshresult (status %d)\n", task->tk_pid, task->tk_status); task->tk_status = 0; diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c index 3946ec3..f4e1357 100644 --- a/net/sunrpc/pmap_clnt.c +++ b/net/sunrpc/pmap_clnt.c @@ -329,7 +329,7 @@ static int xdr_decode_bool(struct rpc_rqst *req, __be32 *p, unsigned int *boolp) static struct rpc_procinfo pmap_procedures[] = { [PMAP_SET] = { .p_proc = PMAP_SET, - .p_encode = (kxdrproc_t) xdr_encode_mapping, + .p_encode = (kxdrproc_t) xdr_encode_mapping, .p_decode = (kxdrproc_t) xdr_decode_bool, .p_bufsiz = 4, .p_count = 1, @@ -338,7 +338,7 @@ static struct rpc_procinfo pmap_procedures[] = { }, [PMAP_UNSET] = { .p_proc = PMAP_UNSET, - .p_encode = (kxdrproc_t) xdr_encode_mapping, + .p_encode = (kxdrproc_t) xdr_encode_mapping, .p_decode = (kxdrproc_t) xdr_decode_bool, .p_bufsiz = 4, .p_count = 1, diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index fc083f0..54a6b92 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -4,7 +4,7 @@ * Scheduling for synchronous and asynchronous RPC requests. * * Copyright (C) 1996 Olaf Kirch, <okir@monad.swb.de> - * + * * TCP NFS related read + write fixes * (C) 1999 Dave Airlie, University of Limerick, Ireland <airlied@linux.ie> */ @@ -307,7 +307,7 @@ EXPORT_SYMBOL(__rpc_wait_for_completion_task); /* * Make an RPC task runnable. * - * Note: If the task is ASYNC, this must be called with + * Note: If the task is ASYNC, this must be called with * the spinlock held to protect the wait queue operation. */ static void rpc_make_runnable(struct rpc_task *task) @@ -646,8 +646,8 @@ static int __rpc_execute(struct rpc_task *task) if (RPC_DO_CALLBACK(task)) { /* Define a callback save pointer */ void (*save_callback)(struct rpc_task *); - - /* + + /* * If a callback exists, save it, reset it, * call it. * The save is needed to stop from resetting diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index c1f8781..b00511d 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -397,7 +397,7 @@ svc_destroy(struct svc_serv *serv) sk_list); svc_close_socket(svsk); } - + cache_clean_deferred(serv); /* Unregister service with the portmapper */ @@ -415,7 +415,7 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size) { int pages; int arghi; - + pages = size / PAGE_SIZE + 1; /* extra page as we hold both request and reply. * We assume one is at most one page */ @@ -514,7 +514,7 @@ choose_pool(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) if (pool != NULL) return pool; - return &serv->sv_pools[(*state)++ % serv->sv_nrpools]; + return &serv->sv_pools[(*state)++ % serv->sv_nrpools]; } /* @@ -530,13 +530,13 @@ choose_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) spin_lock_bh(&pool->sp_lock); } else { /* choose a pool in round-robin fashion */ - for (i = 0; i < serv->sv_nrpools; i++) { - pool = &serv->sv_pools[--(*state) % serv->sv_nrpools]; + for (i = 0; i < serv->sv_nrpools; i++) { + pool = &serv->sv_pools[--(*state) % serv->sv_nrpools]; spin_lock_bh(&pool->sp_lock); - if (!list_empty(&pool->sp_all_threads)) - goto found_pool; + if (!list_empty(&pool->sp_all_threads)) + goto found_pool; spin_unlock_bh(&pool->sp_lock); - } + } return NULL; } @@ -551,7 +551,7 @@ found_pool: rqstp = list_entry(pool->sp_all_threads.next, struct svc_rqst, rq_all); list_del_init(&rqstp->rq_all); task = rqstp->rq_task; - } + } spin_unlock_bh(&pool->sp_lock); return task; @@ -636,7 +636,7 @@ svc_exit_thread(struct svc_rqst *rqstp) /* * Register an RPC service with the local portmapper. - * To unregister a service, call this routine with + * To unregister a service, call this routine with * proto and port == 0. */ int @@ -709,7 +709,7 @@ svc_process(struct svc_rqst *rqstp) goto err_short_len; /* setup response xdr_buf. - * Initially it has just one page + * Initially it has just one page */ rqstp->rq_resused = 1; resv->iov_base = page_address(rqstp->rq_respages[0]); @@ -811,7 +811,7 @@ svc_process(struct svc_rqst *rqstp) memset(rqstp->rq_argp, 0, procp->pc_argsize); memset(rqstp->rq_resp, 0, procp->pc_ressize); - /* un-reserve some of the out-queue now that we have a + /* un-reserve some of the out-queue now that we have a * better idea of reply size */ if (procp->pc_xdrressize) diff --git a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c index c7bb5f7..811a24c 100644 --- a/net/sunrpc/svcauth.c +++ b/net/sunrpc/svcauth.c @@ -2,7 +2,7 @@ * linux/net/sunrpc/svcauth.c * * The generic interface for RPC authentication on the server side. - * + * * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> * * CHANGES @@ -74,7 +74,7 @@ int svc_authorise(struct svc_rqst *rqstp) int rv = 0; rqstp->rq_authop = NULL; - + if (aops) { rv = aops->release(rqstp); module_put(aops->owner); diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 0d1e8fb..987244f 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c @@ -151,7 +151,7 @@ static void ip_map_request(struct cache_detail *cd, char text_addr[20]; struct ip_map *im = container_of(h, struct ip_map, h); __be32 addr = im->m_addr.s_addr; - + snprintf(text_addr, 20, "%u.%u.%u.%u", ntohl(addr) >> 24 & 0xff, ntohl(addr) >> 16 & 0xff, @@ -198,7 +198,7 @@ static int ip_map_parse(struct cache_detail *cd, if (sscanf(buf, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4) return -EINVAL; - + expiry = get_expiry(&mesg); if (expiry ==0) return -EINVAL; @@ -248,7 +248,7 @@ static int ip_map_show(struct seq_file *m, /* class addr domain */ addr = im->m_addr; - if (test_bit(CACHE_VALID, &h->flags) && + if (test_bit(CACHE_VALID, &h->flags) && !test_bit(CACHE_NEGATIVE, &h->flags)) dom = im->m_client->h.name; @@ -262,7 +262,7 @@ static int ip_map_show(struct seq_file *m, ); return 0; } - + struct cache_detail ip_map_cache = { .owner = THIS_MODULE, @@ -343,7 +343,7 @@ int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom) int auth_unix_forget_old(struct auth_domain *dom) { struct unix_domain *udom; - + if (dom->flavour != &svcauth_unix) return -EINVAL; udom = container_of(dom, struct unix_domain, h); @@ -465,7 +465,7 @@ svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp) if (argv->iov_len < 3*4) return SVC_GARBAGE; - if (svc_getu32(argv) != 0) { + if (svc_getu32(argv) != 0) { dprintk("svc: bad null cred\n"); *authp = rpc_autherr_badcred; return SVC_DENIED; diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index cf93cd1..2fd0ba2 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -58,7 +58,7 @@ * providing that certain rules are followed: * * SK_CONN, SK_DATA, can be set or cleared at any time. - * after a set, svc_sock_enqueue must be called. + * after a set, svc_sock_enqueue must be called. * after a clear, the socket must be read/accepted * if this succeeds, it must be set again. * SK_CLOSE can set at any time. It is never cleared. @@ -252,7 +252,7 @@ svc_sock_enqueue(struct svc_sock *svsk) svsk->sk_sk, rqstp); svc_thread_dequeue(pool, rqstp); if (rqstp->rq_sock) - printk(KERN_ERR + printk(KERN_ERR "svc_sock_enqueue: server %p, rq_sock=%p!\n", rqstp, rqstp->rq_sock); rqstp->rq_sock = svsk; @@ -484,7 +484,7 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) if (xdr->tail[0].iov_len) { result = kernel_sendpage(sock, rqstp->rq_respages[0], ((unsigned long)xdr->tail[0].iov_base) - & (PAGE_SIZE-1), + & (PAGE_SIZE-1), xdr->tail[0].iov_len, 0); if (result > 0) @@ -711,7 +711,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) tv.tv_sec = xtime.tv_sec; tv.tv_usec = xtime.tv_nsec / NSEC_PER_USEC; skb_set_timestamp(skb, &tv); - /* Don't enable netstamp, sunrpc doesn't + /* Don't enable netstamp, sunrpc doesn't need that much accuracy */ } skb_get_timestamp(skb, &svsk->sk_sk->sk_stamp); @@ -743,7 +743,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) return 0; } local_bh_enable(); - skb_free_datagram(svsk->sk_sk, skb); + skb_free_datagram(svsk->sk_sk, skb); } else { /* we can use it in-place */ rqstp->rq_arg.head[0].iov_base = skb->data + sizeof(struct udphdr); @@ -794,7 +794,7 @@ svc_udp_init(struct svc_sock *svsk) svsk->sk_sendto = svc_udp_sendto; /* initialise setting must have enough space to - * receive and respond to one request. + * receive and respond to one request. * svc_udp_recvfrom will re-adjust if necessary */ svc_sock_setbufsize(svsk->sk_sock, @@ -923,7 +923,7 @@ svc_tcp_accept(struct svc_sock *svsk) if (ntohs(sin.sin_port) >= 1024) { dprintk(KERN_WARNING "%s: connect from unprivileged port: %u.%u.%u.%u:%d\n", - serv->sv_name, + serv->sv_name, NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); } @@ -1038,7 +1038,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) * on the number of threads which will access the socket. * * rcvbuf just needs to be able to hold a few requests. - * Normally they will be removed from the queue + * Normally they will be removed from the queue * as soon a a complete request arrives. */ svc_sock_setbufsize(svsk->sk_sock, @@ -1063,7 +1063,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) if (len < want) { dprintk("svc: short recvfrom while reading record length (%d of %lu)\n", - len, want); + len, want); svc_sock_received(svsk); return -EAGAIN; /* record header not complete */ } @@ -1221,7 +1221,7 @@ svc_tcp_init(struct svc_sock *svsk) tp->nonagle = 1; /* disable Nagle's algorithm */ /* initialise setting must have enough space to - * receive and respond to one request. + * receive and respond to one request. * svc_tcp_recvfrom will re-adjust if necessary */ svc_sock_setbufsize(svsk->sk_sock, @@ -1230,7 +1230,7 @@ svc_tcp_init(struct svc_sock *svsk) set_bit(SK_CHNGBUF, &svsk->sk_flags); set_bit(SK_DATA, &svsk->sk_flags); - if (sk->sk_state != TCP_ESTABLISHED) + if (sk->sk_state != TCP_ESTABLISHED) set_bit(SK_CLOSE, &svsk->sk_flags); } } @@ -1246,7 +1246,7 @@ svc_sock_update_bufs(struct svc_serv *serv) spin_lock_bh(&serv->sv_lock); list_for_each(le, &serv->sv_permsocks) { - struct svc_sock *svsk = + struct svc_sock *svsk = list_entry(le, struct svc_sock, sk_list); set_bit(SK_CHNGBUF, &svsk->sk_flags); } @@ -1278,11 +1278,11 @@ svc_recv(struct svc_rqst *rqstp, long timeout) rqstp, timeout); if (rqstp->rq_sock) - printk(KERN_ERR + printk(KERN_ERR "svc_recv: service %p, socket not NULL!\n", rqstp); if (waitqueue_active(&rqstp->rq_wait)) - printk(KERN_ERR + printk(KERN_ERR "svc_recv: service %p, wait queue active!\n", rqstp); @@ -1371,7 +1371,7 @@ svc_recv(struct svc_rqst *rqstp, long timeout) return len; } -/* +/* * Drop request */ void @@ -1651,7 +1651,7 @@ svc_delete_socket(struct svc_sock *svsk) if (!test_and_set_bit(SK_DETACHED, &svsk->sk_flags)) list_del_init(&svsk->sk_list); - /* + /* * We used to delete the svc_sock from whichever list * it's sk_ready node was on, but we don't actually * need to. This is because the only time we're called @@ -1697,7 +1697,7 @@ svc_makesock(struct svc_serv *serv, int protocol, unsigned short port) } /* - * Handle defer and revisit of requests + * Handle defer and revisit of requests */ static void svc_revisit(struct cache_deferred_req *dreq, int too_many) @@ -1776,7 +1776,7 @@ static int svc_deferred_recv(struct svc_rqst *rqstp) static struct svc_deferred_req *svc_deferred_dequeue(struct svc_sock *svsk) { struct svc_deferred_req *dr = NULL; - + if (!test_bit(SK_DEFERRED, &svsk->sk_flags)) return NULL; spin_lock_bh(&svsk->sk_defer_lock); diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 82b2752..47d8df2 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c @@ -42,7 +42,7 @@ rpc_register_sysctl(void) sunrpc_table[0].de->owner = THIS_MODULE; #endif } - + } void @@ -126,7 +126,7 @@ static ctl_table debug_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_dodebug - }, + }, { .ctl_name = CTL_NFSDEBUG, .procname = "nfs_debug", @@ -134,7 +134,7 @@ static ctl_table debug_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_dodebug - }, + }, { .ctl_name = CTL_NFSDDEBUG, .procname = "nfsd_debug", @@ -142,7 +142,7 @@ static ctl_table debug_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_dodebug - }, + }, { .ctl_name = CTL_NLMDEBUG, .procname = "nlm_debug", @@ -150,7 +150,7 @@ static ctl_table debug_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_dodebug - }, + }, { .ctl_name = 0 } }; diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index a0af250..6a59180 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -302,7 +302,7 @@ _copy_from_pages(char *p, struct page **pages, size_t pgbase, size_t len) * @buf: xdr_buf * @len: bytes to remove from buf->head[0] * - * Shrinks XDR buffer's header kvec buf->head[0] by + * Shrinks XDR buffer's header kvec buf->head[0] by * 'len' bytes. The extra data is not lost, but is instead * moved into the inlined pages and/or the tail. */ @@ -375,7 +375,7 @@ xdr_shrink_bufhead(struct xdr_buf *buf, size_t len) * @buf: xdr_buf * @len: bytes to remove from buf->pages * - * Shrinks XDR buffer's page array buf->pages by + * Shrinks XDR buffer's page array buf->pages by * 'len' bytes. The extra data is not lost, but is instead * moved into the tail. */ @@ -1024,7 +1024,7 @@ xdr_encode_array2(struct xdr_buf *buf, unsigned int base, int xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len, - int (*actor)(struct scatterlist *, void *), void *data) + int (*actor)(struct scatterlist *, void *), void *data) { int i, ret = 0; unsigned page_len, thislen, page_offset; diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 7a3999f..e7c71a1 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -410,7 +410,7 @@ void xprt_set_retrans_timeout_def(struct rpc_task *task) /* * xprt_set_retrans_timeout_rtt - set a request's retransmit timeout * @task: task whose timeout is to be set - * + * * Set a request's retransmit timeout using the RTT estimator. */ void xprt_set_retrans_timeout_rtt(struct rpc_task *task) @@ -873,7 +873,7 @@ void xprt_release(struct rpc_task *task) */ void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr) { - to->to_initval = + to->to_initval = to->to_increment = incr; to->to_maxval = to->to_initval + (incr * retr); to->to_retries = retr; diff --git a/net/tipc/addr.c b/net/tipc/addr.c index 0be25e1..e5207a1 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c @@ -1,6 +1,6 @@ /* * net/tipc/addr.c: TIPC address utility routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -48,10 +48,10 @@ u32 tipc_get_addr(void) /** * tipc_addr_domain_valid - validates a network domain address - * - * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, + * + * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, * where Z, C, and N are non-zero and do not exceed the configured limits. - * + * * Returns 1 if domain address is valid, otherwise 0 */ @@ -80,10 +80,10 @@ int tipc_addr_domain_valid(u32 addr) /** * tipc_addr_node_valid - validates a proposed network address for this node - * - * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed + * + * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed * the configured limits. - * + * * Returns 1 if address can be used, otherwise 0 */ diff --git a/net/tipc/addr.h b/net/tipc/addr.h index bcfebb3..e4bd533 100644 --- a/net/tipc/addr.h +++ b/net/tipc/addr.h @@ -1,6 +1,6 @@ /* * net/tipc/addr.h: Include file for TIPC address utility routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -100,8 +100,8 @@ static inline int addr_scope(u32 domain) /** * addr_domain - convert 2-bit scope value to equivalent message lookup domain - * - * Needed when address of a named message must be looked up a second time + * + * Needed when address of a named message must be looked up a second time * after a network hop. */ diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 730c5c4..e788017 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c @@ -1,6 +1,6 @@ /* * net/tipc/bcast.c: TIPC broadcast code - * + * * Copyright (c) 2004-2006, Ericsson AB * Copyright (c) 2004, Intel Corporation. * Copyright (c) 2005, Wind River Systems @@ -59,15 +59,15 @@ * Loss rate for incoming broadcast frames; used to test retransmission code. * Set to N to cause every N'th frame to be discarded; 0 => don't discard any. */ - + #define TIPC_BCAST_LOSS_RATE 0 /** * struct bcbearer_pair - a pair of bearers used by broadcast link * @primary: pointer to primary bearer * @secondary: pointer to secondary bearer - * - * Bearers must have same priority and same set of reachable destinations + * + * Bearers must have same priority and same set of reachable destinations * to be paired. */ @@ -84,7 +84,7 @@ struct bcbearer_pair { * @bpairs_temp: temporary array of bearer pairs used by tipc_bcbearer_sort() * @remains: temporary node map used by tipc_bcbearer_send() * @remains_new: temporary node map used tipc_bcbearer_send() - * + * * Note: The fields labelled "temporary" are incorporated into the bearer * to avoid consuming potentially limited stack space through the use of * large local variables within multicast routines. Concurrent access is @@ -104,7 +104,7 @@ struct bcbearer { * struct bclink - link used for broadcast messages * @link: (non-standard) broadcast link structure * @node: (non-standard) node structure representing b'cast link's peer node - * + * * Handles sequence numbering, fragmentation, bundling, etc. */ @@ -125,7 +125,7 @@ char tipc_bclink_name[] = "multicast-link"; static u32 buf_seqno(struct sk_buff *buf) { return msg_seqno(buf_msg(buf)); -} +} static u32 bcbuf_acks(struct sk_buff *buf) { @@ -143,9 +143,9 @@ static void bcbuf_decr_acks(struct sk_buff *buf) } -/** +/** * bclink_set_gap - set gap according to contents of current deferred pkt queue - * + * * Called with 'node' locked, bc_lock unlocked */ @@ -159,14 +159,14 @@ static void bclink_set_gap(struct node *n_ptr) n_ptr->bclink.gap_to = mod(buf_seqno(buf) - 1); } -/** +/** * bclink_ack_allowed - test if ACK or NACK message can be sent at this moment - * + * * This mechanism endeavours to prevent all nodes in network from trying * to ACK or NACK at the same time. - * + * * Note: TIPC uses a different trigger to distribute ACKs than it does to - * distribute NACKs, but tries to use the same spacing (divide by 16). + * distribute NACKs, but tries to use the same spacing (divide by 16). */ static int bclink_ack_allowed(u32 n) @@ -175,11 +175,11 @@ static int bclink_ack_allowed(u32 n) } -/** +/** * bclink_retransmit_pkt - retransmit broadcast packets * @after: sequence number of last packet to *not* retransmit * @to: sequence number of last packet to retransmit - * + * * Called with bc_lock locked */ @@ -189,16 +189,16 @@ static void bclink_retransmit_pkt(u32 after, u32 to) buf = bcl->first_out; while (buf && less_eq(buf_seqno(buf), after)) { - buf = buf->next; + buf = buf->next; } tipc_link_retransmit(bcl, buf, mod(to - after)); } -/** +/** * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets * @n_ptr: node that sent acknowledgement info * @acked: broadcast sequence # that has been acknowledged - * + * * Node is locked, bc_lock unlocked. */ @@ -244,9 +244,9 @@ void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked) spin_unlock_bh(&bc_lock); } -/** +/** * bclink_send_ack - unicast an ACK msg - * + * * tipc_net_lock and node lock set */ @@ -258,9 +258,9 @@ static void bclink_send_ack(struct node *n_ptr) tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); } -/** +/** * bclink_send_nack- broadcast a NACK msg - * + * * tipc_net_lock and node lock set */ @@ -278,7 +278,7 @@ static void bclink_send_nack(struct node *n_ptr) msg_init(msg, BCAST_PROTOCOL, STATE_MSG, TIPC_OK, INT_H_SIZE, n_ptr->addr); msg_set_mc_netid(msg, tipc_net_id); - msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); + msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); msg_set_bcgap_after(msg, n_ptr->bclink.gap_after); msg_set_bcgap_to(msg, n_ptr->bclink.gap_to); msg_set_bcast_tag(msg, tipc_own_tag); @@ -292,17 +292,17 @@ static void bclink_send_nack(struct node *n_ptr) bcl->stats.bearer_congs++; } - /* + /* * Ensure we doesn't send another NACK msg to the node * until 16 more deferred messages arrive from it * (i.e. helps prevent all nodes from NACK'ing at same time) */ - + n_ptr->bclink.nack_sync = tipc_own_tag; } } -/** +/** * tipc_bclink_check_gap - send a NACK if a sequence gap exists * * tipc_net_lock and node lock set @@ -320,9 +320,9 @@ void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent) bclink_send_nack(n_ptr); } -/** +/** * tipc_bclink_peek_nack - process a NACK msg meant for another node - * + * * Only tipc_net_lock set. */ @@ -349,7 +349,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g if (less_eq(my_to, gap_to)) n_ptr->bclink.gap_to = gap_after; } else { - /* + /* * Expand gap if missing bufs not in deferred queue: */ struct sk_buff *buf = n_ptr->bclink.deferred_head; @@ -371,7 +371,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g } /* * Some nodes may send a complementary NACK now: - */ + */ if (bclink_ack_allowed(sender_tag + 1)) { if (n_ptr->bclink.gap_to != n_ptr->bclink.gap_after) { bclink_send_nack(n_ptr); @@ -408,7 +408,7 @@ int tipc_bclink_send_msg(struct sk_buff *buf) /** * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards - * + * * tipc_net_lock is read_locked, no other locks set */ @@ -425,7 +425,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) msg_dbg(msg, "<BC<<<"); - if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported || + if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported || (msg_mc_netid(msg) != tipc_net_id))) { buf_discard(buf); return; @@ -443,7 +443,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) bclink_retransmit_pkt(msg_bcgap_after(msg), msg_bcgap_to(msg)); bcl->owner->next = NULL; - spin_unlock_bh(&bc_lock); + spin_unlock_bh(&bc_lock); } else { tipc_bclink_peek_nack(msg_destnode(msg), msg_bcast_tag(msg), @@ -547,10 +547,10 @@ u32 tipc_bclink_acks_missing(struct node *n_ptr) /** * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer - * + * * Send through as many bearers as necessary to reach all nodes * that support TIPC multicasting. - * + * * Returns 0 if packet sent successfully, non-zero if not */ @@ -581,7 +581,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf, send_count = 0; /* Send buffer over bearers until all targets reached */ - + bcbearer->remains = tipc_cltr_bcast_nodes; for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { @@ -615,7 +615,7 @@ update: bcbearer->remains = bcbearer->remains_new; } - + /* Unable to reach all targets */ bcbearer->bearer.publ.blocked = 1; @@ -682,7 +682,7 @@ void tipc_bcbearer_sort(void) /** * tipc_bcbearer_push - resolve bearer congestion - * + * * Forces bclink to push out any unsent packets, until all packets are gone * or congestion reoccurs. * No locks set when function called @@ -714,27 +714,27 @@ int tipc_bclink_stats(char *buf, const u32 buf_size) spin_lock_bh(&bc_lock); tipc_printf(&pb, "Link <%s>\n" - " Window:%u packets\n", + " Window:%u packets\n", bcl->name, bcl->queue_limit[0]); - tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", bcl->stats.recv_info, bcl->stats.recv_fragments, bcl->stats.recv_fragmented, bcl->stats.recv_bundles, bcl->stats.recv_bundled); - tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", bcl->stats.sent_info, bcl->stats.sent_fragments, - bcl->stats.sent_fragmented, + bcl->stats.sent_fragmented, bcl->stats.sent_bundles, bcl->stats.sent_bundled); - tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n", + tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n", bcl->stats.recv_nacks, - bcl->stats.deferred_recv, + bcl->stats.deferred_recv, bcl->stats.duplicates); - tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n", - bcl->stats.sent_nacks, - bcl->stats.sent_acks, + tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n", + bcl->stats.sent_nacks, + bcl->stats.sent_acks, bcl->stats.retransmitted); tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", bcl->stats.bearer_congs, @@ -778,7 +778,7 @@ int tipc_bclink_init(void) bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC); if (!bcbearer || !bclink) { nomem: - warn("Multicast link creation failed, no memory\n"); + warn("Multicast link creation failed, no memory\n"); kfree(bcbearer); bcbearer = NULL; kfree(bclink); @@ -796,7 +796,7 @@ int tipc_bclink_init(void) bcl->next_out_no = 1; spin_lock_init(&bclink->node.lock); bcl->owner = &bclink->node; - bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; + bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); bcl->b_ptr = &bcbearer->bearer; bcl->state = WORKING_WORKING; diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index b243d9d..f910ed2 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h @@ -1,6 +1,6 @@ /* * net/tipc/bcast.h: Include file for TIPC broadcast code - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -102,7 +102,7 @@ static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node) } } -/** +/** * nmap_remove - remove a node from a node map */ @@ -190,7 +190,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port) /** * port_list_free - free dynamically created entries in port_list chain - * + * * Note: First item is on stack, so it doesn't need to be released */ diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 39744a3..271a375 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -1,6 +1,6 @@ /* * net/tipc/bearer.c: TIPC bearer code - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -52,7 +52,7 @@ struct bearer *tipc_bearers = NULL; /** * media_name_valid - validate media name - * + * * Returns 1 if media name is valid, otherwise 0. */ @@ -84,17 +84,17 @@ static struct media *media_find(const char *name) /** * tipc_register_media - register a media type - * + * * Bearers for this media type must be activated separately at a later stage. */ int tipc_register_media(u32 media_type, - char *name, - int (*enable)(struct tipc_bearer *), - void (*disable)(struct tipc_bearer *), - int (*send_msg)(struct sk_buff *, + char *name, + int (*enable)(struct tipc_bearer *), + void (*disable)(struct tipc_bearer *), + int (*send_msg)(struct sk_buff *, struct tipc_bearer *, - struct tipc_media_addr *), + struct tipc_media_addr *), char *(*addr2str)(struct tipc_media_addr *a, char *str_buf, int str_size), struct tipc_media_addr *bcast_addr, @@ -121,11 +121,11 @@ int tipc_register_media(u32 media_type, } if ((bearer_priority < TIPC_MIN_LINK_PRI) && (bearer_priority > TIPC_MAX_LINK_PRI)) { - warn("Media <%s> rejected, illegal priority (%u)\n", name, + warn("Media <%s> rejected, illegal priority (%u)\n", name, bearer_priority); goto exit; } - if ((link_tolerance < TIPC_MIN_LINK_TOL) || + if ((link_tolerance < TIPC_MIN_LINK_TOL) || (link_tolerance > TIPC_MAX_LINK_TOL)) { warn("Media <%s> rejected, illegal tolerance (%u)\n", name, link_tolerance); @@ -219,7 +219,7 @@ struct sk_buff *tipc_media_get_names(void) read_lock_bh(&tipc_net_lock); for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { - tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, + tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, strlen(m_ptr->name) + 1); } read_unlock_bh(&tipc_net_lock); @@ -230,11 +230,11 @@ struct sk_buff *tipc_media_get_names(void) * bearer_name_validate - validate & (optionally) deconstruct bearer name * @name - ptr to bearer name string * @name_parts - ptr to area for bearer name components (or NULL if not needed) - * + * * Returns 1 if bearer name is valid, otherwise 0. */ -static int bearer_name_validate(const char *name, +static int bearer_name_validate(const char *name, struct bearer_name *name_parts) { char name_copy[TIPC_MAX_BEARER_NAME]; @@ -262,8 +262,8 @@ static int bearer_name_validate(const char *name, /* validate component parts of bearer name */ - if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || - (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || + if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || + (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || (strspn(media_name, tipc_alphabet) != (media_len - 1)) || (strspn(if_name, tipc_alphabet) != (if_len - 1))) return 0; @@ -336,8 +336,8 @@ struct sk_buff *tipc_bearer_get_names(void) for (j = 0; j < MAX_BEARERS; j++) { b_ptr = &tipc_bearers[j]; if (b_ptr->active && (b_ptr->media == m_ptr)) { - tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, - b_ptr->publ.name, + tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, + b_ptr->publ.name, strlen(b_ptr->publ.name) + 1); } } @@ -401,8 +401,8 @@ void tipc_bearer_lock_push(struct bearer *b_ptr) /* - * Interrupt enabling new requests after bearer congestion or blocking: - * See bearer_send(). + * Interrupt enabling new requests after bearer congestion or blocking: + * See bearer_send(). */ void tipc_continue(struct tipc_bearer *tb_ptr) { @@ -417,9 +417,9 @@ void tipc_continue(struct tipc_bearer *tb_ptr) } /* - * Schedule link for sending of messages after the bearer - * has been deblocked by 'continue()'. This method is called - * when somebody tries to send a message via this link while + * Schedule link for sending of messages after the bearer + * has been deblocked by 'continue()'. This method is called + * when somebody tries to send a message via this link while * the bearer is congested. 'tipc_net_lock' is in read_lock here * bearer.lock is busy */ @@ -430,9 +430,9 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p } /* - * Schedule link for sending of messages after the bearer - * has been deblocked by 'continue()'. This method is called - * when somebody tries to send a message via this link while + * Schedule link for sending of messages after the bearer + * has been deblocked by 'continue()'. This method is called + * when somebody tries to send a message via this link while * the bearer is congested. 'tipc_net_lock' is in read_lock here, * bearer.lock is free */ @@ -468,7 +468,7 @@ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) /** * tipc_enable_bearer - enable bearer with the given name - */ + */ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) { @@ -490,7 +490,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) warn("Bearer <%s> rejected, illegal name\n", name); return -EINVAL; } - if (!tipc_addr_domain_valid(bcast_scope) || + if (!tipc_addr_domain_valid(bcast_scope) || !in_scope(bcast_scope, tipc_own_addr)) { warn("Bearer <%s> rejected, illegal broadcast scope\n", name); return -EINVAL; @@ -539,7 +539,7 @@ restart: } } if (bearer_id >= MAX_BEARERS) { - warn("Bearer <%s> rejected, bearer limit reached (%u)\n", + warn("Bearer <%s> rejected, bearer limit reached (%u)\n", name, MAX_BEARERS); goto failed; } @@ -612,7 +612,7 @@ int tipc_block_bearer(const char *name) /** * bearer_disable - - * + * * Note: This routine assumes caller holds tipc_net_lock. */ diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index c4e7c1c..6a36b66 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h @@ -1,6 +1,6 @@ /* * net/tipc/bearer.h: Include file for TIPC bearer code - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -58,14 +58,14 @@ * @type_id: TIPC media identifier [defined in tipc_bearer.h] * @name: media name */ - + struct media { - int (*send_msg)(struct sk_buff *buf, + int (*send_msg)(struct sk_buff *buf, struct tipc_bearer *b_ptr, struct tipc_media_addr *dest); int (*enable_bearer)(struct tipc_bearer *b_ptr); void (*disable_bearer)(struct tipc_bearer *b_ptr); - char *(*addr2str)(struct tipc_media_addr *a, + char *(*addr2str)(struct tipc_media_addr *a, char *str_buf, int str_size); struct tipc_media_addr bcast_addr; int bcast; @@ -91,7 +91,7 @@ struct media { * @net_plane: network plane ('A' through 'H') currently associated with bearer * @nodes: indicates which nodes in cluster can be reached through bearer */ - + struct bearer { struct tipc_bearer publ; struct media *media; @@ -131,21 +131,21 @@ void tipc_bearer_lock_push(struct bearer *b_ptr); /** - * tipc_bearer_send- sends buffer to destination over bearer - * + * tipc_bearer_send- sends buffer to destination over bearer + * * Returns true (1) if successful, or false (0) if unable to send - * + * * IMPORTANT: * The media send routine must not alter the buffer being passed in * as it may be needed for later retransmission! - * - * If the media send routine returns a non-zero value (indicating that + * + * If the media send routine returns a non-zero value (indicating that * it was unable to send the buffer), it must: * 1) mark the bearer as blocked, * 2) call tipc_continue() once the bearer is able to send again. * Media types that are unable to meet these two critera must ensure their * send routine always returns success -- even if the buffer was not sent -- - * and let TIPC's link code deal with the undelivered message. + * and let TIPC's link code deal with the undelivered message. */ static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf, diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c index b46b518..95b3739 100644 --- a/net/tipc/cluster.c +++ b/net/tipc/cluster.c @@ -1,6 +1,6 @@ /* * net/tipc/cluster.c: TIPC cluster management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -56,7 +56,7 @@ struct cluster *tipc_cltr_create(u32 addr) { struct _zone *z_ptr; struct cluster *c_ptr; - int max_nodes; + int max_nodes; c_ptr = kzalloc(sizeof(*c_ptr), GFP_ATOMIC); if (c_ptr == NULL) { @@ -81,7 +81,7 @@ struct cluster *tipc_cltr_create(u32 addr) tipc_local_nodes = c_ptr->nodes; c_ptr->highest_slave = LOWEST_SLAVE - 1; c_ptr->highest_node = 0; - + z_ptr = tipc_zone_find(tipc_zone(addr)); if (!z_ptr) { z_ptr = tipc_zone_create(addr); @@ -150,7 +150,7 @@ void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr) /** * tipc_cltr_select_router - select router to a cluster - * + * * Uses deterministic and fair algorithm. */ @@ -192,7 +192,7 @@ u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref) /** * tipc_cltr_select_node - select destination node within a remote cluster - * + * * Uses deterministic and fair algorithm. */ @@ -295,7 +295,7 @@ void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest) msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, SLAVE_ROUTING_TABLE); for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) { - if (c_ptr->nodes[n_num] && + if (c_ptr->nodes[n_num] && tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); @@ -329,7 +329,7 @@ void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest) msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, EXT_ROUTING_TABLE); for (n_num = 1; n_num <= highest; n_num++) { - if (c_ptr->nodes[n_num] && + if (c_ptr->nodes[n_num] && tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); @@ -360,7 +360,7 @@ void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest) msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, LOCAL_ROUTING_TABLE); for (n_num = 1; n_num <= highest; n_num++) { - if (c_ptr->nodes[n_num] && + if (c_ptr->nodes[n_num] && tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); @@ -492,7 +492,7 @@ void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router) } /** - * tipc_cltr_multicast - multicast message to local nodes + * tipc_cltr_multicast - multicast message to local nodes */ static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, @@ -554,9 +554,9 @@ void tipc_cltr_broadcast(struct sk_buff *buf) buf_copy = skb_copy(buf, GFP_ATOMIC); if (buf_copy == NULL) goto exit; - msg_set_destnode(buf_msg(buf_copy), + msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); - tipc_link_send(buf_copy, n_ptr->addr, + tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr); } } diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h index 1b4cd30..62df074 100644 --- a/net/tipc/cluster.h +++ b/net/tipc/cluster.h @@ -1,6 +1,6 @@ /* * net/tipc/cluster.h: Include file for TIPC cluster management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -50,7 +50,7 @@ * @highest_node: id of highest numbered node within cluster * @highest_slave: (used for secondary node support) */ - + struct cluster { u32 addr; struct _zone *owner; diff --git a/net/tipc/config.c b/net/tipc/config.c index baf55c4..14789a8 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c @@ -1,6 +1,6 @@ /* * net/tipc/config.c: TIPC configuration management code - * + * * Copyright (c) 2002-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -86,7 +86,7 @@ struct sk_buff *tipc_cfg_reply_alloc(int payload_size) return buf; } -int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, +int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, void *tlv_data, int tlv_data_size) { struct tlv_desc *tlv = (struct tlv_desc *)buf->tail; @@ -112,7 +112,7 @@ struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); if (buf) { value_net = htonl(value); - tipc_cfg_append_tlv(buf, tlv_type, &value_net, + tipc_cfg_append_tlv(buf, tlv_type, &value_net, sizeof(value_net)); } return buf; @@ -182,7 +182,7 @@ int tipc_cfg_cmd(const struct tipc_cmd_msg * msg, static void cfg_cmd_event(struct tipc_cmd_msg *msg, char *data, - u32 sz, + u32 sz, struct tipc_portid const *orig) { int rv = -EINVAL; @@ -192,7 +192,7 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg, msg->cmd = ntohl(msg->cmd); - cfg_prepare_res_msg(msg->cmd, msg->usr_handle, rv, &rmsg, msg_sect, + cfg_prepare_res_msg(msg->cmd, msg->usr_handle, rv, &rmsg, msg_sect, data, 0); if (ntohl(msg->magic) != TIPC_MAGIC) goto exit; @@ -295,7 +295,7 @@ static struct sk_buff *cfg_set_own_addr(void) " (cannot change node address once assigned)"); tipc_own_addr = addr; - /* + /* * Must release all spinlocks before calling start_net() because * Linux version of TIPC calls eth_media_start() which calls * register_netdevice_notifier() which may block! @@ -619,7 +619,7 @@ static void cfg_named_msg_event(void *userdata, struct sk_buff **buf, const unchar *msg, u32 size, - u32 importance, + u32 importance, struct tipc_portid const *orig, struct tipc_name_seq const *dest) { @@ -640,7 +640,7 @@ static void cfg_named_msg_event(void *userdata, /* Generate reply for request (if can't, return request) */ rep_buf = tipc_cfg_do_cmd(orig->node, - ntohs(req_hdr->tcm_type), + ntohs(req_hdr->tcm_type), msg + sizeof(*req_hdr), size - sizeof(*req_hdr), BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr)); diff --git a/net/tipc/config.h b/net/tipc/config.h index 7a728f9..5cd7cc5 100644 --- a/net/tipc/config.h +++ b/net/tipc/config.h @@ -1,6 +1,6 @@ /* * net/tipc/config.h: Include file for TIPC configuration service code - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -43,7 +43,7 @@ #include "link.h" struct sk_buff *tipc_cfg_reply_alloc(int payload_size); -int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, +int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, void *tlv_data, int tlv_data_size); struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value); struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string); @@ -68,8 +68,8 @@ static inline struct sk_buff *tipc_cfg_reply_ultra_string(char *string) return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); } -struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, - const void *req_tlv_area, int req_tlv_space, +struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, + const void *req_tlv_area, int req_tlv_space, int headroom); void tipc_cfg_link_event(u32 addr, char *name, int up); diff --git a/net/tipc/core.c b/net/tipc/core.c index 6f5b7ee..d2d7d32 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -89,7 +89,7 @@ int tipc_mode = TIPC_NOT_RUNNING; int tipc_random; atomic_t tipc_user_count = ATOMIC_INIT(0); -const char tipc_alphabet[] = +const char tipc_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."; /* configurable TIPC parameters */ @@ -171,13 +171,13 @@ int tipc_core_start(void) get_random_bytes(&tipc_random, sizeof(tipc_random)); tipc_mode = TIPC_NODE_MODE; - if ((res = tipc_handler_start()) || + if ((res = tipc_handler_start()) || (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions, tipc_random)) || (res = tipc_reg_start()) || (res = tipc_nametbl_init()) || - (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) || - (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) || + (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) || + (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) || (res = tipc_netlink_start()) || (res = tipc_socket_init())) { tipc_core_stop(); @@ -191,7 +191,7 @@ static int __init tipc_init(void) int res; tipc_log_reinit(CONFIG_TIPC_LOG); - info("Activated (version " TIPC_MOD_VER + info("Activated (version " TIPC_MOD_VER " compiled " __DATE__ " " __TIME__ ")\n"); tipc_own_addr = 0; @@ -207,9 +207,9 @@ static int __init tipc_init(void) if ((res = tipc_core_start())) err("Unable to start in single node mode\n"); - else + else info("Started in single node mode\n"); - return res; + return res; } static void __exit tipc_exit(void) @@ -268,11 +268,11 @@ EXPORT_SYMBOL(tipc_available_nodes); /* TIPC API for external bearers (see tipc_bearer.h) */ EXPORT_SYMBOL(tipc_block_bearer); -EXPORT_SYMBOL(tipc_continue); +EXPORT_SYMBOL(tipc_continue); EXPORT_SYMBOL(tipc_disable_bearer); EXPORT_SYMBOL(tipc_enable_bearer); EXPORT_SYMBOL(tipc_recv_msg); -EXPORT_SYMBOL(tipc_register_media); +EXPORT_SYMBOL(tipc_register_media); /* TIPC API for external APIs (see tipc_port.h) */ diff --git a/net/tipc/core.h b/net/tipc/core.h index 4638947c..e40ada9 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -1,6 +1,6 @@ /* * net/tipc/core.h: Include file for TIPC global declarations - * + * * Copyright (c) 2005-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -54,7 +54,7 @@ #include <asm/atomic.h> #include <asm/hardirq.h> #include <linux/netdevice.h> -#include <linux/in.h> +#include <linux/in.h> #include <linux/list.h> #include <linux/vmalloc.h> @@ -88,7 +88,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); #define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) -/* +/* * By default, TIPC_OUTPUT is defined to be system console and TIPC log buffer, * while DBG_OUTPUT is the null print buffer. These defaults can be changed * here, or on a per .c file basis, by redefining these symbols. The following @@ -126,9 +126,9 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); #define dump(fmt,arg...) do {} while (0) -/* +/* * TIPC_OUTPUT is defined to be the system console, while DBG_OUTPUT is - * the null print buffer. Thes ensures that any system or debug messages + * the null print buffer. Thes ensures that any system or debug messages * that are generated without using the above macros are handled correctly. */ @@ -138,10 +138,10 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); #undef DBG_OUTPUT #define DBG_OUTPUT TIPC_NULL -#endif +#endif -/* +/* * TIPC-specific error codes */ @@ -204,11 +204,11 @@ u32 tipc_k_signal(Handler routine, unsigned long argument); * @timer: pointer to timer structure * @routine: pointer to routine to invoke when timer expires * @argument: value to pass to routine when timer expires - * + * * Timer must be initialized before use (and terminated when no longer needed). */ -static inline void k_init_timer(struct timer_list *timer, Handler routine, +static inline void k_init_timer(struct timer_list *timer, Handler routine, unsigned long argument) { dbg("initializing timer %p\n", timer); @@ -221,13 +221,13 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine, * k_start_timer - start a timer * @timer: pointer to timer structure * @msec: time to delay (in ms) - * + * * Schedules a previously initialized timer for later execution. * If timer is already running, the new timeout overrides the previous request. - * + * * To ensure the timer doesn't expire before the specified delay elapses, * the amount of delay is rounded up when converting to the jiffies - * then an additional jiffy is added to account for the fact that + * then an additional jiffy is added to account for the fact that * the starting time may be in the middle of the current jiffy. */ @@ -240,10 +240,10 @@ static inline void k_start_timer(struct timer_list *timer, unsigned long msec) /** * k_cancel_timer - cancel a timer * @timer: pointer to timer structure - * - * Cancels a previously initialized timer. + * + * Cancels a previously initialized timer. * Can be called safely even if the timer is already inactive. - * + * * WARNING: Must not be called when holding locks required by the timer's * timeout routine, otherwise deadlock can occur on SMP systems! */ @@ -257,11 +257,11 @@ static inline void k_cancel_timer(struct timer_list *timer) /** * k_term_timer - terminate a timer * @timer: pointer to timer structure - * + * * Prevents further use of a previously initialized timer. - * + * * WARNING: Caller must ensure timer isn't currently running. - * + * * (Do not "enhance" this routine to automatically cancel an active timer, * otherwise deadlock can arise when a timeout routine calls k_term_timer.) */ @@ -302,7 +302,7 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb) * @size: message size (including TIPC header) * * Returns a new buffer with data pointers set to the specified size. - * + * * NOTE: Headroom is reserved to allow prepending of a data link header. * There may also be unrequested tailroom present at the buffer's end. */ @@ -334,4 +334,4 @@ static inline void buf_discard(struct sk_buff *skb) kfree_skb(skb); } -#endif +#endif diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index 627f99b7..e809d2a 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c @@ -1,6 +1,6 @@ /* * net/tipc/dbg.c: TIPC print buffer routines for debugging - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -123,34 +123,34 @@ int tipc_printbuf_empty(struct print_buf *pb) /** * tipc_printbuf_validate - check for print buffer overflow * @pb: pointer to print buffer structure - * - * Verifies that a print buffer has captured all data written to it. + * + * Verifies that a print buffer has captured all data written to it. * If data has been lost, linearize buffer and prepend an error message - * + * * Returns length of print buffer data string (including trailing NUL) */ int tipc_printbuf_validate(struct print_buf *pb) { - char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; - char *cp_buf; - struct print_buf cb; + char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; + char *cp_buf; + struct print_buf cb; if (!pb->buf) return 0; if (pb->buf[pb->size - 1] == 0) { - cp_buf = kmalloc(pb->size, GFP_ATOMIC); - if (cp_buf != NULL){ - tipc_printbuf_init(&cb, cp_buf, pb->size); - tipc_printbuf_move(&cb, pb); - tipc_printbuf_move(pb, &cb); - kfree(cp_buf); - memcpy(pb->buf, err, strlen(err)); - } else { - tipc_printbuf_reset(pb); - tipc_printf(pb, err); - } + cp_buf = kmalloc(pb->size, GFP_ATOMIC); + if (cp_buf != NULL){ + tipc_printbuf_init(&cb, cp_buf, pb->size); + tipc_printbuf_move(&cb, pb); + tipc_printbuf_move(pb, &cb); + kfree(cp_buf); + memcpy(pb->buf, err, strlen(err)); + } else { + tipc_printbuf_reset(pb); + tipc_printf(pb, err); + } } return (pb->crs - pb->buf + 1); } @@ -159,7 +159,7 @@ int tipc_printbuf_validate(struct print_buf *pb) * tipc_printbuf_move - move print buffer contents to another print buffer * @pb_to: pointer to destination print buffer structure * @pb_from: pointer to source print buffer structure - * + * * Current contents of destination print buffer (if any) are discarded. * Source print buffer becomes empty if a successful move occurs. */ @@ -234,13 +234,13 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) pb->crs = pb->buf + pb->size - 1; } else { strcpy(pb->buf, print_string + chars_left); - save_char = print_string[chars_left]; - print_string[chars_left] = 0; - strcpy(pb->crs, print_string); - print_string[chars_left] = save_char; - pb->crs = pb->buf + chars_to_add - chars_left; - } - } + save_char = print_string[chars_left]; + print_string[chars_left] = 0; + strcpy(pb->crs, print_string); + print_string[chars_left] = save_char; + pb->crs = pb->buf + chars_to_add - chars_left; + } + } pb_next = pb->next; pb->next = NULL; pb = pb_next; @@ -249,7 +249,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) } /** - * TIPC_TEE - perform next output operation on both print buffers + * TIPC_TEE - perform next output operation on both print buffers * @b0: pointer to chain of print buffers (may be NULL) * @b1: pointer to print buffer to add to chain * @@ -350,7 +350,7 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...) } /** - * tipc_log_stop - free up TIPC log print buffer + * tipc_log_stop - free up TIPC log print buffer */ void tipc_log_stop(void) diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h index 467c0bc..c01b085 100644 --- a/net/tipc/dbg.h +++ b/net/tipc/dbg.h @@ -1,6 +1,6 @@ /* * net/tipc/dbg.h: Include file for TIPC print buffer routines - * + * * Copyright (c) 1997-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. diff --git a/net/tipc/discover.c b/net/tipc/discover.c index 3b0cd12..5d643e5 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c @@ -1,6 +1,6 @@ /* * net/tipc/discover.c - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -56,10 +56,10 @@ #define CHECK_LINK_COUNT 306 #endif -/* +/* * TODO: Most of the inter-cluster setup stuff should be * rewritten, and be made conformant with specification. - */ + */ /** @@ -80,10 +80,10 @@ struct link_req { #if 0 -int disc_create_link(const struct tipc_link_create *argv) +int disc_create_link(const struct tipc_link_create *argv) { - /* - * Code for inter cluster link setup here + /* + * Code for inter cluster link setup here */ return TIPC_OK; } @@ -93,16 +93,16 @@ int disc_create_link(const struct tipc_link_create *argv) * disc_lost_link(): A link has lost contact */ -void tipc_disc_link_event(u32 addr, char *name, int up) +void tipc_disc_link_event(u32 addr, char *name, int up) { if (in_own_cluster(addr)) return; - /* - * Code for inter cluster link setup here + /* + * Code for inter cluster link setup here */ } -/** +/** * tipc_disc_init_msg - initialize a link setup message * @type: message type (request or response) * @req_links: number of links associated with message @@ -210,7 +210,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf) dbg("creating link\n"); link = tipc_link_create(b_ptr, orig, &media_addr); if (!link) { - spin_unlock_bh(&n_ptr->lock); + spin_unlock_bh(&n_ptr->lock); return; } } @@ -224,10 +224,10 @@ void tipc_disc_recv_msg(struct sk_buff *buf) warn("Resetting link <%s>, peer interface address changed\n", link->name); memcpy(addr, &media_addr, sizeof(*addr)); - tipc_link_reset(link); + tipc_link_reset(link); } link_fully_up = (link->state == WORKING_WORKING); - spin_unlock_bh(&n_ptr->lock); + spin_unlock_bh(&n_ptr->lock); if ((type == DSC_RESP_MSG) || link_fully_up) return; rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); @@ -244,23 +244,23 @@ void tipc_disc_recv_msg(struct sk_buff *buf) * @req: ptr to link request structure */ -void tipc_disc_stop_link_req(struct link_req *req) +void tipc_disc_stop_link_req(struct link_req *req) { if (!req) return; - + k_cancel_timer(&req->timer); k_term_timer(&req->timer); buf_discard(req->buf); kfree(req); -} +} /** * tipc_disc_update_link_req - update frequency of periodic link setup requests * @req: ptr to link request structure */ -void tipc_disc_update_link_req(struct link_req *req) +void tipc_disc_update_link_req(struct link_req *req) { if (!req) return; @@ -278,16 +278,16 @@ void tipc_disc_update_link_req(struct link_req *req) } else { /* leave timer "as is" if haven't yet reached a "normal" rate */ } -} +} /** * disc_timeout - send a periodic link setup request * @req: ptr to link request structure - * + * * Called whenever a link setup request timer associated with a bearer expires. */ -static void disc_timeout(struct link_req *req) +static void disc_timeout(struct link_req *req) { spin_lock_bh(&req->bearer->publ.lock); @@ -300,7 +300,7 @@ static void disc_timeout(struct link_req *req) req->timer_intv *= 2; if (req->timer_intv > TIPC_LINK_REQ_FAST) req->timer_intv = TIPC_LINK_REQ_FAST; - if ((req->timer_intv == TIPC_LINK_REQ_FAST) && + if ((req->timer_intv == TIPC_LINK_REQ_FAST) && (req->bearer->nodes.count)) req->timer_intv = TIPC_LINK_REQ_SLOW; } @@ -315,14 +315,14 @@ static void disc_timeout(struct link_req *req) * @dest: destination address for request messages * @dest_domain: network domain of node(s) which should respond to message * @req_links: max number of desired links - * + * * Returns pointer to link request structure, or NULL if unable to create. */ -struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, +struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, const struct tipc_media_addr *dest, u32 dest_domain, - u32 req_links) + u32 req_links) { struct link_req *req; @@ -342,5 +342,5 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req); k_start_timer(&req->timer, req->timer_intv); return req; -} +} diff --git a/net/tipc/discover.h b/net/tipc/discover.h index 0454fd1..9fd7587 100644 --- a/net/tipc/discover.h +++ b/net/tipc/discover.h @@ -41,7 +41,7 @@ struct link_req; -struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, +struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, const struct tipc_media_addr *dest, u32 dest_domain, u32 req_links); diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 682da4a..9be4839 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -1,6 +1,6 @@ /* * net/tipc/eth_media.c: Ethernet bearer support for TIPC - * + * * Copyright (c) 2001-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -50,7 +50,7 @@ * @dev: ptr to associated Ethernet network device * @tipc_packet_type: used in binding TIPC to Ethernet driver */ - + struct eth_bearer { struct tipc_bearer *bearer; struct net_device *dev; @@ -62,10 +62,10 @@ static int eth_started = 0; static struct notifier_block notifier; /** - * send_msg - send a TIPC message out over an Ethernet interface + * send_msg - send a TIPC message out over an Ethernet interface */ -static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, +static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, struct tipc_media_addr *dest) { struct sk_buff *clone; @@ -76,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, clone->nh.raw = clone->data; dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; clone->dev = dev; - dev->hard_header(clone, dev, ETH_P_TIPC, + dev->hard_header(clone, dev, ETH_P_TIPC, &dest->dev_addr.eth_addr, dev->dev_addr, clone->len); dev_queue_xmit(clone); @@ -86,12 +86,12 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, /** * recv_msg - handle incoming TIPC message from an Ethernet interface - * + * * Routine truncates any Ethernet padding/CRC appended to the message, * and ensures message size matches actual length */ -static int recv_msg(struct sk_buff *buf, struct net_device *dev, +static int recv_msg(struct sk_buff *buf, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; @@ -99,14 +99,14 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, if (likely(eb_ptr->bearer)) { if (likely(!dev->promiscuity) || - !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || - !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { - size = msg_size((struct tipc_msg *)buf->data); - skb_trim(buf, size); - if (likely(buf->len == size)) { - buf->next = NULL; - tipc_recv_msg(buf, eb_ptr->bearer); - return TIPC_OK; + !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || + !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { + size = msg_size((struct tipc_msg *)buf->data); + skb_trim(buf, size); + if (likely(buf->len == size)) { + buf->next = NULL; + tipc_recv_msg(buf, eb_ptr->bearer); + return TIPC_OK; } } } @@ -115,7 +115,7 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, } /** - * enable_bearer - attach TIPC bearer to an Ethernet interface + * enable_bearer - attach TIPC bearer to an Ethernet interface */ static int enable_bearer(struct tipc_bearer *tb_ptr) @@ -127,7 +127,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) /* Find device with specified name */ - while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { + while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { dev = dev->next; } if (!dev) @@ -154,14 +154,14 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) eb_ptr->bearer = tb_ptr; tb_ptr->usr_handle = (void *)eb_ptr; tb_ptr->mtu = dev->mtu; - tb_ptr->blocked = 0; + tb_ptr->blocked = 0; tb_ptr->addr.type = htonl(TIPC_MEDIA_TYPE_ETH); memcpy(&tb_ptr->addr.dev_addr, &dev->dev_addr, ETH_ALEN); return 0; } /** - * disable_bearer - detach TIPC bearer from an Ethernet interface + * disable_bearer - detach TIPC bearer from an Ethernet interface * * We really should do dev_remove_pack() here, but this function can not be * called at tasklet level. => Use eth_bearer->bearer as a flag to throw away @@ -176,11 +176,11 @@ static void disable_bearer(struct tipc_bearer *tb_ptr) /** * recv_notification - handle device updates from OS * - * Change the state of the Ethernet bearer (if any) associated with the + * Change the state of the Ethernet bearer (if any) associated with the * specified device. */ -static int recv_notification(struct notifier_block *nb, unsigned long evt, +static int recv_notification(struct notifier_block *nb, unsigned long evt, void *dv) { struct net_device *dev = (struct net_device *)dv; @@ -194,7 +194,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, if (!eb_ptr->bearer) return NOTIFY_DONE; /* bearer had been disabled */ - eb_ptr->bearer->mtu = dev->mtu; + eb_ptr->bearer->mtu = dev->mtu; switch (evt) { case NETDEV_CHANGE: @@ -210,12 +210,12 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, tipc_block_bearer(eb_ptr->bearer->name); break; case NETDEV_CHANGEMTU: - case NETDEV_CHANGEADDR: + case NETDEV_CHANGEADDR: tipc_block_bearer(eb_ptr->bearer->name); - tipc_continue(eb_ptr->bearer); + tipc_continue(eb_ptr->bearer); break; case NETDEV_UNREGISTER: - case NETDEV_CHANGENAME: + case NETDEV_CHANGENAME: tipc_disable_bearer(eb_ptr->bearer->name); break; } @@ -227,7 +227,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, */ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) -{ +{ unchar *addr = (unchar *)&a->dev_addr; if (str_size < 18) @@ -246,7 +246,7 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size */ int tipc_eth_media_start(void) -{ +{ struct tipc_media_addr bcast_addr; int res; @@ -259,8 +259,8 @@ int tipc_eth_media_start(void) memset(eth_bearers, 0, sizeof(eth_bearers)); res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", - enable_bearer, disable_bearer, send_msg, - eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, + enable_bearer, disable_bearer, send_msg, + eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, ETH_LINK_TOLERANCE, ETH_LINK_WINDOW); if (res) return res; diff --git a/net/tipc/handler.c b/net/tipc/handler.c index eb80778..e1dcf66 100644 --- a/net/tipc/handler.c +++ b/net/tipc/handler.c @@ -1,6 +1,6 @@ /* * net/tipc/handler.c: TIPC signal handling - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -95,7 +95,7 @@ static void process_signal_queue(unsigned long dummy) int tipc_handler_start(void) { - tipc_queue_item_cache = + tipc_queue_item_cache = kmem_cache_create("tipc_queue_items", sizeof(struct queue_item), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if (!tipc_queue_item_cache) @@ -110,7 +110,7 @@ int tipc_handler_start(void) void tipc_handler_stop(void) { struct list_head *l, *n; - struct queue_item *item; + struct queue_item *item; if (!handler_enabled) return; diff --git a/net/tipc/link.c b/net/tipc/link.c index 1bb983c..71c2f2f 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1,6 +1,6 @@ /* * net/tipc/link.c: TIPC link code - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -50,29 +50,29 @@ #include "bcast.h" -/* - * Limit for deferred reception queue: +/* + * Limit for deferred reception queue: */ #define DEF_QUEUE_LIMIT 256u -/* - * Link state events: +/* + * Link state events: */ #define STARTING_EVT 856384768 /* link processing trigger */ #define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */ #define TIMEOUT_EVT 560817u /* link timer expired */ -/* - * The following two 'message types' is really just implementation - * data conveniently stored in the message header. +/* + * The following two 'message types' is really just implementation + * data conveniently stored in the message header. * They must not be considered part of the protocol */ #define OPEN_MSG 0 #define CLOSED_MSG 1 -/* +/* * State value stored in 'exp_msg_count' */ @@ -97,7 +97,7 @@ struct link_name { /* LINK EVENT CODE IS NOT SUPPORTED AT PRESENT */ -/** +/** * struct link_event - link up/down event notification */ @@ -121,7 +121,7 @@ static int link_send_sections_long(struct port *sender, static void link_check_defragm_bufs(struct link *l_ptr); static void link_state_event(struct link *l_ptr, u32 event); static void link_reset_statistics(struct link *l_ptr); -static void link_print(struct link *l_ptr, struct print_buf *buf, +static void link_print(struct link *l_ptr, struct print_buf *buf, const char *str); /* @@ -136,13 +136,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf, * * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0, - * the dbg_link_XXX() routines simply send their output to the standard + * the dbg_link_XXX() routines simply send their output to the standard * debug print buffer (DBG_OUTPUT), if it has been defined; this can be useful * when there is only a single link in the system being debugged. * * Notes: * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE - * - "l_ptr" must be valid when using dbg_link_XXX() macros + * - "l_ptr" must be valid when using dbg_link_XXX() macros */ #define LINK_LOG_BUF_SIZE 0 @@ -222,18 +222,18 @@ static u32 link_max_pkt(struct link *l_ptr) static void link_init_max_pkt(struct link *l_ptr) { u32 max_pkt; - + max_pkt = (l_ptr->b_ptr->publ.mtu & ~3); if (max_pkt > MAX_MSG_SIZE) max_pkt = MAX_MSG_SIZE; - l_ptr->max_pkt_target = max_pkt; + l_ptr->max_pkt_target = max_pkt; if (l_ptr->max_pkt_target < MAX_PKT_DEFAULT) l_ptr->max_pkt = l_ptr->max_pkt_target; - else + else l_ptr->max_pkt = MAX_PKT_DEFAULT; - l_ptr->max_pkt_probes = 0; + l_ptr->max_pkt_probes = 0; } static u32 link_next_sent(struct link *l_ptr) @@ -269,7 +269,7 @@ int tipc_link_is_active(struct link *l_ptr) * link_name_validate - validate & (optionally) deconstruct link name * @name - ptr to link name string * @name_parts - ptr to area for link name components (or NULL if not needed) - * + * * Returns 1 if link name is valid, otherwise 0. */ @@ -317,8 +317,8 @@ static int link_name_validate(const char *name, struct link_name *name_parts) &z_peer, &c_peer, &n_peer, &dummy) != 3) || (z_local > 255) || (c_local > 4095) || (n_local > 4095) || (z_peer > 255) || (c_peer > 4095) || (n_peer > 4095) || - (if_local_len <= 1) || (if_local_len > TIPC_MAX_IF_NAME) || - (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME) || + (if_local_len <= 1) || (if_local_len > TIPC_MAX_IF_NAME) || + (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME) || (strspn(if_local, tipc_alphabet) != (if_local_len - 1)) || (strspn(if_peer, tipc_alphabet) != (if_peer_len - 1))) return 0; @@ -337,7 +337,7 @@ static int link_name_validate(const char *name, struct link_name *name_parts) /** * link_timeout - handle expiration of link timer * @l_ptr: pointer to link - * + * * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict * with tipc_link_delete(). (There is no risk that the node will be deleted by * another thread because tipc_link_delete() always cancels the link timer before @@ -406,7 +406,7 @@ static void link_set_timer(struct link *l_ptr, u32 time) * @b_ptr: pointer to associated bearer * @peer: network address of node at other end of link * @media_addr: media address to use when sending messages over link - * + * * Returns pointer to link. */ @@ -427,7 +427,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, if_name = strchr(b_ptr->publ.name, ':') + 1; sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), - tipc_node(tipc_own_addr), + tipc_node(tipc_own_addr), if_name, tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); /* note: peer i/f is appended to link name by reset/activate */ @@ -478,17 +478,17 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); - + return l_ptr; } -/** +/** * tipc_link_delete - delete a link * @l_ptr: pointer to link - * + * * Note: 'tipc_net_lock' is write_locked, bearer is locked. * This routine must not grab the node lock until after link timer cancellation - * to avoid a potential deadlock situation. + * to avoid a potential deadlock situation. */ void tipc_link_delete(struct link *l_ptr) @@ -501,7 +501,7 @@ void tipc_link_delete(struct link *l_ptr) dbg("tipc_link_delete()\n"); k_cancel_timer(&l_ptr->timer); - + tipc_node_lock(l_ptr->owner); tipc_link_reset(l_ptr); tipc_node_detach_link(l_ptr->owner, l_ptr); @@ -521,12 +521,12 @@ void tipc_link_start(struct link *l_ptr) } /** - * link_schedule_port - schedule port for deferred sending + * link_schedule_port - schedule port for deferred sending * @l_ptr: pointer to link * @origport: reference to sending port * @sz: amount of data to be sent - * - * Schedules port for renewed sending of messages after link congestion + * + * Schedules port for renewed sending of messages after link congestion * has abated. */ @@ -567,7 +567,7 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all) return; if (link_congested(l_ptr)) goto exit; - list_for_each_entry_safe(p_ptr, temp_p_ptr, &l_ptr->waiting_ports, + list_for_each_entry_safe(p_ptr, temp_p_ptr, &l_ptr->waiting_ports, wait_list) { if (win <= 0) break; @@ -584,7 +584,7 @@ exit: spin_unlock_bh(&tipc_port_list_lock); } -/** +/** * link_release_outqueue - purge link's outbound message queue * @l_ptr: pointer to link */ @@ -621,7 +621,7 @@ void tipc_link_reset_fragments(struct link *l_ptr) l_ptr->defragm_buf = NULL; } -/** +/** * tipc_link_stop - purge all inbound and outbound messages associated with link * @l_ptr: pointer to link */ @@ -665,7 +665,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up), struct link *l_ptr, int up) { struct link_event *ev; - + ev = kmalloc(sizeof(*ev), GFP_ATOMIC); if (!ev) { warn("Link event allocation failure\n"); @@ -690,15 +690,15 @@ void tipc_link_reset(struct link *l_ptr) u32 prev_state = l_ptr->state; u32 checkpoint = l_ptr->next_in_no; int was_active_link = tipc_link_is_active(l_ptr); - + msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1); - /* Link is down, accept any session: */ + /* Link is down, accept any session: */ l_ptr->peer_session = 0; - /* Prepare for max packet size negotiation */ + /* Prepare for max packet size negotiation */ link_init_max_pkt(l_ptr); - + l_ptr->state = RESET_UNKNOWN; dbg_link_state("Resetting Link\n"); @@ -770,7 +770,7 @@ static void link_activate(struct link *l_ptr) static void link_state_event(struct link *l_ptr, unsigned event) { - struct link *other; + struct link *other; u32 cont_intv = l_ptr->continuity_interval; if (!l_ptr->started && (event != STARTING_EVT)) @@ -799,11 +799,11 @@ static void link_state_event(struct link *l_ptr, unsigned event) if (l_ptr->next_in_no != l_ptr->checkpoint) { l_ptr->checkpoint = l_ptr->next_in_no; if (tipc_bclink_acks_missing(l_ptr->owner)) { - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; } @@ -819,7 +819,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) break; case RESET_MSG: dbg_link("RES -> RR\n"); - info("Resetting link <%s>, requested by peer\n", + info("Resetting link <%s>, requested by peer\n", l_ptr->name); tipc_link_reset(l_ptr); l_ptr->state = RESET_RESET; @@ -871,7 +871,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) dbg_link("Probing %u/%u,timer = %u ms)\n", l_ptr->fsm_msg_cnt, l_ptr->abort_limit, cont_intv / 4); - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv / 4); @@ -977,11 +977,11 @@ static void link_state_event(struct link *l_ptr, unsigned event) /* * link_bundle_buf(): Append contents of a buffer to - * the tail of an existing one. + * the tail of an existing one. */ static int link_bundle_buf(struct link *l_ptr, - struct sk_buff *bundler, + struct sk_buff *bundler, struct sk_buff *buf) { struct tipc_msg *bundler_msg = buf_msg(bundler); @@ -1030,8 +1030,8 @@ static void link_add_to_outqueue(struct link *l_ptr, l_ptr->out_queue_size++; } -/* - * tipc_link_send_buf() is the 'full path' for messages, called from +/* + * tipc_link_send_buf() is the 'full path' for messages, called from * inside TIPC when the 'fast path' in tipc_send_buf * has failed, and from link_send() */ @@ -1074,7 +1074,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) if (queue_size > l_ptr->stats.max_queue_sz) l_ptr->stats.max_queue_sz = queue_size; - if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && + if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && !link_congested(l_ptr))) { link_add_to_outqueue(l_ptr, buf, msg); @@ -1094,7 +1094,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) /* Try adding message to an existing bundle */ - if (l_ptr->next_out && + if (l_ptr->next_out && link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); return dsz; @@ -1109,7 +1109,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) if (bundler) { msg_init(&bundler_hdr, MSG_BUNDLER, OPEN_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr); - memcpy(bundler->data, (unchar *)&bundler_hdr, + memcpy(bundler->data, (unchar *)&bundler_hdr, INT_H_SIZE); skb_trim(bundler, INT_H_SIZE); link_bundle_buf(l_ptr, bundler, buf); @@ -1126,8 +1126,8 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) return dsz; } -/* - * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has +/* + * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has * not been selected yet, and the the owner node is not locked * Called by TIPC internal users, e.g. the name distributor */ @@ -1161,8 +1161,8 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) return res; } -/* - * link_send_buf_fast: Entry for data messages where the +/* + * link_send_buf_fast: Entry for data messages where the * destination link is known and the header is complete, * inclusive total message length. Very time critical. * Link is locked. Returns user data length. @@ -1197,8 +1197,8 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, return tipc_link_send_buf(l_ptr, buf); /* All other cases */ } -/* - * tipc_send_buf_fast: Entry for data messages where the +/* + * tipc_send_buf_fast: Entry for data messages where the * destination node is known and the header is complete, * inclusive total message length. * Returns user data length. @@ -1236,15 +1236,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) } -/* - * tipc_link_send_sections_fast: Entry for messages where the +/* + * tipc_link_send_sections_fast: Entry for messages where the * destination processor is known and the header is complete, - * except for total message length. + * except for total message length. * Returns user data length or errno. */ -int tipc_link_send_sections_fast(struct port *sender, +int tipc_link_send_sections_fast(struct port *sender, struct iovec const *msg_sect, - const u32 num_sect, + const u32 num_sect, u32 destaddr) { struct tipc_msg *hdr = &sender->publ.phdr; @@ -1287,14 +1287,14 @@ exit: /* Exit if link (or bearer) is congested */ - if (link_congested(l_ptr) || + if (link_congested(l_ptr) || !list_empty(&l_ptr->b_ptr->cong_links)) { res = link_schedule_port(l_ptr, sender->publ.ref, res); goto exit; } - /* + /* * Message size exceeds max_pkt hint; update hint, * then re-try fast path or fragment the message */ @@ -1324,10 +1324,10 @@ exit: return res; } -/* - * link_send_sections_long(): Entry for long messages where the +/* + * link_send_sections_long(): Entry for long messages where the * destination node is known and the header is complete, - * inclusive total message length. + * inclusive total message length. * Link and bearer congestion status have been checked to be ok, * and are ignored if they change. * @@ -1357,9 +1357,9 @@ static int link_send_sections_long(struct port *sender, again: fragm_no = 1; - max_pkt = sender->max_pkt - INT_H_SIZE; + max_pkt = sender->max_pkt - INT_H_SIZE; /* leave room for tunnel header in case of link changeover */ - fragm_sz = max_pkt - INT_H_SIZE; + fragm_sz = max_pkt - INT_H_SIZE; /* leave room for fragmentation header in each fragment */ rest = dsz; fragm_crs = 0; @@ -1440,7 +1440,7 @@ error: if (!buf) goto error; - buf->next = NULL; + buf->next = NULL; prev->next = buf; memcpy(buf->data, (unchar *)&fragm_hdr, INT_H_SIZE); fragm_crs = INT_H_SIZE; @@ -1450,7 +1450,7 @@ error: } while (rest > 0); - /* + /* * Now we have a buffer chain. Select a link and check * that packet size is still OK */ @@ -1506,7 +1506,7 @@ reject: return dsz; } -/* +/* * tipc_link_push_packet: Push one unsent packet to the media */ u32 tipc_link_push_packet(struct link *l_ptr) @@ -1519,7 +1519,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) /* consider that buffers may have been released in meantime */ if (r_q_size && buf) { - u32 last = lesser(mod(r_q_head + r_q_size), + u32 last = lesser(mod(r_q_head + r_q_size), link_last_sent(l_ptr)); u32 first = msg_seqno(buf_msg(buf)); @@ -1535,7 +1535,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) if (r_q_size && buf && !skb_cloned(buf)) { msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); - msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); + msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">DEF-RETR>"); l_ptr->retransm_queue_head = mod(++r_q_head); @@ -1554,7 +1554,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) buf = l_ptr->proto_msg_queue; if (buf) { msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); - msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in); + msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in); if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">DEF-PROT>"); l_ptr->unacked_window = 0; @@ -1578,7 +1578,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) if (mod(next - first) < l_ptr->queue_limit[0]) { msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); - msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); + msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (msg_user(msg) == MSG_BUNDLER) msg_set_type(msg, CLOSED_MSG); @@ -1629,12 +1629,12 @@ static void link_reset_all(unsigned long addr) tipc_node_lock(n_ptr); - warn("Resetting all links to %s\n", + warn("Resetting all links to %s\n", addr_string_fill(addr_string, n_ptr->addr)); for (i = 0; i < MAX_BEARERS; i++) { if (n_ptr->links[i]) { - link_print(n_ptr->links[i], TIPC_OUTPUT, + link_print(n_ptr->links[i], TIPC_OUTPUT, "Resetting link\n"); tipc_link_reset(n_ptr->links[i]); } @@ -1689,7 +1689,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf) } } -void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, +void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, u32 retransmits) { struct tipc_msg *msg; @@ -1698,7 +1698,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, return; msg = buf_msg(buf); - + dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { @@ -1728,7 +1728,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, while (retransmits && (buf != l_ptr->next_out) && buf && !skb_cloned(buf)) { msg = buf_msg(buf); msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); - msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); + msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">RETR>"); buf = buf->next; @@ -1746,7 +1746,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0; } -/* +/* * link_recv_non_seq: Receive packets which are outside * the link sequence flow */ @@ -1761,11 +1761,11 @@ static void link_recv_non_seq(struct sk_buff *buf) tipc_bclink_recv_pkt(buf); } -/** +/** * link_insert_deferred_queue - insert deferred messages back into receive chain */ -static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, +static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, struct sk_buff *buf) { u32 seq_no; @@ -1813,11 +1813,11 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) link_recv_non_seq(buf); continue; } - + if (unlikely(!msg_short(msg) && (msg_destnode(msg) != tipc_own_addr))) goto cont; - + n_ptr = tipc_node_find(msg_prevnode(msg)); if (unlikely(!n_ptr)) goto cont; @@ -1828,8 +1828,8 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) tipc_node_unlock(n_ptr); goto cont; } - /* - * Release acked messages + /* + * Release acked messages */ if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported) @@ -1837,7 +1837,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) } crs = l_ptr->first_out; - while ((crs != l_ptr->next_out) && + while ((crs != l_ptr->next_out) && less_eq(msg_seqno(buf_msg(crs)), ackd)) { struct sk_buff *next = crs->next; @@ -1875,7 +1875,7 @@ deliver: switch (msg_user(msg)) { case MSG_BUNDLER: l_ptr->stats.recv_bundles++; - l_ptr->stats.recv_bundled += + l_ptr->stats.recv_bundled += msg_msgcnt(msg); tipc_node_unlock(n_ptr); tipc_link_recv_bundle(buf); @@ -1894,7 +1894,7 @@ deliver: continue; case MSG_FRAGMENTER: l_ptr->stats.recv_fragments++; - if (tipc_link_recv_fragment(&l_ptr->defragm_buf, + if (tipc_link_recv_fragment(&l_ptr->defragm_buf, &buf, &msg)) { l_ptr->stats.recv_fragmented++; goto deliver; @@ -1905,7 +1905,7 @@ deliver: if (link_recv_changeover_msg(&l_ptr, &buf)) { msg = buf_msg(buf); seq_no = msg_seqno(msg); - TIPC_SKB_CB(buf)->handle + TIPC_SKB_CB(buf)->handle = b_ptr; if (type == ORIGINAL_MSG) goto deliver; @@ -1948,8 +1948,8 @@ cont: read_unlock_bh(&tipc_net_lock); } -/* - * link_defer_buf(): Sort a received out-of-sequence packet +/* + * link_defer_buf(): Sort a received out-of-sequence packet * into the deferred reception queue. * Returns the increase of the queue length,i.e. 0 or 1 */ @@ -1986,7 +1986,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, if (prev) prev->next = buf; else - *head = buf; + *head = buf; return 1; } if (seq_no == msg_seqno(msg)) { @@ -2003,11 +2003,11 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, return 0; } -/** +/** * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet */ -static void link_handle_out_of_seq_msg(struct link *l_ptr, +static void link_handle_out_of_seq_msg(struct link *l_ptr, struct sk_buff *buf) { u32 seq_no = msg_seqno(buf_msg(buf)); @@ -2017,14 +2017,14 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, return; } - dbg("rx OOS msg: seq_no %u, expecting %u (%u)\n", + dbg("rx OOS msg: seq_no %u, expecting %u (%u)\n", seq_no, mod(l_ptr->next_in_no), l_ptr->next_in_no); /* Record OOS packet arrival (force mismatch on next timeout) */ l_ptr->checkpoint--; - /* + /* * Discard packet if a duplicate; otherwise add it to deferred queue * and notify peer of gap as per protocol specification */ @@ -2053,13 +2053,13 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, { struct sk_buff *buf = NULL; struct tipc_msg *msg = l_ptr->pmsg; - u32 msg_size = sizeof(l_ptr->proto_msg); + u32 msg_size = sizeof(l_ptr->proto_msg); if (link_blocked(l_ptr)) return; msg_set_type(msg, msg_typ); msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); - msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in)); + msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in)); msg_set_last_bcast(msg, tipc_bclink_get_last_sent()); if (msg_typ == STATE_MSG) { @@ -2082,23 +2082,23 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, msg_set_max_pkt(msg, ack_mtu); msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); msg_set_probe(msg, probe_msg != 0); - if (probe_msg) { + if (probe_msg) { u32 mtu = l_ptr->max_pkt; - if ((mtu < l_ptr->max_pkt_target) && + if ((mtu < l_ptr->max_pkt_target) && link_working_working(l_ptr) && l_ptr->fsm_msg_cnt) { msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3; - if (l_ptr->max_pkt_probes == 10) { - l_ptr->max_pkt_target = (msg_size - 4); - l_ptr->max_pkt_probes = 0; + if (l_ptr->max_pkt_probes == 10) { + l_ptr->max_pkt_target = (msg_size - 4); + l_ptr->max_pkt_probes = 0; msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3; - } + } l_ptr->max_pkt_probes++; - } + } l_ptr->stats.sent_probes++; - } + } l_ptr->stats.sent_states++; } else { /* RESET_MSG or ACTIVATE_MSG */ msg_set_ack(msg, mod(l_ptr->reset_checkpoint - 1)); @@ -2144,7 +2144,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, return; memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); - msg_set_size(buf_msg(buf), msg_size); + msg_set_size(buf_msg(buf), msg_size); if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { l_ptr->unacked_window = 0; @@ -2160,15 +2160,15 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, /* * Receive protocol message : - * Note that network plane id propagates through the network, and may - * change at any time. The node with lowest address rules + * Note that network plane id propagates through the network, and may + * change at any time. The node with lowest address rules */ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) { u32 rec_gap = 0; u32 max_pkt_info; - u32 max_pkt_ack; + u32 max_pkt_ack; u32 msg_tol; struct tipc_msg *msg = buf_msg(buf); @@ -2188,12 +2188,12 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) l_ptr->owner->permit_changeover = msg_redundant_link(msg); switch (msg_type(msg)) { - + case RESET_MSG: if (!link_working_unknown(l_ptr) && l_ptr->peer_session) { if (msg_session(msg) == l_ptr->peer_session) { dbg("Duplicate RESET: %u<->%u\n", - msg_session(msg), l_ptr->peer_session); + msg_session(msg), l_ptr->peer_session); break; /* duplicate: ignore */ } } @@ -2211,13 +2211,13 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) l_ptr->priority = msg_linkprio(msg); max_pkt_info = msg_max_pkt(msg); - if (max_pkt_info) { + if (max_pkt_info) { if (max_pkt_info < l_ptr->max_pkt_target) l_ptr->max_pkt_target = max_pkt_info; if (l_ptr->max_pkt > l_ptr->max_pkt_target) l_ptr->max_pkt = l_ptr->max_pkt_target; } else { - l_ptr->max_pkt = l_ptr->max_pkt_target; + l_ptr->max_pkt = l_ptr->max_pkt_target; } l_ptr->owner->bclink.supported = (max_pkt_info != 0); @@ -2235,8 +2235,8 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) if ((msg_tol = msg_link_tolerance(msg))) link_set_supervision_props(l_ptr, msg_tol); - - if (msg_linkprio(msg) && + + if (msg_linkprio(msg) && (msg_linkprio(msg) != l_ptr->priority)) { warn("Resetting link <%s>, priority change %u->%u\n", l_ptr->name, l_ptr->priority, msg_linkprio(msg)); @@ -2250,25 +2250,25 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) break; if (less_eq(mod(l_ptr->next_in_no), msg_next_sent(msg))) { - rec_gap = mod(msg_next_sent(msg) - + rec_gap = mod(msg_next_sent(msg) - mod(l_ptr->next_in_no)); } max_pkt_ack = msg_max_pkt(msg); - if (max_pkt_ack > l_ptr->max_pkt) { - dbg("Link <%s> updated MTU %u -> %u\n", - l_ptr->name, l_ptr->max_pkt, max_pkt_ack); - l_ptr->max_pkt = max_pkt_ack; - l_ptr->max_pkt_probes = 0; - } + if (max_pkt_ack > l_ptr->max_pkt) { + dbg("Link <%s> updated MTU %u -> %u\n", + l_ptr->name, l_ptr->max_pkt, max_pkt_ack); + l_ptr->max_pkt = max_pkt_ack; + l_ptr->max_pkt_probes = 0; + } max_pkt_ack = 0; - if (msg_probe(msg)) { + if (msg_probe(msg)) { l_ptr->stats.recv_probes++; - if (msg_size(msg) > sizeof(l_ptr->proto_msg)) { - max_pkt_ack = msg_size(msg); - } - } + if (msg_size(msg) > sizeof(l_ptr->proto_msg)) { + max_pkt_ack = msg_size(msg); + } + } /* Protocol message before retransmits, reduce loss risk */ @@ -2294,11 +2294,11 @@ exit: /* - * tipc_link_tunnel(): Send one message via a link belonging to + * tipc_link_tunnel(): Send one message via a link belonging to * another bearer. Owner node is locked. */ -void tipc_link_tunnel(struct link *l_ptr, - struct tipc_msg *tunnel_hdr, +void tipc_link_tunnel(struct link *l_ptr, + struct tipc_msg *tunnel_hdr, struct tipc_msg *msg, u32 selector) { @@ -2374,7 +2374,7 @@ void tipc_link_changeover(struct link *l_ptr) return; } - split_bundles = (l_ptr->owner->active_links[0] != + split_bundles = (l_ptr->owner->active_links[0] != l_ptr->owner->active_links[1]); while (crs) { @@ -2418,7 +2418,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) if (msg_user(msg) == MSG_BUNDLER) msg_set_type(msg, CLOSED_MSG); msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */ - msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); + msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); msg_set_size(&tunnel_hdr, length + INT_H_SIZE); outbuf = buf_acquire(length + INT_H_SIZE); if (outbuf == NULL) { @@ -2445,7 +2445,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) * @skb: encapsulating message buffer * @from_pos: offset to extract from * - * Returns a new message buffer containing an embedded message. The + * Returns a new message buffer containing an embedded message. The * encapsulating message itself is left unchanged. */ @@ -2461,7 +2461,7 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos) return eb; } -/* +/* * link_recv_changeover_msg(): Receive tunneled packet sent * via other link. Node is locked. Return extracted buffer. */ @@ -2482,7 +2482,7 @@ static int link_recv_changeover_msg(struct link **l_ptr, goto exit; } if (dest_link == *l_ptr) { - err("Unexpected changeover message on link <%s>\n", + err("Unexpected changeover message on link <%s>\n", (*l_ptr)->name); goto exit; } @@ -2582,9 +2582,9 @@ void tipc_link_recv_bundle(struct sk_buff *buf) */ -/* +/* * tipc_link_send_long_buf: Entry for buffers needing fragmentation. - * The buffer is complete, inclusive total message length. + * The buffer is complete, inclusive total message length. * Returns user data length. */ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) @@ -2650,9 +2650,9 @@ exit: return dsz; } -/* - * A pending message being re-assembled must store certain values - * to handle subsequent fragments correctly. The following functions +/* + * A pending message being re-assembled must store certain values + * to handle subsequent fragments correctly. The following functions * help storing these values in unused, available fields in the * pending message. This makes dynamic memory allocation unecessary. */ @@ -2692,11 +2692,11 @@ static void incr_timer_cnt(struct sk_buff *buf) msg_incr_reroute_cnt(buf_msg(buf)); } -/* - * tipc_link_recv_fragment(): Called with node lock on. Returns +/* + * tipc_link_recv_fragment(): Called with node lock on. Returns * the reassembled buffer if message is complete. */ -int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, +int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, struct tipc_msg **m) { struct sk_buff *prev = NULL; @@ -2737,9 +2737,9 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, /* Prepare buffer for subsequent fragments. */ - set_long_msg_seqno(pbuf, long_msg_seq_no); - set_fragm_size(pbuf,fragm_sz); - set_expected_frags(pbuf,exp_fragm_cnt - 1); + set_long_msg_seqno(pbuf, long_msg_seq_no); + set_fragm_size(pbuf,fragm_sz); + set_expected_frags(pbuf,exp_fragm_cnt - 1); } else { warn("Link unable to reassemble fragmented message\n"); } @@ -2765,7 +2765,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, *m = buf_msg(pbuf); return 1; } - set_expected_frags(pbuf,exp_frags); + set_expected_frags(pbuf,exp_frags); return 0; } dbg(" Discarding orphan fragment %x\n",fbuf); @@ -2849,10 +2849,10 @@ void tipc_link_set_queue_limits(struct link *l_ptr, u32 window) * link_find_link - locate link by name * @name - ptr to link name string * @node - ptr to area to be filled with ptr to associated node - * + * * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted; * this also prevents link deletion. - * + * * Returns pointer to link (or 0 if invalid link name). */ @@ -2860,7 +2860,7 @@ static struct link *link_find_link(const char *name, struct node **node) { struct link_name link_name_parts; struct bearer *b_ptr; - struct link *l_ptr; + struct link *l_ptr; if (!link_name_validate(name, &link_name_parts)) return NULL; @@ -2869,7 +2869,7 @@ static struct link *link_find_link(const char *name, struct node **node) if (!b_ptr) return NULL; - *node = tipc_node_find(link_name_parts.addr_peer); + *node = tipc_node_find(link_name_parts.addr_peer); if (!*node) return NULL; @@ -2880,14 +2880,14 @@ static struct link *link_find_link(const char *name, struct node **node) return l_ptr; } -struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, +struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd) { struct tipc_link_config *args; - u32 new_value; + u32 new_value; struct link *l_ptr; struct node *node; - int res; + int res; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); @@ -2899,40 +2899,40 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space if ((cmd == TIPC_CMD_SET_LINK_WINDOW) && (tipc_bclink_set_queue_limits(new_value) == 0)) return tipc_cfg_reply_none(); - return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED " (cannot change setting on broadcast link)"); } read_lock_bh(&tipc_net_lock); - l_ptr = link_find_link(args->name, &node); + l_ptr = link_find_link(args->name, &node); if (!l_ptr) { read_unlock_bh(&tipc_net_lock); - return tipc_cfg_reply_error_string("link not found"); + return tipc_cfg_reply_error_string("link not found"); } tipc_node_lock(node); res = -EINVAL; switch (cmd) { - case TIPC_CMD_SET_LINK_TOL: - if ((new_value >= TIPC_MIN_LINK_TOL) && + case TIPC_CMD_SET_LINK_TOL: + if ((new_value >= TIPC_MIN_LINK_TOL) && (new_value <= TIPC_MAX_LINK_TOL)) { link_set_supervision_props(l_ptr, new_value); - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, new_value, 0, 0); res = TIPC_OK; } break; - case TIPC_CMD_SET_LINK_PRI: + case TIPC_CMD_SET_LINK_PRI: if ((new_value >= TIPC_MIN_LINK_PRI) && (new_value <= TIPC_MAX_LINK_PRI)) { l_ptr->priority = new_value; - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, new_value, 0); res = TIPC_OK; } break; - case TIPC_CMD_SET_LINK_WINDOW: - if ((new_value >= TIPC_MIN_LINK_WIN) && + case TIPC_CMD_SET_LINK_WINDOW: + if ((new_value >= TIPC_MIN_LINK_WIN) && (new_value <= TIPC_MAX_LINK_WIN)) { tipc_link_set_queue_limits(l_ptr, new_value); res = TIPC_OK; @@ -2943,7 +2943,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space read_unlock_bh(&tipc_net_lock); if (res) - return tipc_cfg_reply_error_string("cannot change link setting"); + return tipc_cfg_reply_error_string("cannot change link setting"); return tipc_cfg_reply_none(); } @@ -2963,7 +2963,7 @@ static void link_reset_statistics(struct link *l_ptr) struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) { char *link_name; - struct link *l_ptr; + struct link *l_ptr; struct node *node; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) @@ -2977,7 +2977,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_ } read_lock_bh(&tipc_net_lock); - l_ptr = link_find_link(link_name, &node); + l_ptr = link_find_link(link_name, &node); if (!l_ptr) { read_unlock_bh(&tipc_net_lock); return tipc_cfg_reply_error_string("link not found"); @@ -3004,14 +3004,14 @@ static u32 percent(u32 count, u32 total) * @name: link name * @buf: print buffer area * @buf_size: size of print buffer area - * + * * Returns length of print buffer data string (or 0 if error) */ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) { struct print_buf pb; - struct link *l_ptr; + struct link *l_ptr; struct node *node; char *status; u32 profile_total = 0; @@ -3022,7 +3022,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) tipc_printbuf_init(&pb, buf, buf_size); read_lock_bh(&tipc_net_lock); - l_ptr = link_find_link(name, &node); + l_ptr = link_find_link(name, &node); if (!l_ptr) { read_unlock_bh(&tipc_net_lock); return 0; @@ -3036,28 +3036,28 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) else status = "DEFUNCT"; tipc_printf(&pb, "Link <%s>\n" - " %s MTU:%u Priority:%u Tolerance:%u ms" - " Window:%u packets\n", - l_ptr->name, status, link_max_pkt(l_ptr), + " %s MTU:%u Priority:%u Tolerance:%u ms" + " Window:%u packets\n", + l_ptr->name, status, link_max_pkt(l_ptr), l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]); - tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", l_ptr->next_in_no - l_ptr->stats.recv_info, l_ptr->stats.recv_fragments, l_ptr->stats.recv_fragmented, l_ptr->stats.recv_bundles, l_ptr->stats.recv_bundled); - tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", l_ptr->next_out_no - l_ptr->stats.sent_info, l_ptr->stats.sent_fragments, - l_ptr->stats.sent_fragmented, + l_ptr->stats.sent_fragmented, l_ptr->stats.sent_bundles, l_ptr->stats.sent_bundled); profile_total = l_ptr->stats.msg_length_counts; if (!profile_total) profile_total = 1; tipc_printf(&pb, " TX profile sample:%u packets average:%u octets\n" - " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% " - "-16354:%u%% -32768:%u%% -66000:%u%%\n", + " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% " + "-16354:%u%% -32768:%u%% -66000:%u%%\n", l_ptr->stats.msg_length_counts, l_ptr->stats.msg_lengths_total / profile_total, percent(l_ptr->stats.msg_length_profile[0], profile_total), @@ -3067,21 +3067,21 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) percent(l_ptr->stats.msg_length_profile[4], profile_total), percent(l_ptr->stats.msg_length_profile[5], profile_total), percent(l_ptr->stats.msg_length_profile[6], profile_total)); - tipc_printf(&pb, " RX states:%u probes:%u naks:%u defs:%u dups:%u\n", + tipc_printf(&pb, " RX states:%u probes:%u naks:%u defs:%u dups:%u\n", l_ptr->stats.recv_states, l_ptr->stats.recv_probes, l_ptr->stats.recv_nacks, - l_ptr->stats.deferred_recv, + l_ptr->stats.deferred_recv, l_ptr->stats.duplicates); - tipc_printf(&pb, " TX states:%u probes:%u naks:%u acks:%u dups:%u\n", - l_ptr->stats.sent_states, - l_ptr->stats.sent_probes, - l_ptr->stats.sent_nacks, - l_ptr->stats.sent_acks, + tipc_printf(&pb, " TX states:%u probes:%u naks:%u acks:%u dups:%u\n", + l_ptr->stats.sent_states, + l_ptr->stats.sent_probes, + l_ptr->stats.sent_nacks, + l_ptr->stats.sent_acks, l_ptr->stats.retransmitted); tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", l_ptr->stats.bearer_congs, - l_ptr->stats.link_congs, + l_ptr->stats.link_congs, l_ptr->stats.max_queue_sz, l_ptr->stats.queue_sz_counts ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts) @@ -3113,7 +3113,7 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); if (!str_len) { buf_discard(buf); - return tipc_cfg_reply_error_string("link not found"); + return tipc_cfg_reply_error_string("link not found"); } skb_put(buf, TLV_SPACE(str_len)); @@ -3164,7 +3164,7 @@ int link_control(const char *name, u32 op, u32 val) * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination * @dest: network address of destination node * @selector: used to select from set of active links - * + * * If no active link can be found, uses default maximum packet size. */ @@ -3173,11 +3173,11 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector) struct node *n_ptr; struct link *l_ptr; u32 res = MAX_PKT_DEFAULT; - + if (dest == tipc_own_addr) return MAX_MSG_SIZE; - read_lock_bh(&tipc_net_lock); + read_lock_bh(&tipc_net_lock); n_ptr = tipc_node_select(dest, selector); if (n_ptr) { tipc_node_lock(n_ptr); @@ -3186,7 +3186,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector) res = link_max_pkt(l_ptr); tipc_node_unlock(n_ptr); } - read_unlock_bh(&tipc_net_lock); + read_unlock_bh(&tipc_net_lock); return res; } @@ -3244,8 +3244,8 @@ static void link_print(struct link *l_ptr, struct print_buf *buf, tipc_printf(buf, "%u]", msg_seqno(buf_msg (l_ptr->last_out)), l_ptr->out_queue_size); - if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) - - msg_seqno(buf_msg(l_ptr->first_out))) + if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) - + msg_seqno(buf_msg(l_ptr->first_out))) != (l_ptr->out_queue_size - 1)) || (l_ptr->last_out->next != 0)) { tipc_printf(buf, "\nSend queue inconsistency\n"); diff --git a/net/tipc/link.h b/net/tipc/link.h index 2d3c157..52f3e7c 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h @@ -1,6 +1,6 @@ /* * net/tipc/link.h: Include file for TIPC link code - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -45,8 +45,8 @@ #define PUSH_FAILED 1 #define PUSH_FINISHED 2 -/* - * Link states +/* + * Link states */ #define WORKING_WORKING 560810u @@ -54,7 +54,7 @@ #define RESET_UNKNOWN 560812u #define RESET_RESET 560813u -/* +/* * Starting value for maximum packet size negotiation on unicast links * (unless bearer MTU is less) */ @@ -74,7 +74,7 @@ * @peer_session: link session # being used by peer end of link * @peer_bearer_id: bearer id used by link's peer endpoint * @b_ptr: pointer to bearer used by link - * @tolerance: minimum link continuity loss needed to reset link [in ms] + * @tolerance: minimum link continuity loss needed to reset link [in ms] * @continuity_interval: link continuity testing interval [in ms] * @abort_limit: # of unacknowledged continuity probes needed to reset link * @state: current state of link FSM @@ -110,7 +110,7 @@ * @stats: collects statistics regarding link activity * @print_buf: print buffer used to log link activity */ - + struct link { u32 addr; char name[TIPC_MAX_LINK_NAME]; @@ -143,18 +143,18 @@ struct link { u32 exp_msg_count; u32 reset_checkpoint; - /* Max packet negotiation */ - u32 max_pkt; - u32 max_pkt_target; - u32 max_pkt_probes; + /* Max packet negotiation */ + u32 max_pkt; + u32 max_pkt_target; + u32 max_pkt_probes; /* Sending */ u32 out_queue_size; struct sk_buff *first_out; struct sk_buff *last_out; u32 next_out_no; - u32 last_retransmitted; - u32 stale_count; + u32 last_retransmitted; + u32 stale_count; /* Reception */ u32 next_in_no; @@ -174,7 +174,7 @@ struct link { u32 long_msg_seq_no; struct sk_buff *defragm_buf; - /* Statistics */ + /* Statistics */ struct { u32 sent_info; /* used in counting # sent packets */ u32 recv_info; /* used in counting # recv'd packets */ @@ -239,9 +239,9 @@ void tipc_link_reset(struct link *l_ptr); int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf); u32 tipc_link_get_max_pkt(u32 dest,u32 selector); -int tipc_link_send_sections_fast(struct port* sender, +int tipc_link_send_sections_fast(struct port* sender, struct iovec const *msg_sect, - const u32 num_sect, + const u32 num_sect, u32 destnode); int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr, @@ -250,7 +250,7 @@ void tipc_link_recv_bundle(struct sk_buff *buf); int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, struct tipc_msg **msg); -void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, +void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); void tipc_link_push_queue(struct link *l_ptr); u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 3bd345a..7824854 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c @@ -1,6 +1,6 @@ /* * net/tipc/msg.c: TIPC message header routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 6699aaf..62d5490 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h @@ -1,6 +1,6 @@ /* * net/tipc/msg.h: Include file for TIPC message header routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -56,10 +56,10 @@ /* TIPC user data message header format, version 2 - + - Fundamental definitions available to privileged TIPC users are located in tipc_msg.h. - - Remaining definitions available to TIPC internal users appear below. + - Remaining definitions available to TIPC internal users appear below. */ @@ -75,7 +75,7 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w, msg_set_word(m, w, (word |= (val << pos))); } -/* +/* * Word 0 */ @@ -84,7 +84,7 @@ static inline u32 msg_version(struct tipc_msg *m) return msg_bits(m, 0, 29, 7); } -static inline void msg_set_version(struct tipc_msg *m) +static inline void msg_set_version(struct tipc_msg *m) { msg_set_bits(m, 0, 29, 0xf, TIPC_VERSION); } @@ -99,47 +99,47 @@ static inline u32 msg_isdata(struct tipc_msg *m) return (msg_user(m) <= DATA_CRITICAL); } -static inline void msg_set_user(struct tipc_msg *m, u32 n) +static inline void msg_set_user(struct tipc_msg *m, u32 n) { msg_set_bits(m, 0, 25, 0xf, n); } -static inline void msg_set_importance(struct tipc_msg *m, u32 i) +static inline void msg_set_importance(struct tipc_msg *m, u32 i) { msg_set_user(m, i); } -static inline void msg_set_hdr_sz(struct tipc_msg *m,u32 n) +static inline void msg_set_hdr_sz(struct tipc_msg *m,u32 n) { msg_set_bits(m, 0, 21, 0xf, n>>2); } -static inline int msg_non_seq(struct tipc_msg *m) +static inline int msg_non_seq(struct tipc_msg *m) { return msg_bits(m, 0, 20, 1); } -static inline void msg_set_non_seq(struct tipc_msg *m) +static inline void msg_set_non_seq(struct tipc_msg *m) { msg_set_bits(m, 0, 20, 1, 1); } -static inline int msg_dest_droppable(struct tipc_msg *m) +static inline int msg_dest_droppable(struct tipc_msg *m) { return msg_bits(m, 0, 19, 1); } -static inline void msg_set_dest_droppable(struct tipc_msg *m, u32 d) +static inline void msg_set_dest_droppable(struct tipc_msg *m, u32 d) { msg_set_bits(m, 0, 19, 1, d); } -static inline int msg_src_droppable(struct tipc_msg *m) +static inline int msg_src_droppable(struct tipc_msg *m) { return msg_bits(m, 0, 18, 1); } -static inline void msg_set_src_droppable(struct tipc_msg *m, u32 d) +static inline void msg_set_src_droppable(struct tipc_msg *m, u32 d) { msg_set_bits(m, 0, 18, 1, d); } @@ -150,31 +150,31 @@ static inline void msg_set_size(struct tipc_msg *m, u32 sz) } -/* +/* * Word 1 */ -static inline void msg_set_type(struct tipc_msg *m, u32 n) +static inline void msg_set_type(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 29, 0x7, n); } -static inline void msg_set_errcode(struct tipc_msg *m, u32 err) +static inline void msg_set_errcode(struct tipc_msg *m, u32 err) { msg_set_bits(m, 1, 25, 0xf, err); } -static inline u32 msg_reroute_cnt(struct tipc_msg *m) +static inline u32 msg_reroute_cnt(struct tipc_msg *m) { return msg_bits(m, 1, 21, 0xf); } -static inline void msg_incr_reroute_cnt(struct tipc_msg *m) +static inline void msg_incr_reroute_cnt(struct tipc_msg *m) { msg_set_bits(m, 1, 21, 0xf, msg_reroute_cnt(m) + 1); } -static inline void msg_reset_reroute_cnt(struct tipc_msg *m) +static inline void msg_reset_reroute_cnt(struct tipc_msg *m) { msg_set_bits(m, 1, 21, 0xf, 0); } @@ -184,12 +184,12 @@ static inline u32 msg_lookup_scope(struct tipc_msg *m) return msg_bits(m, 1, 19, 0x3); } -static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n) +static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 19, 0x3, n); } -static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz) +static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz) { u32 hsz = msg_hdr_sz(m); char *to = (char *)&m->hdr[hsz/4]; @@ -206,13 +206,13 @@ static inline u32 msg_bcast_ack(struct tipc_msg *m) return msg_bits(m, 1, 0, 0xffff); } -static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n) +static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 0, 0xffff, n); } -/* +/* * Word 2 */ @@ -221,7 +221,7 @@ static inline u32 msg_ack(struct tipc_msg *m) return msg_bits(m, 2, 16, 0xffff); } -static inline void msg_set_ack(struct tipc_msg *m, u32 n) +static inline void msg_set_ack(struct tipc_msg *m, u32 n) { msg_set_bits(m, 2, 16, 0xffff, n); } @@ -231,48 +231,48 @@ static inline u32 msg_seqno(struct tipc_msg *m) return msg_bits(m, 2, 0, 0xffff); } -static inline void msg_set_seqno(struct tipc_msg *m, u32 n) +static inline void msg_set_seqno(struct tipc_msg *m, u32 n) { msg_set_bits(m, 2, 0, 0xffff, n); } -/* +/* * Words 3-10 */ -static inline void msg_set_prevnode(struct tipc_msg *m, u32 a) +static inline void msg_set_prevnode(struct tipc_msg *m, u32 a) { msg_set_word(m, 3, a); } -static inline void msg_set_origport(struct tipc_msg *m, u32 p) +static inline void msg_set_origport(struct tipc_msg *m, u32 p) { msg_set_word(m, 4, p); } -static inline void msg_set_destport(struct tipc_msg *m, u32 p) +static inline void msg_set_destport(struct tipc_msg *m, u32 p) { msg_set_word(m, 5, p); } -static inline void msg_set_mc_netid(struct tipc_msg *m, u32 p) +static inline void msg_set_mc_netid(struct tipc_msg *m, u32 p) { msg_set_word(m, 5, p); } -static inline void msg_set_orignode(struct tipc_msg *m, u32 a) +static inline void msg_set_orignode(struct tipc_msg *m, u32 a) { msg_set_word(m, 6, a); } -static inline void msg_set_destnode(struct tipc_msg *m, u32 a) +static inline void msg_set_destnode(struct tipc_msg *m, u32 a) { msg_set_word(m, 7, a); } -static inline int msg_is_dest(struct tipc_msg *m, u32 d) +static inline int msg_is_dest(struct tipc_msg *m, u32 d) { return(msg_short(m) || (msg_destnode(m) == d)); } @@ -284,7 +284,7 @@ static inline u32 msg_routed(struct tipc_msg *m) return(msg_destnode(m) ^ msg_orignode(m)) >> 11; } -static inline void msg_set_nametype(struct tipc_msg *m, u32 n) +static inline void msg_set_nametype(struct tipc_msg *m, u32 n) { msg_set_word(m, 8, n); } @@ -309,17 +309,17 @@ static inline void msg_set_transp_seqno(struct tipc_msg *m, u32 n) msg_set_word(m, 8, n); } -static inline void msg_set_namelower(struct tipc_msg *m, u32 n) +static inline void msg_set_namelower(struct tipc_msg *m, u32 n) { msg_set_word(m, 9, n); } -static inline void msg_set_nameinst(struct tipc_msg *m, u32 n) +static inline void msg_set_nameinst(struct tipc_msg *m, u32 n) { msg_set_namelower(m, n); } -static inline void msg_set_nameupper(struct tipc_msg *m, u32 n) +static inline void msg_set_nameupper(struct tipc_msg *m, u32 n) { msg_set_word(m, 10, n); } @@ -329,7 +329,7 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m) return (struct tipc_msg *)msg_data(m); } -static inline void msg_expand(struct tipc_msg *m, u32 destnode) +static inline void msg_expand(struct tipc_msg *m, u32 destnode) { if (!msg_short(m)) return; @@ -344,7 +344,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) /* TIPC internal message header format, version 2 - 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 + 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ w0:|vers |msg usr|hdr sz |n|resrv| packet size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -372,9 +372,9 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ NB: CONN_MANAGER use data message format. LINK_CONFIG has own format. -*/ +*/ -/* +/* * Internal users */ @@ -390,7 +390,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) #define INT_H_SIZE 40 #define DSC_H_SIZE 40 -/* +/* * Connection management protocol messages */ @@ -398,7 +398,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) #define CONN_PROBE_REPLY 1 #define CONN_ACK 2 -/* +/* * Name distributor messages */ @@ -406,7 +406,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) #define WITHDRAWAL 1 -/* +/* * Word 1 */ @@ -425,13 +425,13 @@ static inline u32 msg_req_links(struct tipc_msg *m) return msg_bits(m, 1, 16, 0xfff); } -static inline void msg_set_req_links(struct tipc_msg *m, u32 n) +static inline void msg_set_req_links(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 16, 0xfff, n); } -/* +/* * Word 2 */ @@ -440,7 +440,7 @@ static inline u32 msg_dest_domain(struct tipc_msg *m) return msg_word(m, 2); } -static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n) +static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n) { msg_set_word(m, 2, n); } @@ -460,13 +460,13 @@ static inline u32 msg_bcgap_to(struct tipc_msg *m) return msg_bits(m, 2, 0, 0xffff); } -static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n) +static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n) { msg_set_bits(m, 2, 0, 0xffff, n); } -/* +/* * Word 4 */ @@ -533,7 +533,7 @@ static inline void msg_set_link_selector(struct tipc_msg *m, u32 n) msg_set_bits(m, 4, 0, 1, (n & 1)); } -/* +/* * Word 5 */ @@ -603,7 +603,7 @@ static inline void msg_clear_redundant_link(struct tipc_msg *m) } -/* +/* * Word 9 */ @@ -627,12 +627,12 @@ static inline void msg_set_bcast_tag(struct tipc_msg *m, u32 n) msg_set_bits(m, 9, 16, 0xffff, n); } -static inline u32 msg_max_pkt(struct tipc_msg *m) +static inline u32 msg_max_pkt(struct tipc_msg *m) { return (msg_bits(m, 9, 16, 0xffff) * 4); } -static inline void msg_set_max_pkt(struct tipc_msg *m, u32 n) +static inline void msg_set_max_pkt(struct tipc_msg *m, u32 n) { msg_set_bits(m, 9, 16, 0xffff, (n / 4)); } @@ -647,7 +647,7 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n) msg_set_bits(m, 9, 0, 0xffff, n); } -/* +/* * Routing table message data */ @@ -672,7 +672,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) msg_data(m)[pos + 4] = 1; } -/* +/* * Segmentation message types */ @@ -680,7 +680,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) #define FRAGMENT 1 #define LAST_FRAGMENT 2 -/* +/* * Link management protocol message types */ @@ -688,13 +688,13 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) #define RESET_MSG 1 #define ACTIVATE_MSG 2 -/* +/* * Changeover tunnel message types */ #define DUPLICATE_MSG 0 #define ORIGINAL_MSG 1 -/* +/* * Routing table message types */ #define EXT_ROUTING_TABLE 0 @@ -703,7 +703,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) #define ROUTE_ADDITION 3 #define ROUTE_REMOVAL 4 -/* +/* * Config protocol message types */ @@ -724,7 +724,7 @@ static inline u32 msg_tot_importance(struct tipc_msg *m) } -static inline void msg_init(struct tipc_msg *m, u32 user, u32 type, +static inline void msg_init(struct tipc_msg *m, u32 user, u32 type, u32 err, u32 hsize, u32 destnode) { memset(m, 0, hsize); @@ -741,7 +741,7 @@ static inline void msg_init(struct tipc_msg *m, u32 user, u32 type, } } -/** +/** * msg_calc_data_size - determine total data size for message */ @@ -755,15 +755,15 @@ static inline int msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect) return dsz; } -/** +/** * msg_build - create message using specified header and data - * + * * Note: Caller must not hold any locks in case copy_from_user() is interrupted! - * + * * Returns message data size or errno */ -static inline int msg_build(struct tipc_msg *hdr, +static inline int msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, u32 num_sect, int max_size, int usrmem, struct sk_buff** buf) { @@ -789,11 +789,11 @@ static inline int msg_build(struct tipc_msg *hdr, memcpy((*buf)->data, (unchar *)hdr, hsz); for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { if (likely(usrmem)) - res = !copy_from_user((*buf)->data + pos, - msg_sect[cnt].iov_base, + res = !copy_from_user((*buf)->data + pos, + msg_sect[cnt].iov_base, msg_sect[cnt].iov_len); else - memcpy((*buf)->data + pos, msg_sect[cnt].iov_base, + memcpy((*buf)->data + pos, msg_sect[cnt].iov_base, msg_sect[cnt].iov_len); pos += msg_sect[cnt].iov_len; } diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 7bf87cb..39fd161 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c @@ -1,6 +1,6 @@ /* * net/tipc/name_distr.c: TIPC name distribution code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -53,15 +53,15 @@ * @upper: name sequence upper bound * @ref: publishing port reference * @key: publication key - * + * * ===> All fields are stored in network byte order. <=== - * + * * First 3 fields identify (name or) name sequence being published. * Reference field uniquely identifies port that published name sequence. * Key field uniquely identifies publication, in the event a port has * multiple publications of the same name sequence. - * - * Note: There is no field that identifies the publishing node because it is + * + * Note: There is no field that identifies the publishing node because it is * the same for all items contained within a publication message. */ @@ -74,12 +74,12 @@ struct distr_item { }; /** - * List of externally visible publications by this node -- + * List of externally visible publications by this node -- * that is, all publications having scope > TIPC_NODE_SCOPE. */ static LIST_HEAD(publ_root); -static u32 publ_cnt = 0; +static u32 publ_cnt = 0; /** * publ_to_item - add publication info to a publication message @@ -101,12 +101,12 @@ static void publ_to_item(struct distr_item *i, struct publication *p) static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) { - struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size); + struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size); struct tipc_msg *msg; if (buf != NULL) { msg = buf_msg(buf); - msg_init(msg, NAME_DISTRIBUTOR, type, TIPC_OK, + msg_init(msg, NAME_DISTRIBUTOR, type, TIPC_OK, LONG_H_SIZE, dest); msg_set_size(msg, LONG_H_SIZE + size); } @@ -174,7 +174,7 @@ void tipc_named_node_up(unsigned long node) u32 rest; u32 max_item_buf; - read_lock_bh(&tipc_nametbl_lock); + read_lock_bh(&tipc_nametbl_lock); max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; max_item_buf *= ITEM_SIZE; rest = publ_cnt * ITEM_SIZE; @@ -183,7 +183,7 @@ void tipc_named_node_up(unsigned long node) if (!buf) { left = (rest <= max_item_buf) ? rest : max_item_buf; rest -= left; - buf = named_prepare_buf(PUBLICATION, left, node); + buf = named_prepare_buf(PUBLICATION, left, node); if (!buf) { warn("Bulk publication distribution failure\n"); goto exit; @@ -196,20 +196,20 @@ void tipc_named_node_up(unsigned long node) if (!left) { msg_set_link_selector(buf_msg(buf), node); dbg("tipc_named_node_up: sending publish msg to " - "<%u.%u.%u>\n", tipc_zone(node), + "<%u.%u.%u>\n", tipc_zone(node), tipc_cluster(node), tipc_node(node)); tipc_link_send(buf, node, node); buf = NULL; } } exit: - read_unlock_bh(&tipc_nametbl_lock); + read_unlock_bh(&tipc_nametbl_lock); } /** * node_is_down - remove publication associated with a failed node - * - * Invoked for each publication issued by a newly failed node. + * + * Invoked for each publication issued by a newly failed node. * Removes publication structure from name table & deletes it. * In rare cases the link may have come back up again when this * function is called, and we have two items representing the same @@ -221,15 +221,15 @@ static void node_is_down(struct publication *publ) { struct publication *p; - write_lock_bh(&tipc_nametbl_lock); - dbg("node_is_down: withdrawing %u, %u, %u\n", + write_lock_bh(&tipc_nametbl_lock); + dbg("node_is_down: withdrawing %u, %u, %u\n", publ->type, publ->lower, publ->upper); - publ->key += 1222345; - p = tipc_nametbl_remove_publ(publ->type, publ->lower, + publ->key += 1222345; + p = tipc_nametbl_remove_publ(publ->type, publ->lower, publ->node, publ->ref, publ->key); write_unlock_bh(&tipc_nametbl_lock); - if (p != publ) { + if (p != publ) { err("Unable to remove publication from failed node\n" "(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n", publ->type, publ->lower, publ->node, publ->ref, publ->key); @@ -251,27 +251,27 @@ void tipc_named_recv(struct sk_buff *buf) struct distr_item *item = (struct distr_item *)msg_data(msg); u32 count = msg_data_sz(msg) / ITEM_SIZE; - write_lock_bh(&tipc_nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); while (count--) { if (msg_type(msg) == PUBLICATION) { - dbg("tipc_named_recv: got publication for %u, %u, %u\n", + dbg("tipc_named_recv: got publication for %u, %u, %u\n", ntohl(item->type), ntohl(item->lower), ntohl(item->upper)); - publ = tipc_nametbl_insert_publ(ntohl(item->type), + publ = tipc_nametbl_insert_publ(ntohl(item->type), ntohl(item->lower), ntohl(item->upper), TIPC_CLUSTER_SCOPE, - msg_orignode(msg), + msg_orignode(msg), ntohl(item->ref), ntohl(item->key)); if (publ) { - tipc_nodesub_subscribe(&publ->subscr, - msg_orignode(msg), + tipc_nodesub_subscribe(&publ->subscr, + msg_orignode(msg), publ, (net_ev_handler)node_is_down); } } else if (msg_type(msg) == WITHDRAWAL) { - dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n", + dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n", ntohl(item->type), ntohl(item->lower), ntohl(item->upper)); publ = tipc_nametbl_remove_publ(ntohl(item->type), @@ -282,7 +282,7 @@ void tipc_named_recv(struct sk_buff *buf) if (publ) { tipc_nodesub_unsubscribe(&publ->subscr); - kfree(publ); + kfree(publ); } else { err("Unable to remove publication by node 0x%x\n" "(type=%u, lower=%u, ref=%u, key=%u)\n", @@ -295,13 +295,13 @@ void tipc_named_recv(struct sk_buff *buf) } item++; } - write_unlock_bh(&tipc_nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); buf_discard(buf); } /** * tipc_named_reinit - re-initialize local publication list - * + * * This routine is called whenever TIPC networking is (re)enabled. * All existing publications by this node that have "cluster" or "zone" scope * are updated to reflect the node's current network address. @@ -312,11 +312,11 @@ void tipc_named_reinit(void) { struct publication *publ; - write_lock_bh(&tipc_nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); list_for_each_entry(publ, &publ_root, local_list) { if (publ->node == tipc_own_addr) break; publ->node = tipc_own_addr; } - write_unlock_bh(&tipc_nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); } diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h index 843da01..1e41bdd 100644 --- a/net/tipc/name_distr.h +++ b/net/tipc/name_distr.h @@ -1,6 +1,6 @@ /* * net/tipc/name_distr.h: Include file for TIPC name distribution code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 049242e..9dfc912 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -1,6 +1,6 @@ /* * net/tipc/name_table.c: TIPC name table code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -65,7 +65,7 @@ struct sub_seq { struct publication *zone_list; }; -/** +/** * struct name_seq - container for all published instances of a name type * @type: 32 bit 'type' value for name sequence * @sseq: pointer to dynamically-sized array of sub-sequences of this 'type'; @@ -89,7 +89,7 @@ struct name_seq { /** * struct name_table - table containing all existing port name publications - * @types: pointer to fixed-sized array of name sequence lists, + * @types: pointer to fixed-sized array of name sequence lists, * accessed via hashing on 'type'; name sequence lists are *not* sorted * @local_publ_count: number of publications issued by this node */ @@ -113,8 +113,8 @@ static int hash(int x) * publ_create - create a publication structure */ -static struct publication *publ_create(u32 type, u32 lower, u32 upper, - u32 scope, u32 node, u32 port_ref, +static struct publication *publ_create(u32 type, u32 lower, u32 upper, + u32 scope, u32 node, u32 port_ref, u32 key) { struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC); @@ -148,7 +148,7 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt) /** * tipc_nameseq_create - create a name sequence structure for the specified 'type' - * + * * Allocates a single sub-sequence structure and sets it to all 0's. */ @@ -178,7 +178,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea /** * nameseq_find_subseq - find sub-sequence (if any) matching a name instance - * + * * Very time-critical, so binary searches through sub-sequence array. */ @@ -204,7 +204,7 @@ static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, /** * nameseq_locate_subseq - determine position of name instance in sub-sequence - * + * * Returns index in sub-sequence array of the entry that contains the specified * instance value; if no entry contains that value, returns the position * where a new entry for it would be inserted in the array. @@ -232,7 +232,7 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) } /** - * tipc_nameseq_insert_publ - + * tipc_nameseq_insert_publ - */ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, @@ -343,8 +343,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, } } - /* - * Any subscriptions waiting for notification? + /* + * Any subscriptions waiting for notification? */ list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { dbg("calling report_overlap()\n"); @@ -352,7 +352,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, publ->lower, publ->upper, TIPC_PUBLISHED, - publ->ref, + publ->ref, publ->node, created_subseq); } @@ -361,7 +361,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, /** * tipc_nameseq_remove_publ - - * + * * NOTE: There may be cases where TIPC is asked to remove a publication * that is not in the name table. For example, if another node issues a * publication for a name sequence that overlaps an existing name sequence @@ -392,12 +392,12 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i prev = sseq->zone_list; publ = sseq->zone_list->zone_list_next; - while ((publ->key != key) || (publ->ref != ref) || + while ((publ->key != key) || (publ->ref != ref) || (publ->node && (publ->node != node))) { prev = publ; publ = publ->zone_list_next; if (prev == sseq->zone_list) { - + /* Prevent endless loop if publication not found */ return NULL; @@ -426,7 +426,7 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i err("Unable to de-list cluster publication\n" "{%u%u}, node=0x%x, ref=%u, key=%u)\n", - publ->type, publ->lower, publ->node, + publ->type, publ->lower, publ->node, publ->ref, publ->key); goto end_cluster; } @@ -456,7 +456,7 @@ end_cluster: err("Unable to de-list node publication\n" "{%u%u}, node=0x%x, ref=%u, key=%u)\n", - publ->type, publ->lower, publ->node, + publ->type, publ->lower, publ->node, publ->ref, publ->key); goto end_node; } @@ -486,8 +486,8 @@ end_node: tipc_subscr_report_overlap(s, publ->lower, publ->upper, - TIPC_WITHDRAWN, - publ->ref, + TIPC_WITHDRAWN, + publ->ref, publ->node, removed_subseq); } @@ -517,8 +517,8 @@ void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) int must_report = 1; do { - tipc_subscr_report_overlap(s, - sseq->lower, + tipc_subscr_report_overlap(s, + sseq->lower, sseq->upper, TIPC_PUBLISHED, crs->ref, @@ -576,7 +576,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, scope, node, port, key); } -struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, +struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, u32 node, u32 ref, u32 key) { struct publication *publ; @@ -676,14 +676,14 @@ not_found: /** * tipc_nametbl_mc_translate - find multicast destinations - * + * * Creates list of all local ports that overlap the given multicast address; * also determines if any off-node ports overlap. * * Note: Publications with a scope narrower than 'limit' are ignored. * (i.e. local node-scope publications mustn't receive messages arriving * from another node, even if the multcast link brought it here) - * + * * Returns non-zero if any off-node ports overlap */ @@ -730,7 +730,7 @@ exit: * tipc_nametbl_publish_rsv - publish port name using a reserved name type */ -int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, +int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) { int res; @@ -745,13 +745,13 @@ int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, * tipc_nametbl_publish - add name publication to network name tables */ -struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, +struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, u32 scope, u32 port_ref, u32 key) { struct publication *publ; if (table.local_publ_count >= tipc_max_publications) { - warn("Publication failed, local publication limit reached (%u)\n", + warn("Publication failed, local publication limit reached (%u)\n", tipc_max_publications); return NULL; } @@ -808,22 +808,22 @@ void tipc_nametbl_subscribe(struct subscription *s) u32 type = s->seq.type; struct name_seq *seq; - write_lock_bh(&tipc_nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); seq = nametbl_find_seq(type); if (!seq) { seq = tipc_nameseq_create(type, &table.types[hash(type)]); } - if (seq){ - spin_lock_bh(&seq->lock); - dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n", - seq, type, s->seq.lower, s->seq.upper); - tipc_nameseq_subscribe(seq, s); - spin_unlock_bh(&seq->lock); - } else { + if (seq){ + spin_lock_bh(&seq->lock); + dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n", + seq, type, s->seq.lower, s->seq.upper); + tipc_nameseq_subscribe(seq, s); + spin_unlock_bh(&seq->lock); + } else { warn("Failed to create subscription for {%u,%u,%u}\n", s->seq.type, s->seq.lower, s->seq.upper); - } - write_unlock_bh(&tipc_nametbl_lock); + } + write_unlock_bh(&tipc_nametbl_lock); } /** @@ -834,19 +834,19 @@ void tipc_nametbl_unsubscribe(struct subscription *s) { struct name_seq *seq; - write_lock_bh(&tipc_nametbl_lock); - seq = nametbl_find_seq(s->seq.type); + write_lock_bh(&tipc_nametbl_lock); + seq = nametbl_find_seq(s->seq.type); if (seq != NULL){ - spin_lock_bh(&seq->lock); - list_del_init(&s->nameseq_list); - spin_unlock_bh(&seq->lock); - if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) { - hlist_del_init(&seq->ns_list); - kfree(seq->sseqs); - kfree(seq); - } - } - write_unlock_bh(&tipc_nametbl_lock); + spin_lock_bh(&seq->lock); + list_del_init(&s->nameseq_list); + spin_unlock_bh(&seq->lock); + if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) { + hlist_del_init(&seq->ns_list); + kfree(seq->sseqs); + kfree(seq); + } + } + write_unlock_bh(&tipc_nametbl_lock); } @@ -952,7 +952,7 @@ static void nametbl_header(struct print_buf *buf, u32 depth) * nametbl_list - print specified name table contents into the given buffer */ -static void nametbl_list(struct print_buf *buf, u32 depth_info, +static void nametbl_list(struct print_buf *buf, u32 depth_info, u32 type, u32 lowbound, u32 upbound) { struct hlist_head *seq_head; @@ -976,7 +976,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, for (i = 0; i < tipc_nametbl_size; i++) { seq_head = &table.types[i]; hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { - nameseq_list(seq, buf, depth, seq->type, + nameseq_list(seq, buf, depth, seq->type, lowbound, upbound, i); } } @@ -991,7 +991,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, seq_head = &table.types[i]; hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { if (seq->type == type) { - nameseq_list(seq, buf, depth, type, + nameseq_list(seq, buf, depth, type, lowbound, upbound, i); break; } @@ -1030,7 +1030,7 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space) tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); read_lock_bh(&tipc_nametbl_lock); - nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), + nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), ntohl(argv->lowbound), ntohl(argv->upbound)); read_unlock_bh(&tipc_nametbl_lock); str_len = tipc_printbuf_validate(&b); diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index e8a3d71..b9e7cd3 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h @@ -1,6 +1,6 @@ /* * net/tipc/name_table.h: Include file for TIPC name table code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -64,7 +64,7 @@ struct port_list; * @node_list: next matching name seq publication with >= node scope * @cluster_list: next matching name seq publication with >= cluster scope * @zone_list: next matching name seq publication with >= zone scope - * + * * Note that the node list, cluster list, and zone list are circular lists. */ @@ -89,16 +89,16 @@ extern rwlock_t tipc_nametbl_lock; struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space); u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node); -int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, +int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, struct port_list *dports); -int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, +int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, struct tipc_name_seq const *seq); struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, u32 scope, u32 port_ref, u32 key); int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, u32 scope, u32 node, u32 ref, u32 key); -struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, +struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, u32 node, u32 ref, u32 key); void tipc_nametbl_subscribe(struct subscription *s); void tipc_nametbl_unsubscribe(struct subscription *s); diff --git a/net/tipc/net.c b/net/tipc/net.c index a991bf8..c39c762 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c @@ -1,6 +1,6 @@ /* * net/tipc/net.c: TIPC network routing code - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -49,63 +49,63 @@ #include "discover.h" #include "config.h" -/* +/* * The TIPC locking policy is designed to ensure a very fine locking * granularity, permitting complete parallel access to individual - * port and node/link instances. The code consists of three major + * port and node/link instances. The code consists of three major * locking domains, each protected with their own disjunct set of locks. * * 1: The routing hierarchy. - * Comprises the structures 'zone', 'cluster', 'node', 'link' - * and 'bearer'. The whole hierarchy is protected by a big - * read/write lock, tipc_net_lock, to enssure that nothing is added - * or removed while code is accessing any of these structures. - * This layer must not be called from the two others while they + * Comprises the structures 'zone', 'cluster', 'node', 'link' + * and 'bearer'. The whole hierarchy is protected by a big + * read/write lock, tipc_net_lock, to enssure that nothing is added + * or removed while code is accessing any of these structures. + * This layer must not be called from the two others while they * hold any of their own locks. * Neither must it itself do any upcalls to the other two before * it has released tipc_net_lock and other protective locks. * - * Within the tipc_net_lock domain there are two sub-domains;'node' and + * Within the tipc_net_lock domain there are two sub-domains;'node' and * 'bearer', where local write operations are permitted, * provided that those are protected by individual spin_locks - * per instance. Code holding tipc_net_lock(read) and a node spin_lock + * per instance. Code holding tipc_net_lock(read) and a node spin_lock * is permitted to poke around in both the node itself and its - * subordinate links. I.e, it can update link counters and queues, - * change link state, send protocol messages, and alter the - * "active_links" array in the node; but it can _not_ remove a link + * subordinate links. I.e, it can update link counters and queues, + * change link state, send protocol messages, and alter the + * "active_links" array in the node; but it can _not_ remove a link * or a node from the overall structure. - * Correspondingly, individual bearers may change status within a - * tipc_net_lock(read), protected by an individual spin_lock ber bearer + * Correspondingly, individual bearers may change status within a + * tipc_net_lock(read), protected by an individual spin_lock ber bearer * instance, but it needs tipc_net_lock(write) to remove/add any bearers. - * * - * 2: The transport level of the protocol. - * This consists of the structures port, (and its user level - * representations, such as user_port and tipc_sock), reference and - * tipc_user (port.c, reg.c, socket.c). + * + * 2: The transport level of the protocol. + * This consists of the structures port, (and its user level + * representations, such as user_port and tipc_sock), reference and + * tipc_user (port.c, reg.c, socket.c). * * This layer has four different locks: * - The tipc_port spin_lock. This is protecting each port instance - * from parallel data access and removal. Since we can not place - * this lock in the port itself, it has been placed in the + * from parallel data access and removal. Since we can not place + * this lock in the port itself, it has been placed in the * corresponding reference table entry, which has the same life - * cycle as the module. This entry is difficult to access from - * outside the TIPC core, however, so a pointer to the lock has - * been added in the port instance, -to be used for unlocking + * cycle as the module. This entry is difficult to access from + * outside the TIPC core, however, so a pointer to the lock has + * been added in the port instance, -to be used for unlocking * only. - * - A read/write lock to protect the reference table itself (teg.c). - * (Nobody is using read-only access to this, so it can just as + * - A read/write lock to protect the reference table itself (teg.c). + * (Nobody is using read-only access to this, so it can just as * well be changed to a spin_lock) * - A spin lock to protect the registry of kernel/driver users (reg.c) - * - A global spin_lock (tipc_port_lock), which only task is to ensure + * - A global spin_lock (tipc_port_lock), which only task is to ensure * consistency where more than one port is involved in an operation, * i.e., whe a port is part of a linked list of ports. * There are two such lists; 'port_list', which is used for management, * and 'wait_list', which is used to queue ports during congestion. - * + * * 3: The name table (name_table.c, name_distr.c, subscription.c) - * - There is one big read/write-lock (tipc_nametbl_lock) protecting the - * overall name table structure. Nothing must be added/removed to + * - There is one big read/write-lock (tipc_nametbl_lock) protecting the + * overall name table structure. Nothing must be added/removed to * this structure without holding write access to it. * - There is one local spin_lock per sub_sequence, which can be seen * as a sub-domain to the tipc_nametbl_lock domain. It is used only @@ -118,7 +118,7 @@ DEFINE_RWLOCK(tipc_net_lock); struct network tipc_net = { NULL }; -struct node *tipc_net_select_remote_node(u32 addr, u32 ref) +struct node *tipc_net_select_remote_node(u32 addr, u32 ref) { return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref); } @@ -224,7 +224,7 @@ void tipc_net_route_msg(struct sk_buff *buf) buf_discard(buf); } else { msg_dbg(msg, "NET>REJ>:"); - tipc_reject_msg(buf, msg_destport(msg) ? + tipc_reject_msg(buf, msg_destport(msg) ? TIPC_ERR_NO_PORT : TIPC_ERR_NO_NAME); } return; @@ -236,7 +236,7 @@ void tipc_net_route_msg(struct sk_buff *buf) dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); if (in_scope(dnode, tipc_own_addr)) { if (msg_isdata(msg)) { - if (msg_mcast(msg)) + if (msg_mcast(msg)) tipc_port_recv_mcast(buf, NULL); else if (msg_destport(msg)) tipc_port_recv_msg(buf); @@ -284,7 +284,7 @@ int tipc_net_start(void) (res = tipc_bclink_init())) { return res; } - tipc_subscr_stop(); + tipc_subscr_stop(); tipc_cfg_stop(); tipc_k_signal((Handler)tipc_subscr_start, 0); tipc_k_signal((Handler)tipc_cfg_init, 0); @@ -298,12 +298,12 @@ void tipc_net_stop(void) { if (tipc_mode != TIPC_NET_MODE) return; - write_lock_bh(&tipc_net_lock); + write_lock_bh(&tipc_net_lock); tipc_bearer_stop(); tipc_mode = TIPC_NODE_MODE; tipc_bclink_stop(); net_stop(); - write_unlock_bh(&tipc_net_lock); + write_unlock_bh(&tipc_net_lock); info("Left network mode \n"); } diff --git a/net/tipc/net.h b/net/tipc/net.h index f3e0b85..a6a0e99 100644 --- a/net/tipc/net.h +++ b/net/tipc/net.h @@ -1,6 +1,6 @@ /* * net/tipc/net.h: Include file for TIPC network routing code - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -43,7 +43,7 @@ struct _zone; * struct network - TIPC network structure * @zones: array of pointers to all zones within network */ - + struct network { struct _zone **zones; }; diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index eb1bb4d..b8e1edc 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c @@ -1,6 +1,6 @@ /* * net/tipc/netlink.c: TIPC configuration handling - * + * * Copyright (c) 2005-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -63,15 +63,15 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) genlmsg_unicast(rep_buf, req_nlh->nlmsg_pid); } - return 0; + return 0; } static struct genl_family family = { - .id = GENL_ID_GENERATE, - .name = TIPC_GENL_NAME, - .version = TIPC_GENL_VERSION, - .hdrsize = TIPC_GENL_HDRLEN, - .maxattr = 0, + .id = GENL_ID_GENERATE, + .name = TIPC_GENL_NAME, + .version = TIPC_GENL_VERSION, + .hdrsize = TIPC_GENL_HDRLEN, + .maxattr = 0, }; static struct genl_ops ops = { @@ -93,7 +93,7 @@ int tipc_netlink_start(void) if (genl_register_ops(&family, &ops)) goto err_unregister; - return 0; + return 0; err_unregister: genl_unregister_family(&family); diff --git a/net/tipc/node.c b/net/tipc/node.c index 4111a31..e2e452a 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -1,6 +1,6 @@ /* * net/tipc/node.c: TIPC node management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -58,7 +58,7 @@ struct node *tipc_node_create(u32 addr) { struct cluster *c_ptr; struct node *n_ptr; - struct node **curr_node; + struct node **curr_node; n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC); if (!n_ptr) { @@ -74,16 +74,16 @@ struct node *tipc_node_create(u32 addr) kfree(n_ptr); return NULL; } - + n_ptr->addr = addr; - spin_lock_init(&n_ptr->lock); + spin_lock_init(&n_ptr->lock); INIT_LIST_HEAD(&n_ptr->nsub); n_ptr->owner = c_ptr; tipc_cltr_attach_node(c_ptr, n_ptr); n_ptr->last_router = -1; /* Insert node into ordered list */ - for (curr_node = &tipc_nodes; *curr_node; + for (curr_node = &tipc_nodes; *curr_node; curr_node = &(*curr_node)->next) { if (addr < (*curr_node)->addr) { n_ptr->next = *curr_node; @@ -116,7 +116,7 @@ void tipc_node_delete(struct node *n_ptr) /** * tipc_node_link_up - handle addition of link - * + * * Link becomes active (alone or shared) or standby, depending on its priority. */ @@ -128,19 +128,19 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) info("Established link <%s> on network plane %c\n", l_ptr->name, l_ptr->b_ptr->net_plane); - + if (!active[0]) { dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]); active[0] = active[1] = l_ptr; node_established_contact(n_ptr); return; } - if (l_ptr->priority < active[0]->priority) { + if (l_ptr->priority < active[0]->priority) { info("New link <%s> becomes standby\n", l_ptr->name); return; } tipc_link_send_duplicate(active[0], l_ptr); - if (l_ptr->priority == active[0]->priority) { + if (l_ptr->priority == active[0]->priority) { active[0] = l_ptr; return; } @@ -160,17 +160,17 @@ static void node_select_active_links(struct node *n_ptr) u32 i; u32 highest_prio = 0; - active[0] = active[1] = NULL; + active[0] = active[1] = NULL; for (i = 0; i < MAX_BEARERS; i++) { - struct link *l_ptr = n_ptr->links[i]; + struct link *l_ptr = n_ptr->links[i]; if (!l_ptr || !tipc_link_is_up(l_ptr) || (l_ptr->priority < highest_prio)) continue; if (l_ptr->priority > highest_prio) { - highest_prio = l_ptr->priority; + highest_prio = l_ptr->priority; active[0] = active[1] = l_ptr; } else { active[1] = l_ptr; @@ -203,15 +203,15 @@ void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr) active[1] = active[0]; if (active[0] == l_ptr) node_select_active_links(n_ptr); - if (tipc_node_is_up(n_ptr)) + if (tipc_node_is_up(n_ptr)) tipc_link_changeover(l_ptr); - else + else node_lost_contact(n_ptr); } int tipc_node_has_active_links(struct node *n_ptr) { - return (n_ptr && + return (n_ptr && ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); } @@ -236,28 +236,28 @@ struct node *tipc_node_attach_link(struct link *l_ptr) if (!n_ptr) n_ptr = tipc_node_create(l_ptr->addr); - if (n_ptr) { + if (n_ptr) { u32 bearer_id = l_ptr->b_ptr->identity; char addr_string[16]; - if (n_ptr->link_cnt >= 2) { + if (n_ptr->link_cnt >= 2) { char addr_string[16]; - err("Attempt to create third link to %s\n", + err("Attempt to create third link to %s\n", addr_string_fill(addr_string, n_ptr->addr)); - return NULL; - } - - if (!n_ptr->links[bearer_id]) { - n_ptr->links[bearer_id] = l_ptr; - tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; - n_ptr->link_cnt++; - return n_ptr; - } - err("Attempt to establish second link on <%s> to %s \n", - l_ptr->b_ptr->publ.name, + return NULL; + } + + if (!n_ptr->links[bearer_id]) { + n_ptr->links[bearer_id] = l_ptr; + tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; + n_ptr->link_cnt++; + return n_ptr; + } + err("Attempt to establish second link on <%s> to %s \n", + l_ptr->b_ptr->publ.name, addr_string_fill(addr_string, l_ptr->addr)); - } + } return NULL; } @@ -272,17 +272,17 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) * Routing table management - five cases to handle: * * 1: A link towards a zone/cluster external node comes up. - * => Send a multicast message updating routing tables of all - * system nodes within own cluster that the new destination - * can be reached via this node. + * => Send a multicast message updating routing tables of all + * system nodes within own cluster that the new destination + * can be reached via this node. * (node.establishedContact()=>cluster.multicastNewRoute()) * * 2: A link towards a slave node comes up. - * => Send a multicast message updating routing tables of all - * system nodes within own cluster that the new destination - * can be reached via this node. + * => Send a multicast message updating routing tables of all + * system nodes within own cluster that the new destination + * can be reached via this node. * (node.establishedContact()=>cluster.multicastNewRoute()) - * => Send a message to the slave node about existence + * => Send a message to the slave node about existence * of all system nodes within cluster: * (node.establishedContact()=>cluster.sendLocalRoutes()) * @@ -292,13 +292,13 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) * nodes which can be reached via this node. * (node.establishedContact()==>network.sendExternalRoutes()) * (node.establishedContact()==>network.sendSlaveRoutes()) - * => Send messages to all directly connected slave nodes + * => Send messages to all directly connected slave nodes * containing information about the existence of the new node * (node.establishedContact()=>cluster.multicastNewRoute()) - * + * * 4: The link towards a zone/cluster external node or slave * node goes down. - * => Send a multcast message updating routing tables of all + * => Send a multcast message updating routing tables of all * nodes within cluster that the new destination can not any * longer be reached via this node. * (node.lostAllLinks()=>cluster.bcastLostRoute()) @@ -308,7 +308,7 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) * routing tables. Note: This is a completely node * local operation. * (node.lostAllLinks()=>network.removeAsRouter()) - * => Send messages to all directly connected slave nodes + * => Send messages to all directly connected slave nodes * containing information about loss of the node * (node.establishedContact()=>cluster.multicastLostRoute()) * @@ -319,12 +319,12 @@ static void node_established_contact(struct node *n_ptr) struct cluster *c_ptr; dbg("node_established_contact:-> %x\n", n_ptr->addr); - if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) { + if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) { tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); } - /* Syncronize broadcast acks */ - n_ptr->bclink.acked = tipc_bclink_get_last_sent(); + /* Syncronize broadcast acks */ + n_ptr->bclink.acked = tipc_bclink_get_last_sent(); if (is_slave(tipc_own_addr)) return; @@ -333,11 +333,11 @@ static void node_established_contact(struct node *n_ptr) c_ptr = tipc_cltr_find(tipc_own_addr); if (!c_ptr) c_ptr = tipc_cltr_create(tipc_own_addr); - if (c_ptr) - tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, + if (c_ptr) + tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); return; - } + } c_ptr = n_ptr->owner; if (is_slave(n_ptr->addr)) { @@ -367,26 +367,26 @@ static void node_lost_contact(struct node *n_ptr) char addr_string[16]; u32 i; - /* Clean up broadcast reception remains */ - n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; - while (n_ptr->bclink.deferred_head) { - struct sk_buff* buf = n_ptr->bclink.deferred_head; - n_ptr->bclink.deferred_head = buf->next; - buf_discard(buf); - } - if (n_ptr->bclink.defragm) { - buf_discard(n_ptr->bclink.defragm); - n_ptr->bclink.defragm = NULL; - } - if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { - tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); - } - - /* Update routing tables */ + /* Clean up broadcast reception remains */ + n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; + while (n_ptr->bclink.deferred_head) { + struct sk_buff* buf = n_ptr->bclink.deferred_head; + n_ptr->bclink.deferred_head = buf->next; + buf_discard(buf); + } + if (n_ptr->bclink.defragm) { + buf_discard(n_ptr->bclink.defragm); + n_ptr->bclink.defragm = NULL; + } + if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { + tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); + } + + /* Update routing tables */ if (is_slave(tipc_own_addr)) { tipc_net_remove_as_router(n_ptr->addr); } else { - if (!in_own_cluster(n_ptr->addr)) { + if (!in_own_cluster(n_ptr->addr)) { /* Case 4 (see above) */ c_ptr = tipc_cltr_find(tipc_own_addr); tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, @@ -399,7 +399,7 @@ static void node_lost_contact(struct node *n_ptr) tipc_max_nodes); } else { if (n_ptr->bclink.supported) { - tipc_nmap_remove(&tipc_cltr_bcast_nodes, + tipc_nmap_remove(&tipc_cltr_bcast_nodes, n_ptr->addr); if (n_ptr->addr < tipc_own_addr) tipc_own_tag--; @@ -414,13 +414,13 @@ static void node_lost_contact(struct node *n_ptr) if (tipc_node_has_active_routes(n_ptr)) return; - info("Lost contact with %s\n", + info("Lost contact with %s\n", addr_string_fill(addr_string, n_ptr->addr)); /* Abort link changeover */ for (i = 0; i < MAX_BEARERS; i++) { struct link *l_ptr = n_ptr->links[i]; - if (!l_ptr) + if (!l_ptr) continue; l_ptr->reset_checkpoint = l_ptr->next_in_no; l_ptr->exp_msg_count = 0; @@ -429,7 +429,7 @@ static void node_lost_contact(struct node *n_ptr) /* Notify subscribers */ list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { - ns->node = NULL; + ns->node = NULL; list_del_init(&ns->nodesub_list); tipc_k_signal((Handler)ns->handle_node_down, (unsigned long)ns->usr_handle); @@ -438,7 +438,7 @@ static void node_lost_contact(struct node *n_ptr) /** * tipc_node_select_next_hop - find the next-hop node for a message - * + * * Called by when cluster local lookup has failed. */ @@ -447,13 +447,13 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector) struct node *n_ptr; u32 router_addr; - if (!tipc_addr_domain_valid(addr)) - return NULL; + if (!tipc_addr_domain_valid(addr)) + return NULL; /* Look for direct link to destination processsor */ n_ptr = tipc_node_find(addr); if (n_ptr && tipc_node_has_active_links(n_ptr)) - return n_ptr; + return n_ptr; /* Cluster local system nodes *must* have direct links */ if (!is_slave(addr) && in_own_cluster(addr)) @@ -461,10 +461,10 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector) /* Look for cluster local router with direct link to node */ router_addr = tipc_node_select_router(n_ptr, selector); - if (router_addr) - return tipc_node_select(router_addr, selector); + if (router_addr) + return tipc_node_select(router_addr, selector); - /* Slave nodes can only be accessed within own cluster via a + /* Slave nodes can only be accessed within own cluster via a known router with direct link -- if no router was found,give up */ if (is_slave(addr)) return NULL; @@ -473,20 +473,20 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector) addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); n_ptr = tipc_net_select_remote_node(addr, selector); if (n_ptr && tipc_node_has_active_links(n_ptr)) - return n_ptr; + return n_ptr; /* Last resort -- look for any router to anywhere in remote zone */ router_addr = tipc_net_select_router(addr, selector); - if (router_addr) - return tipc_node_select(router_addr, selector); + if (router_addr) + return tipc_node_select(router_addr, selector); - return NULL; + return NULL; } /** * tipc_node_select_router - select router to reach specified node - * - * Uses a deterministic and fair algorithm for selecting router node. + * + * Uses a deterministic and fair algorithm for selecting router node. */ u32 tipc_node_select_router(struct node *n_ptr, u32 ref) @@ -496,8 +496,8 @@ u32 tipc_node_select_router(struct node *n_ptr, u32 ref) u32 start; u32 r; - if (!n_ptr) - return 0; + if (!n_ptr) + return 0; if (n_ptr->last_router < 0) return 0; @@ -531,10 +531,10 @@ void tipc_node_add_router(struct node *n_ptr, u32 router) { u32 r_num = tipc_node(router); - n_ptr->routers[r_num / 32] = + n_ptr->routers[r_num / 32] = ((1 << (r_num % 32)) | n_ptr->routers[r_num / 32]); n_ptr->last_router = tipc_max_nodes / 32; - while ((--n_ptr->last_router >= 0) && + while ((--n_ptr->last_router >= 0) && !n_ptr->routers[n_ptr->last_router]); } @@ -548,7 +548,7 @@ void tipc_node_remove_router(struct node *n_ptr, u32 router) n_ptr->routers[r_num / 32] = ((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32])); n_ptr->last_router = tipc_max_nodes / 32; - while ((--n_ptr->last_router >= 0) && + while ((--n_ptr->last_router >= 0) && !n_ptr->routers[n_ptr->last_router]); if (!tipc_node_is_up(n_ptr)) @@ -562,7 +562,7 @@ void node_print(struct print_buf *buf, struct node *n_ptr, char *str) tipc_printf(buf, "\n\n%s", str); for (i = 0; i < MAX_BEARERS; i++) { - if (!n_ptr->links[i]) + if (!n_ptr->links[i]) continue; tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]); } @@ -590,7 +590,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) u32 domain; struct sk_buff *buf; struct node *n_ptr; - struct tipc_node_info node_info; + struct tipc_node_info node_info; u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) @@ -601,10 +601,10 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (network address)"); - if (!tipc_nodes) - return tipc_cfg_reply_none(); + if (!tipc_nodes) + return tipc_cfg_reply_none(); - /* For now, get space for all other nodes + /* For now, get space for all other nodes (will need to modify this when slave nodes are supported */ payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); @@ -620,9 +620,9 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { if (!in_scope(domain, n_ptr->addr)) continue; - node_info.addr = htonl(n_ptr->addr); - node_info.up = htonl(tipc_node_is_up(n_ptr)); - tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, + node_info.addr = htonl(n_ptr->addr); + node_info.up = htonl(tipc_node_is_up(n_ptr)); + tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, &node_info, sizeof(node_info)); } @@ -634,7 +634,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) u32 domain; struct sk_buff *buf; struct node *n_ptr; - struct tipc_link_info link_info; + struct tipc_link_info link_info; u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) @@ -645,9 +645,9 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (network address)"); - if (tipc_mode != TIPC_NET_MODE) - return tipc_cfg_reply_none(); - + if (tipc_mode != TIPC_NET_MODE) + return tipc_cfg_reply_none(); + /* Get space for all unicast links + multicast link */ payload_size = TLV_SPACE(sizeof(link_info)) * @@ -661,27 +661,27 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) /* Add TLV for broadcast link */ - link_info.dest = htonl(tipc_own_addr & 0xfffff00); - link_info.up = htonl(1); - sprintf(link_info.str, tipc_bclink_name); + link_info.dest = htonl(tipc_own_addr & 0xfffff00); + link_info.up = htonl(1); + sprintf(link_info.str, tipc_bclink_name); tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); /* Add TLVs for any other links in scope */ for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { - u32 i; + u32 i; if (!in_scope(domain, n_ptr->addr)) continue; - for (i = 0; i < MAX_BEARERS; i++) { - if (!n_ptr->links[i]) - continue; - link_info.dest = htonl(n_ptr->addr); - link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); - strcpy(link_info.str, n_ptr->links[i]->name); - tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, + for (i = 0; i < MAX_BEARERS; i++) { + if (!n_ptr->links[i]) + continue; + link_info.dest = htonl(n_ptr->addr); + link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); + strcpy(link_info.str, n_ptr->links[i]->name); + tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); - } + } } return buf; diff --git a/net/tipc/node.h b/net/tipc/node.h index a07cc79..cd18826 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h @@ -1,6 +1,6 @@ /* * net/tipc/node.h: Include file for TIPC node management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -67,7 +67,7 @@ * @deferred_tail: newest OOS b'cast message received from node * @defragm: list of partially reassembled b'cast message fragments from node */ - + struct node { u32 addr; spinlock_t lock; @@ -85,8 +85,8 @@ struct node { int supported; u32 acked; u32 last_in; - u32 gap_after; - u32 gap_to; + u32 gap_after; + u32 gap_to; u32 nack_sync; struct sk_buff *deferred_head; struct sk_buff *deferred_tail; diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c index cc3fff3..8ecbd0f 100644 --- a/net/tipc/node_subscr.c +++ b/net/tipc/node_subscr.c @@ -1,6 +1,6 @@ /* * net/tipc/node_subscr.c: TIPC "node down" subscription handling - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -44,14 +44,14 @@ * tipc_nodesub_subscribe - create "node down" subscription for specified node */ -void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, +void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, void *usr_handle, net_ev_handler handle_down) { if (addr == tipc_own_addr) { node_sub->node = NULL; return; } - + node_sub->node = tipc_node_find(addr); if (!node_sub->node) { warn("Node subscription rejected, unknown node 0x%x\n", addr); diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h index 01751c4..5f3f585 100644 --- a/net/tipc/node_subscr.h +++ b/net/tipc/node_subscr.h @@ -1,6 +1,6 @@ /* * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/port.c b/net/tipc/port.c index b7f3199..5f8217d 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -1,6 +1,6 @@ /* * net/tipc/port.c: TIPC port code - * + * * Copyright (c) 1992-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -126,8 +126,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper, TIPC_NODE_SCOPE, &dports); - - /* Send message to destinations (duplicate it only if necessary) */ + + /* Send message to destinations (duplicate it only if necessary) */ if (ext_targets) { if (dports.count != 0) { @@ -157,7 +157,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, /** * tipc_port_recv_mcast - deliver multicast message to all destination ports - * + * * If there is no port list, perform a lookup to create one */ @@ -213,7 +213,7 @@ exit: /** * tipc_createport_raw - create a native TIPC port - * + * * Returns local port reference */ @@ -273,7 +273,7 @@ int tipc_deleteport(u32 ref) tipc_withdraw(ref, 0, NULL); p_ptr = tipc_port_lock(ref); - if (!p_ptr) + if (!p_ptr) return -EINVAL; tipc_ref_discard(ref); @@ -302,7 +302,7 @@ int tipc_deleteport(u32 ref) /** * tipc_get_port() - return port associated with 'ref' - * + * * Note: Port is not locked. */ @@ -336,7 +336,7 @@ static int port_unreliable(struct port *p_ptr) int tipc_portunreliable(u32 ref, unsigned int *isunreliable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -348,7 +348,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable) int tipc_set_portunreliable(u32 ref, unsigned int isunreliable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -365,7 +365,7 @@ static int port_unreturnable(struct port *p_ptr) int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -377,7 +377,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -386,19 +386,19 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) return TIPC_OK; } -/* - * port_build_proto_msg(): build a port level protocol - * or a connection abortion message. Called with +/* + * port_build_proto_msg(): build a port level protocol + * or a connection abortion message. Called with * tipc_port lock on. */ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode, u32 origport, u32 orignode, - u32 usr, u32 type, u32 err, + u32 usr, u32 type, u32 err, u32 seqno, u32 ack) { struct sk_buff *buf; struct tipc_msg *msg; - + buf = buf_acquire(LONG_H_SIZE); if (buf) { msg = buf_msg(buf); @@ -461,7 +461,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) msg_set_orignode(rmsg, tipc_own_addr); else msg_set_orignode(rmsg, msg_destnode(msg)); - msg_set_size(rmsg, data_sz + hdr_sz); + msg_set_size(rmsg, data_sz + hdr_sz); msg_set_nametype(rmsg, msg_nametype(msg)); msg_set_nameinst(rmsg, msg_nameinst(msg)); memcpy(rbuf->data + hdr_sz, msg_data(msg), data_sz); @@ -492,7 +492,7 @@ int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, struct sk_buff *buf; int res; - res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, + res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, !p_ptr->user_port, &buf); if (!buf) return res; @@ -523,7 +523,7 @@ static void port_timeout(unsigned long ref) tipc_own_addr, CONN_MANAGER, CONN_PROBE, - TIPC_OK, + TIPC_OK, port_out_seqno(p_ptr), 0); port_incr_out_seqno(p_ptr); @@ -562,7 +562,7 @@ static struct sk_buff *port_build_self_abort_msg(struct port *p_ptr, u32 err) port_peernode(p_ptr), imp, TIPC_CONN_MSG, - err, + err, p_ptr->last_in_seqno + 1, 0); } @@ -582,7 +582,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err) tipc_own_addr, imp, TIPC_CONN_MSG, - err, + err, port_out_seqno(p_ptr), 0); } @@ -613,7 +613,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) } } if (msg_type(msg) == CONN_ACK) { - int wakeup = tipc_port_congested(p_ptr) && + int wakeup = tipc_port_congested(p_ptr) && p_ptr->publ.congested && p_ptr->wakeup; p_ptr->acked += msg_msgcnt(msg); @@ -630,8 +630,8 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) } if (err) { r_buf = port_build_proto_msg(msg_origport(msg), - msg_orignode(msg), - msg_destport(msg), + msg_orignode(msg), + msg_destport(msg), tipc_own_addr, DATA_HIGH, TIPC_CONN_MSG, @@ -643,10 +643,10 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) /* All is fine */ if (msg_type(msg) == CONN_PROBE) { - r_buf = port_build_proto_msg(msg_origport(msg), - msg_orignode(msg), - msg_destport(msg), - tipc_own_addr, + r_buf = port_build_proto_msg(msg_origport(msg), + msg_orignode(msg), + msg_destport(msg), + tipc_own_addr, CONN_MANAGER, CONN_PROBE_REPLY, TIPC_OK, @@ -665,39 +665,39 @@ exit: static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id) { - struct publication *publ; + struct publication *publ; if (full_id) - tipc_printf(buf, "<%u.%u.%u:%u>:", + tipc_printf(buf, "<%u.%u.%u:%u>:", tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), - tipc_node(tipc_own_addr), p_ptr->publ.ref); + tipc_node(tipc_own_addr), p_ptr->publ.ref); else tipc_printf(buf, "%-10u:", p_ptr->publ.ref); - if (p_ptr->publ.connected) { - u32 dport = port_peerport(p_ptr); - u32 destnode = port_peernode(p_ptr); - - tipc_printf(buf, " connected to <%u.%u.%u:%u>", - tipc_zone(destnode), tipc_cluster(destnode), - tipc_node(destnode), dport); - if (p_ptr->publ.conn_type != 0) - tipc_printf(buf, " via {%u,%u}", - p_ptr->publ.conn_type, - p_ptr->publ.conn_instance); - } - else if (p_ptr->publ.published) { - tipc_printf(buf, " bound to"); - list_for_each_entry(publ, &p_ptr->publications, pport_list) { + if (p_ptr->publ.connected) { + u32 dport = port_peerport(p_ptr); + u32 destnode = port_peernode(p_ptr); + + tipc_printf(buf, " connected to <%u.%u.%u:%u>", + tipc_zone(destnode), tipc_cluster(destnode), + tipc_node(destnode), dport); + if (p_ptr->publ.conn_type != 0) + tipc_printf(buf, " via {%u,%u}", + p_ptr->publ.conn_type, + p_ptr->publ.conn_instance); + } + else if (p_ptr->publ.published) { + tipc_printf(buf, " bound to"); + list_for_each_entry(publ, &p_ptr->publications, pport_list) { if (publ->lower == publ->upper) tipc_printf(buf, " {%u,%u}", publ->type, publ->lower); else - tipc_printf(buf, " {%u,%u,%u}", publ->type, + tipc_printf(buf, " {%u,%u,%u}", publ->type, publ->lower, publ->upper); - } - } - tipc_printf(buf, "\n"); + } + } + tipc_printf(buf, "\n"); } #define MAX_PORT_QUERY 32768 @@ -818,7 +818,7 @@ static void port_dispatcher_sigh(void *dummy) struct sk_buff *next = buf->next; struct tipc_msg *msg = buf_msg(buf); u32 dref = msg_destport(msg); - + message_type = msg_type(msg); if (message_type > TIPC_DIRECT_MSG) goto reject; /* Unsupported message type */ @@ -838,7 +838,7 @@ static void port_dispatcher_sigh(void *dummy) goto err; switch (message_type) { - + case TIPC_CONN_MSG:{ tipc_conn_msg_event cb = up_ptr->conn_msg_cb; u32 peer_port = port_peerport(p_ptr); @@ -856,9 +856,9 @@ static void port_dispatcher_sigh(void *dummy) goto reject; if (unlikely(!cb)) goto reject; - if (unlikely(++p_ptr->publ.conn_unacked >= + if (unlikely(++p_ptr->publ.conn_unacked >= TIPC_FLOW_CONTROL_WIN)) - tipc_acknowledge(dref, + tipc_acknowledge(dref, p_ptr->publ.conn_unacked); skb_pull(buf, msg_hdr_sz(msg)); cb(usr_handle, dref, &buf, msg_data(msg), @@ -874,7 +874,7 @@ static void port_dispatcher_sigh(void *dummy) if (unlikely(!cb)) goto reject; skb_pull(buf, msg_hdr_sz(msg)); - cb(usr_handle, dref, &buf, msg_data(msg), + cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_importance(msg), &orig); break; @@ -895,7 +895,7 @@ static void port_dispatcher_sigh(void *dummy) dseq.upper = (message_type == TIPC_NAMED_MSG) ? dseq.lower : msg_nameupper(msg); skb_pull(buf, msg_hdr_sz(msg)); - cb(usr_handle, dref, &buf, msg_data(msg), + cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_importance(msg), &orig, &dseq); break; @@ -907,9 +907,9 @@ static void port_dispatcher_sigh(void *dummy) continue; err: switch (message_type) { - + case TIPC_CONN_MSG:{ - tipc_conn_shutdown_event cb = + tipc_conn_shutdown_event cb = up_ptr->conn_err_cb; u32 peer_port = port_peerport(p_ptr); u32 peer_node = port_peernode(p_ptr); @@ -940,7 +940,7 @@ err: } case TIPC_MCAST_MSG: case TIPC_NAMED_MSG:{ - tipc_named_msg_err_event cb = + tipc_named_msg_err_event cb = up_ptr->named_err_cb; spin_unlock_bh(p_ptr->publ.lock); @@ -951,7 +951,7 @@ err: dseq.upper = (message_type == TIPC_NAMED_MSG) ? dseq.lower : msg_nameupper(msg); skb_pull(buf, msg_hdr_sz(msg)); - cb(usr_handle, dref, &buf, msg_data(msg), + cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_errcode(msg), &dseq); break; } @@ -986,9 +986,9 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) return TIPC_OK; } -/* +/* * Wake up port after congestion: Called with port locked, - * + * */ static void port_wakeup_sh(unsigned long ref) @@ -1033,7 +1033,7 @@ void tipc_acknowledge(u32 ref, u32 ack) tipc_own_addr, CONN_MANAGER, CONN_ACK, - TIPC_OK, + TIPC_OK, port_out_seqno(p_ptr), ack); } @@ -1046,20 +1046,20 @@ void tipc_acknowledge(u32 ref, u32 ack) * registry if non-zero user_ref. */ -int tipc_createport(u32 user_ref, - void *usr_handle, - unsigned int importance, - tipc_msg_err_event error_cb, - tipc_named_msg_err_event named_error_cb, - tipc_conn_shutdown_event conn_error_cb, - tipc_msg_event msg_cb, - tipc_named_msg_event named_msg_cb, - tipc_conn_msg_event conn_msg_cb, +int tipc_createport(u32 user_ref, + void *usr_handle, + unsigned int importance, + tipc_msg_err_event error_cb, + tipc_named_msg_err_event named_error_cb, + tipc_conn_shutdown_event conn_error_cb, + tipc_msg_event msg_cb, + tipc_named_msg_event named_msg_cb, + tipc_conn_msg_event conn_msg_cb, tipc_continue_event continue_event_cb,/* May be zero */ u32 *portref) { struct user_port *up_ptr; - struct port *p_ptr; + struct port *p_ptr; u32 ref; up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC); @@ -1088,7 +1088,7 @@ int tipc_createport(u32 user_ref, INIT_LIST_HEAD(&up_ptr->uport_list); tipc_reg_add_port(up_ptr); *portref = p_ptr->publ.ref; - dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref); + dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref); tipc_port_unlock(p_ptr); return TIPC_OK; } @@ -1103,7 +1103,7 @@ int tipc_ownidentity(u32 ref, struct tipc_portid *id) int tipc_portimportance(u32 ref, unsigned int *importance) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -1172,19 +1172,19 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) struct publication *publ; struct publication *tpubl; int res = -EINVAL; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; if (!seq) { - list_for_each_entry_safe(publ, tpubl, + list_for_each_entry_safe(publ, tpubl, &p_ptr->publications, pport_list) { - tipc_nametbl_withdraw(publ->type, publ->lower, + tipc_nametbl_withdraw(publ->type, publ->lower, publ->ref, publ->key); } res = TIPC_OK; } else { - list_for_each_entry_safe(publ, tpubl, + list_for_each_entry_safe(publ, tpubl, &p_ptr->publications, pport_list) { if (publ->scope != scope) continue; @@ -1194,7 +1194,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) continue; if (publ->upper != seq->upper) break; - tipc_nametbl_withdraw(publ->type, publ->lower, + tipc_nametbl_withdraw(publ->type, publ->lower, publ->ref, publ->key); res = TIPC_OK; break; @@ -1292,7 +1292,7 @@ int tipc_shutdown(u32 ref) tipc_own_addr, imp, TIPC_CONN_MSG, - TIPC_CONN_SHUTDOWN, + TIPC_CONN_SHUTDOWN, port_out_seqno(p_ptr), 0); } @@ -1304,7 +1304,7 @@ int tipc_shutdown(u32 ref) int tipc_isconnected(u32 ref, int *isconnected) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -1317,7 +1317,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer) { struct port *p_ptr; int res; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -1348,7 +1348,7 @@ int tipc_port_recv_sections(struct port *sender, unsigned int num_sect, { struct sk_buff *buf; int res; - + res = msg_build(&sender->publ.phdr, msg_sect, num_sect, MAX_MSG_SIZE, !sender->user_port, &buf); if (likely(buf)) @@ -1394,7 +1394,7 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect) return -ELINKCONG; } -/** +/** * tipc_send_buf - send message buffer on connection */ @@ -1406,7 +1406,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) u32 hsz; u32 sz; u32 res; - + p_ptr = tipc_port_deref(ref); if (!p_ptr || !p_ptr->publ.connected) return -EINVAL; @@ -1447,12 +1447,12 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) * tipc_forward2name - forward message sections to port name */ -int tipc_forward2name(u32 ref, - struct tipc_name const *name, +int tipc_forward2name(u32 ref, + struct tipc_name const *name, u32 domain, - u32 num_sect, + u32 num_sect, struct iovec const *msg_sect, - struct tipc_portid const *orig, + struct tipc_portid const *orig, unsigned int importance) { struct port *p_ptr; @@ -1483,7 +1483,7 @@ int tipc_forward2name(u32 ref, p_ptr->sent++; if (likely(destnode == tipc_own_addr)) return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); - res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, + res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, destnode); if (likely(res != -ELINKCONG)) return res; @@ -1493,7 +1493,7 @@ int tipc_forward2name(u32 ref, } return -ELINKCONG; } - return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect, + return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect, TIPC_ERR_NO_NAME); } @@ -1501,10 +1501,10 @@ int tipc_forward2name(u32 ref, * tipc_send2name - send message sections to port name */ -int tipc_send2name(u32 ref, +int tipc_send2name(u32 ref, struct tipc_name const *name, - unsigned int domain, - unsigned int num_sect, + unsigned int domain, + unsigned int num_sect, struct iovec const *msg_sect) { struct tipc_portid orig; @@ -1515,7 +1515,7 @@ int tipc_send2name(u32 ref, TIPC_PORT_IMPORTANCE); } -/** +/** * tipc_forward_buf2name - forward message buffer to port name */ @@ -1571,14 +1571,14 @@ int tipc_forward_buf2name(u32 ref, return tipc_reject_msg(buf, TIPC_ERR_NO_NAME); } -/** +/** * tipc_send_buf2name - send message buffer to port name */ -int tipc_send_buf2name(u32 ref, - struct tipc_name const *dest, +int tipc_send_buf2name(u32 ref, + struct tipc_name const *dest, u32 domain, - struct sk_buff *buf, + struct sk_buff *buf, unsigned int dsz) { struct tipc_portid orig; @@ -1589,15 +1589,15 @@ int tipc_send_buf2name(u32 ref, TIPC_PORT_IMPORTANCE); } -/** +/** * tipc_forward2port - forward message sections to port identity */ int tipc_forward2port(u32 ref, struct tipc_portid const *dest, - unsigned int num_sect, + unsigned int num_sect, struct iovec const *msg_sect, - struct tipc_portid const *orig, + struct tipc_portid const *orig, unsigned int importance) { struct port *p_ptr; @@ -1630,24 +1630,24 @@ int tipc_forward2port(u32 ref, return -ELINKCONG; } -/** - * tipc_send2port - send message sections to port identity +/** + * tipc_send2port - send message sections to port identity */ -int tipc_send2port(u32 ref, +int tipc_send2port(u32 ref, struct tipc_portid const *dest, - unsigned int num_sect, + unsigned int num_sect, struct iovec const *msg_sect) { struct tipc_portid orig; orig.ref = ref; orig.node = tipc_own_addr; - return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, + return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, TIPC_PORT_IMPORTANCE); } -/** +/** * tipc_forward_buf2port - forward message buffer to port identity */ int tipc_forward_buf2port(u32 ref, @@ -1692,20 +1692,20 @@ int tipc_forward_buf2port(u32 ref, return -ELINKCONG; } -/** +/** * tipc_send_buf2port - send message buffer to port identity */ -int tipc_send_buf2port(u32 ref, +int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest, - struct sk_buff *buf, + struct sk_buff *buf, unsigned int dsz) { struct tipc_portid orig; orig.ref = ref; orig.node = tipc_own_addr; - return tipc_forward_buf2port(ref, dest, buf, dsz, &orig, + return tipc_forward_buf2port(ref, dest, buf, dsz, &orig, TIPC_PORT_IMPORTANCE); } diff --git a/net/tipc/port.h b/net/tipc/port.h index 839f100..7ef4d64 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h @@ -1,6 +1,6 @@ /* * net/tipc/port.h: Include file for TIPC port code - * + * * Copyright (c) 1994-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -52,17 +52,17 @@ * <various callback routines> * @uport_list: adjacent user ports in list of ports held by user */ - + struct user_port { u32 user_ref; - void *usr_handle; + void *usr_handle; u32 ref; - tipc_msg_err_event err_cb; - tipc_named_msg_err_event named_err_cb; - tipc_conn_shutdown_event conn_err_cb; - tipc_msg_event msg_cb; - tipc_named_msg_event named_msg_cb; - tipc_conn_msg_event conn_msg_cb; + tipc_msg_err_event err_cb; + tipc_named_msg_err_event named_err_cb; + tipc_conn_shutdown_event conn_err_cb; + tipc_msg_event msg_cb; + tipc_named_msg_event named_msg_cb; + tipc_conn_msg_event conn_msg_cb; tipc_continue_event continue_event_cb; struct list_head uport_list; }; @@ -113,7 +113,7 @@ struct port { extern spinlock_t tipc_port_list_lock; struct port_list; -int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect, +int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect, struct iovec const *msg_sect); int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, struct iovec const *msg_sect, u32 num_sect, @@ -133,9 +133,9 @@ static inline struct port *tipc_port_lock(u32 ref) return (struct port *)tipc_ref_lock(ref); } -/** +/** * tipc_port_unlock - unlock a port instance - * + * * Can use pointer instead of tipc_ref_unlock() since port is already locked. */ @@ -164,7 +164,7 @@ static inline int tipc_port_congested(struct port *p_ptr) return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2)); } -/** +/** * tipc_port_recv_msg - receive message from lower layer and deliver to port user */ @@ -175,7 +175,7 @@ static inline int tipc_port_recv_msg(struct sk_buff *buf) u32 destport = msg_destport(msg); u32 dsz = msg_data_sz(msg); u32 err; - + /* forward unresolved named message */ if (unlikely(!destport)) { tipc_net_route_msg(buf); diff --git a/net/tipc/ref.c b/net/tipc/ref.c index e6d6ae2..6704a58 100644 --- a/net/tipc/ref.c +++ b/net/tipc/ref.c @@ -1,6 +1,6 @@ /* * net/tipc/ref.c: TIPC object registry code - * + * * Copyright (c) 1991-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -50,11 +50,11 @@ * Object reference table consists of 2**N entries. * * A used entry has object ptr != 0, reference == XXXX|own index - * (XXXX changes each time entry is acquired) + * (XXXX changes each time entry is acquired) * A free entry has object ptr == 0, reference == YYYY|next free index * (YYYY is one more than last used XXXX) * - * Free list is initially chained from entry (2**N)-1 to entry 1. + * Free list is initially chained from entry (2**N)-1 to entry 1. * Entry 0 is not used to allow index 0 to indicate the end of the free list. * * Note: Any accidental reference of the form XXXX|0--0 won't match entry 0 @@ -113,9 +113,9 @@ void tipc_ref_table_stop(void) /** * tipc_ref_acquire - create reference to an object - * + * * Return a unique reference value which can be translated back to the pointer - * 'object' at a later time. Also, pass back a pointer to the lock protecting + * 'object' at a later time. Also, pass back a pointer to the lock protecting * the object, but without locking it. */ @@ -141,15 +141,15 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock) index = tipc_ref_table.first_free; entry = &(tipc_ref_table.entries[index]); index_mask = tipc_ref_table.index_mask; - /* take lock in case a previous user of entry still holds it */ - spin_lock_bh(&entry->lock); + /* take lock in case a previous user of entry still holds it */ + spin_lock_bh(&entry->lock); next_plus_upper = entry->data.next_plus_upper; tipc_ref_table.first_free = next_plus_upper & index_mask; reference = (next_plus_upper & ~index_mask) + index; entry->data.reference = reference; entry->object = object; - if (lock != 0) - *lock = &entry->lock; + if (lock != 0) + *lock = &entry->lock; spin_unlock_bh(&entry->lock); } write_unlock_bh(&ref_table_lock); @@ -158,7 +158,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock) /** * tipc_ref_discard - invalidate references to an object - * + * * Disallow future references to an object and free up the entry for re-use. * Note: The entry's spin_lock may still be busy after discard */ @@ -166,7 +166,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock) void tipc_ref_discard(u32 ref) { struct reference *entry; - u32 index; + u32 index; u32 index_mask; if (!ref) { @@ -198,7 +198,7 @@ void tipc_ref_discard(u32 ref) tipc_ref_table.first_free = index; else /* next_plus_upper is always XXXX|0--0 for last free entry */ - tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper + tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper |= index; tipc_ref_table.last_free = index; diff --git a/net/tipc/ref.h b/net/tipc/ref.h index 6d20006..38f3a7f 100644 --- a/net/tipc/ref.h +++ b/net/tipc/ref.h @@ -1,6 +1,6 @@ /* * net/tipc/ref.h: Include file for TIPC object registry code - * + * * Copyright (c) 1991-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -43,7 +43,7 @@ * @lock: spinlock controlling access to object * @data: reference value associated with object (or link to next unused entry) */ - + struct reference { void *object; spinlock_t lock; @@ -96,7 +96,7 @@ static inline void *tipc_ref_lock(u32 ref) } /** - * tipc_ref_unlock - unlock referenced object + * tipc_ref_unlock - unlock referenced object */ static inline void tipc_ref_unlock(u32 ref) @@ -119,7 +119,7 @@ static inline void tipc_ref_unlock(u32 ref) static inline void *tipc_ref_deref(u32 ref) { if (likely(tipc_ref_table.entries)) { - struct reference *r = + struct reference *r = &tipc_ref_table.entries[ref & tipc_ref_table.index_mask]; if (likely(r->data.reference == ref)) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 2a6a5a6..b71739f 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1,6 +1,6 @@ /* * net/tipc/socket.c: TIPC socket API - * + * * Copyright (c) 2001-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -82,29 +82,29 @@ static int sockets_enabled = 0; static atomic_t tipc_queue_size = ATOMIC_INIT(0); -/* - * sock_lock(): Lock a port/socket pair. lock_sock() can - * not be used here, since the same lock must protect ports +/* + * sock_lock(): Lock a port/socket pair. lock_sock() can + * not be used here, since the same lock must protect ports * with non-socket interfaces. * See net.c for description of locking policy. */ static void sock_lock(struct tipc_sock* tsock) { - spin_lock_bh(tsock->p->lock); + spin_lock_bh(tsock->p->lock); } -/* +/* * sock_unlock(): Unlock a port/socket pair */ static void sock_unlock(struct tipc_sock* tsock) { - spin_unlock_bh(tsock->p->lock); + spin_unlock_bh(tsock->p->lock); } /** * pollmask - determine the current set of poll() events for a socket * @sock: socket structure - * + * * TIPC sets the returned events as follows: * a) POLLRDNORM and POLLIN are set if the socket's receive queue is non-empty * or if a connection-oriented socket is does not have an active connection @@ -115,7 +115,7 @@ static void sock_unlock(struct tipc_sock* tsock) * * IMPORTANT: The fact that a read or write operation will not block does NOT * imply that the operation will succeed! - * + * * Returns pollmask value */ @@ -130,7 +130,7 @@ static u32 pollmask(struct socket *sock) else mask = 0; - if (sock->state == SS_DISCONNECTING) + if (sock->state == SS_DISCONNECTING) mask |= POLLHUP; else mask |= POLLOUT; @@ -146,9 +146,9 @@ static u32 pollmask(struct socket *sock) static void advance_queue(struct tipc_sock *tsock) { - sock_lock(tsock); + sock_lock(tsock); buf_discard(skb_dequeue(&tsock->sk.sk_receive_queue)); - sock_unlock(tsock); + sock_unlock(tsock); atomic_dec(&tipc_queue_size); } @@ -156,7 +156,7 @@ static void advance_queue(struct tipc_sock *tsock) * tipc_create - create a TIPC socket * @sock: pre-allocated socket structure * @protocol: protocol indicator (must be 0) - * + * * This routine creates and attaches a 'struct sock' to the 'struct socket', * then create and attaches a TIPC port to the 'struct sock' part. * @@ -167,7 +167,7 @@ static int tipc_create(struct socket *sock, int protocol) struct tipc_sock *tsock; struct tipc_port *port; struct sock *sk; - u32 ref; + u32 ref; if (unlikely(protocol != 0)) return -EPROTONOSUPPORT; @@ -232,7 +232,7 @@ static int tipc_create(struct socket *sock, int protocol) * For SEQPACKET and STREAM socket types, the first message is rejected * and any others are discarded. (If the first message on a STREAM socket * is partially-read, it is discarded and the next one is rejected instead.) - * + * * NOTE: Rejected messages are not necessarily returned to the sender! They * are returned or discarded according to the "destination droppable" setting * specified for the message by the sender. @@ -247,7 +247,7 @@ static int release(struct socket *sock) int res = TIPC_OK; struct sk_buff *buf; - dbg("sock_delete: %x\n",tsock); + dbg("sock_delete: %x\n",tsock); if (!tsock) return 0; down_interruptible(&tsock->sem); @@ -255,7 +255,7 @@ static int release(struct socket *sock) up(&tsock->sem); return 0; } - + /* Reject unreceived messages, unless no longer connected */ while (sock->state != SS_DISCONNECTING) { @@ -289,7 +289,7 @@ static int release(struct socket *sock) sock_put(sk); - atomic_dec(&tipc_user_count); + atomic_dec(&tipc_user_count); return res; } @@ -298,11 +298,11 @@ static int release(struct socket *sock) * @sock: socket structure * @uaddr: socket address describing name(s) and desired operation * @uaddr_len: size of socket address data structure - * + * * Name and name sequence binding is indicated using a positive scope value; * a negative scope value unbinds the specified name. Specifying no name * (i.e. a socket address length of 0) unbinds all names from the socket. - * + * * Returns 0 on success, errno otherwise */ @@ -314,7 +314,7 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; - + if (unlikely(!uaddr_len)) { res = tipc_withdraw(tsock->p->ref, 0, NULL); goto exit; @@ -335,8 +335,8 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) res = -EAFNOSUPPORT; goto exit; } - - if (addr->scope > 0) + + if (addr->scope > 0) res = tipc_publish(tsock->p->ref, addr->scope, &addr->addr.nameseq); else @@ -347,17 +347,17 @@ exit: return res; } -/** +/** * get_name - get port ID of socket or peer socket * @sock: socket structure * @uaddr: area for returned socket address * @uaddr_len: area for returned length of socket address * @peer: 0 to obtain socket name, 1 to obtain peer socket name - * + * * Returns 0 on success, errno otherwise */ -static int get_name(struct socket *sock, struct sockaddr *uaddr, +static int get_name(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct tipc_sock *tsock = tipc_sk(sock->sk); @@ -390,7 +390,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr, * Returns the pollmask */ -static unsigned int poll(struct file *file, struct socket *sock, +static unsigned int poll(struct file *file, struct socket *sock, poll_table *wait) { poll_wait(file, sock->sk->sk_sleep, wait); @@ -398,14 +398,14 @@ static unsigned int poll(struct file *file, struct socket *sock, return pollmask(sock); } -/** +/** * dest_name_check - verify user is permitted to send to specified port name * @dest: destination address * @m: descriptor for message to be sent - * + * * Prevents restricted configuration commands from being issued by * unauthorized users. - * + * * Returns 0 if permission is granted, otherwise errno */ @@ -413,19 +413,19 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m) { struct tipc_cfg_msg_hdr hdr; - if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES)) - return 0; - if (likely(dest->addr.name.name.type == TIPC_TOP_SRV)) - return 0; + if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES)) + return 0; + if (likely(dest->addr.name.name.type == TIPC_TOP_SRV)) + return 0; - if (likely(dest->addr.name.name.type != TIPC_CFG_SRV)) - return -EACCES; + if (likely(dest->addr.name.name.type != TIPC_CFG_SRV)) + return -EACCES; - if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr))) + if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr))) return -EFAULT; if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN))) return -EACCES; - + return 0; } @@ -435,12 +435,12 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m) * @sock: socket structure * @m: message to send * @total_len: length of message - * + * * Message must have an destination specified explicitly. - * Used for SOCK_RDM and SOCK_DGRAM messages, + * Used for SOCK_RDM and SOCK_DGRAM messages, * and for 'SYN' messages on SOCK_SEQPACKET and SOCK_STREAM connections. * (Note: 'SYN+' is prohibited on SOCK_STREAM.) - * + * * Returns the number of bytes sent on success, or errno otherwise */ @@ -448,7 +448,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len) { struct tipc_sock *tsock = tipc_sk(sock->sk); - struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; + struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; struct sk_buff *buf; int needs_conn; int res = -EINVAL; @@ -489,61 +489,61 @@ static int send_msg(struct kiocb *iocb, struct socket *sock, sock->state = SS_CONNECTING; } - do { - if (dest->addrtype == TIPC_ADDR_NAME) { - if ((res = dest_name_check(dest, m))) - goto exit; - res = tipc_send2name(tsock->p->ref, - &dest->addr.name.name, - dest->addr.name.domain, - m->msg_iovlen, - m->msg_iov); - } - else if (dest->addrtype == TIPC_ADDR_ID) { - res = tipc_send2port(tsock->p->ref, - &dest->addr.id, - m->msg_iovlen, - m->msg_iov); - } - else if (dest->addrtype == TIPC_ADDR_MCAST) { + do { + if (dest->addrtype == TIPC_ADDR_NAME) { + if ((res = dest_name_check(dest, m))) + goto exit; + res = tipc_send2name(tsock->p->ref, + &dest->addr.name.name, + dest->addr.name.domain, + m->msg_iovlen, + m->msg_iov); + } + else if (dest->addrtype == TIPC_ADDR_ID) { + res = tipc_send2port(tsock->p->ref, + &dest->addr.id, + m->msg_iovlen, + m->msg_iov); + } + else if (dest->addrtype == TIPC_ADDR_MCAST) { if (needs_conn) { res = -EOPNOTSUPP; goto exit; } - if ((res = dest_name_check(dest, m))) - goto exit; - res = tipc_multicast(tsock->p->ref, - &dest->addr.nameseq, - 0, - m->msg_iovlen, - m->msg_iov); - } - if (likely(res != -ELINKCONG)) { -exit: - up(&tsock->sem); - return res; - } + if ((res = dest_name_check(dest, m))) + goto exit; + res = tipc_multicast(tsock->p->ref, + &dest->addr.nameseq, + 0, + m->msg_iovlen, + m->msg_iov); + } + if (likely(res != -ELINKCONG)) { +exit: + up(&tsock->sem); + return res; + } if (m->msg_flags & MSG_DONTWAIT) { res = -EWOULDBLOCK; goto exit; } - if (wait_event_interruptible(*sock->sk->sk_sleep, - !tsock->p->congested)) { - res = -ERESTARTSYS; - goto exit; - } - } while (1); + if (wait_event_interruptible(*sock->sk->sk_sleep, + !tsock->p->congested)) { + res = -ERESTARTSYS; + goto exit; + } + } while (1); } -/** +/** * send_packet - send a connection-oriented message * @iocb: (unused) * @sock: socket structure * @m: message to send * @total_len: length of message - * + * * Used for SOCK_SEQPACKET messages and SOCK_STREAM data. - * + * * Returns the number of bytes sent on success, or errno otherwise */ @@ -551,7 +551,7 @@ static int send_packet(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len) { struct tipc_sock *tsock = tipc_sk(sock->sk); - struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; + struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; int res; /* Handle implied connection establishment */ @@ -561,45 +561,45 @@ static int send_packet(struct kiocb *iocb, struct socket *sock, if (down_interruptible(&tsock->sem)) { return -ERESTARTSYS; - } + } - do { + do { if (unlikely(sock->state != SS_CONNECTED)) { if (sock->state == SS_DISCONNECTING) - res = -EPIPE; + res = -EPIPE; else res = -ENOTCONN; goto exit; } - res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov); - if (likely(res != -ELINKCONG)) { + res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov); + if (likely(res != -ELINKCONG)) { exit: - up(&tsock->sem); - return res; - } + up(&tsock->sem); + return res; + } if (m->msg_flags & MSG_DONTWAIT) { res = -EWOULDBLOCK; goto exit; } - if (wait_event_interruptible(*sock->sk->sk_sleep, - !tsock->p->congested)) { - res = -ERESTARTSYS; - goto exit; - } - } while (1); + if (wait_event_interruptible(*sock->sk->sk_sleep, + !tsock->p->congested)) { + res = -ERESTARTSYS; + goto exit; + } + } while (1); } -/** +/** * send_stream - send stream-oriented data * @iocb: (unused) * @sock: socket structure * @m: data to send * @total_len: total length of data to be sent - * + * * Used for SOCK_STREAM data. - * - * Returns the number of bytes sent on success (or partial success), + * + * Returns the number of bytes sent on success (or partial success), * or errno if no data sent */ @@ -616,26 +616,26 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, int bytes_to_send; int bytes_sent; int res; - + if (likely(total_len <= TIPC_MAX_USER_MSG_SIZE)) return send_packet(iocb, sock, m, total_len); /* Can only send large data streams if already connected */ - if (unlikely(sock->state != SS_CONNECTED)) { - if (sock->state == SS_DISCONNECTING) - return -EPIPE; - else - return -ENOTCONN; - } + if (unlikely(sock->state != SS_CONNECTED)) { + if (sock->state == SS_DISCONNECTING) + return -EPIPE; + else + return -ENOTCONN; + } if (unlikely(m->msg_name)) return -EISCONN; - /* + /* * Send each iovec entry using one or more messages * - * Note: This algorithm is good for the most likely case + * Note: This algorithm is good for the most likely case * (i.e. one large iovec entry), but could be improved to pass sets * of small iovec entries into send_packet(). */ @@ -657,7 +657,7 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, ? curr_left : TIPC_MAX_USER_MSG_SIZE; my_iov.iov_base = curr_start; my_iov.iov_len = bytes_to_send; - if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) { + if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) { return bytes_sent ? bytes_sent : res; } curr_left -= bytes_to_send; @@ -676,11 +676,11 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, * @sock: socket structure * @tsock: TIPC-specific socket structure * @msg: peer's response message - * + * * Returns 0 on success, errno otherwise */ -static int auto_connect(struct socket *sock, struct tipc_sock *tsock, +static int auto_connect(struct socket *sock, struct tipc_sock *tsock, struct tipc_msg *msg) { struct tipc_portid peer; @@ -702,15 +702,15 @@ static int auto_connect(struct socket *sock, struct tipc_sock *tsock, * set_orig_addr - capture sender's address for received message * @m: descriptor for message info * @msg: received message header - * + * * Note: Address is not captured if not requested by receiver. */ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) { - struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name; + struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name; - if (addr) { + if (addr) { addr->family = AF_TIPC; addr->addrtype = TIPC_ADDR_ID; addr->addr.id.ref = msg_origport(msg); @@ -722,13 +722,13 @@ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) } /** - * anc_data_recv - optionally capture ancillary data for received message + * anc_data_recv - optionally capture ancillary data for received message * @m: descriptor for message info * @msg: received message header * @tport: TIPC port associated with message - * + * * Note: Ancillary data is not captured if not requested by receiver. - * + * * Returns 0 if successful, otherwise errno */ @@ -753,7 +753,7 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, if ((res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data))) return res; if (anc_data[1] && - (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], + (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], msg_data(msg)))) return res; } @@ -790,13 +790,13 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, return 0; } -/** +/** * recv_msg - receive packet-oriented message * @iocb: (unused) * @m: descriptor for message info * @buf_len: total size of user buffer area * @flags: receive flags - * + * * Used for SOCK_DGRAM, SOCK_RDM, and SOCK_SEQPACKET messages. * If the complete message doesn't fit in user area, truncate it. * @@ -827,9 +827,9 @@ static int recv_msg(struct kiocb *iocb, struct socket *sock, if (sock->type == SOCK_SEQPACKET) { if (unlikely(sock->state == SS_UNCONNECTED)) return -ENOTCONN; - if (unlikely((sock->state == SS_DISCONNECTING) && + if (unlikely((sock->state == SS_DISCONNECTING) && (skb_queue_len(&sock->sk->sk_receive_queue) == 0))) - return -ENOTCONN; + return -ENOTCONN; } /* Look for a message in receive queue; wait if necessary */ @@ -845,7 +845,7 @@ restart: } if ((res = wait_event_interruptible( - *sock->sk->sk_sleep, + *sock->sk->sk_sleep, ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || (sock->state == SS_DISCONNECTING))) )) { goto exit; @@ -890,7 +890,7 @@ restart: goto exit; /* Capture message data (if valid) & compute return value (always) */ - + if (!err) { if (unlikely(buf_len < sz)) { sz = buf_len; @@ -913,23 +913,23 @@ restart: /* Consume received message (optional) */ if (likely(!(flags & MSG_PEEK))) { - if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) - tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); + if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) + tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); advance_queue(tsock); - } + } exit: up(&tsock->sem); return res; } -/** +/** * recv_stream - receive stream-oriented data * @iocb: (unused) * @m: descriptor for message info * @buf_len: total size of user buffer area * @flags: receive flags - * - * Used for SOCK_STREAM messages only. If not enough data is available + * + * Used for SOCK_STREAM messages only. If not enough data is available * will optionally wait for more; never truncates data. * * Returns size of returned message data, errno otherwise @@ -980,7 +980,7 @@ restart: } if ((res = wait_event_interruptible( - *sock->sk->sk_sleep, + *sock->sk->sk_sleep, ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || (sock->state == SS_DISCONNECTING))) )) { goto exit; @@ -1017,7 +1017,7 @@ restart: } /* Capture message data (if valid) & compute return value (always) */ - + if (!err) { buf_crs = (unsigned char *)(TIPC_SKB_CB(buf)->handle); sz = buf->tail - buf_crs; @@ -1050,14 +1050,14 @@ restart: /* Consume received message (optional) */ if (likely(!(flags & MSG_PEEK))) { - if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) - tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); + if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) + tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); advance_queue(tsock); - } + } /* Loop around if more data is required */ - if ((sz_copied < buf_len) /* didn't get all requested data */ + if ((sz_copied < buf_len) /* didn't get all requested data */ && (flags & MSG_WAITALL) /* ... and need to wait for more */ && (!(flags & MSG_PEEK)) /* ... and aren't just peeking at data */ && (!err) /* ... and haven't reached a FIN */ @@ -1074,7 +1074,7 @@ exit: * @queue_size: current size of queue * @base: nominal maximum size of queue * @msg: message to be added to queue - * + * * Returns 1 if queue is currently overloaded, 0 otherwise */ @@ -1098,7 +1098,7 @@ static int queue_overloaded(u32 queue_size, u32 base, struct tipc_msg *msg) return (queue_size > threshold); } -/** +/** * async_disconnect - wrapper function used to disconnect port * @portref: TIPC port reference (passed as pointer-sized value) */ @@ -1108,13 +1108,13 @@ static void async_disconnect(unsigned long portref) tipc_disconnect((u32)portref); } -/** +/** * dispatch - handle arriving message * @tport: TIPC port that received message * @buf: message - * + * * Called with port locked. Must not take socket lock to avoid deadlock risk. - * + * * Returns TIPC error status code (TIPC_OK if message is not to be rejected) */ @@ -1159,13 +1159,13 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) msg_dbg(msg, "dispatch filter 4\n"); return TIPC_ERR_NO_PORT; } - } + } else if (sock->state == SS_LISTENING) { if (msg_connected(msg) || msg_errcode(msg)) { msg_dbg(msg, "dispatch filter 5\n"); return TIPC_ERR_NO_PORT; } - } + } else if (sock->state == SS_DISCONNECTING) { msg_dbg(msg, "dispatch filter 6\n"); return TIPC_ERR_NO_PORT; @@ -1180,18 +1180,18 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) /* Reject message if there isn't room to queue it */ - if (unlikely((u32)atomic_read(&tipc_queue_size) > + if (unlikely((u32)atomic_read(&tipc_queue_size) > OVERLOAD_LIMIT_BASE)) { - if (queue_overloaded(atomic_read(&tipc_queue_size), + if (queue_overloaded(atomic_read(&tipc_queue_size), OVERLOAD_LIMIT_BASE, msg)) return TIPC_ERR_OVERLOAD; - } + } recv_q_len = skb_queue_len(&tsock->sk.sk_receive_queue); if (unlikely(recv_q_len > (OVERLOAD_LIMIT_BASE / 2))) { - if (queue_overloaded(recv_q_len, - OVERLOAD_LIMIT_BASE / 2, msg)) + if (queue_overloaded(recv_q_len, + OVERLOAD_LIMIT_BASE / 2, msg)) return TIPC_ERR_OVERLOAD; - } + } /* Initiate connection termination for an incoming 'FIN' */ @@ -1213,10 +1213,10 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) return TIPC_OK; } -/** +/** * wakeupdispatch - wake up port after congestion * @tport: port to wakeup - * + * * Called with port lock on. */ @@ -1238,7 +1238,7 @@ static void wakeupdispatch(struct tipc_port *tport) * Returns 0 on success, errno otherwise */ -static int connect(struct socket *sock, struct sockaddr *dest, int destlen, +static int connect(struct socket *sock, struct sockaddr *dest, int destlen, int flags) { struct tipc_sock *tsock = tipc_sk(sock->sk); @@ -1260,7 +1260,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, if (sock->state == SS_CONNECTING) return -EALREADY; if (sock->state != SS_UNCONNECTED) - return -EISCONN; + return -EISCONN; /* * Reject connection attempt using multicast address @@ -1270,7 +1270,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, */ if (dst->addrtype == TIPC_ADDR_MCAST) - return -EINVAL; + return -EINVAL; /* Send a 'SYN-' to destination */ @@ -1281,19 +1281,19 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, return res; } - if (down_interruptible(&tsock->sem)) - return -ERESTARTSYS; - + if (down_interruptible(&tsock->sem)) + return -ERESTARTSYS; + /* Wait for destination's 'ACK' response */ res = wait_event_interruptible_timeout(*sock->sk->sk_sleep, - skb_queue_len(&sock->sk->sk_receive_queue), + skb_queue_len(&sock->sk->sk_receive_queue), sock->sk->sk_rcvtimeo); buf = skb_peek(&sock->sk->sk_receive_queue); if (res > 0) { msg = buf_msg(buf); - res = auto_connect(sock, tsock, msg); - if (!res) { + res = auto_connect(sock, tsock, msg); + if (!res) { if (!msg_data_sz(msg)) advance_queue(tsock); } @@ -1301,7 +1301,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, if (res == 0) { res = -ETIMEDOUT; } else - { /* leave "res" unchanged */ } + { /* leave "res" unchanged */ } sock->state = SS_DISCONNECTING; } @@ -1309,11 +1309,11 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, return res; } -/** +/** * listen - allow socket to listen for incoming connections * @sock: socket structure * @len: (unused) - * + * * Returns 0 on success, errno otherwise */ @@ -1326,15 +1326,15 @@ static int listen(struct socket *sock, int len) if (sock->state != SS_UNCONNECTED) return -EINVAL; sock->state = SS_LISTENING; - return 0; + return 0; } -/** +/** * accept - wait for connection request * @sock: listening socket * @newsock: new socket that is to be connected * @flags: file-related flags associated with socket - * + * * Returns 0 on success, errno otherwise */ @@ -1348,15 +1348,15 @@ static int accept(struct socket *sock, struct socket *newsock, int flags) return -EOPNOTSUPP; if (sock->state != SS_LISTENING) return -EINVAL; - - if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && + + if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && (flags & O_NONBLOCK))) return -EWOULDBLOCK; if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; - if (wait_event_interruptible(*sock->sk->sk_sleep, + if (wait_event_interruptible(*sock->sk->sk_sleep, skb_queue_len(&sock->sk->sk_receive_queue))) { res = -ERESTARTSYS; goto exit; @@ -1381,18 +1381,18 @@ static int accept(struct socket *sock, struct socket *newsock, int flags) new_tsock->p->conn_instance = msg_nameinst(msg); } - /* + /* * Respond to 'SYN-' by discarding it & returning 'ACK'-. * Respond to 'SYN+' by queuing it on new socket. */ msg_dbg(msg,"<ACC<: "); - if (!msg_data_sz(msg)) { - struct msghdr m = {NULL,}; + if (!msg_data_sz(msg)) { + struct msghdr m = {NULL,}; - send_packet(NULL, newsock, &m, 0); - advance_queue(tsock); - } else { + send_packet(NULL, newsock, &m, 0); + advance_queue(tsock); + } else { sock_lock(tsock); skb_dequeue(&sock->sk->sk_receive_queue); sock_unlock(tsock); @@ -1410,7 +1410,7 @@ exit: * @how: direction to close (unused; always treated as read + write) * * Terminates connection (if necessary), then purges socket's receive queue. - * + * * Returns 0 on success, errno otherwise */ @@ -1483,32 +1483,32 @@ restart: * @opt: option identifier * @ov: pointer to new option value * @ol: length of option value - * - * For stream sockets only, accepts and ignores all IPPROTO_TCP options + * + * For stream sockets only, accepts and ignores all IPPROTO_TCP options * (to ease compatibility). - * + * * Returns 0 on success, errno otherwise */ -static int setsockopt(struct socket *sock, +static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, int ol) { struct tipc_sock *tsock = tipc_sk(sock->sk); u32 value; int res; - if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) - return 0; + if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) + return 0; if (lvl != SOL_TIPC) return -ENOPROTOOPT; if (ol < sizeof(value)) return -EINVAL; - if ((res = get_user(value, (u32 __user *)ov))) + if ((res = get_user(value, (u32 __user *)ov))) return res; - if (down_interruptible(&tsock->sem)) + if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; - + switch (opt) { case TIPC_IMPORTANCE: res = tipc_set_portimportance(tsock->p->ref, value); @@ -1516,7 +1516,7 @@ static int setsockopt(struct socket *sock, case TIPC_SRC_DROPPABLE: if (sock->type != SOCK_STREAM) res = tipc_set_portunreliable(tsock->p->ref, value); - else + else res = -ENOPROTOOPT; break; case TIPC_DEST_DROPPABLE: @@ -1540,29 +1540,29 @@ static int setsockopt(struct socket *sock, * @opt: option identifier * @ov: receptacle for option value * @ol: receptacle for length of option value - * - * For stream sockets only, returns 0 length result for all IPPROTO_TCP options + * + * For stream sockets only, returns 0 length result for all IPPROTO_TCP options * (to ease compatibility). - * + * * Returns 0 on success, errno otherwise */ -static int getsockopt(struct socket *sock, +static int getsockopt(struct socket *sock, int lvl, int opt, char __user *ov, int __user *ol) { struct tipc_sock *tsock = tipc_sk(sock->sk); - int len; + int len; u32 value; - int res; + int res; - if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) - return put_user(0, ol); + if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) + return put_user(0, ol); if (lvl != SOL_TIPC) return -ENOPROTOOPT; - if ((res = get_user(len, ol))) - return res; + if ((res = get_user(len, ol))) + return res; - if (down_interruptible(&tsock->sem)) + if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; switch (opt) { @@ -1595,30 +1595,30 @@ static int getsockopt(struct socket *sock, res = put_user(sizeof(value), ol); } - up(&tsock->sem); + up(&tsock->sem); return res; } /** * Placeholders for non-implemented functionality - * + * * Returns error code (POSIX-compliant where defined) */ static int ioctl(struct socket *s, u32 cmd, unsigned long arg) { - return -EINVAL; + return -EINVAL; } static int no_mmap(struct file *file, struct socket *sock, - struct vm_area_struct *vma) + struct vm_area_struct *vma) { - return -EINVAL; + return -EINVAL; } static ssize_t no_sendpage(struct socket *sock, struct page *page, - int offset, size_t size, int flags) + int offset, size_t size, int flags) { - return -EINVAL; + return -EINVAL; } static int no_skpair(struct socket *s1, struct socket *s2) @@ -1647,8 +1647,8 @@ static struct proto_ops msg_ops = { .getsockopt = getsockopt, .sendmsg = send_msg, .recvmsg = recv_msg, - .mmap = no_mmap, - .sendpage = no_sendpage + .mmap = no_mmap, + .sendpage = no_sendpage }; static struct proto_ops packet_ops = { @@ -1668,8 +1668,8 @@ static struct proto_ops packet_ops = { .getsockopt = getsockopt, .sendmsg = send_packet, .recvmsg = recv_msg, - .mmap = no_mmap, - .sendpage = no_sendpage + .mmap = no_mmap, + .sendpage = no_sendpage }; static struct proto_ops stream_ops = { @@ -1689,8 +1689,8 @@ static struct proto_ops stream_ops = { .getsockopt = getsockopt, .sendmsg = send_stream, .recvmsg = recv_stream, - .mmap = no_mmap, - .sendpage = no_sendpage + .mmap = no_mmap, + .sendpage = no_sendpage }; static struct net_proto_family tipc_family_ops = { @@ -1707,14 +1707,14 @@ static struct proto tipc_proto = { /** * tipc_socket_init - initialize TIPC socket interface - * + * * Returns 0 on success, errno otherwise */ int tipc_socket_init(void) { int res; - res = proto_register(&tipc_proto, 1); + res = proto_register(&tipc_proto, 1); if (res) { err("Failed to register TIPC protocol type\n"); goto out; diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index ddade73..8c01ccd 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c @@ -1,6 +1,6 @@ /* * net/tipc/subscr.c: TIPC subscription service - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -49,10 +49,10 @@ * @port_ref: object reference to port used to communicate with subscriber * @swap: indicates if subscriber uses opposite endianness in its messages */ - + struct subscriber { u32 ref; - spinlock_t *lock; + spinlock_t *lock; struct list_head subscriber_list; struct list_head subscription_list; u32 port_ref; @@ -82,7 +82,7 @@ static struct top_srv topsrv = { 0 }; * htohl - convert value to endianness used by destination * @in: value to convert * @swap: non-zero if endianness must be reversed - * + * * Returns converted value */ @@ -97,11 +97,11 @@ static u32 htohl(u32 in, int swap) * subscr_send_event - send a message containing a tipc_event to the subscriber */ -static void subscr_send_event(struct subscription *sub, - u32 found_lower, +static void subscr_send_event(struct subscription *sub, + u32 found_lower, u32 found_upper, - u32 event, - u32 port_ref, + u32 event, + u32 port_ref, u32 node) { struct iovec msg_sect; @@ -123,8 +123,8 @@ static void subscr_send_event(struct subscription *sub, * Returns 1 if there is overlap, otherwise 0. */ -int tipc_subscr_overlap(struct subscription *sub, - u32 found_lower, +int tipc_subscr_overlap(struct subscription *sub, + u32 found_lower, u32 found_upper) { @@ -139,15 +139,15 @@ int tipc_subscr_overlap(struct subscription *sub, /** * tipc_subscr_report_overlap - issue event if there is subscription overlap - * + * * Protected by nameseq.lock in name_table.c */ -void tipc_subscr_report_overlap(struct subscription *sub, - u32 found_lower, +void tipc_subscr_report_overlap(struct subscription *sub, + u32 found_lower, u32 found_upper, - u32 event, - u32 port_ref, + u32 event, + u32 port_ref, u32 node, int must) { @@ -189,11 +189,11 @@ static void subscr_timeout(struct subscription *sub) /* Notify subscriber of timeout, then unlink subscription */ - subscr_send_event(sub, - sub->evt.s.seq.lower, + subscr_send_event(sub, + sub->evt.s.seq.lower, sub->evt.s.seq.upper, - TIPC_SUBSCR_TIMEOUT, - 0, + TIPC_SUBSCR_TIMEOUT, + 0, 0); list_del(&sub->subscription_list); @@ -221,11 +221,11 @@ static void subscr_del(struct subscription *sub) /** * subscr_terminate - terminate communication with a subscriber - * + * * Called with subscriber locked. Routine must temporarily release this lock - * to enable subscription timeout routine(s) to finish without deadlocking; + * to enable subscription timeout routine(s) to finish without deadlocking; * the lock is then reclaimed to allow caller to release it upon return. - * (This should work even in the unlikely event some other thread creates + * (This should work even in the unlikely event some other thread creates * a new object reference in the interim that uses this lock; this routine will * simply wait for it to be released, then claim it.) */ @@ -241,7 +241,7 @@ static void subscr_terminate(struct subscriber *subscriber) spin_unlock_bh(subscriber->lock); /* Destroy any existing subscriptions for subscriber */ - + list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, subscription_list) { if (sub->timeout != TIPC_WAIT_FOREVER) { @@ -315,7 +315,7 @@ static void subscr_cancel(struct tipc_subscr *s, /** * subscr_subscribe - create subscription for subscriber - * + * * Called with subscriber locked */ @@ -431,7 +431,7 @@ static void subscr_conn_msg_event(void *usr_handle, subscr_terminate(subscriber); else subscr_subscribe((struct tipc_subscr *)data, subscriber); - + spin_unlock_bh(subscriber_lock); } @@ -444,7 +444,7 @@ static void subscr_named_msg_event(void *usr_handle, struct sk_buff **buf, const unchar *data, u32 size, - u32 importance, + u32 importance, struct tipc_portid const *orig, struct tipc_name_seq const *dest) { @@ -534,22 +534,22 @@ int tipc_subscr_start(void) return res; } - res = tipc_createport(topsrv.user_ref, - NULL, - TIPC_CRITICAL_IMPORTANCE, - NULL, - NULL, - NULL, - NULL, - subscr_named_msg_event, - NULL, - NULL, - &topsrv.setup_port); - if (res) + res = tipc_createport(topsrv.user_ref, + NULL, + TIPC_CRITICAL_IMPORTANCE, + NULL, + NULL, + NULL, + NULL, + subscr_named_msg_event, + NULL, + NULL, + &topsrv.setup_port); + if (res) goto failed; - res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); - if (res) + res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); + if (res) goto failed; spin_unlock_bh(&topsrv.lock); @@ -571,7 +571,7 @@ void tipc_subscr_stop(void) if (topsrv.user_ref) { tipc_deleteport(topsrv.setup_port); - list_for_each_entry_safe(subscriber, subscriber_temp, + list_for_each_entry_safe(subscriber, subscriber_temp, &topsrv.subscriber_list, subscriber_list) { tipc_ref_lock(subscriber->ref); diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h index 1e50904..93a8e67 100644 --- a/net/tipc/subscr.h +++ b/net/tipc/subscr.h @@ -1,6 +1,6 @@ /* * net/tipc/subscr.h: Include file for TIPC subscription service - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -48,7 +48,7 @@ * @timer_ref: reference to timer governing subscription duration (may be NULL) * @owner: pointer to subscriber object associated with this subscription */ - + struct subscription { struct tipc_name_seq seq; u32 timeout; @@ -60,15 +60,15 @@ struct subscription { struct subscriber *owner; }; -int tipc_subscr_overlap(struct subscription * sub, - u32 found_lower, +int tipc_subscr_overlap(struct subscription * sub, + u32 found_lower, u32 found_upper); -void tipc_subscr_report_overlap(struct subscription * sub, - u32 found_lower, +void tipc_subscr_report_overlap(struct subscription * sub, + u32 found_lower, u32 found_upper, - u32 event, - u32 port_ref, + u32 event, + u32 port_ref, u32 node, int must_report); diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c index 04d1b9b..4146c40 100644 --- a/net/tipc/user_reg.c +++ b/net/tipc/user_reg.c @@ -1,6 +1,6 @@ /* * net/tipc/user_reg.c: TIPC user registry code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -40,7 +40,7 @@ /* * TIPC user registry keeps track of users of the tipc_port interface. * - * The registry utilizes an array of "TIPC user" entries; + * The registry utilizes an array of "TIPC user" entries; * a user's ID is the index of their associated array entry. * Array entry 0 is not used, so userid 0 is not valid; * TIPC sometimes uses this value to denote an anonymous user. @@ -51,7 +51,7 @@ * struct tipc_user - registered TIPC user info * @next: index of next free registry entry (or -1 for an allocated entry) * @callback: ptr to routine to call when TIPC mode changes (NULL if none) - * @usr_handle: user-defined value passed to callback routine + * @usr_handle: user-defined value passed to callback routine * @ports: list of user ports owned by the user */ @@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(reg_lock); /** * reg_init - create TIPC user registry (but don't activate it) - * + * * If registry has been pre-initialized it is left "as is". * NOTE: This routine may be called when TIPC is inactive. */ @@ -79,7 +79,7 @@ static DEFINE_SPINLOCK(reg_lock); static int reg_init(void) { u32 i; - + spin_lock_bh(®_lock); if (!users) { users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC); @@ -137,7 +137,7 @@ int tipc_reg_start(void) */ void tipc_reg_stop(void) -{ +{ int id; if (!users) @@ -174,14 +174,14 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle) user_ptr = &users[next_free_user]; *userid = next_free_user; next_free_user = user_ptr->next; - user_ptr->next = -1; + user_ptr->next = -1; spin_unlock_bh(®_lock); user_ptr->callback = cb; user_ptr->usr_handle = usr_handle; INIT_LIST_HEAD(&user_ptr->ports); atomic_inc(&tipc_user_count); - + if (cb && (tipc_mode != TIPC_NOT_RUNNING)) tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr); return TIPC_OK; @@ -207,16 +207,16 @@ void tipc_detach(u32 userid) } user_ptr = &users[userid]; - user_ptr->callback = NULL; + user_ptr->callback = NULL; INIT_LIST_HEAD(&ports_temp); - list_splice(&user_ptr->ports, &ports_temp); + list_splice(&user_ptr->ports, &ports_temp); user_ptr->next = next_free_user; next_free_user = userid; spin_unlock_bh(®_lock); atomic_dec(&tipc_user_count); - list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { + list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { tipc_deleteport(up_ptr->ref); } } diff --git a/net/tipc/user_reg.h b/net/tipc/user_reg.h index d0e8879..81dc12e 100644 --- a/net/tipc/user_reg.h +++ b/net/tipc/user_reg.h @@ -1,6 +1,6 @@ /* * net/tipc/user_reg.h: Include file for TIPC user registry code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/zone.c b/net/tipc/zone.c index f5b00ea..114e173 100644 --- a/net/tipc/zone.c +++ b/net/tipc/zone.c @@ -1,6 +1,6 @@ /* * net/tipc/zone.c: TIPC zone management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -92,7 +92,7 @@ void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router) for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { if (z_ptr->clusters[c_num]) { - tipc_cltr_remove_as_router(z_ptr->clusters[c_num], + tipc_cltr_remove_as_router(z_ptr->clusters[c_num], router); } } diff --git a/net/tipc/zone.h b/net/tipc/zone.h index 5ab3d08..6e7a08d 100644 --- a/net/tipc/zone.h +++ b/net/tipc/zone.h @@ -1,6 +1,6 @@ /* * net/tipc/zone.h: Include file for TIPC zone management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -47,7 +47,7 @@ * @clusters: array of pointers to all clusters within zone * @links: number of (unicast) links to zone */ - + struct _zone { u32 addr; struct cluster *clusters[2]; /* currently limited to just 1 cluster */ diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2f208c7..ac9478d 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -195,7 +195,7 @@ static inline void unix_release_addr(struct unix_address *addr) * - if started by not zero, should be NULL terminated (FS object) * - if started by zero, it is abstract name. */ - + static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp) { if (len <= sizeof(short) || len > sizeof(*sunaddr)) @@ -432,7 +432,7 @@ static int unix_release_sock (struct sock *sk, int embrion) */ if (atomic_read(&unix_tot_inflight)) - unix_gc(); /* Garbage collect fds */ + unix_gc(); /* Garbage collect fds */ return 0; } @@ -698,7 +698,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len, struct sock *u; struct nameidata nd; int err = 0; - + if (sunname->sun_path[0]) { err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd); if (err) @@ -915,7 +915,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, unix_peer(sk)=other; unix_state_wunlock(sk); } - return 0; + return 0; out_unlock: unix_state_wunlock(sk); @@ -1021,7 +1021,7 @@ restart: goto out; sock_put(other); goto restart; - } + } /* Latch our state. @@ -1415,7 +1415,7 @@ out: return err; } - + static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, struct msghdr *msg, size_t len) { @@ -1467,11 +1467,11 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, if (size > SKB_MAX_ALLOC) size = SKB_MAX_ALLOC; - + /* * Grab a buffer */ - + skb=sock_alloc_send_skb(sk,size,msg->msg_flags&MSG_DONTWAIT, &err); if (skb==NULL) @@ -1530,7 +1530,7 @@ static int unix_seqpacket_sendmsg(struct kiocb *kiocb, struct socket *sock, { int err; struct sock *sk = sock->sk; - + err = sock_error(sk); if (err) return err; @@ -1543,7 +1543,7 @@ static int unix_seqpacket_sendmsg(struct kiocb *kiocb, struct socket *sock, return unix_dgram_sendmsg(kiocb, sock, msg, len); } - + static void unix_copy_addr(struct msghdr *msg, struct sock *sk) { struct unix_sock *u = unix_sk(sk); @@ -1605,7 +1605,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, if (UNIXCB(skb).fp) unix_detach_fds(siocb->scm, skb); } - else + else { /* It is questionable: on PEEK we could: - do not return fds - good, but too simple 8) @@ -1613,11 +1613,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, apparently wrong) - clone fds (I chose it for now, it is the most universal solution) - - POSIX 1003.1g does not actually define this clearly - at all. POSIX 1003.1g doesn't define a lot of things - clearly however! - + + POSIX 1003.1g does not actually define this clearly + at all. POSIX 1003.1g doesn't define a lot of things + clearly however! + */ if (UNIXCB(skb).fp) siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp); @@ -1637,7 +1637,7 @@ out: /* * Sleep until data has arrive. But check for races.. */ - + static long unix_stream_data_wait(struct sock * sk, long timeo) { DEFINE_WAIT(wait); @@ -1721,7 +1721,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, /* * POSIX 1003.1g mandates this order. */ - + if ((err = sock_error(sk)) != 0) break; if (sk->sk_shutdown & RCV_SHUTDOWN) @@ -1937,7 +1937,7 @@ static struct sock *unix_seq_idx(int *iter, loff_t pos) struct sock *s; for (s = first_unix_socket(iter); s; s = next_unix_socket(iter, s)) { - if (off == pos) + if (off == pos) return s; ++off; } @@ -1955,7 +1955,7 @@ static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - if (v == (void *)1) + if (v == (void *)1) return first_unix_socket(seq->private); return next_unix_socket(seq->private, v); } @@ -1967,7 +1967,7 @@ static void unix_seq_stop(struct seq_file *seq, void *v) static int unix_seq_show(struct seq_file *seq, void *v) { - + if (v == (void *)1) seq_puts(seq, "Num RefCount Protocol Flags Type St " "Inode Path\n"); @@ -2064,8 +2064,8 @@ static int __init af_unix_init(void) BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb)); rc = proto_register(&unix_proto, 1); - if (rc != 0) { - printk(KERN_CRIT "%s: Cannot create unix_sock SLAB cache!\n", + if (rc != 0) { + printk(KERN_CRIT "%s: Cannot create unix_sock SLAB cache!\n", __FUNCTION__); goto out; } diff --git a/net/unix/garbage.c b/net/unix/garbage.c index f14ad66..f8bcf5d 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -63,7 +63,7 @@ * Damn. Added missing check for ->dead in listen queues scanning. * */ - + #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> @@ -118,7 +118,7 @@ static struct sock *unix_get_socket(struct file *filp) * Keep the number of times in flight count for the file * descriptor if it is for an AF_UNIX socket. */ - + void unix_inflight(struct file *fp) { struct sock *s = unix_get_socket(fp); @@ -190,7 +190,7 @@ void unix_gc(void) unix_sk(s)->gc_tree = GC_ORPHAN; } /* - * Everything is now marked + * Everything is now marked */ /* Invariant to be maintained: @@ -227,7 +227,7 @@ void unix_gc(void) } /* - * Mark phase + * Mark phase */ while (!empty_stack()) @@ -237,11 +237,11 @@ void unix_gc(void) spin_lock(&x->sk_receive_queue.lock); skb = skb_peek(&x->sk_receive_queue); - + /* - * Loop through all but first born + * Loop through all but first born */ - + while (skb && skb != (struct sk_buff *)&x->sk_receive_queue) { /* * Do we have file descriptors ? diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c index c205973..41d7e32 100644 --- a/net/wanrouter/af_wanpipe.c +++ b/net/wanrouter/af_wanpipe.c @@ -11,11 +11,11 @@ * 2 of the License, or (at your option) any later version. * ============================================================================ * Due Credit: -* Wanpipe socket layer is based on Packet and -* the X25 socket layers. The above sockets were -* used for the specific use of Sangoma Technologies -* API programs. -* Packet socket Authors: Ross Biro, Fred N. van Kempen and +* Wanpipe socket layer is based on Packet and +* the X25 socket layers. The above sockets were +* used for the specific use of Sangoma Technologies +* API programs. +* Packet socket Authors: Ross Biro, Fred N. van Kempen and * Alan Cox. * X25 socket Author: Jonathan Naylor. * ============================================================================ @@ -28,7 +28,7 @@ * Feb 29, 2000 Nenad Corbic o Added support for PVC protocols, such as * CHDLC, Frame Relay and HDLC API. * Jan 17, 2000 Nenad Corbic o Initial version, based on AF_PACKET socket. -* X25API support only. +* X25API support only. * ******************************************************************************/ @@ -71,33 +71,33 @@ #define DBG_PRINTK(format, a...) printk(format, ## a) #else #define DBG_PRINTK(format, a...) -#endif +#endif -/* SECURE SOCKET IMPLEMENTATION - * +/* SECURE SOCKET IMPLEMENTATION + * * TRANSMIT: * * When the user sends a packet via send() system call - * the wanpipe_sendmsg() function is executed. - * + * the wanpipe_sendmsg() function is executed. + * * Each packet is enqueud into sk->sk_write_queue transmit * queue. When the packet is enqueued, a delayed transmit - * timer is triggerd which acts as a Bottom Half hander. + * timer is triggerd which acts as a Bottom Half hander. * * wanpipe_delay_transmit() function (BH), dequeues packets - * from the sk->sk_write_queue transmit queue and sends it - * to the deriver via dev->hard_start_xmit(skb, dev) function. + * from the sk->sk_write_queue transmit queue and sends it + * to the deriver via dev->hard_start_xmit(skb, dev) function. * Note, this function is actual a function pointer of if_send() * routine in the wanpipe driver. * * X25API GUARANTEED DELIVERY: * - * In order to provide 100% guaranteed packet delivery, - * an atomic 'packet_sent' counter is implemented. Counter - * is incremented for each packet enqueued + * In order to provide 100% guaranteed packet delivery, + * an atomic 'packet_sent' counter is implemented. Counter + * is incremented for each packet enqueued * into sk->sk_write_queue. Counter is decremented each - * time wanpipe_delayed_transmit() function successfuly + * time wanpipe_delayed_transmit() function successfuly * passes the packet to the driver. Before each send(), a poll * routine checks the sock resources The maximum value of * packet sent counter is 1, thus if one packet is queued, the @@ -110,11 +110,11 @@ * function, wanpipe_rcv() to queue the incoming packets * into an AF_WANPIPE socket queue. Based on wanpipe_rcv() * return code, the driver knows whether the packet was - * successfully queued. If the socket queue is full, - * protocol flow control is used by the driver, if any, + * successfully queued. If the socket queue is full, + * protocol flow control is used by the driver, if any, * to slow down the traffic until the sock queue is free. * - * Every time a packet arrives into a socket queue the + * Every time a packet arrives into a socket queue the * socket wakes up processes which are waiting to receive * data. * @@ -122,12 +122,12 @@ * bit which signals the socket to kick the wanpipe driver * bottom half hander when the socket queue is partialy * empty. wanpipe_recvmsg() function performs this action. - * + * * In case of x25api, packets will never be dropped, since - * flow control is available. - * - * In case of streaming protocols like CHDLC, packets will - * be dropped but the statistics will be generated. + * flow control is available. + * + * In case of streaming protocols like CHDLC, packets will + * be dropped but the statistics will be generated. */ @@ -170,11 +170,11 @@ struct wanpipe_opt struct net_device *dev; /* Bounded device */ unsigned short lcn; /* Binded LCN */ unsigned char svc; /* 0=pvc, 1=svc */ - unsigned char timer; /* flag for delayed transmit*/ + unsigned char timer; /* flag for delayed transmit*/ struct timer_list tx_timer; unsigned poll_cnt; unsigned char force; /* Used to force sock release */ - atomic_t packet_sent; + atomic_t packet_sent; }; #endif @@ -215,8 +215,8 @@ static int check_driver_busy (struct sock *); * * Wanpipe socket bottom half handler. This function * is called by the WANPIPE device drivers to queue a - * incoming packet into the socket receive queue. - * Once the packet is queued, all processes waiting to + * incoming packet into the socket receive queue. + * Once the packet is queued, all processes waiting to * read are woken up. * * During socket bind, this function is bounded into @@ -245,13 +245,13 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, if (dev->hard_header_parse) sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr); - /* + /* * WAN_PACKET_DATA : Data which should be passed up the receive queue. - * WAN_PACKET_ASYC : Asynchronous data like place call, which should - * be passed up the listening sock. - * WAN_PACKET_ERR : Asynchronous data like clear call or restart - * which should go into an error queue. - */ + * WAN_PACKET_ASYC : Asynchronous data like place call, which should + * be passed up the listening sock. + * WAN_PACKET_ERR : Asynchronous data like clear call or restart + * which should go into an error queue. + */ switch (skb->pkt_type){ case WAN_PACKET_DATA: @@ -261,10 +261,10 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, break; case WAN_PACKET_CMD: sk->sk_state = chan->state; - /* Bug fix: update Mar6. - * Do not set the sock lcn number here, since - * cmd is not guaranteed to be executed on the - * board, thus Lcn could be wrong */ + /* Bug fix: update Mar6. + * Do not set the sock lcn number here, since + * cmd is not guaranteed to be executed on the + * board, thus Lcn could be wrong */ sk->sk_data_ready(sk, skb->len); kfree_skb(skb); break; @@ -276,7 +276,7 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, break; default: printk(KERN_INFO "wansock: BH Illegal Packet Type Dropping\n"); - kfree_skb(skb); + kfree_skb(skb); break; } @@ -297,20 +297,20 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, * * Wanpipe LISTEN socket bottom half handler. This function * is called by the WANPIPE device drivers to queue an - * incoming call into the socket listening queue. - * Once the packet is queued, the waiting accept() process + * incoming call into the socket listening queue. + * Once the packet is queued, the waiting accept() process * is woken up. * * During socket bind, this function is bounded into - * WANPIPE driver private. - * + * WANPIPE driver private. + * * IMPORTANT NOTE: * The accept call() is waiting for an skb packet * which contains a pointer to a device structure. * - * When we do a bind to a device structre, we - * bind a newly created socket into "chan->sk". Thus, - * when accept receives the skb packet, it will know + * When we do a bind to a device structre, we + * bind a newly created socket into "chan->sk". Thus, + * when accept receives the skb packet, it will know * from which dev it came form, and in turn it will know * the address of the new sock. * @@ -322,31 +322,31 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk) wanpipe_opt *wp = wp_sk(sk), *newwp; struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb; struct sock *newsk; - struct net_device *dev; + struct net_device *dev; sdla_t *card; mbox_cmd_t *mbox_ptr; wanpipe_common_t *chan; - /* Find a free device, if none found, all svc's are busy - */ + /* Find a free device, if none found, all svc's are busy + */ card = (sdla_t*)wp->card; if (!card){ printk(KERN_INFO "wansock: LISTEN ERROR, No Card\n"); return -ENODEV; } - + dev = wanpipe_find_free_dev(card); if (!dev){ printk(KERN_INFO "wansock: LISTEN ERROR, No Free Device\n"); return -ENODEV; } - chan=dev->priv; + chan=dev->priv; chan->state = WANSOCK_CONNECTING; /* Allocate a new sock, which accept will bind - * and pass up to the user + * and pass up to the user */ if ((newsk = wanpipe_make_new(sk)) == NULL){ release_device(dev); @@ -354,33 +354,33 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk) } - /* Initialize the new sock structure + /* Initialize the new sock structure */ newsk->sk_bound_dev_if = dev->ifindex; newwp = wp_sk(newsk); newwp->card = wp->card; /* Insert the sock into the main wanpipe - * sock list. - */ + * sock list. + */ atomic_inc(&wanpipe_socks_nr); /* Allocate and fill in the new Mail Box. Then - * bind the mail box to the sock. It will be - * used by the ioctl call to read call information - * and to execute commands. - */ + * bind the mail box to the sock. It will be + * used by the ioctl call to read call information + * and to execute commands. + */ if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) { wanpipe_kill_sock_irq (newsk); - release_device(dev); + release_device(dev); return -ENOMEM; } memcpy(mbox_ptr,skb->data,skb->len); /* Register the lcn on which incoming call came - * from. Thus, if we have to clear it, we know - * which lcn to clear - */ + * from. Thus, if we have to clear it, we know + * which lcn to clear + */ newwp->lcn = mbox_ptr->cmd.lcn; newwp->mbox = (void *)mbox_ptr; @@ -416,20 +416,20 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk) /* We must do this manually, since the sock_queue_rcv_skb() * function sets the skb->dev to NULL. However, we use - * the dev field in the accept function.*/ - if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= + * the dev field in the accept function.*/ + if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= (unsigned)sk->sk_rcvbuf) { - wanpipe_unlink_driver(newsk); + wanpipe_unlink_driver(newsk); wanpipe_kill_sock_irq (newsk); --sk->sk_ack_backlog; return -ENOMEM; - } + } skb_set_owner_r(skb, sk); skb_queue_tail(&sk->sk_receive_queue, skb); sk->sk_data_ready(sk, skb->len); - + return 0; } @@ -474,7 +474,7 @@ static struct sock *wanpipe_make_new(struct sock *osk) return sk; } -/* +/* * FIXME: wanpipe_opt has to include a sock in its definition and stop using * sk_protinfo, but this code is not even compilable now, so lets leave it for * later. @@ -489,12 +489,12 @@ static struct proto wanpipe_proto = { * wanpipe_make_new * * Allocate memory for the a new sock, and sock - * private data. - * + * private data. + * * Increment the module use count. - * - * This function is used by wanpipe_create() and - * wanpipe_make_new() functions. + * + * This function is used by wanpipe_create() and + * wanpipe_make_new() functions. * *===========================================================*/ @@ -514,7 +514,7 @@ static struct sock *wanpipe_alloc_socket(void) wp_sk(sk) = wan_opt; /* Use timer to send data to the driver. This will act - * as a BH handler for sendmsg functions */ + * as a BH handler for sendmsg functions */ init_timer(&wan_opt->tx_timer); wan_opt->tx_timer.data = (unsigned long)sk; wan_opt->tx_timer.function = wanpipe_delayed_transmit; @@ -528,14 +528,14 @@ static struct sock *wanpipe_alloc_socket(void) * wanpipe_sendmsg * * This function implements a sendto() system call, - * for AF_WANPIPE socket family. + * for AF_WANPIPE socket family. * During socket bind() sk->sk_bound_dev_if is initialized * to a correct network device. This number is used * to find a network device to which the packet should * be passed to. * - * Each packet is queued into sk->sk_write_queue and - * delayed transmit bottom half handler is marked for + * Each packet is queued into sk->sk_write_queue and + * delayed transmit bottom half handler is marked for * execution. * * A socket must be in WANSOCK_CONNECTED state before @@ -554,18 +554,18 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, unsigned char *addr; int ifindex, err, reserve = 0; - + if (!sock_flag(sk, SOCK_ZAPPED)) return -ENETDOWN; if (sk->sk_state != WANSOCK_CONNECTED) - return -ENOTCONN; + return -ENOTCONN; - if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return(-EINVAL); /* it was <=, now one can send - * zero length packets */ + * zero length packets */ if (len < sizeof(x25api_hdr_t)) return -EINVAL; @@ -577,7 +577,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, addr = NULL; }else{ - if (msg->msg_namelen < sizeof(struct wan_sockaddr_ll)){ + if (msg->msg_namelen < sizeof(struct wan_sockaddr_ll)){ return -EINVAL; } @@ -592,12 +592,12 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, return -ENXIO; } dev_put(dev); - + if (sock->type == SOCK_RAW) reserve = dev->hard_header_len; if (len > dev->mtu+reserve){ - return -EMSGSIZE; + return -EMSGSIZE; } skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev), @@ -606,7 +606,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, if (skb==NULL){ goto out_unlock; } - + skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb->nh.raw = skb->data; @@ -645,7 +645,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, if (!(test_and_set_bit(0, &wp->timer))) mod_timer(&wp->tx_timer, jiffies + 1); - + return(len); out_free: @@ -658,12 +658,12 @@ out_unlock: * wanpipe_delayed_tarnsmit * * Transmit bottom half handler. It dequeues packets - * from sk->sk_write_queue and passes them to the - * driver. If the driver is busy, the packet is - * re-enqueued. + * from sk->sk_write_queue and passes them to the + * driver. If the driver is busy, the packet is + * re-enqueued. * * Packet Sent counter is decremented on successful - * transmission. + * transmission. *===========================================================*/ @@ -680,17 +680,17 @@ static void wanpipe_delayed_transmit (unsigned long data) DBG_PRINTK(KERN_INFO "wansock: Transmit delay, no dev or card\n"); return; } - + if (sk->sk_state != WANSOCK_CONNECTED || !sock_flag(sk, SOCK_ZAPPED)) { clear_bit(0, &wp->timer); DBG_PRINTK(KERN_INFO "wansock: Tx Timer, State not CONNECTED\n"); return; } - + /* If driver is executing command, we must offload - * the board by not sending data. Otherwise a - * pending command will never get a free buffer - * to execute */ + * the board by not sending data. Otherwise a + * pending command will never get a free buffer + * to execute */ if (atomic_read(&card->u.x.command_busy)){ wp->tx_timer.expires = jiffies + SLOW_BACKOFF; add_timer(&wp->tx_timer); @@ -698,30 +698,30 @@ static void wanpipe_delayed_transmit (unsigned long data) return; } - + if (test_and_set_bit(0,&wanpipe_tx_critical)){ printk(KERN_INFO "WanSock: Tx timer critical %s\n",dev->name); wp->tx_timer.expires = jiffies + SLOW_BACKOFF; add_timer(&wp->tx_timer); return; - } - + } + /* Check for a packet in the fifo and send */ if ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL){ - if (dev->hard_start_xmit(skb, dev) != 0){ + if (dev->hard_start_xmit(skb, dev) != 0){ /* Driver failed to transmit, re-enqueue - * the packet and retry again later */ + * the packet and retry again later */ skb_queue_head(&sk->sk_write_queue,skb); clear_bit(0,&wanpipe_tx_critical); return; }else{ /* Packet Sent successful. Check for more packets - * if more packets, re-trigger the transmit routine - * other wise exit - */ + * if more packets, re-trigger the transmit routine + * other wise exit + */ atomic_dec(&wp->packet_sent); if (skb_peek(&sk->sk_write_queue) == NULL) { @@ -741,18 +741,18 @@ static void wanpipe_delayed_transmit (unsigned long data) } /*============================================================ - * execute_command + * execute_command * * Execute x25api commands. The atomic variable * chan->command is used to indicate to the driver that * command is pending for execution. The acutal command - * structure is placed into a sock mbox structure + * structure is placed into a sock mbox structure * (wp_sk(sk)->mbox). * * The sock private structure, mbox is * used as shared memory between sock and the driver. * Driver uses the sock mbox to execute the command - * and return the result. + * and return the result. * * For all command except PLACE CALL, the function * waits for the result. PLACE CALL can be ether @@ -768,7 +768,7 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla wanpipe_common_t *chan=NULL; int err=0; DECLARE_WAITQUEUE(wait, current); - + dev = dev_get_by_index(sk->sk_bound_dev_if); if (dev == NULL){ printk(KERN_INFO "wansock: Exec failed no dev %i\n", @@ -793,7 +793,7 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla return -EINVAL; } - ((mbox_cmd_t*)wp->mbox)->cmd.command = cmd; + ((mbox_cmd_t*)wp->mbox)->cmd.command = cmd; ((mbox_cmd_t*)wp->mbox)->cmd.lcn = wp->lcn; ((mbox_cmd_t*)wp->mbox)->cmd.result = 0x7F; @@ -820,12 +820,12 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla } current->state = TASK_RUNNING; remove_wait_queue(sk->sk_sleep,&wait); - + return err; } /*============================================================ - * wanpipe_destroy_timer + * wanpipe_destroy_timer * * Used by wanpipe_release, to delay release of * the socket. @@ -846,7 +846,7 @@ static void wanpipe_destroy_timer(unsigned long data) kfree(wp); wp_sk(sk) = NULL; - + if (atomic_read(&sk->sk_refcnt) != 1) { atomic_set(&sk->sk_refcnt, 1); DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i ! :delay.\n", @@ -865,9 +865,9 @@ static void wanpipe_destroy_timer(unsigned long data) /*============================================================ * wanpipe_unlink_driver * - * When the socket is released, this function is + * When the socket is released, this function is * used to remove links that bind the sock and the - * driver together. + * driver together. *===========================================================*/ static void wanpipe_unlink_driver (struct sock *sk) { @@ -882,7 +882,7 @@ static void wanpipe_unlink_driver (struct sock *sk) if (!dev){ printk(KERN_INFO "wansock: No dev on release\n"); return; - } + } dev_put(dev); if ((chan = dev->priv) == NULL){ @@ -897,7 +897,7 @@ static void wanpipe_unlink_driver (struct sock *sk) chan->tx_timer=NULL; clear_bit(0,&chan->common_critical); release_device(dev); - + return; } @@ -931,7 +931,7 @@ static void wanpipe_link_driver(struct net_device *dev, struct sock *sk) /*============================================================ * release_device * - * During sock release, clear a critical bit, which + * During sock release, clear a critical bit, which * marks the device a being taken. *===========================================================*/ @@ -945,8 +945,8 @@ static void release_device(struct net_device *dev) /*============================================================ * wanpipe_release * - * Close a PACKET socket. This is fairly simple. We - * immediately go to 'closed' state and remove our + * Close a PACKET socket. This is fairly simple. We + * immediately go to 'closed' state and remove our * protocol entry in the device list. *===========================================================*/ @@ -954,7 +954,7 @@ static int wanpipe_release(struct socket *sock) { wanpipe_opt *wp; struct sock *sk = sock->sk; - + if (!sk) return 0; @@ -962,9 +962,9 @@ static int wanpipe_release(struct socket *sock) check_write_queue(sk); /* Kill the tx timer, if we don't kill it now, the timer - * will run after we kill the sock. Timer code will - * try to access the sock which has been killed and cause - * kernel panic */ + * will run after we kill the sock. Timer code will + * try to access the sock which has been killed and cause + * kernel panic */ del_timer(&wp->tx_timer); @@ -982,7 +982,7 @@ static int wanpipe_release(struct socket *sock) DBG_PRINTK(KERN_INFO "wansock: Sending Clear Indication %i\n", sk->sk_state); dev_put(dev); - } + } } set_bit(1,&wanpipe_tx_critical); @@ -992,10 +992,10 @@ static int wanpipe_release(struct socket *sock) clear_bit(1,&wanpipe_tx_critical); - + release_driver(sk); - + /* * Now the socket is dead. No more input will appear. */ @@ -1040,9 +1040,9 @@ static int wanpipe_release(struct socket *sock) /*============================================================ * check_write_queue * - * During sock shutdown, if the sock state is - * WANSOCK_CONNECTED and there is transmit data - * pending. Wait until data is released + * During sock shutdown, if the sock state is + * WANSOCK_CONNECTED and there is transmit data + * pending. Wait until data is released * before proceeding. *===========================================================*/ @@ -1062,7 +1062,7 @@ static void check_write_queue(struct sock *sk) /*============================================================ * release_driver * - * This function is called during sock shutdown, to + * This function is called during sock shutdown, to * release any resources and links that bind the sock * to the driver. It also changes the state of the * sock to WANSOCK_DISCONNECTED @@ -1105,7 +1105,7 @@ static void release_driver(struct sock *sk) * start_cleanup_timer * * If new incoming call's are pending but the socket - * is being released, start the timer which will + * is being released, start the timer which will * envoke the kill routines for pending socks. *===========================================================*/ @@ -1125,7 +1125,7 @@ static void start_cleanup_timer (struct sock *sk) * * This is a function which performs actual killing * of the sock. It releases socket resources, - * and unlinks the sock from the driver. + * and unlinks the sock from the driver. *===========================================================*/ static void wanpipe_kill_sock_timer (unsigned long data) @@ -1139,13 +1139,13 @@ static void wanpipe_kill_sock_timer (unsigned long data) /* This function can be called from interrupt. We must use * appropriate locks */ - + if (test_bit(1,&wanpipe_tx_critical)){ sk->sk_timer.expires = jiffies + 10; add_timer(&sk->sk_timer); return; } - + write_lock(&wanpipe_sklist_lock); sk_del_node_init(sk); write_unlock(&wanpipe_sklist_lock); @@ -1159,7 +1159,7 @@ static void wanpipe_kill_sock_timer (unsigned long data) chan=dev->priv; atomic_set(&chan->disconnect,1); dev_put(dev); - } + } } release_driver(sk); @@ -1170,7 +1170,7 @@ static void wanpipe_kill_sock_timer (unsigned long data) skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_write_queue); skb_queue_purge(&sk->sk_error_queue); - + if (atomic_read(&sk->sk_rmem_alloc) || atomic_read(&sk->sk_wmem_alloc)) { del_timer(&sk->sk_timer); @@ -1205,7 +1205,7 @@ static void wanpipe_kill_sock_accept (struct sock *sk) /* This function can be called from interrupt. We must use * appropriate locks */ - + write_lock(&wanpipe_sklist_lock); sk_del_node_init(sk); write_unlock(&wanpipe_sklist_lock); @@ -1282,10 +1282,10 @@ static int wanpipe_do_bind(struct sock *sk, struct net_device *dev, chan=dev->priv; sk->sk_state = chan->state; - if (wp->num == htons(X25_PROT) && - sk->sk_state != WANSOCK_DISCONNECTED && + if (wp->num == htons(X25_PROT) && + sk->sk_state != WANSOCK_DISCONNECTED && sk->sk_state != WANSOCK_CONNECTING) { - DBG_PRINTK(KERN_INFO + DBG_PRINTK(KERN_INFO "wansock: Binding to Device not DISCONNECTED %i\n", sk->sk_state); release_device(dev); @@ -1338,7 +1338,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le /* * Check legality */ - + if (addr_len < sizeof(struct wan_sockaddr_ll)){ printk(KERN_INFO "wansock: Address length error\n"); return -EINVAL; @@ -1358,12 +1358,12 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le if (!strcmp(sll->sll_device,"svc_listen")){ - /* Bind a sock to a card structure for listening - */ - int err=0; + /* Bind a sock to a card structure for listening + */ + int err=0; /* This is x25 specific area if protocol doesn't - * match, return error */ + * match, return error */ if (sll->sll_protocol != htons(X25_PROT)) return -EINVAL; @@ -1376,14 +1376,14 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le sk->sk_state = WANSOCK_BIND_LISTEN; return 0; - }else if (!strcmp(sll->sll_device,"svc_connect")){ + }else if (!strcmp(sll->sll_device,"svc_connect")){ /* This is x25 specific area if protocol doesn't - * match, return error */ + * match, return error */ if (sll->sll_protocol != htons(X25_PROT)) return -EINVAL; - /* Find a free device + /* Find a free device */ dev = wanpipe_find_free_dev(card); if (dev == NULL){ @@ -1392,9 +1392,9 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le return -EINVAL; } }else{ - /* Bind a socket to a interface name - * This is used by PVC mostly - */ + /* Bind a socket to a interface name + * This is used by PVC mostly + */ strlcpy(name,sll->sll_device,sizeof(name)); dev = dev_get_by_name(name); if (dev == NULL){ @@ -1419,8 +1419,8 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le /*============================================================ * get_atomic_device - * - * Sets a bit atomically which indicates that + * + * Sets a bit atomically which indicates that * the interface is taken. This avoids race conditions. *===========================================================*/ @@ -1436,7 +1436,7 @@ static inline int get_atomic_device(struct net_device *dev) /*============================================================ * check_dev - * + * * Check that device name belongs to a particular card. *===========================================================*/ @@ -1446,8 +1446,8 @@ static int check_dev(struct net_device *dev, sdla_t *card) for (tmp_dev = card->wandev.dev; tmp_dev; tmp_dev = *((struct net_device **)tmp_dev->priv)) { - if (tmp_dev->ifindex == dev->ifindex){ - return 0; + if (tmp_dev->ifindex == dev->ifindex){ + return 0; } } return 1; @@ -1455,7 +1455,7 @@ static int check_dev(struct net_device *dev, sdla_t *card) /*============================================================ * wanpipe_find_free_dev - * + * * Find a free network interface. If found set atomic * bit indicating that the interface is taken. * X25API Specific. @@ -1468,12 +1468,12 @@ struct net_device *wanpipe_find_free_dev(sdla_t *card) if (test_and_set_bit(0,&find_free_critical)){ printk(KERN_INFO "CRITICAL in Find Free\n"); - } + } for (dev = card->wandev.dev; dev; dev = *((struct net_device **)dev->priv)) { chan = dev->priv; - if (!chan) + if (!chan) continue; if (chan->usedby == API && chan->svc){ if (!get_atomic_device (dev)){ @@ -1492,16 +1492,16 @@ struct net_device *wanpipe_find_free_dev(sdla_t *card) /*============================================================ * wanpipe_create - * + * * SOCKET() System call. It allocates a sock structure - * and adds the socket to the wanpipe_sk_list. + * and adds the socket to the wanpipe_sk_list. * Crates AF_WANPIPE socket. *===========================================================*/ static int wanpipe_create(struct socket *sock, int protocol) { struct sock *sk; - + //FIXME: This checks for root user, SECURITY ? //if (!capable(CAP_NET_RAW)) // return -EPERM; @@ -1526,7 +1526,7 @@ static int wanpipe_create(struct socket *sock, int protocol) sk->sk_bound_dev_if = 0; atomic_inc(&wanpipe_socks_nr); - + /* We must disable interrupts because the ISR * can also change the list */ set_bit(1,&wanpipe_tx_critical); @@ -1541,8 +1541,8 @@ static int wanpipe_create(struct socket *sock, int protocol) /*============================================================ * wanpipe_recvmsg - * - * Pull a packet from our receive queue and hand it + * + * Pull a packet from our receive queue and hand it * to the user. If necessary we block. *===========================================================*/ @@ -1570,13 +1570,13 @@ static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock, * but then it will block. */ - if (flags & MSG_OOB){ + if (flags & MSG_OOB){ skb = skb_dequeue(&sk->sk_error_queue); }else{ skb=skb_recv_datagram(sk,flags,1,&err); } /* - * An error occurred so return it. Because skb_recv_datagram() + * An error occurred so return it. Because skb_recv_datagram() * handles the blocking we don't see and worry about blocking * retries. */ @@ -1602,9 +1602,9 @@ static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock, err = memcpy_toiovec(msg->msg_iov, skb->data, copied); if (err) goto out_free; - + sock_recv_timestamp(msg, sk, skb); - + if (msg->msg_name) memcpy(msg->msg_name, skb->cb, msg->msg_namelen); @@ -1623,13 +1623,13 @@ out: /*============================================================ * wanpipe_wakeup_driver - * + * * If socket receive buffer is full and driver cannot * pass data up the sock, it sets a packet_block flag. - * This function check that flag and if sock receive - * queue has room it kicks the driver BH handler. + * This function check that flag and if sock receive + * queue has room it kicks the driver BH handler. * - * This way, driver doesn't have to poll the sock + * This way, driver doesn't have to poll the sock * receive queue. *===========================================================*/ @@ -1646,8 +1646,8 @@ static void wanpipe_wakeup_driver(struct sock *sk) if ((chan = dev->priv) == NULL) return; - - if (atomic_read(&chan->receive_block)){ + + if (atomic_read(&chan->receive_block)){ if (atomic_read(&sk->sk_rmem_alloc) < ((unsigned)sk->sk_rcvbuf * 0.9)) { printk(KERN_INFO "wansock: Queuing task for wanpipe\n"); @@ -1655,13 +1655,13 @@ static void wanpipe_wakeup_driver(struct sock *sk) wanpipe_queue_tq(&chan->wanpipe_task); wanpipe_mark_bh(); } - } -} + } +} /*============================================================ * wanpipe_getname - * - * I don't know what to do with this yet. + * + * I don't know what to do with this yet. * User can use this function to get sock address * information. Not very useful for Sangoma's purposes. *===========================================================*/ @@ -1687,17 +1687,17 @@ static int wanpipe_getname(struct socket *sock, struct sockaddr *uaddr, sll->sll_halen = 0; } *uaddr_len = sizeof(*sll); - + dev_put(dev); - + return 0; } /*============================================================ * wanpipe_notifier - * + * * If driver turns off network interface, this function - * will be envoked. Currently I treate it as a + * will be envoked. Currently I treate it as a * call disconnect. More thought should go into this * function. * @@ -1718,7 +1718,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void continue; if (dev == NULL) continue; - + switch (msg) { case NETDEV_DOWN: case NETDEV_UNREGISTER: @@ -1732,7 +1732,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void if (msg == NETDEV_UNREGISTER) { printk(KERN_INFO "wansock: Unregistering Device: %s\n", - dev->name); + dev->name); wanpipe_unlink_driver(sk); sk->sk_bound_dev_if = 0; } @@ -1753,7 +1753,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void /*============================================================ * wanpipe_ioctl - * + * * Execute a user commands, and set socket options. * * FIXME: More thought should go into this function. @@ -1765,7 +1765,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar struct sock *sk = sock->sk; int err; - switch(cmd) + switch(cmd) { case SIOCGSTAMP: return sock_get_timestamp(sk, (struct timeval __user *)arg); @@ -1778,7 +1778,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar if (sk->sk_state == WANSOCK_CONNECTED) return 0; - + return 1; @@ -1804,7 +1804,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar case SIOC_WANPIPE_DEBUG: return wanpipe_debug(sk,(void*)arg); - + case SIOC_WANPIPE_SET_NONBLOCK: if (sk->sk_state != WANSOCK_DISCONNECTED) @@ -1812,7 +1812,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar sock->file->f_flags |= O_NONBLOCK; return 0; - + #ifdef CONFIG_INET case SIOCADDRT: case SIOCDELRT: @@ -1842,7 +1842,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar /*============================================================ * wanpipe_debug - * + * * This function will pass up information about all * active sockets. * @@ -1893,49 +1893,49 @@ static int wanpipe_debug (struct sock *origsk, void *arg) if (sk->sk_bound_dev_if) { dev = dev_get_by_index(sk->sk_bound_dev_if); - if (!dev) + if (!dev) continue; chan=dev->priv; dev_put(dev); - + if ((err=put_user(chan->state, &dbg_data->debug[cnt].d_state))) return err; if ((err=put_user(chan->svc, &dbg_data->debug[cnt].svc))) return err; - if ((err=put_user(atomic_read(&chan->command), + if ((err=put_user(atomic_read(&chan->command), &dbg_data->debug[cnt].command))) return err; if (wp){ - sdla_t *card = (sdla_t*)wp->card; - + sdla_t *card = (sdla_t*)wp->card; + if (card){ - if ((err=put_user(atomic_read(&card->u.x.command_busy), + if ((err=put_user(atomic_read(&card->u.x.command_busy), &dbg_data->debug[cnt].cmd_busy))) return err; } - if ((err=put_user(wp->lcn, + if ((err=put_user(wp->lcn, &dbg_data->debug[cnt].lcn))) return err; - + if (wp->mbox) { if ((err=put_user(1, &dbg_data->debug[cnt].mbox))) return err; } } - if ((err=put_user(atomic_read(&chan->receive_block), + if ((err=put_user(atomic_read(&chan->receive_block), &dbg_data->debug[cnt].rblock))) return err; if (copy_to_user(dbg_data->debug[cnt].name, dev->name, strlen(dev->name))) return -EFAULT; } - + if (++cnt == MAX_NUM_DEBUG) break; } @@ -1944,7 +1944,7 @@ static int wanpipe_debug (struct sock *origsk, void *arg) /*============================================================ * get_ioctl_cmd - * + * * Pass up the contents of socket MBOX to the user. *===========================================================*/ @@ -1974,7 +1974,7 @@ static int get_ioctl_cmd (struct sock *sk, void *arg) if ((err=put_user(mbox_ptr->cmd.result, &usr_data->hdr.result))) return err; if ((err=put_user(mbox_ptr->cmd.lcn, &usr_data->hdr.lcn))) - return err; + return err; if (mbox_ptr->cmd.length > 0){ if (mbox_ptr->cmd.length > X25_MAX_DATA) @@ -1986,13 +1986,13 @@ static int get_ioctl_cmd (struct sock *sk, void *arg) } } return 0; -} +} /*============================================================ * set_ioctl_cmd - * + * * Before command can be execute, socket MBOX must - * be created, and initialized with user data. + * be created, and initialized with user data. *===========================================================*/ static int set_ioctl_cmd (struct sock *sk, void *arg) @@ -2008,7 +2008,7 @@ static int set_ioctl_cmd (struct sock *sk, void *arg) return -ENODEV; dev_put(dev); - + if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) return -ENOMEM; @@ -2092,12 +2092,12 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w return mask; } - /* This check blocks the user process if there is + /* This check blocks the user process if there is * a packet already queued in the socket write queue. - * This option is only for X25API protocol, for other - * protocol like chdlc enable streaming mode, - * where multiple packets can be pending in the socket - * transmit queue */ + * This option is only for X25API protocol, for other + * protocol like chdlc enable streaming mode, + * where multiple packets can be pending in the socket + * transmit queue */ if (wp_sk(sk)->num == htons(X25_PROT)) { if (atomic_read(&wp_sk(sk)->packet_sent)) @@ -2110,7 +2110,7 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w }else{ set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); } - + return mask; } @@ -2125,8 +2125,8 @@ static int wanpipe_listen(struct socket *sock, int backlog) { struct sock *sk = sock->sk; - /* This is x25 specific area if protocol doesn't - * match, return error */ + /* This is x25 specific area if protocol doesn't + * match, return error */ if (wp_sk(sk)->num != htons(X25_PROT)) return -EINVAL; @@ -2163,7 +2163,7 @@ static int wanpipe_link_card (struct sock *sk) card->sk=sk; card->func=wanpipe_listen_rcv; sock_set_flag(sk, SOCK_ZAPPED); - + return 0; } @@ -2176,7 +2176,7 @@ static int wanpipe_link_card (struct sock *sk) static void wanpipe_unlink_card (struct sock *sk) { - sdla_t *card = (sdla_t*)wp_sk(sk)->card; + sdla_t *card = (sdla_t*)wp_sk(sk)->card; if (card){ card->sk=NULL; @@ -2202,9 +2202,9 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) printk(KERN_INFO "NO MBOX PTR !!!!!\n"); return -EINVAL; } - + /* This is x25 specific area if protocol doesn't - * match, return error */ + * match, return error */ if (wp->num != htons(X25_PROT)) return -EINVAL; @@ -2217,17 +2217,17 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) err = -EHOSTDOWN; break; } - + err = execute_command(sk,X25_ACCEPT_CALL,0); if (err < 0) break; - /* Update. Mar6 2000. - * Do not set the sock lcn number here, since - * it is done in wanpipe_listen_rcv(). - */ - if (sk->sk_state == WANSOCK_CONNECTED) { - wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; + /* Update. Mar6 2000. + * Do not set the sock lcn number here, since + * it is done in wanpipe_listen_rcv(). + */ + if (sk->sk_state == WANSOCK_CONNECTED) { + wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; DBG_PRINTK(KERN_INFO "\nwansock: Accept OK %i\n", wp->lcn); err = 0; @@ -2249,15 +2249,15 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) /* Check if data buffers are pending for transmission, - * if so, check whether user wants to wait until data - * is transmitted, or clear a call and drop packets */ - + * if so, check whether user wants to wait until data + * is transmitted, or clear a call and drop packets */ + if (atomic_read(&sk->sk_wmem_alloc) || check_driver_busy(sk)) { - mbox_cmd_t *mbox = wp->mbox; + mbox_cmd_t *mbox = wp->mbox; if (mbox->cmd.qdm & 0x80){ mbox->cmd.result = 0x35; - err = -EAGAIN; + err = -EAGAIN; break; } } @@ -2286,15 +2286,15 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) /* Check if data buffers are pending for transmission, - * if so, check whether user wants to wait until data - * is transmitted, or reset a call and drop packets */ - + * if so, check whether user wants to wait until data + * is transmitted, or reset a call and drop packets */ + if (atomic_read(&sk->sk_wmem_alloc) || check_driver_busy(sk)) { - mbox_cmd_t *mbox = wp->mbox; + mbox_cmd_t *mbox = wp->mbox; if (mbox->cmd.qdm & 0x80){ mbox->cmd.result = 0x35; - err = -EAGAIN; + err = -EAGAIN; break; } } @@ -2316,7 +2316,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) if (sk->sk_state == WANSOCK_CONNECTED) { - wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; + wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; DBG_PRINTK(KERN_INFO "\nwansock: PLACE CALL OK %i\n", wp->lcn); @@ -2337,7 +2337,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) break; - default: + default: return -EINVAL; } @@ -2364,9 +2364,9 @@ static int check_driver_busy (struct sock *sk) /*====================================================================== * wanpipe_accept * - * ACCEPT() System call. X25API Specific function. - * For each incoming call, create a new socket and - * return it to the user. + * ACCEPT() System call. X25API Specific function. + * For each incoming call, create a new socket and + * return it to the user. *=====================================================================*/ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags) @@ -2378,10 +2378,10 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags int err=0; if (newsock->sk != NULL){ - wanpipe_kill_sock_accept(newsock->sk); + wanpipe_kill_sock_accept(newsock->sk); newsock->sk=NULL; } - + if ((sk = sock->sk) == NULL) return -EINVAL; @@ -2410,10 +2410,10 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags } current->state = TASK_RUNNING; remove_wait_queue(sk->sk_sleep,&wait); - + if (err != 0) return err; - + newsk = get_newsk_from_skb(skb); if (!newsk){ return -EINVAL; @@ -2431,7 +2431,7 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags /* Now attach up the new socket */ sk->sk_ack_backlog--; newsock->sk = newsk; - + kfree_skb(skb); DBG_PRINTK(KERN_INFO "\nwansock: ACCEPT Got LCN %i\n", @@ -2449,16 +2449,16 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags struct sock * get_newsk_from_skb (struct sk_buff *skb) { struct net_device *dev = skb->dev; - wanpipe_common_t *chan; + wanpipe_common_t *chan; if (!dev){ return NULL; } - + if ((chan = dev->priv) == NULL){ return NULL; } - + if (!chan->sk){ return NULL; } @@ -2470,7 +2470,7 @@ struct sock * get_newsk_from_skb (struct sk_buff *skb) * * CONNECT() System Call. X25API specific function * Check the state of the sock, and execute PLACE_CALL command. - * Connect can ether block or return without waiting for connection, + * Connect can ether block or return without waiting for connection, * if specified by user. *=====================================================================*/ @@ -2492,7 +2492,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr return -ECONNREFUSED; } - sk->sk_state = WANSOCK_DISCONNECTED; + sk->sk_state = WANSOCK_DISCONNECTED; sock->state = SS_UNCONNECTED; if (addr_len != sizeof(struct wan_sockaddr_ll)) @@ -2505,7 +2505,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr return -ENETUNREACH; dev_put(dev); - + if (!sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */ return -EINVAL; @@ -2534,7 +2534,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr if (sk->sk_state != WANSOCK_CONNECTED) { sock->state = SS_UNCONNECTED; - return -ECONNREFUSED; + return -ECONNREFUSED; } sock->state = SS_CONNECTED; @@ -2549,10 +2549,10 @@ const struct proto_ops wanpipe_ops = { .connect = wanpipe_connect, .socketpair = sock_no_socketpair, .accept = wanpipe_accept, - .getname = wanpipe_getname, + .getname = wanpipe_getname, .poll = wanpipe_poll, .ioctl = wanpipe_ioctl, - .listen = wanpipe_listen, + .listen = wanpipe_listen, .shutdown = sock_no_shutdown, .setsockopt = sock_no_setsockopt, .getsockopt = sock_no_getsockopt, diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index 4d90a17..5d2d93d 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c @@ -314,10 +314,10 @@ __be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev) cnt += 1; break; - case NLPID_SNAP: /* SNAP encapsulation */ + case NLPID_SNAP: /* SNAP encapsulation */ if (memcmp(&skb->data[cnt + 1], wanrouter_oui_ether, sizeof(wanrouter_oui_ether))){ - printk(KERN_INFO + printk(KERN_INFO "%s: unsupported SNAP OUI %02X-%02X-%02X " "on interface %s!\n", wanrouter_modname, skb->data[cnt+1], skb->data[cnt+2], @@ -450,7 +450,7 @@ static int wanrouter_device_setup(struct wan_device *wandev, kfree(conf); printk(KERN_INFO "%s: ERROR, Invalid MAGIC Number\n", wandev->name); - return -EINVAL; + return -EINVAL; } if (conf->data_size && conf->data) { @@ -459,13 +459,13 @@ static int wanrouter_device_setup(struct wan_device *wandev, "%s: ERROR, Invalid firmware data size %i !\n", wandev->name, conf->data_size); kfree(conf); - return -EINVAL; + return -EINVAL; } data = vmalloc(conf->data_size); if (!data) { printk(KERN_INFO - "%s: ERROR, Faild allocate kernel memory !\n", + "%s: ERROR, Faild allocate kernel memory !\n", wandev->name); kfree(conf); return -ENOBUFS; @@ -686,7 +686,7 @@ out: static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name) { char name[WAN_IFNAME_SZ + 1]; - int err = 0; + int err = 0; if (wandev->state == WAN_UNCONFIGURED) return -ENODEV; @@ -709,8 +709,8 @@ static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_nam * interfaces are deleted and the link irrecoverably disconnected. */ - if (!wandev->ndev && wandev->shutdown) - err = wandev->shutdown(wandev); + if (!wandev->ndev && wandev->shutdown) + err = wandev->shutdown(wandev); return err; } @@ -804,7 +804,7 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name) static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags) { - spin_lock_irqsave(lock, *smp_flags); + spin_lock_irqsave(lock, *smp_flags); } diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c index 930ea59..abce828 100644 --- a/net/wanrouter/wanproc.c +++ b/net/wanrouter/wanproc.c @@ -37,10 +37,10 @@ #define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\ (prot == WANCONFIG_X25) ? " X25" : \ - (prot == WANCONFIG_PPP) ? " PPP" : \ + (prot == WANCONFIG_PPP) ? " PPP" : \ (prot == WANCONFIG_CHDLC) ? " CHDLC": \ (prot == WANCONFIG_MPPP) ? " MPPP" : \ - " Unknown" ) + " Unknown" ) /****** Function Prototypes *************************************************/ diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index b37d894..e62ba41 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * @@ -18,11 +18,11 @@ * X.25 002 Jonathan Naylor Centralised disconnect handling. * New timer architecture. * 2000-03-11 Henner Eisen MSG_EOR handling more POSIX compliant. - * 2000-03-22 Daniela Squassoni Allowed disabling/enabling of - * facilities negotiation and increased + * 2000-03-22 Daniela Squassoni Allowed disabling/enabling of + * facilities negotiation and increased * the throughput upper limit. * 2000-08-27 Arnaldo C. Melo s/suser/capable/ + micro cleanups - * 2000-09-04 Henner Eisen Set sock->state in x25_accept(). + * 2000-09-04 Henner Eisen Set sock->state in x25_accept(). * Fixed x25_output() related skb leakage. * 2000-10-02 Henner Eisen Made x25_kick() single threaded per socket. * 2000-10-27 Henner Eisen MSG_DONTWAIT for fragment allocation. @@ -256,8 +256,8 @@ static struct sock *x25_find_listener(struct x25_address *addr, * call user data vs this sockets call user data */ if(skb->len > 0 && x25_sk(s)->cudmatchlength > 0) { - if((memcmp(x25_sk(s)->calluserdata.cuddata, - skb->data, + if((memcmp(x25_sk(s)->calluserdata.cuddata, + skb->data, x25_sk(s)->cudmatchlength)) == 0) { sock_hold(s); goto found; @@ -421,7 +421,7 @@ static int x25_getsockopt(struct socket *sock, int level, int optname, { struct sock *sk = sock->sk; int val, len, rc = -ENOPROTOOPT; - + if (level != SOL_X25 || optname != X25_QBITINCL) goto out; @@ -434,7 +434,7 @@ static int x25_getsockopt(struct socket *sock, int level, int optname, rc = -EINVAL; if (len < 0) goto out; - + rc = -EFAULT; if (put_user(len, optlen)) goto out; @@ -523,12 +523,12 @@ static int x25_create(struct socket *sock, int protocol) x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE; x25->facilities.throughput = X25_DEFAULT_THROUGHPUT; x25->facilities.reverse = X25_DEFAULT_REVERSE; - x25->dte_facilities.calling_len = 0; - x25->dte_facilities.called_len = 0; - memset(x25->dte_facilities.called_ae, '\0', - sizeof(x25->dte_facilities.called_ae)); - memset(x25->dte_facilities.calling_ae, '\0', - sizeof(x25->dte_facilities.calling_ae)); + x25->dte_facilities.calling_len = 0; + x25->dte_facilities.called_len = 0; + memset(x25->dte_facilities.called_ae, '\0', + sizeof(x25->dte_facilities.called_ae)); + memset(x25->dte_facilities.calling_ae, '\0', + sizeof(x25->dte_facilities.calling_ae)); rc = 0; out: @@ -608,7 +608,7 @@ static int x25_release(struct socket *sock) break; } - sock->sk = NULL; + sock->sk = NULL; sk->sk_socket = NULL; /* Not used, but we should do this */ out: return 0; @@ -635,7 +635,7 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) static int x25_wait_for_connection_establishment(struct sock *sk) { DECLARE_WAITQUEUE(wait, current); - int rc; + int rc; add_wait_queue_exclusive(sk->sk_sleep, &wait); for (;;) { @@ -686,7 +686,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, if (sk->sk_state == TCP_ESTABLISHED) goto out; - sk->sk_state = TCP_CLOSE; + sk->sk_state = TCP_CLOSE; sock->state = SS_UNCONNECTED; rc = -EINVAL; @@ -778,7 +778,7 @@ static int x25_wait_for_data(struct sock *sk, long timeout) remove_wait_queue(sk->sk_sleep, &wait); return rc; } - + static int x25_accept(struct socket *sock, struct socket *newsock, int flags) { struct sock *sk = sock->sk; @@ -837,7 +837,7 @@ static int x25_getname(struct socket *sock, struct sockaddr *uaddr, return 0; } - + int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, unsigned int lci) { @@ -1120,7 +1120,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock, if (msg->msg_flags & MSG_OOB) skb_queue_tail(&x25->interrupt_out_queue, skb); else { - len = x25_output(sk, skb); + len = x25_output(sk, skb); if (len < 0) kfree_skb(skb); else if (x25->qbitincl) @@ -1219,7 +1219,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock, msg->msg_flags |= MSG_TRUNC; } - /* Currently, each datagram always contains a complete record */ + /* Currently, each datagram always contains a complete record */ msg->msg_flags |= MSG_EOR; rc = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); @@ -1277,8 +1277,8 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCGSTAMP: rc = -EINVAL; if (sk) - rc = sock_get_timestamp(sk, - (struct timeval __user *)argp); + rc = sock_get_timestamp(sk, + (struct timeval __user *)argp); break; case SIOCGIFADDR: case SIOCSIFADDR: @@ -1346,17 +1346,17 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) } case SIOCX25GDTEFACILITIES: { - rc = copy_to_user(argp, &x25->dte_facilities, + rc = copy_to_user(argp, &x25->dte_facilities, sizeof(x25->dte_facilities)); if (rc) rc = -EFAULT; - break; - } + break; + } - case SIOCX25SDTEFACILITIES: { - struct x25_dte_facilities dtefacs; - rc = -EFAULT; - if (copy_from_user(&dtefacs, argp, sizeof(dtefacs))) + case SIOCX25SDTEFACILITIES: { + struct x25_dte_facilities dtefacs; + rc = -EFAULT; + if (copy_from_user(&dtefacs, argp, sizeof(dtefacs))) break; rc = -EINVAL; if (sk->sk_state != TCP_LISTEN && @@ -1414,7 +1414,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) if (copy_from_user(&sub_addr, argp, sizeof(sub_addr))) break; - rc = -EINVAL; + rc = -EINVAL; if(sub_addr.cudmatchlength > X25_MAX_CUD_LEN) break; x25->cudmatchlength = sub_addr.cudmatchlength; @@ -1443,7 +1443,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) break; } - default: + default: rc = -ENOIOCTLCMD; break; } diff --git a/net/x25/sysctl_net_x25.c b/net/x25/sysctl_net_x25.c index 2b2e7fd..5f63106 100644 --- a/net/x25/sysctl_net_x25.c +++ b/net/x25/sysctl_net_x25.c @@ -18,7 +18,7 @@ static int max_timer[] = { 300 * HZ }; static struct ctl_table_header *x25_table_header; static struct ctl_table x25_table[] = { - { + { .ctl_name = NET_X25_RESTART_REQUEST_TIMEOUT, .procname = "restart_request_timeout", .data = &sysctl_x25_restart_request_timeout, @@ -29,7 +29,7 @@ static struct ctl_table x25_table[] = { .extra1 = &min_timer, .extra2 = &max_timer, }, - { + { .ctl_name = NET_X25_CALL_REQUEST_TIMEOUT, .procname = "call_request_timeout", .data = &sysctl_x25_call_request_timeout, @@ -40,7 +40,7 @@ static struct ctl_table x25_table[] = { .extra1 = &min_timer, .extra2 = &max_timer, }, - { + { .ctl_name = NET_X25_RESET_REQUEST_TIMEOUT, .procname = "reset_request_timeout", .data = &sysctl_x25_reset_request_timeout, @@ -51,7 +51,7 @@ static struct ctl_table x25_table[] = { .extra1 = &min_timer, .extra2 = &max_timer, }, - { + { .ctl_name = NET_X25_CLEAR_REQUEST_TIMEOUT, .procname = "clear_request_timeout", .data = &sysctl_x25_clear_request_timeout, @@ -62,7 +62,7 @@ static struct ctl_table x25_table[] = { .extra1 = &min_timer, .extra2 = &max_timer, }, - { + { .ctl_name = NET_X25_ACK_HOLD_BACK_TIMEOUT, .procname = "acknowledgement_hold_back_timeout", .data = &sysctl_x25_ack_holdback_timeout, diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index f099fd6..c7221de 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c @@ -1,8 +1,8 @@ /* * X.25 Packet Layer release 002 * - * This is ALPHA test software. This code may break your machine, randomly fail to work with new - * releases, misbehave and/or generally screw up. It might even work. + * This is ALPHA test software. This code may break your machine, randomly fail to work with new + * releases, misbehave and/or generally screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * @@ -31,7 +31,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) unsigned int lci; frametype = skb->data[2]; - lci = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF); + lci = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF); /* * LCI of zero is always for us, and its always a link control diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c index 27f5cc7..dec404a 100644 --- a/net/x25/x25_facilities.c +++ b/net/x25/x25_facilities.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * @@ -15,7 +15,7 @@ * * History * X.25 001 Split from x25_subr.c - * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities * negotiation. * apr/14/05 Shaun Pereira - Allow fast select with no restriction * on response. @@ -125,8 +125,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, break; case X25_FAC_CLASS_D: switch (*p) { - case X25_FAC_CALLING_AE: - if (p[1] > X25_MAX_DTE_FACIL_LEN) + case X25_FAC_CALLING_AE: + if (p[1] > X25_MAX_DTE_FACIL_LEN) break; dte_facs->calling_len = p[2]; memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); @@ -293,7 +293,7 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk, } /* - * Limit values of certain facilities according to the capability of the + * Limit values of certain facilities according to the capability of the * currently attached x25 link. */ void x25_limit_facilities(struct x25_facilities *facilities, diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index eed50e1..c5239fc 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * @@ -17,7 +17,7 @@ * X.25 001 Jonathan Naylor Started coding. * X.25 002 Jonathan Naylor Centralised disconnection code. * New timer architecture. - * 2000-03-20 Daniela Squassoni Disabling/enabling of facilities + * 2000-03-20 Daniela Squassoni Disabling/enabling of facilities * negotiation. * 2000-11-10 Henner Eisen Check and reset for out-of-sequence * i-frames. @@ -67,7 +67,7 @@ static int x25_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more) kfree_skb(skbo); } - x25->fraglen = 0; + x25->fraglen = 0; } skb_set_owner_r(skbn, sk); @@ -167,7 +167,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametyp int queued = 0; int modulus; struct x25_sock *x25 = x25_sk(sk); - + modulus = (x25->neighbour->extended) ? X25_EMODULUS : X25_SMODULUS; switch (frametype) { diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index 0a760fe..741ce95 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * @@ -16,7 +16,7 @@ * History * X.25 001 Jonathan Naylor Started coding. * X.25 002 Jonathan Naylor New timer architecture. - * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities * negotiation. * 2000-09-04 Henner Eisen dev_hold() / dev_put() for x25_neigh. */ @@ -94,7 +94,7 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb, skb->data[3], skb->data[4], skb->data[5], skb->data[6]); break; - + default: printk(KERN_WARNING "x25: received unknown %02X " "with LCI 000\n", frametype); diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c index a2e62ce..6f57378 100644 --- a/net/x25/x25_out.c +++ b/net/x25/x25_out.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * @@ -78,7 +78,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb) "sent\n", err, sent); return err; } - + skb_reserve(skbn, frontlen); len = max_len > skb->len ? skb->len : max_len; @@ -101,7 +101,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb) skb_queue_tail(&sk->sk_write_queue, skbn); sent += len; } - + kfree_skb(skb); } else { skb_queue_tail(&sk->sk_write_queue, skb); @@ -110,7 +110,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb) return sent; } -/* +/* * This procedure is passed a buffer descriptor for an iframe. It builds * the rest of the control part of the frame and then writes it out. */ @@ -131,7 +131,7 @@ static void x25_send_iframe(struct sock *sk, struct sk_buff *skb) skb->data[2] |= (x25->vr << 5) & 0xE0; } - x25_transmit_link(skb, x25->neighbour); + x25_transmit_link(skb, x25->neighbour); } void x25_kick(struct sock *sk) diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c index e0470bd..3c9f1ba 100644 --- a/net/x25/x25_proc.c +++ b/net/x25/x25_proc.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.4 with seq_file support * @@ -62,7 +62,7 @@ static void *x25_seq_route_next(struct seq_file *seq, void *v, loff_t *pos) rt = v; if (rt->node.next != &x25_route_list) rt = list_entry(rt->node.next, struct x25_route, node); - else + else rt = NULL; out: return rt; @@ -88,7 +88,7 @@ static int x25_seq_route_show(struct seq_file *seq, void *v) rt->dev ? rt->dev->name : "???"); out: return 0; -} +} static __inline__ struct sock *x25_get_socket_idx(loff_t pos) { @@ -163,7 +163,7 @@ static int x25_seq_socket_show(struct seq_file *seq, void *v) s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L); out: return 0; -} +} static __inline__ struct x25_forward *x25_get_forward_idx(loff_t pos) { diff --git a/net/x25/x25_route.c b/net/x25/x25_route.c index 883a848..060fcfa 100644 --- a/net/x25/x25_route.c +++ b/net/x25/x25_route.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c index 71ff308..2af190d 100644 --- a/net/x25/x25_timer.c +++ b/net/x25/x25_timer.c @@ -3,7 +3,7 @@ * * This is ALPHA test software. This code may break your machine, * randomly fail to work with new releases, misbehave and/or generally - * screw up. It might even work. + * screw up. It might even work. * * This code REQUIRES 2.1.15 or higher * @@ -99,8 +99,8 @@ static void x25_heartbeat_expiry(unsigned long param) { struct sock *sk = (struct sock *)param; - bh_lock_sock(sk); - if (sock_owned_by_user(sk)) /* can currently only occur in state 3 */ + bh_lock_sock(sk); + if (sock_owned_by_user(sk)) /* can currently only occur in state 3 */ goto restart_heartbeat; switch (x25_sk(sk)->state) { diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c index 248f948..f373a8a 100644 --- a/net/xfrm/xfrm_algo.c +++ b/net/xfrm/xfrm_algo.c @@ -1,11 +1,11 @@ -/* +/* * xfrm algorithm interface * * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> * * 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 (at your option) + * Software Foundation; either version 2 of the License, or (at your option) * any later version. */ @@ -32,14 +32,14 @@ static struct xfrm_algo_desc aalg_list[] = { { .name = "hmac(digest_null)", .compat = "digest_null", - + .uinfo = { .auth = { .icv_truncbits = 0, .icv_fullbits = 0, } }, - + .desc = { .sadb_alg_id = SADB_X_AALG_NULL, .sadb_alg_ivlen = 0, @@ -57,7 +57,7 @@ static struct xfrm_algo_desc aalg_list[] = { .icv_fullbits = 128, } }, - + .desc = { .sadb_alg_id = SADB_AALG_MD5HMAC, .sadb_alg_ivlen = 0, @@ -142,14 +142,14 @@ static struct xfrm_algo_desc ealg_list[] = { { .name = "ecb(cipher_null)", .compat = "cipher_null", - + .uinfo = { .encr = { .blockbits = 8, .defkeybits = 0, } }, - + .desc = { .sadb_alg_id = SADB_EALG_NULL, .sadb_alg_ivlen = 0, @@ -248,22 +248,22 @@ static struct xfrm_algo_desc ealg_list[] = { } }, { - .name = "cbc(serpent)", - .compat = "serpent", - - .uinfo = { - .encr = { - .blockbits = 128, - .defkeybits = 128, - } - }, - - .desc = { - .sadb_alg_id = SADB_X_EALG_SERPENTCBC, - .sadb_alg_ivlen = 8, - .sadb_alg_minbits = 128, - .sadb_alg_maxbits = 256, - } + .name = "cbc(serpent)", + .compat = "serpent", + + .uinfo = { + .encr = { + .blockbits = 128, + .defkeybits = 128, + } + }, + + .desc = { + .sadb_alg_id = SADB_X_EALG_SERPENTCBC, + .sadb_alg_ivlen = 8, + .sadb_alg_minbits = 128, + .sadb_alg_maxbits = 256, + } }, { .name = "cbc(camellia)", @@ -283,22 +283,22 @@ static struct xfrm_algo_desc ealg_list[] = { } }, { - .name = "cbc(twofish)", - .compat = "twofish", - - .uinfo = { - .encr = { - .blockbits = 128, - .defkeybits = 128, - } - }, - - .desc = { - .sadb_alg_id = SADB_X_EALG_TWOFISHCBC, - .sadb_alg_ivlen = 8, - .sadb_alg_minbits = 128, - .sadb_alg_maxbits = 256 - } + .name = "cbc(twofish)", + .compat = "twofish", + + .uinfo = { + .encr = { + .blockbits = 128, + .defkeybits = 128, + } + }, + + .desc = { + .sadb_alg_id = SADB_X_EALG_TWOFISHCBC, + .sadb_alg_ivlen = 8, + .sadb_alg_minbits = 128, + .sadb_alg_maxbits = 256 + } }, }; @@ -478,7 +478,7 @@ void xfrm_probe_algs(void) { #ifdef CONFIG_CRYPTO int i, status; - + BUG_ON(in_softirq()); for (i = 0; i < aalg_entries(); i++) { @@ -487,14 +487,14 @@ void xfrm_probe_algs(void) if (aalg_list[i].available != status) aalg_list[i].available = status; } - + for (i = 0; i < ealg_entries(); i++) { status = crypto_has_blkcipher(ealg_list[i].name, 0, CRYPTO_ALG_ASYNC); if (ealg_list[i].available != status) ealg_list[i].available = status; } - + for (i = 0; i < calg_entries(); i++) { status = crypto_has_comp(calg_list[i].name, 0, CRYPTO_ALG_ASYNC); @@ -541,15 +541,15 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, if (copy > 0) { if (copy > len) copy = len; - + sg.page = virt_to_page(skb->data + offset); sg.offset = (unsigned long)(skb->data + offset) % PAGE_SIZE; sg.length = copy; - + err = icv_update(desc, &sg, copy); if (unlikely(err)) return err; - + if ((len -= copy) == 0) return 0; offset += copy; @@ -566,11 +566,11 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, if (copy > len) copy = len; - + sg.page = frag->page; sg.offset = frag->page_offset + offset-start; sg.length = copy; - + err = icv_update(desc, &sg, copy); if (unlikely(err)) return err; diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 414f890..ee15bda 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c @@ -4,7 +4,7 @@ * Changes: * YOSHIFUJI Hideaki @USAGI * Split up af-specific portion - * + * */ #include <linux/slab.h> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index fa7ce06..a24f385 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1,4 +1,4 @@ -/* +/* * xfrm_policy.c * * Changes: @@ -151,7 +151,7 @@ retry: return type; } -int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, +int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family) { struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family); @@ -262,7 +262,7 @@ static inline unsigned long make_jiffies(long secs) if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ) return MAX_SCHEDULE_TIMEOUT-1; else - return secs*HZ; + return secs*HZ; } static void xfrm_policy_timer(unsigned long data) @@ -1024,17 +1024,17 @@ end: static inline int policy_to_flow_dir(int dir) { if (XFRM_POLICY_IN == FLOW_DIR_IN && - XFRM_POLICY_OUT == FLOW_DIR_OUT && - XFRM_POLICY_FWD == FLOW_DIR_FWD) - return dir; - switch (dir) { - default: - case XFRM_POLICY_IN: - return FLOW_DIR_IN; - case XFRM_POLICY_OUT: - return FLOW_DIR_OUT; - case XFRM_POLICY_FWD: - return FLOW_DIR_FWD; + XFRM_POLICY_OUT == FLOW_DIR_OUT && + XFRM_POLICY_FWD == FLOW_DIR_FWD) + return dir; + switch (dir) { + default: + case XFRM_POLICY_IN: + return FLOW_DIR_IN; + case XFRM_POLICY_OUT: + return FLOW_DIR_OUT; + case XFRM_POLICY_FWD: + return FLOW_DIR_FWD; }; } @@ -1044,9 +1044,9 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(struct sock *sk, int dir, struc read_lock_bh(&xfrm_policy_lock); if ((pol = sk->sk_policy[dir]) != NULL) { - int match = xfrm_selector_match(&pol->selector, fl, + int match = xfrm_selector_match(&pol->selector, fl, sk->sk_family); - int err = 0; + int err = 0; if (match) { err = security_xfrm_policy_lookup(pol, fl->secid, @@ -1511,7 +1511,7 @@ restart: } *dst_p = dst; dst_release(dst_orig); - xfrm_pols_put(pols, npols); + xfrm_pols_put(pols, npols); return 0; error: @@ -1546,7 +1546,7 @@ xfrm_secpath_reject(int idx, struct sk_buff *skb, struct flowi *fl) */ static inline int -xfrm_state_ok(struct xfrm_tmpl *tmpl, struct xfrm_state *x, +xfrm_state_ok(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short family) { if (xfrm_state_kern(x)) @@ -1619,7 +1619,7 @@ static inline int secpath_has_nontransport(struct sec_path *sp, int k, int *idxp return 0; } -int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, +int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) { struct xfrm_policy *pol; @@ -2243,7 +2243,7 @@ static int xfrm_migrate_selector_match(struct xfrm_selector *sel_cmp, if (sel_cmp->proto == IPSEC_ULPROTO_ANY) { if (sel_tgt->family == sel_cmp->family && xfrm_addr_cmp(&sel_tgt->daddr, &sel_cmp->daddr, - sel_cmp->family) == 0 && + sel_cmp->family) == 0 && xfrm_addr_cmp(&sel_tgt->saddr, &sel_cmp->saddr, sel_cmp->family) == 0 && sel_tgt->prefixlen_d == sel_cmp->prefixlen_d && diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 91b0268..a35f9e4 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -227,7 +227,7 @@ static inline unsigned long make_jiffies(long secs) if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ) return MAX_SCHEDULE_TIMEOUT-1; else - return secs*HZ; + return secs*HZ; } static void xfrm_timer_handler(unsigned long data) @@ -523,7 +523,7 @@ static void xfrm_hash_grow_check(int have_hash_collision) } struct xfrm_state * -xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, +xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, struct flowi *fl, struct xfrm_tmpl *tmpl, struct xfrm_policy *pol, int *err, unsigned short family) @@ -534,7 +534,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, int acquire_in_progress = 0; int error = 0; struct xfrm_state *best = NULL; - + spin_lock_bh(&xfrm_state_lock); hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) { if (x->props.family == family && @@ -570,7 +570,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, acquire_in_progress = 1; } else if (x->km.state == XFRM_STATE_ERROR || x->km.state == XFRM_STATE_EXPIRED) { - if (xfrm_selector_match(&x->sel, fl, family) && + if (xfrm_selector_match(&x->sel, fl, family) && security_xfrm_state_pol_flow_match(x, pol, fl)) error = -ESRCH; } @@ -866,7 +866,7 @@ struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp) } x->props.calgo = orig->props.calgo; - if (orig->encap) { + if (orig->encap) { x->encap = kmemdup(orig->encap, sizeof(*x->encap), GFP_KERNEL); if (!x->encap) goto error; @@ -947,7 +947,7 @@ struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m) } } - return NULL; + return NULL; } EXPORT_SYMBOL(xfrm_migrate_state_find); @@ -1121,8 +1121,8 @@ xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, EXPORT_SYMBOL(xfrm_state_lookup_byaddr); struct xfrm_state * -xfrm_find_acq(u8 mode, u32 reqid, u8 proto, - xfrm_address_t *daddr, xfrm_address_t *saddr, +xfrm_find_acq(u8 mode, u32 reqid, u8 proto, + xfrm_address_t *daddr, xfrm_address_t *saddr, int create, unsigned short family) { struct xfrm_state *x; @@ -1738,7 +1738,7 @@ error: } EXPORT_SYMBOL(xfrm_init_state); - + void __init xfrm_state_init(void) { unsigned int sz; diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 079a5d3..d55436d 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -48,7 +48,7 @@ static int verify_one_alg(struct rtattr **xfrma, enum xfrm_attr_type_t type) algp = RTA_DATA(rt); - len -= (algp->alg_key_len + 7U) / 8; + len -= (algp->alg_key_len + 7U) / 8; if (len < 0) return -EINVAL; @@ -1107,7 +1107,7 @@ static int copy_sec_ctx(struct xfrm_sec_ctx *s, struct sk_buff *skb) uctx->ctx_alg = s->ctx_alg; uctx->ctx_len = s->ctx_len; memcpy(uctx + 1, s->ctx_str, s->ctx_len); - return 0; + return 0; rtattr_failure: return -1; @@ -2467,7 +2467,7 @@ static int __init xfrm_user_init(void) printk(KERN_INFO "Initializing XFRM netlink socket\n"); nlsk = netlink_kernel_create(NETLINK_XFRM, XFRMNLGRP_MAX, - xfrm_netlink_rcv, THIS_MODULE); + xfrm_netlink_rcv, THIS_MODULE); if (nlsk == NULL) return -ENOMEM; rcu_assign_pointer(xfrm_nl, nlsk); |