Commit 6516c655 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[UDP]: ipv4 whitespace cleanup

Fix whitespace around keywords.
Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a2a316fd
...@@ -175,7 +175,8 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum, ...@@ -175,7 +175,8 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
; ;
} }
result = best; result = best;
for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE;
i++, result += UDP_HTABLE_SIZE) {
if (result > sysctl_local_port_range[1]) if (result > sysctl_local_port_range[1])
result = sysctl_local_port_range[0] result = sysctl_local_port_range[0]
+ ((result - sysctl_local_port_range[0]) & + ((result - sysctl_local_port_range[0]) &
...@@ -270,10 +271,10 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport, ...@@ -270,10 +271,10 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport,
continue; continue;
score+=2; score+=2;
} }
if(score == 9) { if (score == 9) {
result = sk; result = sk;
break; break;
} else if(score > badness) { } else if (score > badness) {
result = sk; result = sk;
badness = score; badness = score;
} }
...@@ -765,8 +766,7 @@ out: ...@@ -765,8 +766,7 @@ out:
int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{ {
switch(cmd) switch (cmd) {
{
case SIOCOUTQ: case SIOCOUTQ:
{ {
int amount = atomic_read(&sk->sk_wmem_alloc); int amount = atomic_read(&sk->sk_wmem_alloc);
...@@ -796,7 +796,8 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -796,7 +796,8 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
return(0);
return 0;
} }
/* /*
...@@ -958,7 +959,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) ...@@ -958,7 +959,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
/* Check if this is a keepalive packet. If so, eat it. */ /* Check if this is a keepalive packet. If so, eat it. */
if (len == 1 && udpdata[0] == 0xff) { if (len == 1 && udpdata[0] == 0xff) {
return 0; return 0;
} else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0 ) { } else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0) {
/* ESP Packet without Non-ESP header */ /* ESP Packet without Non-ESP header */
len = sizeof(struct udphdr); len = sizeof(struct udphdr);
} else } else
...@@ -1141,10 +1142,10 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb, ...@@ -1141,10 +1142,10 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb,
sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr, sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr,
uh->source, saddr, dif); uh->source, saddr, dif);
if(sknext) if (sknext)
skb1 = skb_clone(skb, GFP_ATOMIC); skb1 = skb_clone(skb, GFP_ATOMIC);
if(skb1) { if (skb1) {
int ret = udp_queue_rcv_skb(sk, skb1); int ret = udp_queue_rcv_skb(sk, skb1);
if (ret > 0) if (ret > 0)
/* we should probably re-process instead /* we should probably re-process instead
...@@ -1152,7 +1153,7 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb, ...@@ -1152,7 +1153,7 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb,
kfree_skb(skb1); kfree_skb(skb1);
} }
sk = sknext; sk = sknext;
} while(sknext); } while (sknext);
} else } else
kfree_skb(skb); kfree_skb(skb);
read_unlock(&udp_hash_lock); read_unlock(&udp_hash_lock);
...@@ -1230,7 +1231,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], ...@@ -1230,7 +1231,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
if (udp4_csum_init(skb, uh, proto)) if (udp4_csum_init(skb, uh, proto))
goto csum_error; goto csum_error;
if(rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest,
...@@ -1264,7 +1265,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], ...@@ -1264,7 +1265,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
* don't wanna listen. Ignore it. * don't wanna listen. Ignore it.
*/ */
kfree_skb(skb); kfree_skb(skb);
return(0); return 0;
short_packet: short_packet:
LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %u.%u.%u.%u:%u %d/%d to %u.%u.%u.%u:%u\n", LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %u.%u.%u.%u:%u %d/%d to %u.%u.%u.%u:%u\n",
...@@ -1292,7 +1293,7 @@ csum_error: ...@@ -1292,7 +1293,7 @@ csum_error:
drop: drop:
UDP_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); UDP_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
kfree_skb(skb); kfree_skb(skb);
return(0); return 0;
} }
__inline__ int udp_rcv(struct sk_buff *skb) __inline__ int udp_rcv(struct sk_buff *skb)
...@@ -1319,13 +1320,13 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, ...@@ -1319,13 +1320,13 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
int val; int val;
int err = 0; int err = 0;
if(optlen<sizeof(int)) if (optlen<sizeof(int))
return -EINVAL; return -EINVAL;
if (get_user(val, (int __user *)optval)) if (get_user(val, (int __user *)optval))
return -EFAULT; return -EFAULT;
switch(optname) { switch (optname) {
case UDP_CORK: case UDP_CORK:
if (val != 0) { if (val != 0) {
up->corkflag = 1; up->corkflag = 1;
...@@ -1379,7 +1380,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, ...@@ -1379,7 +1380,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
default: default:
err = -ENOPROTOOPT; err = -ENOPROTOOPT;
break; break;
}; }
return err; return err;
} }
...@@ -1410,15 +1411,15 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, ...@@ -1410,15 +1411,15 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname,
struct udp_sock *up = udp_sk(sk); struct udp_sock *up = udp_sk(sk);
int val, len; int val, len;
if(get_user(len,optlen)) if (get_user(len,optlen))
return -EFAULT; return -EFAULT;
len = min_t(unsigned int, len, sizeof(int)); len = min_t(unsigned int, len, sizeof(int));
if(len < 0) if (len < 0)
return -EINVAL; return -EINVAL;
switch(optname) { switch (optname) {
case UDP_CORK: case UDP_CORK:
val = up->corkflag; val = up->corkflag;
break; break;
...@@ -1439,11 +1440,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, ...@@ -1439,11 +1440,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname,
default: default:
return -ENOPROTOOPT; return -ENOPROTOOPT;
}; }
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;
} }
...@@ -1575,7 +1576,7 @@ static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) ...@@ -1575,7 +1576,7 @@ static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos)
struct sock *sk = udp_get_first(seq); struct sock *sk = udp_get_first(seq);
if (sk) if (sk)
while(pos && (sk = udp_get_next(seq, sk)) != NULL) while (pos && (sk = udp_get_next(seq, sk)) != NULL)
--pos; --pos;
return pos ? NULL : sk; return pos ? NULL : sk;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment