Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78112
b: refs/heads/master
c: 60d5fcf
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jan 28, 2008
1 parent a50e774 commit eec218c
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d26f398400311982d2433debae85746c348b7d58
refs/heads/master: 60d5fcfb19d8a958fc563e52240cd05ec23f36c9
1 change: 0 additions & 1 deletion trunk/include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ struct xfrm_spi_skb_cb {
struct inet6_skb_parm h6;
} header;

unsigned int nhoff;
unsigned int daddroff;
};

Expand Down
13 changes: 7 additions & 6 deletions trunk/net/ipv4/xfrm4_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb)
return xfrm4_extract_header(skb);
}

#ifdef CONFIG_NETFILTER
static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb)
{
if (skb->dst == NULL) {
Expand All @@ -36,29 +35,31 @@ static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb)
kfree_skb(skb);
return NET_RX_DROP;
}
#endif

int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
int encap_type)
{
XFRM_SPI_SKB_CB(skb)->nhoff = offsetof(struct iphdr, protocol);
XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
return xfrm_input(skb, nexthdr, spi, encap_type);
}
EXPORT_SYMBOL(xfrm4_rcv_encap);

int xfrm4_transport_finish(struct sk_buff *skb, int async)
{
struct iphdr *iph = ip_hdr(skb);

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

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

NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL,
xfrm4_rcv_encap_finish);
return 0;
#else
return -ip_hdr(skb)->protocol;
return -iph->protocol;
#endif
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/net/ipv4/xfrm4_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb)
if (err)
return err;

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

return xfrm4_extract_header(skb);
}

Expand Down
1 change: 0 additions & 1 deletion trunk/net/ipv4/xfrm4_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ int xfrm4_extract_header(struct sk_buff *skb)
XFRM_MODE_SKB_CB(skb)->frag_off = iph->frag_off;
XFRM_MODE_SKB_CB(skb)->tos = iph->tos;
XFRM_MODE_SKB_CB(skb)->ttl = iph->ttl;
XFRM_MODE_SKB_CB(skb)->protocol = iph->protocol;
memset(XFRM_MODE_SKB_CB(skb)->flow_lbl, 0,
sizeof(XFRM_MODE_SKB_CB(skb)->flow_lbl));

Expand Down
4 changes: 3 additions & 1 deletion trunk/net/ipv6/xfrm6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb)

int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
{
XFRM_SPI_SKB_CB(skb)->nhoff = IP6CB(skb)->nhoff;
XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr);
return xfrm_input(skb, nexthdr, spi, 0);
}
EXPORT_SYMBOL(xfrm6_rcv_spi);

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
ipv6_hdr(skb)->payload_len = htons(skb->len);
__skb_push(skb, skb->data - skb_network_header(skb));
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/ipv6/xfrm6_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb)
if (err)
return err;

IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
XFRM_MODE_SKB_CB(skb)->protocol = ipv6_hdr(skb)->nexthdr;

return xfrm6_extract_header(skb);
}

Expand Down
2 changes: 0 additions & 2 deletions trunk/net/ipv6/xfrm6_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ int xfrm6_extract_header(struct sk_buff *skb)
XFRM_MODE_SKB_CB(skb)->frag_off = htons(IP_DF);
XFRM_MODE_SKB_CB(skb)->tos = ipv6_get_dsfield(iph);
XFRM_MODE_SKB_CB(skb)->ttl = iph->hop_limit;
XFRM_MODE_SKB_CB(skb)->protocol =
skb_network_header(skb)[IP6CB(skb)->nhoff];
memcpy(XFRM_MODE_SKB_CB(skb)->flow_lbl, iph->flow_lbl,
sizeof(XFRM_MODE_SKB_CB(skb)->flow_lbl));

Expand Down
5 changes: 2 additions & 3 deletions trunk/net/xfrm/xfrm_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
__be32 seq;
struct xfrm_state *x;
int decaps = 0;
unsigned int nhoff = XFRM_SPI_SKB_CB(skb)->nhoff;
unsigned int daddroff = XFRM_SPI_SKB_CB(skb)->daddroff;

/* Allocate new secpath or COW existing one. */
Expand Down Expand Up @@ -157,8 +156,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
goto drop_unlock;
}

skb_network_header(skb)[nhoff] = nexthdr;

/* only the first xfrm gets the encap type */
encap_type = 0;

Expand All @@ -170,6 +167,8 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)

spin_unlock(&x->lock);

XFRM_MODE_SKB_CB(skb)->protocol = nexthdr;

if (x->inner_mode->input(x, skb))
goto drop;

Expand Down

0 comments on commit eec218c

Please sign in to comment.