Skip to content

Commit b2dfc9b

Browse files
committed
system-linux: inherit tos value in outer ip6 header
In case of ipip6 tunnels, inherit the tos value in the ip6 header from the inner ip4 header as the default behaviour. Without this commit, the tos value in the ip6 header is hard coded to 0 which is wrong. The ipip6 mode tunnels lack a tos uci option allowing the choice of either inheriting tos value or setting it as per uci config. I will push a change to address this separately, but, in the absense of such a config, the default behaviour should be inherit the tos value from the inner ip4 header and not to hard code it to 0. This commit fixes that. Signed-off-by: Rahul Thakur <rahul.thakur@iopsys.eu>
1 parent 33ec3da commit b2dfc9b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

system-linux.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3665,6 +3665,7 @@ static int system_add_ip6_tunnel(const char *name, const unsigned int link,
36653665
struct ifinfomsg ifi = { .ifi_family = AF_UNSPEC };
36663666
struct blob_attr *cur;
36673667
int ret = 0, ttl = 0;
3668+
uint32_t tun_flags = IP6_TNL_F_IGN_ENCAP_LIMIT;
36683669

36693670
if (!nlm)
36703671
return -1;
@@ -3716,7 +3717,6 @@ static int system_add_ip6_tunnel(const char *name, const unsigned int link,
37163717

37173718
if ((cur = tb[TUNNEL_ATTR_DATA])) {
37183719
struct blob_attr *tb_data[__IPIP6_DATA_ATTR_MAX];
3719-
uint32_t tun_flags = IP6_TNL_F_IGN_ENCAP_LIMIT;
37203720

37213721
blobmsg_parse(ipip6_data_attr_list.params, __IPIP6_DATA_ATTR_MAX, tb_data,
37223722
blobmsg_data(cur), blobmsg_len(cur));
@@ -3805,10 +3805,12 @@ static int system_add_ip6_tunnel(const char *name, const unsigned int link,
38053805
nla_nest_end(nlm, fmrs);
38063806
}
38073807
#endif
3808-
if (tun_flags)
3809-
nla_put_u32(nlm, IFLA_IPTUN_FLAGS, tun_flags);
38103808
}
38113809

3810+
tun_flags |= IP6_TNL_F_USE_ORIG_TCLASS;
3811+
if (tun_flags)
3812+
nla_put_u32(nlm, IFLA_IPTUN_FLAGS, tun_flags);
3813+
38123814
nla_nest_end(nlm, infodata);
38133815
nla_nest_end(nlm, linkinfo);
38143816

0 commit comments

Comments
 (0)