aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-02-09 09:24:49 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-11 02:19:42 -0500
commit1ab1457c42bc078e5a9becd82a7f9f940b55c53a (patch)
treec25d27c58fb27f4c5930ad120995cc2e3f1e7a4f /net/ipv6/tcp_ipv6.c
parente905a9edab7f4f14f9213b52234e4a346c690911 (diff)
[NET] IPV6: 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/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index dcb7b00a737d..f57a9baa6b27 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1,13 +1,13 @@
1/* 1/*
2 * TCP over IPv6 2 * TCP over IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: tcp_ipv6.c,v 1.144 2002/02/01 22:01:04 davem Exp $ 8 * $Id: tcp_ipv6.c,v 1.144 2002/02/01 22:01:04 davem Exp $
9 * 9 *
10 * Based on: 10 * Based on:
11 * linux/net/ipv4/tcp.c 11 * linux/net/ipv4/tcp.c
12 * linux/net/ipv4/tcp_input.c 12 * linux/net/ipv4/tcp_input.c
13 * linux/net/ipv4/tcp_output.c 13 * linux/net/ipv4/tcp_output.c
@@ -74,7 +74,7 @@ static struct socket *tcp6_socket;
74 74
75static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb); 75static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
76static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); 76static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);
77static void tcp_v6_send_check(struct sock *sk, int len, 77static void tcp_v6_send_check(struct sock *sk, int len,
78 struct sk_buff *skb); 78 struct sk_buff *skb);
79 79
80static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); 80static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb);
@@ -106,8 +106,8 @@ static void tcp_v6_hash(struct sock *sk)
106} 106}
107 107
108static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len, 108static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len,
109 struct in6_addr *saddr, 109 struct in6_addr *saddr,
110 struct in6_addr *daddr, 110 struct in6_addr *daddr,
111 __wsum base) 111 __wsum base)
112{ 112{
113 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); 113 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
@@ -121,11 +121,11 @@ static __u32 tcp_v6_init_sequence(struct sk_buff *skb)
121 skb->h.th->source); 121 skb->h.th->source);
122} 122}
123 123
124static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, 124static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
125 int addr_len) 125 int addr_len)
126{ 126{
127 struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; 127 struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
128 struct inet_sock *inet = inet_sk(sk); 128 struct inet_sock *inet = inet_sk(sk);
129 struct inet_connection_sock *icsk = inet_csk(sk); 129 struct inet_connection_sock *icsk = inet_csk(sk);
130 struct ipv6_pinfo *np = inet6_sk(sk); 130 struct ipv6_pinfo *np = inet6_sk(sk);
131 struct tcp_sock *tp = tcp_sk(sk); 131 struct tcp_sock *tp = tcp_sk(sk);
@@ -135,10 +135,10 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
135 int addr_type; 135 int addr_type;
136 int err; 136 int err;
137 137
138 if (addr_len < SIN6_LEN_RFC2133) 138 if (addr_len < SIN6_LEN_RFC2133)
139 return -EINVAL; 139 return -EINVAL;
140 140
141 if (usin->sin6_family != AF_INET6) 141 if (usin->sin6_family != AF_INET6)
142 return(-EAFNOSUPPORT); 142 return(-EAFNOSUPPORT);
143 143
144 memset(&fl, 0, sizeof(fl)); 144 memset(&fl, 0, sizeof(fl));
@@ -157,11 +157,11 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
157 } 157 }
158 158
159 /* 159 /*
160 * connect() to INADDR_ANY means loopback (BSD'ism). 160 * connect() to INADDR_ANY means loopback (BSD'ism).
161 */ 161 */
162 162
163 if(ipv6_addr_any(&usin->sin6_addr)) 163 if(ipv6_addr_any(&usin->sin6_addr))
164 usin->sin6_addr.s6_addr[15] = 0x1; 164 usin->sin6_addr.s6_addr[15] = 0x1;
165 165
166 addr_type = ipv6_addr_type(&usin->sin6_addr); 166 addr_type = ipv6_addr_type(&usin->sin6_addr);
167 167
@@ -323,7 +323,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
323 struct ipv6_pinfo *np; 323 struct ipv6_pinfo *np;
324 struct sock *sk; 324 struct sock *sk;
325 int err; 325 int err;
326 struct tcp_sock *tp; 326 struct tcp_sock *tp;
327 __u32 seq; 327 __u32 seq;
328 328
329 sk = inet6_lookup(&tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr, 329 sk = inet6_lookup(&tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr,
@@ -347,7 +347,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
347 goto out; 347 goto out;
348 348
349 tp = tcp_sk(sk); 349 tp = tcp_sk(sk);
350 seq = ntohl(th->seq); 350 seq = ntohl(th->seq);
351 if (sk->sk_state != TCP_LISTEN && 351 if (sk->sk_state != TCP_LISTEN &&
352 !between(seq, tp->snd_una, tp->snd_nxt)) { 352 !between(seq, tp->snd_una, tp->snd_nxt)) {
353 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); 353 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
@@ -434,7 +434,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
434 434
435 case TCP_SYN_SENT: 435 case TCP_SYN_SENT:
436 case TCP_SYN_RECV: /* Cannot happen. 436 case TCP_SYN_RECV: /* Cannot happen.
437 It can, it SYNs are crossed. --ANK */ 437 It can, it SYNs are crossed. --ANK */
438 if (!sock_owned_by_user(sk)) { 438 if (!sock_owned_by_user(sk)) {
439 sk->sk_err = err; 439 sk->sk_err = err;
440 sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ 440 sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */
@@ -519,7 +519,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
519 } 519 }
520 520
521done: 521done:
522 if (opt && opt != np->opt) 522 if (opt && opt != np->opt)
523 sock_kfree_s(sk, opt, opt->tot_len); 523 sock_kfree_s(sk, opt, opt->tot_len);
524 dst_release(dst); 524 dst_release(dst);
525 return err; 525 return err;
@@ -950,8 +950,8 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
950 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); 950 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0);
951 skb->csum_offset = offsetof(struct tcphdr, check); 951 skb->csum_offset = offsetof(struct tcphdr, check);
952 } else { 952 } else {
953 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 953 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP,
954 csum_partial((char *)th, th->doff<<2, 954 csum_partial((char *)th, th->doff<<2,
955 skb->csum)); 955 skb->csum));
956 } 956 }
957} 957}
@@ -977,7 +977,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
977 977
978static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) 978static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
979{ 979{
980 struct tcphdr *th = skb->h.th, *t1; 980 struct tcphdr *th = skb->h.th, *t1;
981 struct sk_buff *buff; 981 struct sk_buff *buff;
982 struct flowi fl; 982 struct flowi fl;
983 int tot_len = sizeof(*th); 983 int tot_len = sizeof(*th);
@@ -989,7 +989,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
989 return; 989 return;
990 990
991 if (!ipv6_unicast_destination(skb)) 991 if (!ipv6_unicast_destination(skb))
992 return; 992 return;
993 993
994#ifdef CONFIG_TCP_MD5SIG 994#ifdef CONFIG_TCP_MD5SIG
995 if (sk) 995 if (sk)
@@ -1008,8 +1008,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
1008 1008
1009 buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len, 1009 buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
1010 GFP_ATOMIC); 1010 GFP_ATOMIC);
1011 if (buff == NULL) 1011 if (buff == NULL)
1012 return; 1012 return;
1013 1013
1014 skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); 1014 skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len);
1015 1015
@@ -1021,9 +1021,9 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
1021 t1->source = th->dest; 1021 t1->source = th->dest;
1022 t1->doff = tot_len / 4; 1022 t1->doff = tot_len / 4;
1023 t1->rst = 1; 1023 t1->rst = 1;
1024 1024
1025 if(th->ack) { 1025 if(th->ack) {
1026 t1->seq = th->ack_seq; 1026 t1->seq = th->ack_seq;
1027 } else { 1027 } else {
1028 t1->ack = 1; 1028 t1->ack = 1;
1029 t1->ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin 1029 t1->ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin
@@ -1128,7 +1128,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
1128 t1->window = htons(win); 1128 t1->window = htons(win);
1129 1129
1130 topt = (__be32 *)(t1 + 1); 1130 topt = (__be32 *)(t1 + 1);
1131 1131
1132 if (ts) { 1132 if (ts) {
1133 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 1133 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1134 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); 1134 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
@@ -1243,15 +1243,15 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1243 return tcp_v4_conn_request(sk, skb); 1243 return tcp_v4_conn_request(sk, skb);
1244 1244
1245 if (!ipv6_unicast_destination(skb)) 1245 if (!ipv6_unicast_destination(skb))
1246 goto drop; 1246 goto drop;
1247 1247
1248 /* 1248 /*
1249 * There are no SYN attacks on IPv6, yet... 1249 * There are no SYN attacks on IPv6, yet...
1250 */ 1250 */
1251 if (inet_csk_reqsk_queue_is_full(sk) && !isn) { 1251 if (inet_csk_reqsk_queue_is_full(sk) && !isn) {
1252 if (net_ratelimit()) 1252 if (net_ratelimit())
1253 printk(KERN_INFO "TCPv6: dropping request, synflood is possible\n"); 1253 printk(KERN_INFO "TCPv6: dropping request, synflood is possible\n");
1254 goto drop; 1254 goto drop;
1255 } 1255 }
1256 1256
1257 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) 1257 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
@@ -1292,7 +1292,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1292 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) 1292 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL)
1293 treq->iif = inet6_iif(skb); 1293 treq->iif = inet6_iif(skb);
1294 1294
1295 if (isn == 0) 1295 if (isn == 0)
1296 isn = tcp_v6_init_sequence(skb); 1296 isn = tcp_v6_init_sequence(skb);
1297 1297
1298 tcp_rsk(req)->snt_isn = isn; 1298 tcp_rsk(req)->snt_isn = isn;
@@ -1334,7 +1334,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1334 1334
1335 newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst); 1335 newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst);
1336 1336
1337 if (newsk == NULL) 1337 if (newsk == NULL)
1338 return NULL; 1338 return NULL;
1339 1339
1340 newtcp6sk = (struct tcp6_sock *)newsk; 1340 newtcp6sk = (struct tcp6_sock *)newsk;
@@ -1419,7 +1419,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1419 1419
1420 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0) 1420 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0)
1421 goto out; 1421 goto out;
1422 } 1422 }
1423 1423
1424 newsk = tcp_create_openreq_child(sk, req, skb); 1424 newsk = tcp_create_openreq_child(sk, req, skb);
1425 if (newsk == NULL) 1425 if (newsk == NULL)
@@ -1448,7 +1448,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1448 ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr); 1448 ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr);
1449 newsk->sk_bound_dev_if = treq->iif; 1449 newsk->sk_bound_dev_if = treq->iif;
1450 1450
1451 /* Now IPv6 options... 1451 /* Now IPv6 options...
1452 1452
1453 First: no IPv4 options. 1453 First: no IPv4 options.
1454 */ 1454 */
@@ -1592,7 +1592,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1592 looks not very well thought. For now we latch 1592 looks not very well thought. For now we latch
1593 options, received in the last packet, enqueued 1593 options, received in the last packet, enqueued
1594 by tcp. Feel free to propose better solution. 1594 by tcp. Feel free to propose better solution.
1595 --ANK (980728) 1595 --ANK (980728)
1596 */ 1596 */
1597 if (np->rxopt.all) 1597 if (np->rxopt.all)
1598 opt_skb = skb_clone(skb, GFP_ATOMIC); 1598 opt_skb = skb_clone(skb, GFP_ATOMIC);
@@ -1610,7 +1610,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1610 if (skb->len < (skb->h.th->doff<<2) || tcp_checksum_complete(skb)) 1610 if (skb->len < (skb->h.th->doff<<2) || tcp_checksum_complete(skb))
1611 goto csum_err; 1611 goto csum_err;
1612 1612
1613 if (sk->sk_state == TCP_LISTEN) { 1613 if (sk->sk_state == TCP_LISTEN) {
1614 struct sock *nsk = tcp_v6_hnd_req(sk, skb); 1614 struct sock *nsk = tcp_v6_hnd_req(sk, skb);
1615 if (!nsk) 1615 if (!nsk)
1616 goto discard; 1616 goto discard;
@@ -1620,7 +1620,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1620 * otherwise we just shortcircuit this and continue with 1620 * otherwise we just shortcircuit this and continue with
1621 * the new socket.. 1621 * the new socket..
1622 */ 1622 */
1623 if(nsk != sk) { 1623 if(nsk != sk) {
1624 if (tcp_child_process(sk, nsk, skb)) 1624 if (tcp_child_process(sk, nsk, skb))
1625 goto reset; 1625 goto reset;
1626 if (opt_skb) 1626 if (opt_skb)
@@ -1681,7 +1681,7 @@ ipv6_pktoptions:
1681static int tcp_v6_rcv(struct sk_buff **pskb) 1681static int tcp_v6_rcv(struct sk_buff **pskb)
1682{ 1682{
1683 struct sk_buff *skb = *pskb; 1683 struct sk_buff *skb = *pskb;
1684 struct tcphdr *th; 1684 struct tcphdr *th;
1685 struct sock *sk; 1685 struct sock *sk;
1686 int ret; 1686 int ret;
1687 1687
@@ -1739,10 +1739,10 @@ process:
1739 ret = 0; 1739 ret = 0;
1740 if (!sock_owned_by_user(sk)) { 1740 if (!sock_owned_by_user(sk)) {
1741#ifdef CONFIG_NET_DMA 1741#ifdef CONFIG_NET_DMA
1742 struct tcp_sock *tp = tcp_sk(sk); 1742 struct tcp_sock *tp = tcp_sk(sk);
1743 if (tp->ucopy.dma_chan) 1743 if (tp->ucopy.dma_chan)
1744 ret = tcp_v6_do_rcv(sk, skb); 1744 ret = tcp_v6_do_rcv(sk, skb);
1745 else 1745 else
1746#endif 1746#endif
1747 { 1747 {
1748 if (!tcp_prequeue(sk, skb)) 1748 if (!tcp_prequeue(sk, skb))
@@ -1945,7 +1945,7 @@ static int tcp_v6_destroy_sock(struct sock *sk)
1945} 1945}
1946 1946
1947/* Proc filesystem TCPv6 sock list dumping. */ 1947/* Proc filesystem TCPv6 sock list dumping. */
1948static void get_openreq6(struct seq_file *seq, 1948static void get_openreq6(struct seq_file *seq,
1949 struct sock *sk, struct request_sock *req, int i, int uid) 1949 struct sock *sk, struct request_sock *req, int i, int uid)
1950{ 1950{
1951 int ttd = req->expires - jiffies; 1951 int ttd = req->expires - jiffies;
@@ -1967,11 +1967,11 @@ static void get_openreq6(struct seq_file *seq,
1967 ntohs(inet_rsk(req)->rmt_port), 1967 ntohs(inet_rsk(req)->rmt_port),
1968 TCP_SYN_RECV, 1968 TCP_SYN_RECV,
1969 0,0, /* could print option size, but that is af dependent. */ 1969 0,0, /* could print option size, but that is af dependent. */
1970 1, /* timers active (only the expire timer) */ 1970 1, /* timers active (only the expire timer) */
1971 jiffies_to_clock_t(ttd), 1971 jiffies_to_clock_t(ttd),
1972 req->retrans, 1972 req->retrans,
1973 uid, 1973 uid,
1974 0, /* non standard timer */ 1974 0, /* non standard timer */
1975 0, /* open_requests have no inode */ 1975 0, /* open_requests have no inode */
1976 0, req); 1976 0, req);
1977} 1977}
@@ -2014,7 +2014,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
2014 src->s6_addr32[2], src->s6_addr32[3], srcp, 2014 src->s6_addr32[2], src->s6_addr32[3], srcp,
2015 dest->s6_addr32[0], dest->s6_addr32[1], 2015 dest->s6_addr32[0], dest->s6_addr32[1],
2016 dest->s6_addr32[2], dest->s6_addr32[3], destp, 2016 dest->s6_addr32[2], dest->s6_addr32[3], destp,
2017 sp->sk_state, 2017 sp->sk_state,
2018 tp->write_seq-tp->snd_una, 2018 tp->write_seq-tp->snd_una,
2019 (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), 2019 (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq),
2020 timer_active, 2020 timer_active,
@@ -2031,7 +2031,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
2031 ); 2031 );
2032} 2032}
2033 2033
2034static void get_timewait6_sock(struct seq_file *seq, 2034static void get_timewait6_sock(struct seq_file *seq,
2035 struct inet_timewait_sock *tw, int i) 2035 struct inet_timewait_sock *tw, int i)
2036{ 2036{
2037 struct in6_addr *dest, *src; 2037 struct in6_addr *dest, *src;