@@ -160,4 +160,10 @@ enum {
};
#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
+
+#define TUNNEL_CSUM __cpu_to_be16(0x01)
+#define TUNNEL_KEY __cpu_to_be16(0x04)
+#define TUNNEL_SEQ __cpu_to_be16(0x08)
+#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
+
#endif /* _IF_TUNNEL_H_ */
@@ -18,6 +18,7 @@
#include <string.h>
#include <linux/ila.h>
#include <linux/lwtunnel.h>
+#include <linux/if_tunnel.h>
#include <linux/mpls_iptunnel.h>
#include <errno.h>
@@ -31,7 +32,6 @@
#include <linux/seg6_iptunnel.h>
#include <linux/seg6_hmac.h>
#include <linux/seg6_local.h>
-#include <net/if.h>
static const char *format_encap_type(int type)
{
@@ -780,12 +780,14 @@ static int parse_encap_ip(struct rtattr *rta, size_t len,
char **argv = *argvp;
int argc = *argcp;
int ret = 0;
+ __u16 flags = 0;
while (argc > 0) {
if (strcmp(*argv, "id") == 0) {
__u64 id;
NEXT_ARG();
+ flags |= TUNNEL_KEY;
if (id_ok++)
duparg2("id", *argv);
if (get_be64(&id, *argv, 0))
@@ -835,6 +837,9 @@ static int parse_encap_ip(struct rtattr *rta, size_t len,
argc--; argv++;
}
+ if (flags)
+ ret = rta_addattr16(rta, len, LWTUNNEL_IP_FLAGS, flags);
+
/* argv is currently the first unparsed argument,
* but the lwt_parse_encap() caller will move to the next,
* so step back
@@ -930,12 +935,14 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len,
char **argv = *argvp;
int argc = *argcp;
int ret = 0;
+ __u16 flags = 0;
while (argc > 0) {
if (strcmp(*argv, "id") == 0) {
__u64 id;
NEXT_ARG();
+ flags |= TUNNEL_KEY;
if (id_ok++)
duparg2("id", *argv);
if (get_be64(&id, *argv, 0))
@@ -987,6 +994,8 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len,
argc--; argv++;
}
+ if (flags)
+ ret = rta_addattr16(rta, len, LWTUNNEL_IP_FLAGS, flags);
/* argv is currently the first unparsed argument,
* but the lwt_parse_encap() caller will move to the next,
* so step back