diff options
author | Jianjun Kong <jianjun@zeuux.org> | 2008-11-03 03:27:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-03 03:27:11 -0500 |
commit | 09cb105ea78d5644570d52085e2149f784575872 (patch) | |
tree | 35c42ad887f3a2edc840014671b4788e21de5b31 | |
parent | a7e9ff735bd5e3437a8e5ecbbc2db3865974a523 (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>
-rw-r--r-- | net/ipv4/ip_sockglue.c | 32 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 8 |
2 files changed, 20 insertions, 20 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) | |||
94 | static void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb) | 94 | static 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); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index ba85d8831893..a524627923ae 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -42,7 +42,7 @@ | |||
42 | /* People can turn this off for buggy TCP's found in printers etc. */ | 42 | /* People can turn this off for buggy TCP's found in printers etc. */ |
43 | int sysctl_tcp_retrans_collapse __read_mostly = 1; | 43 | int sysctl_tcp_retrans_collapse __read_mostly = 1; |
44 | 44 | ||
45 | /* People can turn this on to work with those rare, broken TCPs that | 45 | /* People can turn this on to work with those rare, broken TCPs that |
46 | * interpret the window field as a signed quantity. | 46 | * interpret the window field as a signed quantity. |
47 | */ | 47 | */ |
48 | int sysctl_tcp_workaround_signed_windows __read_mostly = 0; | 48 | int sysctl_tcp_workaround_signed_windows __read_mostly = 0; |
@@ -484,7 +484,7 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, | |||
484 | } | 484 | } |
485 | if (likely(sysctl_tcp_window_scaling)) { | 485 | if (likely(sysctl_tcp_window_scaling)) { |
486 | opts->ws = tp->rx_opt.rcv_wscale; | 486 | opts->ws = tp->rx_opt.rcv_wscale; |
487 | if(likely(opts->ws)) | 487 | if (likely(opts->ws)) |
488 | size += TCPOLEN_WSCALE_ALIGNED; | 488 | size += TCPOLEN_WSCALE_ALIGNED; |
489 | } | 489 | } |
490 | if (likely(sysctl_tcp_sack)) { | 490 | if (likely(sysctl_tcp_sack)) { |
@@ -526,7 +526,7 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
526 | 526 | ||
527 | if (likely(ireq->wscale_ok)) { | 527 | if (likely(ireq->wscale_ok)) { |
528 | opts->ws = ireq->rcv_wscale; | 528 | opts->ws = ireq->rcv_wscale; |
529 | if(likely(opts->ws)) | 529 | if (likely(opts->ws)) |
530 | size += TCPOLEN_WSCALE_ALIGNED; | 530 | size += TCPOLEN_WSCALE_ALIGNED; |
531 | } | 531 | } |
532 | if (likely(doing_ts)) { | 532 | if (likely(doing_ts)) { |
@@ -1172,7 +1172,7 @@ static int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, | |||
1172 | 1172 | ||
1173 | static inline int tcp_minshall_check(const struct tcp_sock *tp) | 1173 | static inline int tcp_minshall_check(const struct tcp_sock *tp) |
1174 | { | 1174 | { |
1175 | return after(tp->snd_sml,tp->snd_una) && | 1175 | return after(tp->snd_sml, tp->snd_una) && |
1176 | !after(tp->snd_sml, tp->snd_nxt); | 1176 | !after(tp->snd_sml, tp->snd_nxt); |
1177 | } | 1177 | } |
1178 | 1178 | ||