diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-10 08:46:34 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:56 -0500 |
commit | d23c7107bfbaac955289685c522c7ff99dad3780 (patch) | |
tree | 9926a1d0275bd6cf7e05eb4bbceb03f1dabceacd /net/dccp | |
parent | 9b42078ed6edfe04e9dc9a59b946ad912aeef717 (diff) |
[DCCP]: Simplify jump labels in dccp_v{4,6}_rcv
This is a code simplification and was singled out from the
DCCPv6 Oops patch on
http://www.mail-archive.com/dccp@vger.kernel.org/msg00600.html
It mainly makes the code consistent between ipv{4,6}.c for the functions
dccp_v4_rcv
dccp_v6_rcv
and removes the do_time_wait label to simplify code somewhat.
Commiter note: fixed up a compile problem, trivial.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ipv4.c | 15 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 22 |
2 files changed, 14 insertions, 23 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index ce8eed32dbeb..7107885ada7e 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -910,8 +910,7 @@ static int dccp_v4_rcv(struct sk_buff *skb) | |||
910 | dccp_pr_debug_cat("\n"); | 910 | dccp_pr_debug_cat("\n"); |
911 | } else { | 911 | } else { |
912 | DCCP_SKB_CB(skb)->dccpd_ack_seq = dccp_hdr_ack_seq(skb); | 912 | DCCP_SKB_CB(skb)->dccpd_ack_seq = dccp_hdr_ack_seq(skb); |
913 | dccp_pr_debug_cat(", ack=%llu\n", | 913 | dccp_pr_debug_cat(", ack=%llu\n", (unsigned long long) |
914 | (unsigned long long) | ||
915 | DCCP_SKB_CB(skb)->dccpd_ack_seq); | 914 | DCCP_SKB_CB(skb)->dccpd_ack_seq); |
916 | } | 915 | } |
917 | 916 | ||
@@ -940,11 +939,10 @@ static int dccp_v4_rcv(struct sk_buff *skb) | |||
940 | * Generate Reset(No Connection) unless P.type == Reset | 939 | * Generate Reset(No Connection) unless P.type == Reset |
941 | * Drop packet and return | 940 | * Drop packet and return |
942 | */ | 941 | */ |
943 | |||
944 | if (sk->sk_state == DCCP_TIME_WAIT) { | 942 | if (sk->sk_state == DCCP_TIME_WAIT) { |
945 | dccp_pr_debug("sk->sk_state == DCCP_TIME_WAIT: " | 943 | dccp_pr_debug("sk->sk_state == DCCP_TIME_WAIT: do_time_wait\n"); |
946 | "do_time_wait\n"); | 944 | inet_twsk_put(inet_twsk(sk)); |
947 | goto do_time_wait; | 945 | goto no_dccp_socket; |
948 | } | 946 | } |
949 | 947 | ||
950 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) | 948 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) |
@@ -968,17 +966,12 @@ no_dccp_socket: | |||
968 | } | 966 | } |
969 | 967 | ||
970 | discard_it: | 968 | discard_it: |
971 | /* Discard frame. */ | ||
972 | kfree_skb(skb); | 969 | kfree_skb(skb); |
973 | return 0; | 970 | return 0; |
974 | 971 | ||
975 | discard_and_relse: | 972 | discard_and_relse: |
976 | sock_put(sk); | 973 | sock_put(sk); |
977 | goto discard_it; | 974 | goto discard_it; |
978 | |||
979 | do_time_wait: | ||
980 | inet_twsk_put(inet_twsk(sk)); | ||
981 | goto no_dccp_socket; | ||
982 | } | 975 | } |
983 | 976 | ||
984 | static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { | 977 | static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 116bddb64b80..dee085301576 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -1071,8 +1071,11 @@ static int dccp_v6_rcv(struct sk_buff **pskb) | |||
1071 | * Generate Reset(No Connection) unless P.type == Reset | 1071 | * Generate Reset(No Connection) unless P.type == Reset |
1072 | * Drop packet and return | 1072 | * Drop packet and return |
1073 | */ | 1073 | */ |
1074 | if (sk == NULL) | 1074 | if (sk == NULL) { |
1075 | dccp_pr_debug("failed to look up flow ID in table and " | ||
1076 | "get corresponding socket\n"); | ||
1075 | goto no_dccp_socket; | 1077 | goto no_dccp_socket; |
1078 | } | ||
1076 | 1079 | ||
1077 | /* | 1080 | /* |
1078 | * Step 2: | 1081 | * Step 2: |
@@ -1080,8 +1083,11 @@ static int dccp_v6_rcv(struct sk_buff **pskb) | |||
1080 | * Generate Reset(No Connection) unless P.type == Reset | 1083 | * Generate Reset(No Connection) unless P.type == Reset |
1081 | * Drop packet and return | 1084 | * Drop packet and return |
1082 | */ | 1085 | */ |
1083 | if (sk->sk_state == DCCP_TIME_WAIT) | 1086 | if (sk->sk_state == DCCP_TIME_WAIT) { |
1084 | goto do_time_wait; | 1087 | dccp_pr_debug("sk->sk_state == DCCP_TIME_WAIT: do_time_wait\n"); |
1088 | inet_twsk_put(inet_twsk(sk)); | ||
1089 | goto no_dccp_socket; | ||
1090 | } | ||
1085 | 1091 | ||
1086 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) | 1092 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) |
1087 | goto discard_and_relse; | 1093 | goto discard_and_relse; |
@@ -1101,22 +1107,14 @@ no_dccp_socket: | |||
1101 | DCCP_RESET_CODE_NO_CONNECTION; | 1107 | DCCP_RESET_CODE_NO_CONNECTION; |
1102 | dccp_v6_ctl_send_reset(skb); | 1108 | dccp_v6_ctl_send_reset(skb); |
1103 | } | 1109 | } |
1104 | discard_it: | ||
1105 | |||
1106 | /* | ||
1107 | * Discard frame | ||
1108 | */ | ||
1109 | 1110 | ||
1111 | discard_it: | ||
1110 | kfree_skb(skb); | 1112 | kfree_skb(skb); |
1111 | return 0; | 1113 | return 0; |
1112 | 1114 | ||
1113 | discard_and_relse: | 1115 | discard_and_relse: |
1114 | sock_put(sk); | 1116 | sock_put(sk); |
1115 | goto discard_it; | 1117 | goto discard_it; |
1116 | |||
1117 | do_time_wait: | ||
1118 | inet_twsk_put(inet_twsk(sk)); | ||
1119 | goto no_dccp_socket; | ||
1120 | } | 1118 | } |
1121 | 1119 | ||
1122 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = { | 1120 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = { |