[SRU][F:linux-bluefield][PATCH] UBUNTU: SAUCE: xfrm: IPsec Export xfrm_policy_lookup_bytype function

Bodong Wang bodong at nvidia.com
Thu Jul 1 16:47:37 UTC 2021


From: Raed Salem <raeds at nvidia.com>

BugLink: https://launchpad.net/bugs/1934313

Export policy lookup function so drivers could lookup
a policy that match specific criteria.

Signed-off-by: Raed Salem <raeds at nvidia.com>
Signed-off-by: Bodong Wang <bodong at nvidia.com>
---
 include/net/xfrm.h     | 4 ++++
 net/xfrm/xfrm_policy.c | 9 +++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index bb89b6f6..f9e6b50 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -345,6 +345,10 @@ int km_query(struct xfrm_state *x, struct xfrm_tmpl *t,
 	     struct xfrm_policy *pol);
 void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
 int __xfrm_state_delete(struct xfrm_state *x);
+struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
+					      const struct flowi *fl,
+					      u16 family, u8 dir,
+					      u32 if_id);
 
 struct xfrm_state_afinfo {
 	u8				family;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index cfbe490..e318ec7 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2071,10 +2071,10 @@ static int xfrm_policy_match(const struct xfrm_policy *pol,
 	return prefer;
 }
 
-static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
-						     const struct flowi *fl,
-						     u16 family, u8 dir,
-						     u32 if_id)
+struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
+					      const struct flowi *fl,
+					      u16 family, u8 dir,
+					      u32 if_id)
 {
 	struct xfrm_pol_inexact_candidates cand;
 	const xfrm_address_t *daddr, *saddr;
@@ -2135,6 +2135,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
 
 	return ret;
 }
+EXPORT_SYMBOL(xfrm_policy_lookup_bytype);
 
 static struct xfrm_policy *xfrm_policy_lookup(struct net *net,
 					      const struct flowi *fl,
-- 
1.8.3.1




More information about the kernel-team mailing list