aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_sockglue.c
diff options
context:
space:
mode:
authorJianjun Kong <jianjun@zeuux.org>2008-11-03 03:27:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-03 03:27:11 -0500
commit09cb105ea78d5644570d52085e2149f784575872 (patch)
tree35c42ad887f3a2edc840014671b4788e21de5b31 /net/ipv4/ip_sockglue.c
parenta7e9ff735bd5e3437a8e5ecbbc2db3865974a523 (diff)
net: clean up net/ipv4/ip_sockglue.c tcp_output.c
Signed-off-by: Jianjun Kong <jianjun@zeuux.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.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 465abf0a9869..e976efeb1456 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -94,7 +94,7 @@ static void ip_cmsg_recv_opts(struct msghdr *msg, struct sk_buff *skb)
94static void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb) 94static void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb)
95{ 95{
96 unsigned char optbuf[sizeof(struct ip_options) + 40]; 96 unsigned char optbuf[sizeof(struct ip_options) + 40];
97 struct ip_options * opt = (struct ip_options*)optbuf; 97 struct ip_options * opt = (struct ip_options *)optbuf;
98 98
99 if (IPCB(skb)->opt.optlen == 0) 99 if (IPCB(skb)->opt.optlen == 0)
100 return; 100 return;
@@ -411,7 +411,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
411 int optname, char __user *optval, int optlen) 411 int optname, char __user *optval, int optlen)
412{ 412{
413 struct inet_sock *inet = inet_sk(sk); 413 struct inet_sock *inet = inet_sk(sk);
414 int val=0,err; 414 int val = 0, err;
415 415
416 if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) | 416 if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) |
417 (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) | 417 (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) |
@@ -437,7 +437,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
437 /* If optlen==0, it is equivalent to val == 0 */ 437 /* If optlen==0, it is equivalent to val == 0 */
438 438
439 if (ip_mroute_opt(optname)) 439 if (ip_mroute_opt(optname))
440 return ip_mroute_setsockopt(sk,optname,optval,optlen); 440 return ip_mroute_setsockopt(sk, optname, optval, optlen);
441 441
442 err = 0; 442 err = 0;
443 lock_sock(sk); 443 lock_sock(sk);
@@ -549,7 +549,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
549 goto e_inval; 549 goto e_inval;
550 if (optlen<1) 550 if (optlen<1)
551 goto e_inval; 551 goto e_inval;
552 if (val==-1) 552 if (val == -1)
553 val = 1; 553 val = 1;
554 if (val < 0 || val > 255) 554 if (val < 0 || val > 255)
555 goto e_inval; 555 goto e_inval;
@@ -573,12 +573,12 @@ static int do_ip_setsockopt(struct sock *sk, int level,
573 573
574 err = -EFAULT; 574 err = -EFAULT;
575 if (optlen >= sizeof(struct ip_mreqn)) { 575 if (optlen >= sizeof(struct ip_mreqn)) {
576 if (copy_from_user(&mreq,optval,sizeof(mreq))) 576 if (copy_from_user(&mreq, optval, sizeof(mreq)))
577 break; 577 break;
578 } else { 578 } else {
579 memset(&mreq, 0, sizeof(mreq)); 579 memset(&mreq, 0, sizeof(mreq));
580 if (optlen >= sizeof(struct in_addr) && 580 if (optlen >= sizeof(struct in_addr) &&
581 copy_from_user(&mreq.imr_address,optval,sizeof(struct in_addr))) 581 copy_from_user(&mreq.imr_address, optval, sizeof(struct in_addr)))
582 break; 582 break;
583 } 583 }
584 584
@@ -626,11 +626,11 @@ static int do_ip_setsockopt(struct sock *sk, int level,
626 goto e_inval; 626 goto e_inval;
627 err = -EFAULT; 627 err = -EFAULT;
628 if (optlen >= sizeof(struct ip_mreqn)) { 628 if (optlen >= sizeof(struct ip_mreqn)) {
629 if (copy_from_user(&mreq,optval,sizeof(mreq))) 629 if (copy_from_user(&mreq, optval, sizeof(mreq)))
630 break; 630 break;
631 } else { 631 } else {
632 memset(&mreq, 0, sizeof(mreq)); 632 memset(&mreq, 0, sizeof(mreq));
633 if (copy_from_user(&mreq,optval,sizeof(struct ip_mreq))) 633 if (copy_from_user(&mreq, optval, sizeof(struct ip_mreq)))
634 break; 634 break;
635 } 635 }
636 636
@@ -808,7 +808,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
808 err = -ENOBUFS; 808 err = -ENOBUFS;
809 break; 809 break;
810 } 810 }
811 gsf = kmalloc(optlen,GFP_KERNEL); 811 gsf = kmalloc(optlen, GFP_KERNEL);
812 if (!gsf) { 812 if (!gsf) {
813 err = -ENOBUFS; 813 err = -ENOBUFS;
814 break; 814 break;
@@ -828,7 +828,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
828 goto mc_msf_out; 828 goto mc_msf_out;
829 } 829 }
830 msize = IP_MSFILTER_SIZE(gsf->gf_numsrc); 830 msize = IP_MSFILTER_SIZE(gsf->gf_numsrc);
831 msf = kmalloc(msize,GFP_KERNEL); 831 msf = kmalloc(msize, GFP_KERNEL);
832 if (!msf) { 832 if (!msf) {
833 err = -ENOBUFS; 833 err = -ENOBUFS;
834 goto mc_msf_out; 834 goto mc_msf_out;
@@ -971,9 +971,9 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
971 return -EOPNOTSUPP; 971 return -EOPNOTSUPP;
972 972
973 if (ip_mroute_opt(optname)) 973 if (ip_mroute_opt(optname))
974 return ip_mroute_getsockopt(sk,optname,optval,optlen); 974 return ip_mroute_getsockopt(sk, optname, optval, optlen);
975 975
976 if (get_user(len,optlen)) 976 if (get_user(len, optlen))
977 return -EFAULT; 977 return -EFAULT;
978 if (len < 0) 978 if (len < 0)
979 return -EINVAL; 979 return -EINVAL;
@@ -984,7 +984,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
984 case IP_OPTIONS: 984 case IP_OPTIONS:
985 { 985 {
986 unsigned char optbuf[sizeof(struct ip_options)+40]; 986 unsigned char optbuf[sizeof(struct ip_options)+40];
987 struct ip_options * opt = (struct ip_options*)optbuf; 987 struct ip_options * opt = (struct ip_options *)optbuf;
988 opt->optlen = 0; 988 opt->optlen = 0;
989 if (inet->opt) 989 if (inet->opt)
990 memcpy(optbuf, inet->opt, 990 memcpy(optbuf, inet->opt,
@@ -1154,13 +1154,13 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1154 len = 1; 1154 len = 1;
1155 if (put_user(len, optlen)) 1155 if (put_user(len, optlen))
1156 return -EFAULT; 1156 return -EFAULT;
1157 if (copy_to_user(optval,&ucval,1)) 1157 if (copy_to_user(optval, &ucval, 1))
1158 return -EFAULT; 1158 return -EFAULT;
1159 } else { 1159 } else {
1160 len = min_t(unsigned int, sizeof(int), len); 1160 len = min_t(unsigned int, sizeof(int), len);
1161 if (put_user(len, optlen)) 1161 if (put_user(len, optlen))
1162 return -EFAULT; 1162 return -EFAULT;
1163 if (copy_to_user(optval,&val,len)) 1163 if (copy_to_user(optval, &val, len))
1164 return -EFAULT; 1164 return -EFAULT;
1165 } 1165 }
1166 return 0; 1166 return 0;
@@ -1178,7 +1178,7 @@ int ip_getsockopt(struct sock *sk, int level,
1178 !ip_mroute_opt(optname)) { 1178 !ip_mroute_opt(optname)) {
1179 int len; 1179 int len;
1180 1180
1181 if (get_user(len,optlen)) 1181 if (get_user(len, optlen))
1182 return -EFAULT; 1182 return -EFAULT;
1183 1183
1184 lock_sock(sk); 1184 lock_sock(sk);