Skip to content

Commit

Permalink
ipsec: Fix bogus bundle flowi
Browse files Browse the repository at this point in the history
When I merged the bundle creation code, I introduced a bogus
flowi value in the bundle.  Instead of getting from the caller,
it was instead set to the flow in the route object, which is
totally different.

The end result is that the bundles we created never match, and
we instead end up with an ever growing bundle list.

Thanks to Jamal for find this problem.

Reported-by: Jamal Hadi Salim <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Acked-by: Steffen Klassert <[email protected]>
Acked-by: Jamal Hadi Salim <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
herbertx authored and davem330 committed Mar 3, 2010
1 parent 3a5b27b commit 87c1e12
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ struct xfrm_policy_afinfo {
struct dst_entry *dst,
int nfheader_len);
int (*fill_dst)(struct xfrm_dst *xdst,
struct net_device *dev);
struct net_device *dev,
struct flowi *fl);
};

extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
Expand Down
5 changes: 3 additions & 2 deletions net/ipv4/xfrm4_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst,
return 0;
}

static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev)
static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
struct flowi *fl)
{
struct rtable *rt = (struct rtable *)xdst->route;

xdst->u.rt.fl = rt->fl;
xdst->u.rt.fl = *fl;

xdst->u.dst.dev = dev;
dev_hold(dev);
Expand Down
3 changes: 2 additions & 1 deletion net/ipv6/xfrm6_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst,
return 0;
}

static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev)
static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
struct flowi *fl)
{
struct rt6_info *rt = (struct rt6_info*)xdst->route;

Expand Down
7 changes: 4 additions & 3 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,8 @@ static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
return err;
}

static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev)
static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
struct flowi *fl)
{
struct xfrm_policy_afinfo *afinfo =
xfrm_policy_get_afinfo(xdst->u.dst.ops->family);
Expand All @@ -1381,7 +1382,7 @@ static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev)
if (!afinfo)
return -EINVAL;

err = afinfo->fill_dst(xdst, dev);
err = afinfo->fill_dst(xdst, dev, fl);

xfrm_policy_put_afinfo(afinfo);

Expand Down Expand Up @@ -1486,7 +1487,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
for (dst_prev = dst0; dst_prev != dst; dst_prev = dst_prev->child) {
struct xfrm_dst *xdst = (struct xfrm_dst *)dst_prev;

err = xfrm_fill_dst(xdst, dev);
err = xfrm_fill_dst(xdst, dev, fl);
if (err)
goto free_dst;

Expand Down

0 comments on commit 87c1e12

Please sign in to comment.