summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-10-03 21:46:53 -0700
committerLinux Build Service Account <lnxbuild@localhost>2019-10-03 21:46:53 -0700
commit6ed4c5de4bb191a209c629463678e34f076fb417 (patch)
tree19621b337f8b900ba5b38131b95c4db21fda1c7c /include/net
parent09106cce83b26f915da23d2ec15465b2d1559fa7 (diff)
parenta8e92fae3a9de72877cfbd2f8b84a0d539413eb1 (diff)
Merge a8e92fae3a9de72877cfbd2f8b84a0d539413eb1 on remote branch
Change-Id: I96a4fbd1df63e22c3b6b2234039b0005f3712d4c
Diffstat (limited to 'include/net')
-rw-r--r--include/net/xfrm.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 9e1325e36415..c5c03fa47f8c 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1304,6 +1304,23 @@ static inline int xfrm_state_kern(const struct xfrm_state *x)
return atomic_read(&x->tunnel_users);
}
+static inline bool xfrm_id_proto_valid(u8 proto)
+{
+ switch (proto) {
+ case IPPROTO_AH:
+ case IPPROTO_ESP:
+ case IPPROTO_COMP:
+#if IS_ENABLED(CONFIG_IPV6)
+ case IPPROTO_ROUTING:
+ case IPPROTO_DSTOPTS:
+#endif
+ return true;
+ default:
+ return false;
+ }
+}
+
+/* IPSEC_PROTO_ANY only matches 3 IPsec protocols, 0 could match all. */
static inline int xfrm_id_proto_match(u8 proto, u8 userproto)
{
return (!userproto || proto == userproto ||