Skip to content

Commit

Permalink
[IPSEC]: Fix transport-mode async resume on intput without netfilter
Browse files Browse the repository at this point in the history
When netfilter is off the transport-mode async resumption doesn't work
because we don't push back the IP header.  This patch fixes that by
moving most of the code outside of ifdef NETFILTER since the only part
that's not common is the short-circuit in the protocol handler.

Signed-off-by: Herbert Xu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
herbertx authored and davem330 committed Jan 28, 2008
1 parent fcb8c15 commit 0883ae0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 5 additions & 7 deletions net/ipv4/xfrm4_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,18 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async)

iph->protocol = XFRM_MODE_SKB_CB(skb)->protocol;

#ifdef CONFIG_NETFILTER
#ifndef CONFIG_NETFILTER
if (!async)
return -iph->protocol;
#endif

__skb_push(skb, skb->data - skb_network_header(skb));
iph->tot_len = htons(skb->len);
ip_send_check(iph);

NF_HOOK(PF_INET, NF_INET_PRE_ROUTING, skb, skb->dev, NULL,
xfrm4_rcv_encap_finish);
return 0;
#else
if (async)
return xfrm4_rcv_encap_finish(skb);

return -iph->protocol;
#endif
}

/* If it's a keepalive packet, then just eat it.
Expand Down
12 changes: 5 additions & 7 deletions net/ipv6/xfrm6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,17 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async)
skb_network_header(skb)[IP6CB(skb)->nhoff] =
XFRM_MODE_SKB_CB(skb)->protocol;

#ifdef CONFIG_NETFILTER
#ifndef CONFIG_NETFILTER
if (!async)
return 1;
#endif

ipv6_hdr(skb)->payload_len = htons(skb->len);
__skb_push(skb, skb->data - skb_network_header(skb));

NF_HOOK(PF_INET6, NF_INET_PRE_ROUTING, skb, skb->dev, NULL,
ip6_rcv_finish);
return -1;
#else
if (async)
return ip6_rcv_finish(skb);

return 1;
#endif
}

int xfrm6_rcv(struct sk_buff *skb)
Expand Down

0 comments on commit 0883ae0

Please sign in to comment.