[PATCH] netifd: add support of GRE tunnel ignore-df option

Denis Kalashnikov denis281089 at gmail.com
Mon Apr 17 02:29:00 PDT 2023


This is useful for GRE TAP tunnel when tunnel is added to a br-lan bridge.
In this case you need to create it with "nopmtudisc ignore-df". Otherwise
large IP-packets with DF=1 (TCP-data, large pings) will be silently dropped
(since DF=1 but stack failed to send ICMP "need fragmentation" back). But with
"ignore-df" packets with DF=1 will be fragmented.

Signed-off-by: Denis Kalashnikov <denis281089 at gmail.com>
---
 system-linux.c | 5 +++++
 system.c       | 1 +
 system.h       | 1 +
 3 files changed, 7 insertions(+)

diff --git a/system-linux.c b/system-linux.c
index e4041fb..4397460 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -3500,6 +3500,11 @@ static int system_add_gre_tunnel(const char *name, const char *kind,
 
 		nla_put_u8(nlm, IFLA_GRE_PMTUDISC, set_df ? 1 : 0);
 
+		if ((cur = tb[TUNNEL_ATTR_IGNORE_DF])) {
+			nla_put_u8(nlm, IFLA_GRE_IGNORE_DF,
+				blobmsg_get_bool(cur));
+		}
+
 		nla_put_u8(nlm, IFLA_GRE_TOS, tos);
 	}
 
diff --git a/system.c b/system.c
index 32597c1..e773245 100644
--- a/system.c
+++ b/system.c
@@ -21,6 +21,7 @@ static const struct blobmsg_policy tunnel_attrs[__TUNNEL_ATTR_MAX] = {
 	[TUNNEL_ATTR_REMOTE] = { .name = "remote", .type = BLOBMSG_TYPE_STRING },
 	[TUNNEL_ATTR_MTU] = { .name = "mtu", .type = BLOBMSG_TYPE_INT32 },
 	[TUNNEL_ATTR_DF] = { .name = "df", .type = BLOBMSG_TYPE_BOOL },
+	[TUNNEL_ATTR_IGNORE_DF] = { .name = "ignore-df", .type = BLOBMSG_TYPE_BOOL },
 	[TUNNEL_ATTR_TTL] = { .name = "ttl", .type = BLOBMSG_TYPE_INT32 },
 	[TUNNEL_ATTR_TOS] = { .name = "tos", .type = BLOBMSG_TYPE_STRING },
 	[TUNNEL_ATTR_LINK] = { .name = "link", .type = BLOBMSG_TYPE_STRING },
diff --git a/system.h b/system.h
index 1f7037d..a7a713d 100644
--- a/system.h
+++ b/system.h
@@ -29,6 +29,7 @@ enum tunnel_param {
 	TUNNEL_ATTR_LOCAL,
 	TUNNEL_ATTR_MTU,
 	TUNNEL_ATTR_DF,
+	TUNNEL_ATTR_IGNORE_DF,
 	TUNNEL_ATTR_TTL,
 	TUNNEL_ATTR_TOS,
 	TUNNEL_ATTR_LINK,
-- 
2.39.2




More information about the openwrt-devel mailing list