Commit 841b5d15 authored by Hans Dedecker's avatar Hans Dedecker

system-linux: enable by default ignore encaplimit for grev6 tunnels

Similar as for ip6 tunnels ignore encaplimit by default as not all ISPs
support the destination option header containing the tunnel encapsulation
limit resulting into broken connectivity
Signed-off-by: default avatarHans Dedecker <dedeckeh@gmail.com>
parent 125cbee9
......@@ -2456,10 +2456,11 @@ static int system_add_gre_tunnel(const char *name, const char *kind,
struct nl_msg *nlm;
struct ifinfomsg ifi = { .ifi_family = AF_UNSPEC, };
struct blob_attr *cur;
uint32_t ikey = 0, okey = 0, flags = 0, flowinfo = 0;
uint32_t ikey = 0, okey = 0, flowinfo = 0, flags6 = IP6_TNL_F_IGN_ENCAP_LIMIT;
uint16_t iflags = 0, oflags = 0;
uint8_t tos = 0;
int ret = 0, ttl = 0;
unsigned encap_limit = 0;
nlm = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_REPLACE | NLM_F_CREATE);
if (!nlm)
......@@ -2503,7 +2504,7 @@ static int system_add_gre_tunnel(const char *name, const char *kind,
tos = uval;
} else {
if (v6)
flags |= IP6_TNL_F_USE_ORIG_TCLASS;
flags6 |= IP6_TNL_F_USE_ORIG_TCLASS;
else
tos = 1;
}
......@@ -2544,6 +2545,23 @@ static int system_add_gre_tunnel(const char *name, const char *kind,
if (blobmsg_get_bool(cur))
oflags |= GRE_SEQ;
}
if ((cur = tb_data[GRE_DATA_ENCAPLIMIT])) {
char *str = blobmsg_get_string(cur);
if (strcmp(str, "ignore")) {
char *e;
encap_limit = strtoul(str, &e, 0);
if (e == str || *e || encap_limit > 255) {
ret = -EINVAL;
goto failure;
}
flags6 &= ~IP6_TNL_F_IGN_ENCAP_LIMIT;
}
}
}
if (v6) {
......@@ -2563,13 +2581,15 @@ static int system_add_gre_tunnel(const char *name, const char *kind,
}
nla_put(nlm, IFLA_GRE_REMOTE, sizeof(in6buf), &in6buf);
}
nla_put_u8(nlm, IFLA_GRE_ENCAP_LIMIT, 4);
if (!(flags6 & IP6_TNL_F_IGN_ENCAP_LIMIT))
nla_put_u8(nlm, IFLA_GRE_ENCAP_LIMIT, encap_limit);
if (flowinfo)
nla_put_u32(nlm, IFLA_GRE_FLOWINFO, flowinfo);
if (flags)
nla_put_u32(nlm, IFLA_GRE_FLAGS, flags);
if (flags6)
nla_put_u32(nlm, IFLA_GRE_FLAGS, flags6);
if (!ttl)
ttl = 64;
......
......@@ -52,6 +52,7 @@ static const struct blobmsg_policy gre_data_attrs[__GRE_DATA_ATTR_MAX] = {
[GRE_DATA_OCSUM] = { .name = "ocsum", .type = BLOBMSG_TYPE_BOOL },
[GRE_DATA_ISEQNO] = { .name = "iseqno", .type = BLOBMSG_TYPE_BOOL },
[GRE_DATA_OSEQNO] = { .name = "oseqno", .type = BLOBMSG_TYPE_BOOL },
[GRE_DATA_ENCAPLIMIT] = { .name = "encaplimit", .type = BLOBMSG_TYPE_STRING },
};
const struct uci_blob_param_list gre_data_attr_list = {
......
......@@ -53,6 +53,7 @@ enum gre_data {
GRE_DATA_OCSUM,
GRE_DATA_ISEQNO,
GRE_DATA_OSEQNO,
GRE_DATA_ENCAPLIMIT,
__GRE_DATA_ATTR_MAX
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment