aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/xfrm4_input.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-10-10 18:46:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:56 -0400
commit631a6698d09e57cadc069914d613899609a0ae83 (patch)
tree7e915991e7dea60077e2f160908820c90e34fb18 /net/ipv4/xfrm4_input.c
parentceb1eec8291175686d0208e66595ff83bc0624e2 (diff)
[IPSEC]: Move IP protocol setting from transforms into xfrm4_input.c
This patch makes the IPv4 x->type->input functions return the next protocol instead of setting it directly. This is identical to how we do things in IPv6 and will help us merge common code on the input path. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/xfrm4_input.c')
-rw-r--r--net/ipv4/xfrm4_input.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 2fa108245413..e9bbfde19ac3 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -54,12 +54,14 @@ static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
54 int xfrm_nr = 0; 54 int xfrm_nr = 0;
55 int decaps = 0; 55 int decaps = 0;
56 int err = xfrm4_parse_spi(skb, ip_hdr(skb)->protocol, &spi, &seq); 56 int err = xfrm4_parse_spi(skb, ip_hdr(skb)->protocol, &spi, &seq);
57 unsigned int nhoff = offsetof(struct iphdr, protocol);
57 58
58 if (err != 0) 59 if (err != 0)
59 goto drop; 60 goto drop;
60 61
61 do { 62 do {
62 const struct iphdr *iph = ip_hdr(skb); 63 const struct iphdr *iph = ip_hdr(skb);
64 int nexthdr;
63 65
64 if (xfrm_nr == XFRM_MAX_DEPTH) 66 if (xfrm_nr == XFRM_MAX_DEPTH)
65 goto drop; 67 goto drop;
@@ -82,9 +84,12 @@ static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
82 if (xfrm_state_check_expire(x)) 84 if (xfrm_state_check_expire(x))
83 goto drop_unlock; 85 goto drop_unlock;
84 86
85 if (x->type->input(x, skb)) 87 nexthdr = x->type->input(x, skb);
88 if (nexthdr <= 0)
86 goto drop_unlock; 89 goto drop_unlock;
87 90
91 skb_network_header(skb)[nhoff] = nexthdr;
92
88 /* only the first xfrm gets the encap type */ 93 /* only the first xfrm gets the encap type */
89 encap_type = 0; 94 encap_type = 0;
90 95