Skip to content

Commit

Permalink
netns xfrm: ipcomp support
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexey Dobriyan authored and David S. Miller committed Jan 28, 2010
1 parent a166477 commit a92df25
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/ipv4/ipcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

static void ipcomp4_err(struct sk_buff *skb, u32 info)
{
struct net *net = dev_net(skb->dev);
__be32 spi;
struct iphdr *iph = (struct iphdr *)skb->data;
struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2));
Expand All @@ -35,7 +36,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
return;

spi = htonl(ntohs(ipch->cpi));
x = xfrm_state_lookup(&init_net, (xfrm_address_t *)&iph->daddr,
x = xfrm_state_lookup(net, (xfrm_address_t *)&iph->daddr,
spi, IPPROTO_COMP, AF_INET);
if (!x)
return;
Expand All @@ -47,9 +48,10 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
/* We always hold one tunnel user reference to indicate a tunnel */
static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x)
{
struct net *net = xs_net(x);
struct xfrm_state *t;

t = xfrm_state_alloc(&init_net);
t = xfrm_state_alloc(net);
if (t == NULL)
goto out;

Expand Down Expand Up @@ -82,10 +84,11 @@ static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x)
*/
static int ipcomp_tunnel_attach(struct xfrm_state *x)
{
struct net *net = xs_net(x);
int err = 0;
struct xfrm_state *t;

t = xfrm_state_lookup(&init_net, (xfrm_address_t *)&x->id.daddr.a4,
t = xfrm_state_lookup(net, (xfrm_address_t *)&x->id.daddr.a4,
x->props.saddr.a4, IPPROTO_IPIP, AF_INET);
if (!t) {
t = ipcomp_tunnel_create(x);
Expand Down

0 comments on commit a92df25

Please sign in to comment.