diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-26 23:42:22 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:11:19 -0500 |
commit | 25995ff577675b58dbd848b7758e7bad87411947 (patch) | |
tree | 4d47595b01f8645552fa8af7b2be2019f133fefb /net/dccp | |
parent | ce1d4d3e88b3a69d23c3feb436a0b36b6ca0642b (diff) |
[SOCK]: Introduce sk_receive_skb
Its common enough to to justify that, TCP still can't use it as it has the
prequeueing stuff, still to be made generic in the not so distant future :-)
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ipv4.c | 23 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 17 |
2 files changed, 3 insertions, 37 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index c363051a7f16..99e8afa7ba1e 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -914,7 +914,6 @@ int dccp_v4_rcv(struct sk_buff *skb) | |||
914 | { | 914 | { |
915 | const struct dccp_hdr *dh; | 915 | const struct dccp_hdr *dh; |
916 | struct sock *sk; | 916 | struct sock *sk; |
917 | int rc; | ||
918 | 917 | ||
919 | /* Step 1: Check header basics: */ | 918 | /* Step 1: Check header basics: */ |
920 | 919 | ||
@@ -984,28 +983,10 @@ int dccp_v4_rcv(struct sk_buff *skb) | |||
984 | goto do_time_wait; | 983 | goto do_time_wait; |
985 | } | 984 | } |
986 | 985 | ||
987 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) { | 986 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) |
988 | dccp_pr_debug("xfrm4_policy_check failed\n"); | ||
989 | goto discard_and_relse; | 987 | goto discard_and_relse; |
990 | } | ||
991 | |||
992 | if (sk_filter(sk, skb, 0)) { | ||
993 | dccp_pr_debug("sk_filter failed\n"); | ||
994 | goto discard_and_relse; | ||
995 | } | ||
996 | |||
997 | skb->dev = NULL; | ||
998 | 988 | ||
999 | bh_lock_sock(sk); | 989 | return sk_receive_skb(sk, skb); |
1000 | rc = 0; | ||
1001 | if (!sock_owned_by_user(sk)) | ||
1002 | rc = dccp_v4_do_rcv(sk, skb); | ||
1003 | else | ||
1004 | sk_add_backlog(sk, skb); | ||
1005 | bh_unlock_sock(sk); | ||
1006 | |||
1007 | sock_put(sk); | ||
1008 | return rc; | ||
1009 | 990 | ||
1010 | no_dccp_socket: | 991 | no_dccp_socket: |
1011 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) | 992 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 599b0be21515..2e194c8f9953 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -1032,7 +1032,6 @@ static int dccp_v6_rcv(struct sk_buff **pskb, unsigned int *nhoffp) | |||
1032 | const struct dccp_hdr *dh; | 1032 | const struct dccp_hdr *dh; |
1033 | struct sk_buff *skb = *pskb; | 1033 | struct sk_buff *skb = *pskb; |
1034 | struct sock *sk; | 1034 | struct sock *sk; |
1035 | int rc; | ||
1036 | 1035 | ||
1037 | /* Step 1: Check header basics: */ | 1036 | /* Step 1: Check header basics: */ |
1038 | 1037 | ||
@@ -1077,21 +1076,7 @@ static int dccp_v6_rcv(struct sk_buff **pskb, unsigned int *nhoffp) | |||
1077 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) | 1076 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) |
1078 | goto discard_and_relse; | 1077 | goto discard_and_relse; |
1079 | 1078 | ||
1080 | if (sk_filter(sk, skb, 0)) | 1079 | return sk_receive_skb(sk, skb) ? -1 : 0; |
1081 | goto discard_and_relse; | ||
1082 | |||
1083 | skb->dev = NULL; | ||
1084 | |||
1085 | bh_lock_sock(sk); | ||
1086 | rc = 0; | ||
1087 | if (!sock_owned_by_user(sk)) | ||
1088 | rc = dccp_v6_do_rcv(sk, skb); | ||
1089 | else | ||
1090 | sk_add_backlog(sk, skb); | ||
1091 | bh_unlock_sock(sk); | ||
1092 | |||
1093 | sock_put(sk); | ||
1094 | return rc ? -1 : 0; | ||
1095 | 1080 | ||
1096 | no_dccp_socket: | 1081 | no_dccp_socket: |
1097 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) | 1082 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) |