[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>
This commit is contained in:
committed by
David S. Miller
parent
ceb1eec829
commit
631a6698d0
@@ -54,12 +54,14 @@ static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
|
||||
int xfrm_nr = 0;
|
||||
int decaps = 0;
|
||||
int err = xfrm4_parse_spi(skb, ip_hdr(skb)->protocol, &spi, &seq);
|
||||
unsigned int nhoff = offsetof(struct iphdr, protocol);
|
||||
|
||||
if (err != 0)
|
||||
goto drop;
|
||||
|
||||
do {
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
int nexthdr;
|
||||
|
||||
if (xfrm_nr == XFRM_MAX_DEPTH)
|
||||
goto drop;
|
||||
@@ -82,9 +84,12 @@ static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
|
||||
if (xfrm_state_check_expire(x))
|
||||
goto drop_unlock;
|
||||
|
||||
if (x->type->input(x, skb))
|
||||
nexthdr = x->type->input(x, skb);
|
||||
if (nexthdr <= 0)
|
||||
goto drop_unlock;
|
||||
|
||||
skb_network_header(skb)[nhoff] = nexthdr;
|
||||
|
||||
/* only the first xfrm gets the encap type */
|
||||
encap_type = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user