提交 67ba4152 编写于 作者: I Ian Morris 提交者: David S. Miller

ipv6: White-space cleansing : Line Layouts

This patch makes no changes to the logic of the code but simply addresses
coding style issues as detected by checkpatch.

Both objdump and diff -w show no differences.

A number of items are addressed in this patch:
* Multiple spaces converted to tabs
* Spaces before tabs removed.
* Spaces in pointer typing cleansed (char *)foo etc.
* Remove space after sizeof
* Ensure spacing around comparators such as if statements.
Signed-off-by: NIan Morris <ipm@chirality.org.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a9b0b2fa
...@@ -3035,7 +3035,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) ...@@ -3035,7 +3035,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
struct hlist_head *h = &inet6_addr_lst[i]; struct hlist_head *h = &inet6_addr_lst[i];
spin_lock_bh(&addrconf_hash_lock); spin_lock_bh(&addrconf_hash_lock);
restart: restart:
hlist_for_each_entry_rcu(ifa, h, addr_lst) { hlist_for_each_entry_rcu(ifa, h, addr_lst) {
if (ifa->idev == idev) { if (ifa->idev == idev) {
hlist_del_init_rcu(&ifa->addr_lst); hlist_del_init_rcu(&ifa->addr_lst);
......
...@@ -284,7 +284,7 @@ static int ipv6_clear_mutable_options(struct ipv6hdr *iph, int len, int dir) ...@@ -284,7 +284,7 @@ static int ipv6_clear_mutable_options(struct ipv6hdr *iph, int len, int dir)
ipv6_rearrange_rthdr(iph, exthdr.rth); ipv6_rearrange_rthdr(iph, exthdr.rth);
break; break;
default : default:
return 0; return 0;
} }
...@@ -478,7 +478,7 @@ static void ah6_input_done(struct crypto_async_request *base, int err) ...@@ -478,7 +478,7 @@ static void ah6_input_done(struct crypto_async_request *base, int err)
auth_data = ah_tmp_auth(work_iph, hdr_len); auth_data = ah_tmp_auth(work_iph, hdr_len);
icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len); icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len);
err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG: 0; err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
if (err) if (err)
goto out; goto out;
...@@ -622,7 +622,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -622,7 +622,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
goto out_free; goto out_free;
} }
err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG: 0; err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
if (err) if (err)
goto out_free; goto out_free;
...@@ -647,8 +647,8 @@ static int ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -647,8 +647,8 @@ static int ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, __be32 info) u8 type, u8 code, int offset, __be32 info)
{ {
struct net *net = dev_net(skb->dev); struct net *net = dev_net(skb->dev);
struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset); struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+offset);
struct xfrm_state *x; struct xfrm_state *x;
if (type != ICMPV6_PKT_TOOBIG && if (type != ICMPV6_PKT_TOOBIG &&
......
...@@ -142,7 +142,7 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, struct sk_buff *skb) ...@@ -142,7 +142,7 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, struct sk_buff *skb)
default: /* Other TLV code so scan list */ default: /* Other TLV code so scan list */
if (optlen > len) if (optlen > len)
goto bad; goto bad;
for (curr=procs; curr->type >= 0; curr++) { for (curr = procs; curr->type >= 0; curr++) {
if (curr->type == nh[off]) { if (curr->type == nh[off]) {
/* type specific length/alignment /* type specific length/alignment
checks will be performed in the checks will be performed in the
......
...@@ -503,7 +503,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) ...@@ -503,7 +503,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
msg.type = type; msg.type = type;
len = skb->len - msg.offset; len = skb->len - msg.offset;
len = min_t(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr) -sizeof(struct icmp6hdr)); len = min_t(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr) - sizeof(struct icmp6hdr));
if (len < 0) { if (len < 0) {
LIMIT_NETDEBUG(KERN_DEBUG "icmp: len problem\n"); LIMIT_NETDEBUG(KERN_DEBUG "icmp: len problem\n");
goto out_dst_release; goto out_dst_release;
...@@ -636,7 +636,7 @@ void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info) ...@@ -636,7 +636,7 @@ void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info)
/* now skip over extension headers */ /* now skip over extension headers */
inner_offset = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), inner_offset = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr),
&nexthdr, &frag_off); &nexthdr, &frag_off);
if (inner_offset<0) if (inner_offset < 0)
goto out; goto out;
} else { } else {
inner_offset = sizeof(struct ipv6hdr); inner_offset = sizeof(struct ipv6hdr);
......
...@@ -163,7 +163,7 @@ void inet6_csk_reqsk_queue_hash_add(struct sock *sk, ...@@ -163,7 +163,7 @@ void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
EXPORT_SYMBOL_GPL(inet6_csk_reqsk_queue_hash_add); EXPORT_SYMBOL_GPL(inet6_csk_reqsk_queue_hash_add);
void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr) void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr)
{ {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) uaddr; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) uaddr;
......
...@@ -136,7 +136,7 @@ static void ip6_fl_gc(unsigned long dummy) ...@@ -136,7 +136,7 @@ static void ip6_fl_gc(unsigned long dummy)
spin_lock(&ip6_fl_lock); spin_lock(&ip6_fl_lock);
for (i=0; i<=FL_HASH_MASK; i++) { for (i = 0; i <= FL_HASH_MASK; i++) {
struct ip6_flowlabel *fl; struct ip6_flowlabel *fl;
struct ip6_flowlabel __rcu **flp; struct ip6_flowlabel __rcu **flp;
...@@ -239,7 +239,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net, ...@@ -239,7 +239,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net,
/* Socket flowlabel lists */ /* Socket flowlabel lists */
struct ip6_flowlabel * fl6_sock_lookup(struct sock *sk, __be32 label) struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label)
{ {
struct ipv6_fl_socklist *sfl; struct ipv6_fl_socklist *sfl;
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
...@@ -293,11 +293,11 @@ void fl6_free_socklist(struct sock *sk) ...@@ -293,11 +293,11 @@ void fl6_free_socklist(struct sock *sk)
following rthdr. following rthdr.
*/ */
struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
struct ip6_flowlabel * fl, struct ip6_flowlabel *fl,
struct ipv6_txoptions * fopt) struct ipv6_txoptions *fopt)
{ {
struct ipv6_txoptions * fl_opt = fl->opt; struct ipv6_txoptions *fl_opt = fl->opt;
if (fopt == NULL || fopt->opt_flen == 0) if (fopt == NULL || fopt->opt_flen == 0)
return fl_opt; return fl_opt;
...@@ -388,7 +388,7 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, ...@@ -388,7 +388,7 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
goto done; goto done;
msg.msg_controllen = olen; msg.msg_controllen = olen;
msg.msg_control = (void*)(fl->opt+1); msg.msg_control = (void *)(fl->opt+1);
memset(&flowi6, 0, sizeof(flowi6)); memset(&flowi6, 0, sizeof(flowi6));
err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt,
...@@ -517,7 +517,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) ...@@ -517,7 +517,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
struct net *net = sock_net(sk); struct net *net = sock_net(sk);
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
struct in6_flowlabel_req freq; struct in6_flowlabel_req freq;
struct ipv6_fl_socklist *sfl1=NULL; struct ipv6_fl_socklist *sfl1 = NULL;
struct ipv6_fl_socklist *sfl; struct ipv6_fl_socklist *sfl;
struct ipv6_fl_socklist __rcu **sflp; struct ipv6_fl_socklist __rcu **sflp;
struct ip6_flowlabel *fl, *fl1 = NULL; struct ip6_flowlabel *fl, *fl1 = NULL;
...@@ -542,7 +542,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) ...@@ -542,7 +542,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
} }
spin_lock_bh(&ip6_sk_fl_lock); spin_lock_bh(&ip6_sk_fl_lock);
for (sflp = &np->ipv6_fl_list; for (sflp = &np->ipv6_fl_list;
(sfl = rcu_dereference(*sflp))!=NULL; (sfl = rcu_dereference(*sflp)) != NULL;
sflp = &sfl->next) { sflp = &sfl->next) {
if (sfl->fl->label == freq.flr_label) { if (sfl->fl->label == freq.flr_label) {
if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK)) if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK))
......
...@@ -244,7 +244,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, ...@@ -244,7 +244,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
continue; continue;
iph2 = (struct ipv6hdr *)(p->data + off); iph2 = (struct ipv6hdr *)(p->data + off);
first_word = *(__be32 *)iph ^ *(__be32 *)iph2 ; first_word = *(__be32 *)iph ^ *(__be32 *)iph2;
/* All fields must match except length and Traffic Class. /* All fields must match except length and Traffic Class.
* XXX skbs on the gro_list have all been parsed and pulled * XXX skbs on the gro_list have all been parsed and pulled
......
...@@ -555,14 +555,14 @@ static void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) ...@@ -555,14 +555,14 @@ static void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
{ {
struct sk_buff *frag; struct sk_buff *frag;
struct rt6_info *rt = (struct rt6_info*)skb_dst(skb); struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
struct ipv6hdr *tmp_hdr; struct ipv6hdr *tmp_hdr;
struct frag_hdr *fh; struct frag_hdr *fh;
unsigned int mtu, hlen, left, len; unsigned int mtu, hlen, left, len;
int hroom, troom; int hroom, troom;
__be32 frag_id = 0; __be32 frag_id = 0;
int ptr, offset = 0, err=0; int ptr, offset = 0, err = 0;
u8 *prevhdr, nexthdr = 0; u8 *prevhdr, nexthdr = 0;
struct net *net = dev_net(skb_dst(skb)->dev); struct net *net = dev_net(skb_dst(skb)->dev);
...@@ -637,7 +637,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -637,7 +637,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
} }
__skb_pull(skb, hlen); __skb_pull(skb, hlen);
fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr)); fh = (struct frag_hdr *)__skb_push(skb, sizeof(struct frag_hdr));
__skb_push(skb, hlen); __skb_push(skb, hlen);
skb_reset_network_header(skb); skb_reset_network_header(skb);
memcpy(skb_network_header(skb), tmp_hdr, hlen); memcpy(skb_network_header(skb), tmp_hdr, hlen);
...@@ -662,7 +662,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -662,7 +662,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
if (frag) { if (frag) {
frag->ip_summed = CHECKSUM_NONE; frag->ip_summed = CHECKSUM_NONE;
skb_reset_transport_header(frag); skb_reset_transport_header(frag);
fh = (struct frag_hdr*)__skb_push(frag, sizeof(struct frag_hdr)); fh = (struct frag_hdr *)__skb_push(frag, sizeof(struct frag_hdr));
__skb_push(frag, hlen); __skb_push(frag, hlen);
skb_reset_network_header(frag); skb_reset_network_header(frag);
memcpy(skb_network_header(frag), tmp_hdr, memcpy(skb_network_header(frag), tmp_hdr,
...@@ -681,7 +681,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -681,7 +681,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
} }
err = output(skb); err = output(skb);
if(!err) if (!err)
IP6_INC_STATS(net, ip6_dst_idev(&rt->dst), IP6_INC_STATS(net, ip6_dst_idev(&rt->dst),
IPSTATS_MIB_FRAGCREATES); IPSTATS_MIB_FRAGCREATES);
...@@ -742,7 +742,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -742,7 +742,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
/* /*
* Keep copying data until we run out. * Keep copying data until we run out.
*/ */
while(left > 0) { while (left > 0) {
len = left; len = left;
/* IF: it doesn't fit, use 'mtu' - the data space left */ /* IF: it doesn't fit, use 'mtu' - the data space left */
if (len > mtu) if (len > mtu)
...@@ -1049,7 +1049,7 @@ static inline int ip6_ufo_append_data(struct sock *sk, ...@@ -1049,7 +1049,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
int getfrag(void *from, char *to, int offset, int len, int getfrag(void *from, char *to, int offset, int len,
int odd, struct sk_buff *skb), int odd, struct sk_buff *skb),
void *from, int length, int hh_len, int fragheaderlen, void *from, int length, int hh_len, int fragheaderlen,
int transhdrlen, int mtu,unsigned int flags, int transhdrlen, int mtu, unsigned int flags,
struct rt6_info *rt) struct rt6_info *rt)
{ {
...@@ -1072,7 +1072,7 @@ static inline int ip6_ufo_append_data(struct sock *sk, ...@@ -1072,7 +1072,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
skb_reserve(skb, hh_len); skb_reserve(skb, hh_len);
/* create space for UDP/IP header */ /* create space for UDP/IP header */
skb_put(skb,fragheaderlen + transhdrlen); skb_put(skb, fragheaderlen + transhdrlen);
/* initialize network header pointer */ /* initialize network header pointer */
skb_reset_network_header(skb); skb_reset_network_header(skb);
......
...@@ -408,12 +408,12 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw) ...@@ -408,12 +408,12 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw)
{ {
const struct ipv6hdr *ipv6h = (const struct ipv6hdr *) raw; const struct ipv6hdr *ipv6h = (const struct ipv6hdr *) raw;
__u8 nexthdr = ipv6h->nexthdr; __u8 nexthdr = ipv6h->nexthdr;
__u16 off = sizeof (*ipv6h); __u16 off = sizeof(*ipv6h);
while (ipv6_ext_hdr(nexthdr) && nexthdr != NEXTHDR_NONE) { while (ipv6_ext_hdr(nexthdr) && nexthdr != NEXTHDR_NONE) {
__u16 optlen = 0; __u16 optlen = 0;
struct ipv6_opt_hdr *hdr; struct ipv6_opt_hdr *hdr;
if (raw + off + sizeof (*hdr) > skb->data && if (raw + off + sizeof(*hdr) > skb->data &&
!pskb_may_pull(skb, raw - skb->data + off + sizeof (*hdr))) !pskb_may_pull(skb, raw - skb->data + off + sizeof (*hdr)))
break; break;
...@@ -530,7 +530,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, ...@@ -530,7 +530,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
mtu = IPV6_MIN_MTU; mtu = IPV6_MIN_MTU;
t->dev->mtu = mtu; t->dev->mtu = mtu;
if ((len = sizeof (*ipv6h) + ntohs(ipv6h->payload_len)) > mtu) { if ((len = sizeof(*ipv6h) + ntohs(ipv6h->payload_len)) > mtu) {
rel_type = ICMPV6_PKT_TOOBIG; rel_type = ICMPV6_PKT_TOOBIG;
rel_code = 0; rel_code = 0;
rel_info = mtu; rel_info = mtu;
...@@ -991,7 +991,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ...@@ -991,7 +991,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
t->parms.name); t->parms.name);
goto tx_err_dst_release; goto tx_err_dst_release;
} }
mtu = dst_mtu(dst) - sizeof (*ipv6h); mtu = dst_mtu(dst) - sizeof(*ipv6h);
if (encap_limit >= 0) { if (encap_limit >= 0) {
max_headroom += 8; max_headroom += 8;
mtu -= 8; mtu -= 8;
...@@ -1083,7 +1083,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1083,7 +1083,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
encap_limit = t->parms.encap_limit; encap_limit = t->parms.encap_limit;
memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6)); memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6));
fl6.flowi6_proto = IPPROTO_IPIP; fl6.flowi6_proto = IPPROTO_IPIP;
dsfield = ipv4_get_dsfield(iph); dsfield = ipv4_get_dsfield(iph);
...@@ -1135,7 +1135,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1135,7 +1135,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
} else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) } else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
encap_limit = t->parms.encap_limit; encap_limit = t->parms.encap_limit;
memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6)); memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6));
fl6.flowi6_proto = IPPROTO_IPV6; fl6.flowi6_proto = IPPROTO_IPV6;
dsfield = ipv6_get_dsfield(ipv6h); dsfield = ipv6_get_dsfield(ipv6h);
...@@ -1229,11 +1229,11 @@ static void ip6_tnl_link_config(struct ip6_tnl *t) ...@@ -1229,11 +1229,11 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
if (rt->dst.dev) { if (rt->dst.dev) {
dev->hard_header_len = rt->dst.dev->hard_header_len + dev->hard_header_len = rt->dst.dev->hard_header_len +
sizeof (struct ipv6hdr); sizeof(struct ipv6hdr);
dev->mtu = rt->dst.dev->mtu - sizeof (struct ipv6hdr); dev->mtu = rt->dst.dev->mtu - sizeof(struct ipv6hdr);
if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
dev->mtu-=8; dev->mtu -= 8;
if (dev->mtu < IPV6_MIN_MTU) if (dev->mtu < IPV6_MIN_MTU)
dev->mtu = IPV6_MIN_MTU; dev->mtu = IPV6_MIN_MTU;
...@@ -1350,7 +1350,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1350,7 +1350,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
switch (cmd) { switch (cmd) {
case SIOCGETTUNNEL: case SIOCGETTUNNEL:
if (dev == ip6n->fb_tnl_dev) { if (dev == ip6n->fb_tnl_dev) {
if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof (p))) { if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) {
err = -EFAULT; err = -EFAULT;
break; break;
} }
...@@ -1362,7 +1362,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1362,7 +1362,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
} }
ip6_tnl_parm_to_user(&p, &t->parms); ip6_tnl_parm_to_user(&p, &t->parms);
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) {
err = -EFAULT; err = -EFAULT;
} }
break; break;
...@@ -1372,7 +1372,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1372,7 +1372,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
break; break;
err = -EFAULT; err = -EFAULT;
if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof (p))) if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p)))
break; break;
err = -EINVAL; err = -EINVAL;
if (p.proto != IPPROTO_IPV6 && p.proto != IPPROTO_IPIP && if (p.proto != IPPROTO_IPV6 && p.proto != IPPROTO_IPIP &&
...@@ -1407,7 +1407,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1407,7 +1407,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (dev == ip6n->fb_tnl_dev) { if (dev == ip6n->fb_tnl_dev) {
err = -EFAULT; err = -EFAULT;
if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof (p))) if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p)))
break; break;
err = -ENOENT; err = -ENOENT;
ip6_tnl_parm_from_user(&p1, &p); ip6_tnl_parm_from_user(&p1, &p);
...@@ -1482,11 +1482,11 @@ static void ip6_tnl_dev_setup(struct net_device *dev) ...@@ -1482,11 +1482,11 @@ static void ip6_tnl_dev_setup(struct net_device *dev)
dev->destructor = ip6_dev_free; dev->destructor = ip6_dev_free;
dev->type = ARPHRD_TUNNEL6; dev->type = ARPHRD_TUNNEL6;
dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr); dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr);
dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr); dev->mtu = ETH_DATA_LEN - sizeof(struct ipv6hdr);
t = netdev_priv(dev); t = netdev_priv(dev);
if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
dev->mtu-=8; dev->mtu -= 8;
dev->flags |= IFF_NOARP; dev->flags |= IFF_NOARP;
dev->addr_len = sizeof(struct in6_addr); dev->addr_len = sizeof(struct in6_addr);
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
......
...@@ -845,7 +845,7 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c) ...@@ -845,7 +845,7 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c)
atomic_dec(&mrt->cache_resolve_queue_len); atomic_dec(&mrt->cache_resolve_queue_len);
while((skb = skb_dequeue(&c->mfc_un.unres.unresolved)) != NULL) { while ((skb = skb_dequeue(&c->mfc_un.unres.unresolved)) != NULL) {
if (ipv6_hdr(skb)->version == 0) { if (ipv6_hdr(skb)->version == 0) {
struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr)); struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr));
nlh->nlmsg_type = NLMSG_ERROR; nlh->nlmsg_type = NLMSG_ERROR;
...@@ -1103,7 +1103,7 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt, ...@@ -1103,7 +1103,7 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt,
* Play the pending entries through our router * Play the pending entries through our router
*/ */
while((skb = __skb_dequeue(&uc->mfc_un.unres.unresolved))) { while ((skb = __skb_dequeue(&uc->mfc_un.unres.unresolved))) {
if (ipv6_hdr(skb)->version == 0) { if (ipv6_hdr(skb)->version == 0) {
struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr)); struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr));
......
...@@ -66,12 +66,12 @@ int ip6_ra_control(struct sock *sk, int sel) ...@@ -66,12 +66,12 @@ int ip6_ra_control(struct sock *sk, int sel)
if (sk->sk_type != SOCK_RAW || inet_sk(sk)->inet_num != IPPROTO_RAW) if (sk->sk_type != SOCK_RAW || inet_sk(sk)->inet_num != IPPROTO_RAW)
return -ENOPROTOOPT; return -ENOPROTOOPT;
new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; new_ra = (sel >= 0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL;
write_lock_bh(&ip6_ra_lock); write_lock_bh(&ip6_ra_lock);
for (rap = &ip6_ra_chain; (ra=*rap) != NULL; rap = &ra->next) { for (rap = &ip6_ra_chain; (ra = *rap) != NULL; rap = &ra->next) {
if (ra->sk == sk) { if (ra->sk == sk) {
if (sel>=0) { if (sel >= 0) {
write_unlock_bh(&ip6_ra_lock); write_unlock_bh(&ip6_ra_lock);
kfree(new_ra); kfree(new_ra);
return -EADDRINUSE; return -EADDRINUSE;
...@@ -130,7 +130,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -130,7 +130,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
int retv = -ENOPROTOOPT; int retv = -ENOPROTOOPT;
if (optval == NULL) if (optval == NULL)
val=0; val = 0;
else { else {
if (optlen >= sizeof(int)) { if (optlen >= sizeof(int)) {
if (get_user(val, (int __user *) optval)) if (get_user(val, (int __user *) optval))
...@@ -139,7 +139,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -139,7 +139,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
val = 0; val = 0;
} }
valbool = (val!=0); valbool = (val != 0);
if (ip6_mroute_opt(optname)) if (ip6_mroute_opt(optname))
return ip6_mroute_setsockopt(sk, optname, optval, optlen); return ip6_mroute_setsockopt(sk, optname, optval, optlen);
...@@ -474,7 +474,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -474,7 +474,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
goto done; goto done;
msg.msg_controllen = optlen; msg.msg_controllen = optlen;
msg.msg_control = (void*)(opt+1); msg.msg_control = (void *)(opt+1);
retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk,
&junk, &junk); &junk, &junk);
...@@ -687,7 +687,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -687,7 +687,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
retv = -ENOBUFS; retv = -ENOBUFS;
break; break;
} }
gsf = kmalloc(optlen,GFP_KERNEL); gsf = kmalloc(optlen, GFP_KERNEL);
if (!gsf) { if (!gsf) {
retv = -ENOBUFS; retv = -ENOBUFS;
break; break;
...@@ -921,7 +921,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt, ...@@ -921,7 +921,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
if (!opt) if (!opt)
return 0; return 0;
switch(optname) { switch (optname) {
case IPV6_HOPOPTS: case IPV6_HOPOPTS:
hdr = opt->hopopt; hdr = opt->hopopt;
break; break;
...@@ -1284,9 +1284,9 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1284,9 +1284,9 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
return -ENOPROTOOPT; return -ENOPROTOOPT;
} }
len = min_t(unsigned int, sizeof(int), len); len = min_t(unsigned int, sizeof(int), len);
if(put_user(len, optlen)) if (put_user(len, optlen))
return -EFAULT; return -EFAULT;
if(copy_to_user(optval,&val,len)) if (copy_to_user(optval, &val, len))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -1299,7 +1299,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1299,7 +1299,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
if (level == SOL_IP && sk->sk_type != SOCK_RAW) if (level == SOL_IP && sk->sk_type != SOCK_RAW)
return udp_prot.getsockopt(sk, level, optname, optval, optlen); return udp_prot.getsockopt(sk, level, optname, optval, optlen);
if(level != SOL_IPV6) if (level != SOL_IPV6)
return -ENOPROTOOPT; return -ENOPROTOOPT;
err = do_ipv6_getsockopt(sk, level, optname, optval, optlen, 0); err = do_ipv6_getsockopt(sk, level, optname, optval, optlen, 0);
......
...@@ -232,7 +232,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) ...@@ -232,7 +232,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
spin_lock(&ipv6_sk_mc_lock); spin_lock(&ipv6_sk_mc_lock);
for (lnk = &np->ipv6_mc_list; for (lnk = &np->ipv6_mc_list;
(mc_lst = rcu_dereference_protected(*lnk, (mc_lst = rcu_dereference_protected(*lnk,
lockdep_is_held(&ipv6_sk_mc_lock))) !=NULL ; lockdep_is_held(&ipv6_sk_mc_lock))) != NULL;
lnk = &mc_lst->next) { lnk = &mc_lst->next) {
if ((ifindex == 0 || mc_lst->ifindex == ifindex) && if ((ifindex == 0 || mc_lst->ifindex == ifindex) &&
ipv6_addr_equal(&mc_lst->addr, addr)) { ipv6_addr_equal(&mc_lst->addr, addr)) {
...@@ -390,7 +390,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk, ...@@ -390,7 +390,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
if (!psl) if (!psl)
goto done; /* err = -EADDRNOTAVAIL */ goto done; /* err = -EADDRNOTAVAIL */
rv = !0; rv = !0;
for (i=0; i<psl->sl_count; i++) { for (i = 0; i < psl->sl_count; i++) {
rv = !ipv6_addr_equal(&psl->sl_addr[i], source); rv = !ipv6_addr_equal(&psl->sl_addr[i], source);
if (rv == 0) if (rv == 0)
break; break;
...@@ -407,7 +407,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk, ...@@ -407,7 +407,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
/* update the interface filter */ /* update the interface filter */
ip6_mc_del_src(idev, group, omode, 1, source, 1); ip6_mc_del_src(idev, group, omode, 1, source, 1);
for (j=i+1; j<psl->sl_count; j++) for (j = i+1; j < psl->sl_count; j++)
psl->sl_addr[j-1] = psl->sl_addr[j]; psl->sl_addr[j-1] = psl->sl_addr[j];
psl->sl_count--; psl->sl_count--;
err = 0; err = 0;
...@@ -433,19 +433,19 @@ int ip6_mc_source(int add, int omode, struct sock *sk, ...@@ -433,19 +433,19 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
newpsl->sl_max = count; newpsl->sl_max = count;
newpsl->sl_count = count - IP6_SFBLOCK; newpsl->sl_count = count - IP6_SFBLOCK;
if (psl) { if (psl) {
for (i=0; i<psl->sl_count; i++) for (i = 0; i < psl->sl_count; i++)
newpsl->sl_addr[i] = psl->sl_addr[i]; newpsl->sl_addr[i] = psl->sl_addr[i];
sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max)); sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max));
} }
pmc->sflist = psl = newpsl; pmc->sflist = psl = newpsl;
} }
rv = 1; /* > 0 for insert logic below if sl_count is 0 */ rv = 1; /* > 0 for insert logic below if sl_count is 0 */
for (i=0; i<psl->sl_count; i++) { for (i = 0; i < psl->sl_count; i++) {
rv = !ipv6_addr_equal(&psl->sl_addr[i], source); rv = !ipv6_addr_equal(&psl->sl_addr[i], source);
if (rv == 0) /* There is an error in the address. */ if (rv == 0) /* There is an error in the address. */
goto done; goto done;
} }
for (j=psl->sl_count-1; j>=i; j--) for (j = psl->sl_count-1; j >= i; j--)
psl->sl_addr[j+1] = psl->sl_addr[j]; psl->sl_addr[j+1] = psl->sl_addr[j];
psl->sl_addr[i] = *source; psl->sl_addr[i] = *source;
psl->sl_count++; psl->sl_count++;
...@@ -514,7 +514,7 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) ...@@ -514,7 +514,7 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
goto done; goto done;
} }
newpsl->sl_max = newpsl->sl_count = gsf->gf_numsrc; newpsl->sl_max = newpsl->sl_count = gsf->gf_numsrc;
for (i=0; i<newpsl->sl_count; ++i) { for (i = 0; i < newpsl->sl_count; ++i) {
struct sockaddr_in6 *psin6; struct sockaddr_in6 *psin6;
psin6 = (struct sockaddr_in6 *)&gsf->gf_slist[i]; psin6 = (struct sockaddr_in6 *)&gsf->gf_slist[i];
...@@ -606,7 +606,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, ...@@ -606,7 +606,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
* on ipv6_sk_mc_lock and a write lock on pmc->sflock. We * on ipv6_sk_mc_lock and a write lock on pmc->sflock. We
* have the socket lock, so reading here is safe. * have the socket lock, so reading here is safe.
*/ */
for (i=0; i<copycount; i++) { for (i = 0; i < copycount; i++) {
struct sockaddr_in6 *psin6; struct sockaddr_in6 *psin6;
struct sockaddr_storage ss; struct sockaddr_storage ss;
...@@ -648,7 +648,7 @@ bool inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr, ...@@ -648,7 +648,7 @@ bool inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr,
} else { } else {
int i; int i;
for (i=0; i<psl->sl_count; i++) { for (i = 0; i < psl->sl_count; i++) {
if (ipv6_addr_equal(&psl->sl_addr[i], src_addr)) if (ipv6_addr_equal(&psl->sl_addr[i], src_addr))
break; break;
} }
...@@ -762,7 +762,7 @@ static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) ...@@ -762,7 +762,7 @@ static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
pmc->mca_tomb = im->mca_tomb; pmc->mca_tomb = im->mca_tomb;
pmc->mca_sources = im->mca_sources; pmc->mca_sources = im->mca_sources;
im->mca_tomb = im->mca_sources = NULL; im->mca_tomb = im->mca_sources = NULL;
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
psf->sf_crcount = pmc->mca_crcount; psf->sf_crcount = pmc->mca_crcount;
} }
spin_unlock_bh(&im->mca_lock); spin_unlock_bh(&im->mca_lock);
...@@ -780,7 +780,7 @@ static void mld_del_delrec(struct inet6_dev *idev, const struct in6_addr *pmca) ...@@ -780,7 +780,7 @@ static void mld_del_delrec(struct inet6_dev *idev, const struct in6_addr *pmca)
spin_lock_bh(&idev->mc_lock); spin_lock_bh(&idev->mc_lock);
pmc_prev = NULL; pmc_prev = NULL;
for (pmc=idev->mc_tomb; pmc; pmc=pmc->next) { for (pmc = idev->mc_tomb; pmc; pmc = pmc->next) {
if (ipv6_addr_equal(&pmc->mca_addr, pmca)) if (ipv6_addr_equal(&pmc->mca_addr, pmca))
break; break;
pmc_prev = pmc; pmc_prev = pmc;
...@@ -794,7 +794,7 @@ static void mld_del_delrec(struct inet6_dev *idev, const struct in6_addr *pmca) ...@@ -794,7 +794,7 @@ static void mld_del_delrec(struct inet6_dev *idev, const struct in6_addr *pmca)
spin_unlock_bh(&idev->mc_lock); spin_unlock_bh(&idev->mc_lock);
if (pmc) { if (pmc) {
for (psf=pmc->mca_tomb; psf; psf=psf_next) { for (psf = pmc->mca_tomb; psf; psf = psf_next) {
psf_next = psf->sf_next; psf_next = psf->sf_next;
kfree(psf); kfree(psf);
} }
...@@ -821,14 +821,14 @@ static void mld_clear_delrec(struct inet6_dev *idev) ...@@ -821,14 +821,14 @@ static void mld_clear_delrec(struct inet6_dev *idev)
/* clear dead sources, too */ /* clear dead sources, too */
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
for (pmc=idev->mc_list; pmc; pmc=pmc->next) { for (pmc = idev->mc_list; pmc; pmc = pmc->next) {
struct ip6_sf_list *psf, *psf_next; struct ip6_sf_list *psf, *psf_next;
spin_lock_bh(&pmc->mca_lock); spin_lock_bh(&pmc->mca_lock);
psf = pmc->mca_tomb; psf = pmc->mca_tomb;
pmc->mca_tomb = NULL; pmc->mca_tomb = NULL;
spin_unlock_bh(&pmc->mca_lock); spin_unlock_bh(&pmc->mca_lock);
for (; psf; psf=psf_next) { for (; psf; psf = psf_next) {
psf_next = psf->sf_next; psf_next = psf->sf_next;
kfree(psf); kfree(psf);
} }
...@@ -917,7 +917,7 @@ int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr) ...@@ -917,7 +917,7 @@ int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr)
struct ifmcaddr6 *ma, **map; struct ifmcaddr6 *ma, **map;
write_lock_bh(&idev->lock); write_lock_bh(&idev->lock);
for (map = &idev->mc_list; (ma=*map) != NULL; map = &ma->next) { for (map = &idev->mc_list; (ma = *map) != NULL; map = &ma->next) {
if (ipv6_addr_equal(&ma->mca_addr, addr)) { if (ipv6_addr_equal(&ma->mca_addr, addr)) {
if (--ma->mca_users == 0) { if (--ma->mca_users == 0) {
*map = ma->next; *map = ma->next;
...@@ -968,7 +968,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group, ...@@ -968,7 +968,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
idev = __in6_dev_get(dev); idev = __in6_dev_get(dev);
if (idev) { if (idev) {
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
for (mc = idev->mc_list; mc; mc=mc->next) { for (mc = idev->mc_list; mc; mc = mc->next) {
if (ipv6_addr_equal(&mc->mca_addr, group)) if (ipv6_addr_equal(&mc->mca_addr, group))
break; break;
} }
...@@ -977,7 +977,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group, ...@@ -977,7 +977,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
struct ip6_sf_list *psf; struct ip6_sf_list *psf;
spin_lock_bh(&mc->mca_lock); spin_lock_bh(&mc->mca_lock);
for (psf=mc->mca_sources;psf;psf=psf->sf_next) { for (psf = mc->mca_sources; psf; psf = psf->sf_next) {
if (ipv6_addr_equal(&psf->sf_addr, src_addr)) if (ipv6_addr_equal(&psf->sf_addr, src_addr))
break; break;
} }
...@@ -986,7 +986,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group, ...@@ -986,7 +986,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
psf->sf_count[MCAST_EXCLUDE] != psf->sf_count[MCAST_EXCLUDE] !=
mc->mca_sfcount[MCAST_EXCLUDE]; mc->mca_sfcount[MCAST_EXCLUDE];
else else
rv = mc->mca_sfcount[MCAST_EXCLUDE] !=0; rv = mc->mca_sfcount[MCAST_EXCLUDE] != 0;
spin_unlock_bh(&mc->mca_lock); spin_unlock_bh(&mc->mca_lock);
} else } else
rv = true; /* don't filter unspecified source */ rv = true; /* don't filter unspecified source */
...@@ -1077,10 +1077,10 @@ static bool mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, ...@@ -1077,10 +1077,10 @@ static bool mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs,
int i, scount; int i, scount;
scount = 0; scount = 0;
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { for (psf = pmc->mca_sources; psf; psf = psf->sf_next) {
if (scount == nsrcs) if (scount == nsrcs)
break; break;
for (i=0; i<nsrcs; i++) { for (i = 0; i < nsrcs; i++) {
/* skip inactive filters */ /* skip inactive filters */
if (psf->sf_count[MCAST_INCLUDE] || if (psf->sf_count[MCAST_INCLUDE] ||
pmc->mca_sfcount[MCAST_EXCLUDE] != pmc->mca_sfcount[MCAST_EXCLUDE] !=
...@@ -1110,10 +1110,10 @@ static bool mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, ...@@ -1110,10 +1110,10 @@ static bool mld_marksources(struct ifmcaddr6 *pmc, int nsrcs,
/* mark INCLUDE-mode sources */ /* mark INCLUDE-mode sources */
scount = 0; scount = 0;
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { for (psf = pmc->mca_sources; psf; psf = psf->sf_next) {
if (scount == nsrcs) if (scount == nsrcs)
break; break;
for (i=0; i<nsrcs; i++) { for (i = 0; i < nsrcs; i++) {
if (ipv6_addr_equal(&srcs[i], &psf->sf_addr)) { if (ipv6_addr_equal(&srcs[i], &psf->sf_addr)) {
psf->sf_gsresp = 1; psf->sf_gsresp = 1;
scount++; scount++;
...@@ -1364,13 +1364,13 @@ int igmp6_event_query(struct sk_buff *skb) ...@@ -1364,13 +1364,13 @@ int igmp6_event_query(struct sk_buff *skb)
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
if (group_type == IPV6_ADDR_ANY) { if (group_type == IPV6_ADDR_ANY) {
for (ma = idev->mc_list; ma; ma=ma->next) { for (ma = idev->mc_list; ma; ma = ma->next) {
spin_lock_bh(&ma->mca_lock); spin_lock_bh(&ma->mca_lock);
igmp6_group_queried(ma, max_delay); igmp6_group_queried(ma, max_delay);
spin_unlock_bh(&ma->mca_lock); spin_unlock_bh(&ma->mca_lock);
} }
} else { } else {
for (ma = idev->mc_list; ma; ma=ma->next) { for (ma = idev->mc_list; ma; ma = ma->next) {
if (!ipv6_addr_equal(group, &ma->mca_addr)) if (!ipv6_addr_equal(group, &ma->mca_addr))
continue; continue;
spin_lock_bh(&ma->mca_lock); spin_lock_bh(&ma->mca_lock);
...@@ -1434,7 +1434,7 @@ int igmp6_event_report(struct sk_buff *skb) ...@@ -1434,7 +1434,7 @@ int igmp6_event_report(struct sk_buff *skb)
*/ */
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
for (ma = idev->mc_list; ma; ma=ma->next) { for (ma = idev->mc_list; ma; ma = ma->next) {
if (ipv6_addr_equal(&ma->mca_addr, &mld->mld_mca)) { if (ipv6_addr_equal(&ma->mca_addr, &mld->mld_mca)) {
spin_lock(&ma->mca_lock); spin_lock(&ma->mca_lock);
if (del_timer(&ma->mca_timer)) if (del_timer(&ma->mca_timer))
...@@ -1498,7 +1498,7 @@ mld_scount(struct ifmcaddr6 *pmc, int type, int gdeleted, int sdeleted) ...@@ -1498,7 +1498,7 @@ mld_scount(struct ifmcaddr6 *pmc, int type, int gdeleted, int sdeleted)
struct ip6_sf_list *psf; struct ip6_sf_list *psf;
int scount = 0; int scount = 0;
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { for (psf = pmc->mca_sources; psf; psf = psf->sf_next) {
if (!is_in(pmc, psf, type, gdeleted, sdeleted)) if (!is_in(pmc, psf, type, gdeleted, sdeleted))
continue; continue;
scount++; scount++;
...@@ -1712,7 +1712,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, ...@@ -1712,7 +1712,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc,
} }
first = 1; first = 1;
psf_prev = NULL; psf_prev = NULL;
for (psf=*psf_list; psf; psf=psf_next) { for (psf = *psf_list; psf; psf = psf_next) {
struct in6_addr *psrc; struct in6_addr *psrc;
psf_next = psf->sf_next; psf_next = psf->sf_next;
...@@ -1791,7 +1791,7 @@ static void mld_send_report(struct inet6_dev *idev, struct ifmcaddr6 *pmc) ...@@ -1791,7 +1791,7 @@ static void mld_send_report(struct inet6_dev *idev, struct ifmcaddr6 *pmc)
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
if (!pmc) { if (!pmc) {
for (pmc=idev->mc_list; pmc; pmc=pmc->next) { for (pmc = idev->mc_list; pmc; pmc = pmc->next) {
if (pmc->mca_flags & MAF_NOREPORT) if (pmc->mca_flags & MAF_NOREPORT)
continue; continue;
spin_lock_bh(&pmc->mca_lock); spin_lock_bh(&pmc->mca_lock);
...@@ -1824,7 +1824,7 @@ static void mld_clear_zeros(struct ip6_sf_list **ppsf) ...@@ -1824,7 +1824,7 @@ static void mld_clear_zeros(struct ip6_sf_list **ppsf)
struct ip6_sf_list *psf_prev, *psf_next, *psf; struct ip6_sf_list *psf_prev, *psf_next, *psf;
psf_prev = NULL; psf_prev = NULL;
for (psf=*ppsf; psf; psf = psf_next) { for (psf = *ppsf; psf; psf = psf_next) {
psf_next = psf->sf_next; psf_next = psf->sf_next;
if (psf->sf_crcount == 0) { if (psf->sf_crcount == 0) {
if (psf_prev) if (psf_prev)
...@@ -1848,7 +1848,7 @@ static void mld_send_cr(struct inet6_dev *idev) ...@@ -1848,7 +1848,7 @@ static void mld_send_cr(struct inet6_dev *idev)
/* deleted MCA's */ /* deleted MCA's */
pmc_prev = NULL; pmc_prev = NULL;
for (pmc=idev->mc_tomb; pmc; pmc=pmc_next) { for (pmc = idev->mc_tomb; pmc; pmc = pmc_next) {
pmc_next = pmc->next; pmc_next = pmc->next;
if (pmc->mca_sfmode == MCAST_INCLUDE) { if (pmc->mca_sfmode == MCAST_INCLUDE) {
type = MLD2_BLOCK_OLD_SOURCES; type = MLD2_BLOCK_OLD_SOURCES;
...@@ -1881,7 +1881,7 @@ static void mld_send_cr(struct inet6_dev *idev) ...@@ -1881,7 +1881,7 @@ static void mld_send_cr(struct inet6_dev *idev)
spin_unlock(&idev->mc_lock); spin_unlock(&idev->mc_lock);
/* change recs */ /* change recs */
for (pmc=idev->mc_list; pmc; pmc=pmc->next) { for (pmc = idev->mc_list; pmc; pmc = pmc->next) {
spin_lock_bh(&pmc->mca_lock); spin_lock_bh(&pmc->mca_lock);
if (pmc->mca_sfcount[MCAST_EXCLUDE]) { if (pmc->mca_sfcount[MCAST_EXCLUDE]) {
type = MLD2_BLOCK_OLD_SOURCES; type = MLD2_BLOCK_OLD_SOURCES;
...@@ -2018,7 +2018,7 @@ static void mld_send_initial_cr(struct inet6_dev *idev) ...@@ -2018,7 +2018,7 @@ static void mld_send_initial_cr(struct inet6_dev *idev)
skb = NULL; skb = NULL;
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
for (pmc=idev->mc_list; pmc; pmc=pmc->next) { for (pmc = idev->mc_list; pmc; pmc = pmc->next) {
spin_lock_bh(&pmc->mca_lock); spin_lock_bh(&pmc->mca_lock);
if (pmc->mca_sfcount[MCAST_EXCLUDE]) if (pmc->mca_sfcount[MCAST_EXCLUDE])
type = MLD2_CHANGE_TO_EXCLUDE; type = MLD2_CHANGE_TO_EXCLUDE;
...@@ -2063,7 +2063,7 @@ static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, ...@@ -2063,7 +2063,7 @@ static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,
int rv = 0; int rv = 0;
psf_prev = NULL; psf_prev = NULL;
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { for (psf = pmc->mca_sources; psf; psf = psf->sf_next) {
if (ipv6_addr_equal(&psf->sf_addr, psfsrc)) if (ipv6_addr_equal(&psf->sf_addr, psfsrc))
break; break;
psf_prev = psf; psf_prev = psf;
...@@ -2104,7 +2104,7 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca, ...@@ -2104,7 +2104,7 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca,
if (!idev) if (!idev)
return -ENODEV; return -ENODEV;
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
for (pmc=idev->mc_list; pmc; pmc=pmc->next) { for (pmc = idev->mc_list; pmc; pmc = pmc->next) {
if (ipv6_addr_equal(pmca, &pmc->mca_addr)) if (ipv6_addr_equal(pmca, &pmc->mca_addr))
break; break;
} }
...@@ -2124,7 +2124,7 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca, ...@@ -2124,7 +2124,7 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca,
pmc->mca_sfcount[sfmode]--; pmc->mca_sfcount[sfmode]--;
} }
err = 0; err = 0;
for (i=0; i<sfcount; i++) { for (i = 0; i < sfcount; i++) {
int rv = ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]); int rv = ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]);
changerec |= rv > 0; changerec |= rv > 0;
...@@ -2140,7 +2140,7 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca, ...@@ -2140,7 +2140,7 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca,
pmc->mca_sfmode = MCAST_INCLUDE; pmc->mca_sfmode = MCAST_INCLUDE;
pmc->mca_crcount = idev->mc_qrv; pmc->mca_crcount = idev->mc_qrv;
idev->mc_ifc_count = pmc->mca_crcount; idev->mc_ifc_count = pmc->mca_crcount;
for (psf=pmc->mca_sources; psf; psf = psf->sf_next) for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
psf->sf_crcount = 0; psf->sf_crcount = 0;
mld_ifc_event(pmc->idev); mld_ifc_event(pmc->idev);
} else if (sf_setstate(pmc) || changerec) } else if (sf_setstate(pmc) || changerec)
...@@ -2159,7 +2159,7 @@ static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode, ...@@ -2159,7 +2159,7 @@ static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode,
struct ip6_sf_list *psf, *psf_prev; struct ip6_sf_list *psf, *psf_prev;
psf_prev = NULL; psf_prev = NULL;
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { for (psf = pmc->mca_sources; psf; psf = psf->sf_next) {
if (ipv6_addr_equal(&psf->sf_addr, psfsrc)) if (ipv6_addr_equal(&psf->sf_addr, psfsrc))
break; break;
psf_prev = psf; psf_prev = psf;
...@@ -2184,7 +2184,7 @@ static void sf_markstate(struct ifmcaddr6 *pmc) ...@@ -2184,7 +2184,7 @@ static void sf_markstate(struct ifmcaddr6 *pmc)
struct ip6_sf_list *psf; struct ip6_sf_list *psf;
int mca_xcount = pmc->mca_sfcount[MCAST_EXCLUDE]; int mca_xcount = pmc->mca_sfcount[MCAST_EXCLUDE];
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
if (pmc->mca_sfcount[MCAST_EXCLUDE]) { if (pmc->mca_sfcount[MCAST_EXCLUDE]) {
psf->sf_oldin = mca_xcount == psf->sf_oldin = mca_xcount ==
psf->sf_count[MCAST_EXCLUDE] && psf->sf_count[MCAST_EXCLUDE] &&
...@@ -2201,7 +2201,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc) ...@@ -2201,7 +2201,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc)
int new_in, rv; int new_in, rv;
rv = 0; rv = 0;
for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { for (psf = pmc->mca_sources; psf; psf = psf->sf_next) {
if (pmc->mca_sfcount[MCAST_EXCLUDE]) { if (pmc->mca_sfcount[MCAST_EXCLUDE]) {
new_in = mca_xcount == psf->sf_count[MCAST_EXCLUDE] && new_in = mca_xcount == psf->sf_count[MCAST_EXCLUDE] &&
!psf->sf_count[MCAST_INCLUDE]; !psf->sf_count[MCAST_INCLUDE];
...@@ -2211,8 +2211,8 @@ static int sf_setstate(struct ifmcaddr6 *pmc) ...@@ -2211,8 +2211,8 @@ static int sf_setstate(struct ifmcaddr6 *pmc)
if (!psf->sf_oldin) { if (!psf->sf_oldin) {
struct ip6_sf_list *prev = NULL; struct ip6_sf_list *prev = NULL;
for (dpsf=pmc->mca_tomb; dpsf; for (dpsf = pmc->mca_tomb; dpsf;
dpsf=dpsf->sf_next) { dpsf = dpsf->sf_next) {
if (ipv6_addr_equal(&dpsf->sf_addr, if (ipv6_addr_equal(&dpsf->sf_addr,
&psf->sf_addr)) &psf->sf_addr))
break; break;
...@@ -2234,7 +2234,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc) ...@@ -2234,7 +2234,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc)
* add or update "delete" records if an active filter * add or update "delete" records if an active filter
* is now inactive * is now inactive
*/ */
for (dpsf=pmc->mca_tomb; dpsf; dpsf=dpsf->sf_next) for (dpsf = pmc->mca_tomb; dpsf; dpsf = dpsf->sf_next)
if (ipv6_addr_equal(&dpsf->sf_addr, if (ipv6_addr_equal(&dpsf->sf_addr,
&psf->sf_addr)) &psf->sf_addr))
break; break;
...@@ -2268,7 +2268,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, ...@@ -2268,7 +2268,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
if (!idev) if (!idev)
return -ENODEV; return -ENODEV;
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
for (pmc=idev->mc_list; pmc; pmc=pmc->next) { for (pmc = idev->mc_list; pmc; pmc = pmc->next) {
if (ipv6_addr_equal(pmca, &pmc->mca_addr)) if (ipv6_addr_equal(pmca, &pmc->mca_addr))
break; break;
} }
...@@ -2284,7 +2284,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, ...@@ -2284,7 +2284,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
if (!delta) if (!delta)
pmc->mca_sfcount[sfmode]++; pmc->mca_sfcount[sfmode]++;
err = 0; err = 0;
for (i=0; i<sfcount; i++) { for (i = 0; i < sfcount; i++) {
err = ip6_mc_add1_src(pmc, sfmode, &psfsrc[i]); err = ip6_mc_add1_src(pmc, sfmode, &psfsrc[i]);
if (err) if (err)
break; break;
...@@ -2294,7 +2294,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, ...@@ -2294,7 +2294,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
if (!delta) if (!delta)
pmc->mca_sfcount[sfmode]--; pmc->mca_sfcount[sfmode]--;
for (j=0; j<i; j++) for (j = 0; j < i; j++)
ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]); ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]);
} else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) {
struct ip6_sf_list *psf; struct ip6_sf_list *psf;
...@@ -2308,7 +2308,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, ...@@ -2308,7 +2308,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
pmc->mca_crcount = idev->mc_qrv; pmc->mca_crcount = idev->mc_qrv;
idev->mc_ifc_count = pmc->mca_crcount; idev->mc_ifc_count = pmc->mca_crcount;
for (psf=pmc->mca_sources; psf; psf = psf->sf_next) for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
psf->sf_crcount = 0; psf->sf_crcount = 0;
mld_ifc_event(idev); mld_ifc_event(idev);
} else if (sf_setstate(pmc)) } else if (sf_setstate(pmc))
...@@ -2322,12 +2322,12 @@ static void ip6_mc_clear_src(struct ifmcaddr6 *pmc) ...@@ -2322,12 +2322,12 @@ static void ip6_mc_clear_src(struct ifmcaddr6 *pmc)
{ {
struct ip6_sf_list *psf, *nextpsf; struct ip6_sf_list *psf, *nextpsf;
for (psf=pmc->mca_tomb; psf; psf=nextpsf) { for (psf = pmc->mca_tomb; psf; psf = nextpsf) {
nextpsf = psf->sf_next; nextpsf = psf->sf_next;
kfree(psf); kfree(psf);
} }
pmc->mca_tomb = NULL; pmc->mca_tomb = NULL;
for (psf=pmc->mca_sources; psf; psf=nextpsf) { for (psf = pmc->mca_sources; psf; psf = nextpsf) {
nextpsf = psf->sf_next; nextpsf = psf->sf_next;
kfree(psf); kfree(psf);
} }
...@@ -2471,7 +2471,7 @@ void ipv6_mc_down(struct inet6_dev *idev) ...@@ -2471,7 +2471,7 @@ void ipv6_mc_down(struct inet6_dev *idev)
mld_gq_stop_timer(idev); mld_gq_stop_timer(idev);
mld_dad_stop_timer(idev); mld_dad_stop_timer(idev);
for (i = idev->mc_list; i; i=i->next) for (i = idev->mc_list; i; i = i->next)
igmp6_group_dropped(i); igmp6_group_dropped(i);
read_unlock_bh(&idev->lock); read_unlock_bh(&idev->lock);
...@@ -2488,7 +2488,7 @@ void ipv6_mc_up(struct inet6_dev *idev) ...@@ -2488,7 +2488,7 @@ void ipv6_mc_up(struct inet6_dev *idev)
/* Install multicast list, except for all-nodes (already installed) */ /* Install multicast list, except for all-nodes (already installed) */
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
for (i = idev->mc_list; i; i=i->next) for (i = idev->mc_list; i; i = i->next)
igmp6_group_added(i); igmp6_group_added(i);
read_unlock_bh(&idev->lock); read_unlock_bh(&idev->lock);
} }
......
...@@ -175,7 +175,7 @@ static struct nd_opt_hdr *ndisc_next_option(struct nd_opt_hdr *cur, ...@@ -175,7 +175,7 @@ static struct nd_opt_hdr *ndisc_next_option(struct nd_opt_hdr *cur,
type = cur->nd_opt_type; type = cur->nd_opt_type;
do { do {
cur = ((void *)cur) + (cur->nd_opt_len << 3); cur = ((void *)cur) + (cur->nd_opt_len << 3);
} while(cur < end && cur->nd_opt_type != type); } while (cur < end && cur->nd_opt_type != type);
return cur <= end && cur->nd_opt_type == type ? cur : NULL; return cur <= end && cur->nd_opt_type == type ? cur : NULL;
} }
...@@ -192,7 +192,7 @@ static struct nd_opt_hdr *ndisc_next_useropt(struct nd_opt_hdr *cur, ...@@ -192,7 +192,7 @@ static struct nd_opt_hdr *ndisc_next_useropt(struct nd_opt_hdr *cur,
return NULL; return NULL;
do { do {
cur = ((void *)cur) + (cur->nd_opt_len << 3); cur = ((void *)cur) + (cur->nd_opt_len << 3);
} while(cur < end && !ndisc_is_useropt(cur)); } while (cur < end && !ndisc_is_useropt(cur));
return cur <= end && ndisc_is_useropt(cur) ? cur : NULL; return cur <= end && ndisc_is_useropt(cur) ? cur : NULL;
} }
...@@ -296,7 +296,7 @@ static u32 ndisc_hash(const void *pkey, ...@@ -296,7 +296,7 @@ static u32 ndisc_hash(const void *pkey,
static int ndisc_constructor(struct neighbour *neigh) static int ndisc_constructor(struct neighbour *neigh)
{ {
struct in6_addr *addr = (struct in6_addr*)&neigh->primary_key; struct in6_addr *addr = (struct in6_addr *)&neigh->primary_key;
struct net_device *dev = neigh->dev; struct net_device *dev = neigh->dev;
struct inet6_dev *in6_dev; struct inet6_dev *in6_dev;
struct neigh_parms *parms; struct neigh_parms *parms;
...@@ -344,7 +344,7 @@ static int ndisc_constructor(struct neighbour *neigh) ...@@ -344,7 +344,7 @@ static int ndisc_constructor(struct neighbour *neigh)
static int pndisc_constructor(struct pneigh_entry *n) static int pndisc_constructor(struct pneigh_entry *n)
{ {
struct in6_addr *addr = (struct in6_addr*)&n->key; struct in6_addr *addr = (struct in6_addr *)&n->key;
struct in6_addr maddr; struct in6_addr maddr;
struct net_device *dev = n->dev; struct net_device *dev = n->dev;
...@@ -357,7 +357,7 @@ static int pndisc_constructor(struct pneigh_entry *n) ...@@ -357,7 +357,7 @@ static int pndisc_constructor(struct pneigh_entry *n)
static void pndisc_destructor(struct pneigh_entry *n) static void pndisc_destructor(struct pneigh_entry *n)
{ {
struct in6_addr *addr = (struct in6_addr*)&n->key; struct in6_addr *addr = (struct in6_addr *)&n->key;
struct in6_addr maddr; struct in6_addr maddr;
struct net_device *dev = n->dev; struct net_device *dev = n->dev;
...@@ -1065,7 +1065,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1065,7 +1065,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
int optlen; int optlen;
unsigned int pref = 0; unsigned int pref = 0;
__u8 * opt = (__u8 *)(ra_msg + 1); __u8 *opt = (__u8 *)(ra_msg + 1);
optlen = (skb_tail_pointer(skb) - skb_transport_header(skb)) - optlen = (skb_tail_pointer(skb) - skb_transport_header(skb)) -
sizeof(struct ra_msg); sizeof(struct ra_msg);
...@@ -1319,7 +1319,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1319,7 +1319,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
continue; continue;
if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen) if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
continue; continue;
rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, rt6_route_rcv(skb->dev, (u8 *)p, (p->nd_opt_len) << 3,
&ipv6_hdr(skb)->saddr); &ipv6_hdr(skb)->saddr);
} }
} }
...@@ -1352,7 +1352,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1352,7 +1352,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
__be32 n; __be32 n;
u32 mtu; u32 mtu;
memcpy(&n, ((u8*)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu)); memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu));
mtu = ntohl(n); mtu = ntohl(n);
if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) { if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) {
......
...@@ -35,7 +35,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) ...@@ -35,7 +35,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
if (found_rhdr) if (found_rhdr)
return offset; return offset;
break; break;
default : default:
return offset; return offset;
} }
......
...@@ -889,7 +889,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -889,7 +889,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
else { else {
lock_sock(sk); lock_sock(sk);
err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov,
len, 0, hlimit, tclass, opt, &fl6, (struct rt6_info*)dst, len, 0, hlimit, tclass, opt, &fl6, (struct rt6_info *)dst,
msg->msg_flags, dontfrag); msg->msg_flags, dontfrag);
if (err) if (err)
...@@ -902,7 +902,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -902,7 +902,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
dst_release(dst); dst_release(dst);
out: out:
fl6_sock_release(flowlabel); fl6_sock_release(flowlabel);
return err<0?err:len; return err < 0 ? err : len;
do_confirm: do_confirm:
dst_confirm(dst); dst_confirm(dst);
if (!(msg->msg_flags & MSG_PROBE) || len) if (!(msg->msg_flags & MSG_PROBE) || len)
...@@ -1045,7 +1045,7 @@ static int do_rawv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1045,7 +1045,7 @@ static int do_rawv6_getsockopt(struct sock *sk, int level, int optname,
struct raw6_sock *rp = raw6_sk(sk); struct raw6_sock *rp = raw6_sk(sk);
int val, len; int val, len;
if (get_user(len,optlen)) if (get_user(len, optlen))
return -EFAULT; return -EFAULT;
switch (optname) { switch (optname) {
...@@ -1069,7 +1069,7 @@ static int do_rawv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1069,7 +1069,7 @@ static int do_rawv6_getsockopt(struct sock *sk, int level, int optname,
if (put_user(len, optlen)) if (put_user(len, optlen))
return -EFAULT; return -EFAULT;
if (copy_to_user(optval,&val,len)) if (copy_to_user(optval, &val, len))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
......
...@@ -68,7 +68,7 @@ struct ip6frag_skb_cb ...@@ -68,7 +68,7 @@ struct ip6frag_skb_cb
int offset; int offset;
}; };
#define FRAG6_CB(skb) ((struct ip6frag_skb_cb*)((skb)->cb)) #define FRAG6_CB(skb) ((struct ip6frag_skb_cb *)((skb)->cb))
static inline u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h) static inline u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
{ {
...@@ -289,7 +289,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, ...@@ -289,7 +289,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
goto found; goto found;
} }
prev = NULL; prev = NULL;
for(next = fq->q.fragments; next != NULL; next = next->next) { for (next = fq->q.fragments; next != NULL; next = next->next) {
if (FRAG6_CB(next)->offset >= offset) if (FRAG6_CB(next)->offset >= offset)
break; /* bingo! */ break; /* bingo! */
prev = next; prev = next;
...@@ -529,7 +529,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) ...@@ -529,7 +529,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS); IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS);
/* Jumbo payload inhibits frag. header */ /* Jumbo payload inhibits frag. header */
if (hdr->payload_len==0) if (hdr->payload_len == 0)
goto fail_hdr; goto fail_hdr;
if (!pskb_may_pull(skb, (skb_transport_offset(skb) + if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
......
...@@ -813,7 +813,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net, ...@@ -813,7 +813,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
} }
struct dst_entry * ip6_route_lookup(struct net *net, struct flowi6 *fl6, struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
int flags) int flags)
{ {
return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_lookup); return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_lookup);
...@@ -1024,7 +1024,7 @@ static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table ...@@ -1024,7 +1024,7 @@ static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table
return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags); return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags);
} }
struct dst_entry * ip6_route_output(struct net *net, const struct sock *sk, struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
struct flowi6 *fl6) struct flowi6 *fl6)
{ {
int flags = 0; int flags = 0;
...@@ -1149,7 +1149,7 @@ static void ip6_link_failure(struct sk_buff *skb) ...@@ -1149,7 +1149,7 @@ static void ip6_link_failure(struct sk_buff *skb)
static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb, u32 mtu) struct sk_buff *skb, u32 mtu)
{ {
struct rt6_info *rt6 = (struct rt6_info*)dst; struct rt6_info *rt6 = (struct rt6_info *)dst;
dst_confirm(dst); dst_confirm(dst);
if (mtu < dst_mtu(dst) && rt6->rt6i_dst.plen == 128) { if (mtu < dst_mtu(dst) && rt6->rt6i_dst.plen == 128) {
...@@ -1924,7 +1924,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net, ...@@ -1924,7 +1924,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
return NULL; return NULL;
read_lock_bh(&table->tb6_lock); read_lock_bh(&table->tb6_lock);
fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0); fn = fib6_locate(&table->tb6_root, prefix, prefixlen, NULL, 0);
if (!fn) if (!fn)
goto out; goto out;
...@@ -1983,7 +1983,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev ...@@ -1983,7 +1983,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
return NULL; return NULL;
read_lock_bh(&table->tb6_lock); read_lock_bh(&table->tb6_lock);
for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) { for (rt = table->tb6_root.leaf; rt; rt = rt->dst.rt6_next) {
if (dev == rt->dst.dev && if (dev == rt->dst.dev &&
((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) && ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) &&
ipv6_addr_equal(&rt->rt6i_gateway, addr)) ipv6_addr_equal(&rt->rt6i_gateway, addr))
...@@ -2068,7 +2068,7 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg) ...@@ -2068,7 +2068,7 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg)
struct in6_rtmsg rtmsg; struct in6_rtmsg rtmsg;
int err; int err;
switch(cmd) { switch (cmd) {
case SIOCADDRT: /* Add a route */ case SIOCADDRT: /* Add a route */
case SIOCDELRT: /* Delete a route */ case SIOCDELRT: /* Delete a route */
if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
...@@ -2191,7 +2191,7 @@ int ip6_route_get_saddr(struct net *net, ...@@ -2191,7 +2191,7 @@ int ip6_route_get_saddr(struct net *net,
unsigned int prefs, unsigned int prefs,
struct in6_addr *saddr) struct in6_addr *saddr)
{ {
struct inet6_dev *idev = ip6_dst_idev((struct dst_entry*)rt); struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt);
int err = 0; int err = 0;
if (rt->rt6i_prefsrc.plen) if (rt->rt6i_prefsrc.plen)
*saddr = rt->rt6i_prefsrc.addr; *saddr = rt->rt6i_prefsrc.addr;
...@@ -2486,7 +2486,7 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add) ...@@ -2486,7 +2486,7 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add)
return last_err; return last_err;
} }
static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh) static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh)
{ {
struct fib6_config cfg; struct fib6_config cfg;
int err; int err;
...@@ -2501,7 +2501,7 @@ static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh) ...@@ -2501,7 +2501,7 @@ static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh)
return ip6_route_del(&cfg); return ip6_route_del(&cfg);
} }
static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh) static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh)
{ {
struct fib6_config cfg; struct fib6_config cfg;
int err; int err;
...@@ -2693,7 +2693,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg) ...@@ -2693,7 +2693,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
prefix, 0, NLM_F_MULTI); prefix, 0, NLM_F_MULTI);
} }
static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh) static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
{ {
struct net *net = sock_net(in_skb->sk); struct net *net = sock_net(in_skb->sk);
struct nlattr *tb[RTA_MAX+1]; struct nlattr *tb[RTA_MAX+1];
......
...@@ -1123,7 +1123,7 @@ static int ipip6_tunnel_update_6rd(struct ip_tunnel *t, ...@@ -1123,7 +1123,7 @@ static int ipip6_tunnel_update_6rd(struct ip_tunnel *t,
#endif #endif
static int static int
ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
int err = 0; int err = 0;
struct ip_tunnel_parm p; struct ip_tunnel_parm p;
......
...@@ -530,7 +530,7 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -530,7 +530,7 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data;
const struct in6_addr *saddr = &hdr->saddr; const struct in6_addr *saddr = &hdr->saddr;
const struct in6_addr *daddr = &hdr->daddr; const struct in6_addr *daddr = &hdr->daddr;
struct udphdr *uh = (struct udphdr*)(skb->data+offset); struct udphdr *uh = (struct udphdr *)(skb->data+offset);
struct sock *sk; struct sock *sk;
int err; int err;
struct net *net = dev_net(skb->dev); struct net *net = dev_net(skb->dev);
...@@ -596,7 +596,7 @@ static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) ...@@ -596,7 +596,7 @@ static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
static __inline__ void udpv6_err(struct sk_buff *skb, static __inline__ void udpv6_err(struct sk_buff *skb,
struct inet6_skb_parm *opt, u8 type, struct inet6_skb_parm *opt, u8 type,
u8 code, int offset, __be32 info ) u8 code, int offset, __be32 info)
{ {
__udp6_lib_err(skb, opt, type, code, offset, info, &udp_table); __udp6_lib_err(skb, opt, type, code, offset, info, &udp_table);
} }
...@@ -1294,7 +1294,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -1294,7 +1294,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag;
err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen, err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen,
sizeof(struct udphdr), hlimit, tclass, opt, &fl6, sizeof(struct udphdr), hlimit, tclass, opt, &fl6,
(struct rt6_info*)dst, (struct rt6_info *)dst,
corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag); corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag);
if (err) if (err)
udp_v6_flush_pending_frames(sk); udp_v6_flush_pending_frames(sk);
......
...@@ -84,7 +84,7 @@ static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst, ...@@ -84,7 +84,7 @@ static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst,
int nfheader_len) int nfheader_len)
{ {
if (dst->ops->family == AF_INET6) { if (dst->ops->family == AF_INET6) {
struct rt6_info *rt = (struct rt6_info*)dst; struct rt6_info *rt = (struct rt6_info *)dst;
if (rt->rt6i_node) if (rt->rt6i_node)
path->path_cookie = rt->rt6i_node->fn_sernum; path->path_cookie = rt->rt6i_node->fn_sernum;
} }
...@@ -97,7 +97,7 @@ static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst, ...@@ -97,7 +97,7 @@ static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst,
static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
const struct flowi *fl) const struct flowi *fl)
{ {
struct rt6_info *rt = (struct rt6_info*)xdst->route; struct rt6_info *rt = (struct rt6_info *)xdst->route;
xdst->u.dst.dev = dev; xdst->u.dst.dev = dev;
dev_hold(dev); dev_hold(dev);
......
...@@ -45,10 +45,10 @@ xfrm6_init_temprop(struct xfrm_state *x, const struct xfrm_tmpl *tmpl, ...@@ -45,10 +45,10 @@ xfrm6_init_temprop(struct xfrm_state *x, const struct xfrm_tmpl *tmpl,
const xfrm_address_t *daddr, const xfrm_address_t *saddr) const xfrm_address_t *daddr, const xfrm_address_t *saddr)
{ {
x->id = tmpl->id; x->id = tmpl->id;
if (ipv6_addr_any((struct in6_addr*)&x->id.daddr)) if (ipv6_addr_any((struct in6_addr *)&x->id.daddr))
memcpy(&x->id.daddr, daddr, sizeof(x->sel.daddr)); memcpy(&x->id.daddr, daddr, sizeof(x->sel.daddr));
memcpy(&x->props.saddr, &tmpl->saddr, sizeof(x->props.saddr)); memcpy(&x->props.saddr, &tmpl->saddr, sizeof(x->props.saddr));
if (ipv6_addr_any((struct in6_addr*)&x->props.saddr)) if (ipv6_addr_any((struct in6_addr *)&x->props.saddr))
memcpy(&x->props.saddr, saddr, sizeof(x->props.saddr)); memcpy(&x->props.saddr, saddr, sizeof(x->props.saddr));
x->props.mode = tmpl->mode; x->props.mode = tmpl->mode;
x->props.reqid = tmpl->reqid; x->props.reqid = tmpl->reqid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册