summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2017-06-14 10:10:05 -0700
committerStephen Hemminger <stephen@networkplumber.org>2017-06-14 10:25:39 -0700
commita9ae195a2169421a5e5cb53238f796a87a4970cd (patch)
treeeb80c45d04d0ead2da2a0d037273569f2d91bbd6
parent7b201d6019104575fcce121f776008d8c711d925 (diff)
downloadiproute2-a9ae195a2169421a5e5cb53238f796a87a4970cd.tar.gz
xfrm: get #define's from linux includes
Use linux/ipsec.h and linux/in.h to get the definition of IP related protocols. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--include/linux/ipsec.h47
-rw-r--r--include/utils.h13
-rw-r--r--ip/xfrm.h12
3 files changed, 49 insertions, 23 deletions
diff --git a/include/linux/ipsec.h b/include/linux/ipsec.h
new file mode 100644
index 00000000..d17a6302
--- /dev/null
+++ b/include/linux/ipsec.h
@@ -0,0 +1,47 @@
+#ifndef _LINUX_IPSEC_H
+#define _LINUX_IPSEC_H
+
+/* The definitions, required to talk to KAME racoon IKE. */
+
+#include <linux/pfkeyv2.h>
+
+#define IPSEC_PORT_ANY 0
+#define IPSEC_ULPROTO_ANY 255
+#define IPSEC_PROTO_ANY 255
+
+enum {
+ IPSEC_MODE_ANY = 0, /* We do not support this for SA */
+ IPSEC_MODE_TRANSPORT = 1,
+ IPSEC_MODE_TUNNEL = 2,
+ IPSEC_MODE_BEET = 3
+};
+
+enum {
+ IPSEC_DIR_ANY = 0,
+ IPSEC_DIR_INBOUND = 1,
+ IPSEC_DIR_OUTBOUND = 2,
+ IPSEC_DIR_FWD = 3, /* It is our own */
+ IPSEC_DIR_MAX = 4,
+ IPSEC_DIR_INVALID = 5
+};
+
+enum {
+ IPSEC_POLICY_DISCARD = 0,
+ IPSEC_POLICY_NONE = 1,
+ IPSEC_POLICY_IPSEC = 2,
+ IPSEC_POLICY_ENTRUST = 3,
+ IPSEC_POLICY_BYPASS = 4
+};
+
+enum {
+ IPSEC_LEVEL_DEFAULT = 0,
+ IPSEC_LEVEL_USE = 1,
+ IPSEC_LEVEL_REQUIRE = 2,
+ IPSEC_LEVEL_UNIQUE = 3
+};
+
+#define IPSEC_MANUAL_REQID_MAX 0x3fff
+
+#define IPSEC_REPLAYWSIZE 32
+
+#endif /* _LINUX_IPSEC_H */
diff --git a/include/utils.h b/include/utils.h
index bfbc9e6d..915c82e9 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -27,19 +27,6 @@ extern int max_flush_loops;
extern int batch_mode;
extern bool do_all;
-#ifndef IPPROTO_ESP
-#define IPPROTO_ESP 50
-#endif
-#ifndef IPPROTO_AH
-#define IPPROTO_AH 51
-#endif
-#ifndef IPPROTO_COMP
-#define IPPROTO_COMP 108
-#endif
-#ifndef IPSEC_PROTO_ANY
-#define IPSEC_PROTO_ANY 255
-#endif
-
#ifndef CONFDIR
#define CONFDIR "/etc/iproute2"
#endif
diff --git a/ip/xfrm.h b/ip/xfrm.h
index 773c92e9..54d80ce5 100644
--- a/ip/xfrm.h
+++ b/ip/xfrm.h
@@ -26,17 +26,9 @@
#include <stdio.h>
#include <sys/socket.h>
+#include <linux/in.h>
#include <linux/xfrm.h>
-
-#ifndef IPPROTO_SCTP
-# define IPPROTO_SCTP 132
-#endif
-#ifndef IPPROTO_DCCP
-# define IPPROTO_DCCP 33
-#endif
-#ifndef IPPROTO_MH
-# define IPPROTO_MH 135
-#endif
+#include <linux/ipsec.h>
#define XFRMS_RTA(x) ((struct rtattr*)(((char*)(x)) + NLMSG_ALIGN(sizeof(struct xfrm_usersa_info))))
#define XFRMS_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct xfrm_usersa_info))