aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_sockglue.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-02-09 09:24:47 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-11 02:19:39 -0500
commite905a9edab7f4f14f9213b52234e4a346c690911 (patch)
tree9e52a5f47eec47c5685c347ff7af22290a10305b /net/ipv4/ip_sockglue.c
parent642656518b2e64fd59d9bbd15b6885cac5fe99b1 (diff)
[NET] IPV4: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r--net/ipv4/ip_sockglue.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 57d4bae6f080..e120686c3cb8 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -4,7 +4,7 @@
4 * interface as the means of communication with the user level. 4 * interface as the means of communication with the user level.
5 * 5 *
6 * The IP to API glue. 6 * The IP to API glue.
7 * 7 *
8 * Version: $Id: ip_sockglue.c,v 1.62 2002/02/01 22:01:04 davem Exp $ 8 * Version: $Id: ip_sockglue.c,v 1.62 2002/02/01 22:01:04 davem Exp $
9 * 9 *
10 * Authors: see ip.c 10 * Authors: see ip.c
@@ -12,7 +12,7 @@
12 * Fixes: 12 * Fixes:
13 * Many : Split from ip.c , see ip.c for history. 13 * Many : Split from ip.c , see ip.c for history.
14 * Martin Mares : TOS setting fixed. 14 * Martin Mares : TOS setting fixed.
15 * Alan Cox : Fixed a couple of oopses in Martin's 15 * Alan Cox : Fixed a couple of oopses in Martin's
16 * TOS tweaks. 16 * TOS tweaks.
17 * Mike McLagan : Routing by source 17 * Mike McLagan : Routing by source
18 */ 18 */
@@ -253,7 +253,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s
253 return 0; 253 return 0;
254} 254}
255 255
256void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 256void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
257 __be16 port, u32 info, u8 *payload) 257 __be16 port, u32 info, u8 *payload)
258{ 258{
259 struct inet_sock *inet = inet_sk(sk); 259 struct inet_sock *inet = inet_sk(sk);
@@ -266,10 +266,10 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
266 if (!skb) 266 if (!skb)
267 return; 267 return;
268 268
269 serr = SKB_EXT_ERR(skb); 269 serr = SKB_EXT_ERR(skb);
270 serr->ee.ee_errno = err; 270 serr->ee.ee_errno = err;
271 serr->ee.ee_origin = SO_EE_ORIGIN_ICMP; 271 serr->ee.ee_origin = SO_EE_ORIGIN_ICMP;
272 serr->ee.ee_type = skb->h.icmph->type; 272 serr->ee.ee_type = skb->h.icmph->type;
273 serr->ee.ee_code = skb->h.icmph->code; 273 serr->ee.ee_code = skb->h.icmph->code;
274 serr->ee.ee_pad = 0; 274 serr->ee.ee_pad = 0;
275 serr->ee.ee_info = info; 275 serr->ee.ee_info = info;
@@ -301,10 +301,10 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
301 skb->nh.iph = iph; 301 skb->nh.iph = iph;
302 iph->daddr = daddr; 302 iph->daddr = daddr;
303 303
304 serr = SKB_EXT_ERR(skb); 304 serr = SKB_EXT_ERR(skb);
305 serr->ee.ee_errno = err; 305 serr->ee.ee_errno = err;
306 serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL; 306 serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL;
307 serr->ee.ee_type = 0; 307 serr->ee.ee_type = 0;
308 serr->ee.ee_code = 0; 308 serr->ee.ee_code = 0;
309 serr->ee.ee_pad = 0; 309 serr->ee.ee_pad = 0;
310 serr->ee.ee_info = info; 310 serr->ee.ee_info = info;
@@ -319,7 +319,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
319 kfree_skb(skb); 319 kfree_skb(skb);
320} 320}
321 321
322/* 322/*
323 * Handle MSG_ERRQUEUE 323 * Handle MSG_ERRQUEUE
324 */ 324 */
325int ip_recv_error(struct sock *sk, struct msghdr *msg, int len) 325int 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)
391 } else 391 } else
392 spin_unlock_bh(&sk->sk_error_queue.lock); 392 spin_unlock_bh(&sk->sk_error_queue.lock);
393 393
394out_free_skb: 394out_free_skb:
395 kfree_skb(skb); 395 kfree_skb(skb);
396out: 396out:
397 return err; 397 return err;
@@ -409,15 +409,15 @@ static int do_ip_setsockopt(struct sock *sk, int level,
409 struct inet_sock *inet = inet_sk(sk); 409 struct inet_sock *inet = inet_sk(sk);
410 int val=0,err; 410 int val=0,err;
411 411
412 if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) | 412 if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) |
413 (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) | 413 (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) |
414 (1<<IP_RETOPTS) | (1<<IP_TOS) | 414 (1<<IP_RETOPTS) | (1<<IP_TOS) |
415 (1<<IP_TTL) | (1<<IP_HDRINCL) | 415 (1<<IP_TTL) | (1<<IP_HDRINCL) |
416 (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) | 416 (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) |
417 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | 417 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
418 (1<<IP_PASSSEC))) || 418 (1<<IP_PASSSEC))) ||
419 optname == IP_MULTICAST_TTL || 419 optname == IP_MULTICAST_TTL ||
420 optname == IP_MULTICAST_LOOP) { 420 optname == IP_MULTICAST_LOOP) {
421 if (optlen >= sizeof(int)) { 421 if (optlen >= sizeof(int)) {
422 if (get_user(val, (int __user *) optval)) 422 if (get_user(val, (int __user *) optval))
423 return -EFAULT; 423 return -EFAULT;
@@ -511,7 +511,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
511 val &= ~3; 511 val &= ~3;
512 val |= inet->tos & 3; 512 val |= inet->tos & 3;
513 } 513 }
514 if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP && 514 if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP &&
515 !capable(CAP_NET_ADMIN)) { 515 !capable(CAP_NET_ADMIN)) {
516 err = -EPERM; 516 err = -EPERM;
517 break; 517 break;
@@ -519,7 +519,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
519 if (inet->tos != val) { 519 if (inet->tos != val) {
520 inet->tos = val; 520 inet->tos = val;
521 sk->sk_priority = rt_tos2priority(val); 521 sk->sk_priority = rt_tos2priority(val);
522 sk_dst_reset(sk); 522 sk_dst_reset(sk);
523 } 523 }
524 break; 524 break;
525 case IP_TTL: 525 case IP_TTL:
@@ -556,13 +556,13 @@ static int do_ip_setsockopt(struct sock *sk, int level,
556 if (val < 0 || val > 255) 556 if (val < 0 || val > 255)
557 goto e_inval; 557 goto e_inval;
558 inet->mc_ttl = val; 558 inet->mc_ttl = val;
559 break; 559 break;
560 case IP_MULTICAST_LOOP: 560 case IP_MULTICAST_LOOP:
561 if (optlen<1) 561 if (optlen<1)
562 goto e_inval; 562 goto e_inval;
563 inet->mc_loop = !!val; 563 inet->mc_loop = !!val;
564 break; 564 break;
565 case IP_MULTICAST_IF: 565 case IP_MULTICAST_IF:
566 { 566 {
567 struct ip_mreqn mreq; 567 struct ip_mreqn mreq;
568 struct net_device *dev = NULL; 568 struct net_device *dev = NULL;
@@ -616,7 +616,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
616 } 616 }
617 617
618 case IP_ADD_MEMBERSHIP: 618 case IP_ADD_MEMBERSHIP:
619 case IP_DROP_MEMBERSHIP: 619 case IP_DROP_MEMBERSHIP:
620 { 620 {
621 struct ip_mreqn mreq; 621 struct ip_mreqn mreq;
622 622
@@ -629,7 +629,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
629 } else { 629 } else {
630 memset(&mreq, 0, sizeof(mreq)); 630 memset(&mreq, 0, sizeof(mreq));
631 if (copy_from_user(&mreq,optval,sizeof(struct ip_mreq))) 631 if (copy_from_user(&mreq,optval,sizeof(struct ip_mreq)))
632 break; 632 break;
633 } 633 }
634 634
635 if (optname == IP_ADD_MEMBERSHIP) 635 if (optname == IP_ADD_MEMBERSHIP)
@@ -714,7 +714,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
714 break; 714 break;
715 } 715 }
716 case MCAST_JOIN_GROUP: 716 case MCAST_JOIN_GROUP:
717 case MCAST_LEAVE_GROUP: 717 case MCAST_LEAVE_GROUP:
718 { 718 {
719 struct group_req greq; 719 struct group_req greq;
720 struct sockaddr_in *psin; 720 struct sockaddr_in *psin;
@@ -858,16 +858,16 @@ mc_msf_out:
858 kfree(gsf); 858 kfree(gsf);
859 break; 859 break;
860 } 860 }
861 case IP_ROUTER_ALERT: 861 case IP_ROUTER_ALERT:
862 err = ip_ra_control(sk, val ? 1 : 0, NULL); 862 err = ip_ra_control(sk, val ? 1 : 0, NULL);
863 break; 863 break;
864 864
865 case IP_FREEBIND: 865 case IP_FREEBIND:
866 if (optlen<1) 866 if (optlen<1)
867 goto e_inval; 867 goto e_inval;
868 inet->freebind = !!val; 868 inet->freebind = !!val;
869 break; 869 break;
870 870
871 case IP_IPSEC_POLICY: 871 case IP_IPSEC_POLICY:
872 case IP_XFRM_POLICY: 872 case IP_XFRM_POLICY:
873 err = -EPERM; 873 err = -EPERM;
@@ -954,7 +954,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
954 struct inet_sock *inet = inet_sk(sk); 954 struct inet_sock *inet = inet_sk(sk);
955 int val; 955 int val;
956 int len; 956 int len;
957 957
958 if(level!=SOL_IP) 958 if(level!=SOL_IP)
959 return -EOPNOTSUPP; 959 return -EOPNOTSUPP;
960 960
@@ -969,7 +969,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
969 return -EFAULT; 969 return -EFAULT;
970 if(len < 0) 970 if(len < 0)
971 return -EINVAL; 971 return -EINVAL;
972 972
973 lock_sock(sk); 973 lock_sock(sk);
974 974
975 switch(optname) { 975 switch(optname) {
@@ -984,7 +984,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
984 inet->opt->optlen); 984 inet->opt->optlen);
985 release_sock(sk); 985 release_sock(sk);
986 986
987 if (opt->optlen == 0) 987 if (opt->optlen == 0)
988 return put_user(0, optlen); 988 return put_user(0, optlen);
989 989
990 ip_options_undo(opt); 990 ip_options_undo(opt);
@@ -1059,8 +1059,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1059 addr.s_addr = inet->mc_addr; 1059 addr.s_addr = inet->mc_addr;
1060 release_sock(sk); 1060 release_sock(sk);
1061 1061
1062 if(put_user(len, optlen)) 1062 if(put_user(len, optlen))
1063 return -EFAULT; 1063 return -EFAULT;
1064 if(copy_to_user(optval, &addr, len)) 1064 if(copy_to_user(optval, &addr, len))
1065 return -EFAULT; 1065 return -EFAULT;
1066 return 0; 1066 return 0;
@@ -1101,7 +1101,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1101 release_sock(sk); 1101 release_sock(sk);
1102 return err; 1102 return err;
1103 } 1103 }
1104 case IP_PKTOPTIONS: 1104 case IP_PKTOPTIONS:
1105 { 1105 {
1106 struct msghdr msg; 1106 struct msghdr msg;
1107 1107
@@ -1129,15 +1129,15 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1129 len -= msg.msg_controllen; 1129 len -= msg.msg_controllen;
1130 return put_user(len, optlen); 1130 return put_user(len, optlen);
1131 } 1131 }
1132 case IP_FREEBIND: 1132 case IP_FREEBIND:
1133 val = inet->freebind; 1133 val = inet->freebind;
1134 break; 1134 break;
1135 default: 1135 default:
1136 release_sock(sk); 1136 release_sock(sk);
1137 return -ENOPROTOOPT; 1137 return -ENOPROTOOPT;
1138 } 1138 }
1139 release_sock(sk); 1139 release_sock(sk);
1140 1140
1141 if (len < sizeof(int) && len > 0 && val>=0 && val<255) { 1141 if (len < sizeof(int) && len > 0 && val>=0 && val<255) {
1142 unsigned char ucval = (unsigned char)val; 1142 unsigned char ucval = (unsigned char)val;
1143 len = 1; 1143 len = 1;
@@ -1168,7 +1168,7 @@ int ip_getsockopt(struct sock *sk, int level,
1168 && (optname < MRT_BASE || optname > MRT_BASE+10) 1168 && (optname < MRT_BASE || optname > MRT_BASE+10)
1169#endif 1169#endif
1170 ) { 1170 ) {
1171 int len; 1171 int len;
1172 1172
1173 if(get_user(len,optlen)) 1173 if(get_user(len,optlen))
1174 return -EFAULT; 1174 return -EFAULT;
@@ -1197,7 +1197,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
1197 && (optname < MRT_BASE || optname > MRT_BASE+10) 1197 && (optname < MRT_BASE || optname > MRT_BASE+10)
1198#endif 1198#endif
1199 ) { 1199 ) {
1200 int len; 1200 int len;
1201 1201
1202 if (get_user(len, optlen)) 1202 if (get_user(len, optlen))
1203 return -EFAULT; 1203 return -EFAULT;