Skip to content

Commit

Permalink
netns xfrm: xfrm_route_forward() in netns
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and davem330 committed Nov 26, 2008
1 parent f6e1e25 commit 99a6665
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,9 @@ extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);

static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
{
return !init_net.xfrm.policy_count[XFRM_POLICY_OUT] ||
struct net *net = dev_net(skb->dev);

return !net->xfrm.policy_count[XFRM_POLICY_OUT] ||
(skb->dst->flags & DST_NOXFRM) ||
__xfrm_route_forward(skb, family);
}
Expand Down
3 changes: 2 additions & 1 deletion net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,7 @@ EXPORT_SYMBOL(__xfrm_policy_check);

int __xfrm_route_forward(struct sk_buff *skb, unsigned short family)
{
struct net *net = dev_net(skb->dev);
struct flowi fl;

if (xfrm_decode_session(skb, &fl, family) < 0) {
Expand All @@ -2052,7 +2053,7 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family)
return 0;
}

return xfrm_lookup(&init_net, &skb->dst, &fl, NULL, 0) == 0;
return xfrm_lookup(net, &skb->dst, &fl, NULL, 0) == 0;
}
EXPORT_SYMBOL(__xfrm_route_forward);

Expand Down

0 comments on commit 99a6665

Please sign in to comment.