Commit 855dad99 authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

xfrm_policy: remove always true/false branches

after previous change oldflo and xdst are always NULL.
These branches were already removed by gcc, this doesn't change code.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3ca28286
...@@ -2056,36 +2056,12 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, ...@@ -2056,36 +2056,12 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
{ {
struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
struct xfrm_dst *xdst, *new_xdst; struct xfrm_dst *xdst, *new_xdst;
int num_pols = 0, num_xfrms = 0, i, err, pol_dead; int num_pols = 0, num_xfrms = 0, err;
struct flow_cache_object *oldflo = NULL;
/* Check if the policies from old bundle are usable */ /* Check if the policies from old bundle are usable */
xdst = NULL; xdst = NULL;
if (oldflo) {
xdst = container_of(oldflo, struct xfrm_dst, flo);
num_pols = xdst->num_pols;
num_xfrms = xdst->num_xfrms;
pol_dead = 0;
for (i = 0; i < num_pols; i++) {
pols[i] = xdst->pols[i];
pol_dead |= pols[i]->walk.dead;
}
if (pol_dead) {
/* Mark DST_OBSOLETE_DEAD to fail the next
* xfrm_dst_check()
*/
xdst->u.dst.obsolete = DST_OBSOLETE_DEAD;
dst_release_immediate(&xdst->u.dst);
xdst = NULL;
num_pols = 0;
num_xfrms = 0;
oldflo = NULL;
}
}
/* Resolve policies to use if we couldn't get them from /* Resolve policies to use if we couldn't get them from
* previous cache entry */ * previous cache entry */
if (xdst == NULL) {
num_pols = 1; num_pols = 1;
pols[0] = __xfrm_policy_lookup(net, fl, family, pols[0] = __xfrm_policy_lookup(net, fl, family,
flow_to_policy_dir(dir)); flow_to_policy_dir(dir));
...@@ -2097,7 +2073,6 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, ...@@ -2097,7 +2073,6 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
return NULL; return NULL;
if (num_xfrms <= 0) if (num_xfrms <= 0)
goto make_dummy_bundle; goto make_dummy_bundle;
}
new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family,
xflo->dst_orig); xflo->dst_orig);
...@@ -2105,26 +2080,10 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, ...@@ -2105,26 +2080,10 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
err = PTR_ERR(new_xdst); err = PTR_ERR(new_xdst);
if (err != -EAGAIN) if (err != -EAGAIN)
goto error; goto error;
if (oldflo == NULL)
goto make_dummy_bundle; goto make_dummy_bundle;
dst_hold(&xdst->u.dst);
return oldflo;
} else if (new_xdst == NULL) { } else if (new_xdst == NULL) {
num_xfrms = 0; num_xfrms = 0;
if (oldflo == NULL)
goto make_dummy_bundle; goto make_dummy_bundle;
xdst->num_xfrms = 0;
dst_hold(&xdst->u.dst);
return oldflo;
}
/* Kill the previous bundle */
if (xdst) {
/* The policies were stolen for newly generated bundle */
xdst->num_pols = 0;
/* Mark DST_OBSOLETE_DEAD to fail the next xfrm_dst_check() */
xdst->u.dst.obsolete = DST_OBSOLETE_DEAD;
dst_release_immediate(&xdst->u.dst);
} }
return &new_xdst->flo; return &new_xdst->flo;
...@@ -2148,11 +2107,6 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, ...@@ -2148,11 +2107,6 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
inc_error: inc_error:
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR); XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
error: error:
if (xdst != NULL) {
/* Mark DST_OBSOLETE_DEAD to fail the next xfrm_dst_check() */
xdst->u.dst.obsolete = DST_OBSOLETE_DEAD;
dst_release_immediate(&xdst->u.dst);
} else
xfrm_pols_put(pols, num_pols); xfrm_pols_put(pols, num_pols);
return ERR_PTR(err); return ERR_PTR(err);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment