diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2006-10-10 22:41:46 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-12 02:59:58 -0400 |
commit | 9469c7b4aa210ce94c6e7208cfadbd0aca0ebe08 (patch) | |
tree | 3461046e3c0a63577dc26d70246bac6892fe342c | |
parent | 496c98dff8e353880299168d36fa082d6fba5237 (diff) |
[NET]: Use typesafe inet_twsk() inline function instead of cast.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/dccp/ipv4.c | 6 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 6 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 16 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 11 |
4 files changed, 18 insertions, 21 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index bf692c1c116f..7e746c4c1688 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -311,7 +311,7 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info) | |||
311 | } | 311 | } |
312 | 312 | ||
313 | if (sk->sk_state == DCCP_TIME_WAIT) { | 313 | if (sk->sk_state == DCCP_TIME_WAIT) { |
314 | inet_twsk_put((struct inet_timewait_sock *)sk); | 314 | inet_twsk_put(inet_twsk(sk)); |
315 | return; | 315 | return; |
316 | } | 316 | } |
317 | 317 | ||
@@ -614,7 +614,7 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
614 | bh_lock_sock(nsk); | 614 | bh_lock_sock(nsk); |
615 | return nsk; | 615 | return nsk; |
616 | } | 616 | } |
617 | inet_twsk_put((struct inet_timewait_sock *)nsk); | 617 | inet_twsk_put(inet_twsk(nsk)); |
618 | return NULL; | 618 | return NULL; |
619 | } | 619 | } |
620 | 620 | ||
@@ -980,7 +980,7 @@ discard_and_relse: | |||
980 | goto discard_it; | 980 | goto discard_it; |
981 | 981 | ||
982 | do_time_wait: | 982 | do_time_wait: |
983 | inet_twsk_put((struct inet_timewait_sock *)sk); | 983 | inet_twsk_put(inet_twsk(sk)); |
984 | goto no_dccp_socket; | 984 | goto no_dccp_socket; |
985 | } | 985 | } |
986 | 986 | ||
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 7a47399cf31f..7171a78671aa 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -285,7 +285,7 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
285 | } | 285 | } |
286 | 286 | ||
287 | if (sk->sk_state == DCCP_TIME_WAIT) { | 287 | if (sk->sk_state == DCCP_TIME_WAIT) { |
288 | inet_twsk_put((struct inet_timewait_sock *)sk); | 288 | inet_twsk_put(inet_twsk(sk)); |
289 | return; | 289 | return; |
290 | } | 290 | } |
291 | 291 | ||
@@ -663,7 +663,7 @@ static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
663 | bh_lock_sock(nsk); | 663 | bh_lock_sock(nsk); |
664 | return nsk; | 664 | return nsk; |
665 | } | 665 | } |
666 | inet_twsk_put((struct inet_timewait_sock *)nsk); | 666 | inet_twsk_put(inet_twsk(nsk)); |
667 | return NULL; | 667 | return NULL; |
668 | } | 668 | } |
669 | 669 | ||
@@ -1109,7 +1109,7 @@ discard_and_relse: | |||
1109 | goto discard_it; | 1109 | goto discard_it; |
1110 | 1110 | ||
1111 | do_time_wait: | 1111 | do_time_wait: |
1112 | inet_twsk_put((struct inet_timewait_sock *)sk); | 1112 | inet_twsk_put(inet_twsk(sk)); |
1113 | goto no_dccp_socket; | 1113 | goto no_dccp_socket; |
1114 | } | 1114 | } |
1115 | 1115 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f745095196f7..6bbd98575172 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -355,7 +355,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info) | |||
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | if (sk->sk_state == TCP_TIME_WAIT) { | 357 | if (sk->sk_state == TCP_TIME_WAIT) { |
358 | inet_twsk_put((struct inet_timewait_sock *)sk); | 358 | inet_twsk_put(inet_twsk(sk)); |
359 | return; | 359 | return; |
360 | } | 360 | } |
361 | 361 | ||
@@ -960,7 +960,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
960 | bh_lock_sock(nsk); | 960 | bh_lock_sock(nsk); |
961 | return nsk; | 961 | return nsk; |
962 | } | 962 | } |
963 | inet_twsk_put((struct inet_timewait_sock *)nsk); | 963 | inet_twsk_put(inet_twsk(nsk)); |
964 | return NULL; | 964 | return NULL; |
965 | } | 965 | } |
966 | 966 | ||
@@ -1154,26 +1154,24 @@ discard_and_relse: | |||
1154 | 1154 | ||
1155 | do_time_wait: | 1155 | do_time_wait: |
1156 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 1156 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
1157 | inet_twsk_put((struct inet_timewait_sock *) sk); | 1157 | inet_twsk_put(inet_twsk(sk)); |
1158 | goto discard_it; | 1158 | goto discard_it; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) { | 1161 | if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) { |
1162 | TCP_INC_STATS_BH(TCP_MIB_INERRS); | 1162 | TCP_INC_STATS_BH(TCP_MIB_INERRS); |
1163 | inet_twsk_put((struct inet_timewait_sock *) sk); | 1163 | inet_twsk_put(inet_twsk(sk)); |
1164 | goto discard_it; | 1164 | goto discard_it; |
1165 | } | 1165 | } |
1166 | switch (tcp_timewait_state_process((struct inet_timewait_sock *)sk, | 1166 | switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) { |
1167 | skb, th)) { | ||
1168 | case TCP_TW_SYN: { | 1167 | case TCP_TW_SYN: { |
1169 | struct sock *sk2 = inet_lookup_listener(&tcp_hashinfo, | 1168 | struct sock *sk2 = inet_lookup_listener(&tcp_hashinfo, |
1170 | skb->nh.iph->daddr, | 1169 | skb->nh.iph->daddr, |
1171 | th->dest, | 1170 | th->dest, |
1172 | inet_iif(skb)); | 1171 | inet_iif(skb)); |
1173 | if (sk2) { | 1172 | if (sk2) { |
1174 | inet_twsk_deschedule((struct inet_timewait_sock *)sk, | 1173 | inet_twsk_deschedule(inet_twsk(sk), &tcp_death_row); |
1175 | &tcp_death_row); | 1174 | inet_twsk_put(inet_twsk(sk)); |
1176 | inet_twsk_put((struct inet_timewait_sock *)sk); | ||
1177 | sk = sk2; | 1175 | sk = sk2; |
1178 | goto process; | 1176 | goto process; |
1179 | } | 1177 | } |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 34e004bdeab0..4c2a7c0cafef 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -329,7 +329,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
329 | } | 329 | } |
330 | 330 | ||
331 | if (sk->sk_state == TCP_TIME_WAIT) { | 331 | if (sk->sk_state == TCP_TIME_WAIT) { |
332 | inet_twsk_put((struct inet_timewait_sock *)sk); | 332 | inet_twsk_put(inet_twsk(sk)); |
333 | return; | 333 | return; |
334 | } | 334 | } |
335 | 335 | ||
@@ -749,7 +749,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
749 | bh_lock_sock(nsk); | 749 | bh_lock_sock(nsk); |
750 | return nsk; | 750 | return nsk; |
751 | } | 751 | } |
752 | inet_twsk_put((struct inet_timewait_sock *)nsk); | 752 | inet_twsk_put(inet_twsk(nsk)); |
753 | return NULL; | 753 | return NULL; |
754 | } | 754 | } |
755 | 755 | ||
@@ -1283,18 +1283,17 @@ discard_and_relse: | |||
1283 | 1283 | ||
1284 | do_time_wait: | 1284 | do_time_wait: |
1285 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 1285 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
1286 | inet_twsk_put((struct inet_timewait_sock *)sk); | 1286 | inet_twsk_put(inet_twsk(sk)); |
1287 | goto discard_it; | 1287 | goto discard_it; |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | if (skb->len < (th->doff<<2) || tcp_checksum_complete(skb)) { | 1290 | if (skb->len < (th->doff<<2) || tcp_checksum_complete(skb)) { |
1291 | TCP_INC_STATS_BH(TCP_MIB_INERRS); | 1291 | TCP_INC_STATS_BH(TCP_MIB_INERRS); |
1292 | inet_twsk_put((struct inet_timewait_sock *)sk); | 1292 | inet_twsk_put(inet_twsk(sk)); |
1293 | goto discard_it; | 1293 | goto discard_it; |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | switch (tcp_timewait_state_process((struct inet_timewait_sock *)sk, | 1296 | switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) { |
1297 | skb, th)) { | ||
1298 | case TCP_TW_SYN: | 1297 | case TCP_TW_SYN: |
1299 | { | 1298 | { |
1300 | struct sock *sk2; | 1299 | struct sock *sk2; |