Skip to content

Commit 86dc8ee

Browse files
Florian Westphaldavem330
authored andcommitted
xfrm_policy: remove xfrm_policy_lookup
This removes the wrapper and renames the __xfrm_policy_lookup variant to get rid of another place that used flow cache objects. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent aff669b commit 86dc8ee

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

net/xfrm/xfrm_policy.c

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
11751175
}
11761176

11771177
static struct xfrm_policy *
1178-
__xfrm_policy_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir)
1178+
xfrm_policy_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir)
11791179
{
11801180
#ifdef CONFIG_XFRM_SUB_POLICY
11811181
struct xfrm_policy *pol;
@@ -1187,26 +1187,6 @@ __xfrm_policy_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir
11871187
return xfrm_policy_lookup_bytype(net, XFRM_POLICY_TYPE_MAIN, fl, family, dir);
11881188
}
11891189

1190-
static struct flow_cache_object *
1191-
xfrm_policy_lookup(struct net *net, const struct flowi *fl, u16 family,
1192-
u8 dir, struct flow_cache_object *old_obj, void *ctx)
1193-
{
1194-
struct xfrm_policy *pol;
1195-
1196-
if (old_obj)
1197-
xfrm_pol_put(container_of(old_obj, struct xfrm_policy, flo));
1198-
1199-
pol = __xfrm_policy_lookup(net, fl, family, dir);
1200-
if (IS_ERR_OR_NULL(pol))
1201-
return ERR_CAST(pol);
1202-
1203-
/* Resolver returns two references:
1204-
* one for cache and one for caller of flow_cache_lookup() */
1205-
xfrm_pol_hold(pol);
1206-
1207-
return &pol->flo;
1208-
}
1209-
12101190
static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir,
12111191
const struct flowi *fl, u16 family)
12121192
{
@@ -2028,7 +2008,7 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
20282008
/* Resolve policies to use if we couldn't get them from
20292009
* previous cache entry */
20302010
num_pols = 1;
2031-
pols[0] = __xfrm_policy_lookup(net, fl, family, dir);
2011+
pols[0] = xfrm_policy_lookup(net, fl, family, dir);
20322012
err = xfrm_expand_policies(fl, family, pols,
20332013
&num_pols, &num_xfrms);
20342014
if (err < 0)
@@ -2398,16 +2378,8 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
23982378
}
23992379
}
24002380

2401-
if (!pol) {
2402-
struct flow_cache_object *flo;
2403-
2404-
flo = xfrm_policy_lookup(net, &fl, family, dir, NULL, NULL);
2405-
2406-
if (IS_ERR_OR_NULL(flo))
2407-
pol = ERR_CAST(flo);
2408-
else
2409-
pol = container_of(flo, struct xfrm_policy, flo);
2410-
}
2381+
if (!pol)
2382+
pol = xfrm_policy_lookup(net, &fl, family, dir);
24112383

24122384
if (IS_ERR(pol)) {
24132385
XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR);

0 commit comments

Comments
 (0)