diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2010-01-25 05:38:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-28 09:31:06 -0500 |
commit | a92df2545402c1a08e7a158f4477a52dea0eeeed (patch) | |
tree | 862f3166ba559972e796d10e1956dac8af50381b | |
parent | a1664773907a2b69e2a3019598dcbeffa6bc724b (diff) |
netns xfrm: ipcomp support
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/ipcomp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 38fbf04150ae..b55a0c3df82f 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | static void ipcomp4_err(struct sk_buff *skb, u32 info) | 26 | static void ipcomp4_err(struct sk_buff *skb, u32 info) |
27 | { | 27 | { |
28 | struct net *net = dev_net(skb->dev); | ||
28 | __be32 spi; | 29 | __be32 spi; |
29 | struct iphdr *iph = (struct iphdr *)skb->data; | 30 | struct iphdr *iph = (struct iphdr *)skb->data; |
30 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); | 31 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); |
@@ -35,7 +36,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
35 | return; | 36 | return; |
36 | 37 | ||
37 | spi = htonl(ntohs(ipch->cpi)); | 38 | spi = htonl(ntohs(ipch->cpi)); |
38 | x = xfrm_state_lookup(&init_net, (xfrm_address_t *)&iph->daddr, | 39 | x = xfrm_state_lookup(net, (xfrm_address_t *)&iph->daddr, |
39 | spi, IPPROTO_COMP, AF_INET); | 40 | spi, IPPROTO_COMP, AF_INET); |
40 | if (!x) | 41 | if (!x) |
41 | return; | 42 | return; |
@@ -47,9 +48,10 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
47 | /* We always hold one tunnel user reference to indicate a tunnel */ | 48 | /* We always hold one tunnel user reference to indicate a tunnel */ |
48 | static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x) | 49 | static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x) |
49 | { | 50 | { |
51 | struct net *net = xs_net(x); | ||
50 | struct xfrm_state *t; | 52 | struct xfrm_state *t; |
51 | 53 | ||
52 | t = xfrm_state_alloc(&init_net); | 54 | t = xfrm_state_alloc(net); |
53 | if (t == NULL) | 55 | if (t == NULL) |
54 | goto out; | 56 | goto out; |
55 | 57 | ||
@@ -82,10 +84,11 @@ error: | |||
82 | */ | 84 | */ |
83 | static int ipcomp_tunnel_attach(struct xfrm_state *x) | 85 | static int ipcomp_tunnel_attach(struct xfrm_state *x) |
84 | { | 86 | { |
87 | struct net *net = xs_net(x); | ||
85 | int err = 0; | 88 | int err = 0; |
86 | struct xfrm_state *t; | 89 | struct xfrm_state *t; |
87 | 90 | ||
88 | t = xfrm_state_lookup(&init_net, (xfrm_address_t *)&x->id.daddr.a4, | 91 | t = xfrm_state_lookup(net, (xfrm_address_t *)&x->id.daddr.a4, |
89 | x->props.saddr.a4, IPPROTO_IPIP, AF_INET); | 92 | x->props.saddr.a4, IPPROTO_IPIP, AF_INET); |
90 | if (!t) { | 93 | if (!t) { |
91 | t = ipcomp_tunnel_create(x); | 94 | t = ipcomp_tunnel_create(x); |