Author: Ken Zhu Date: Mon Mar 12 11:23:11 2018 -0700 netifd: add rfc7597 draft03 version support for tunipip6 draft03 version of rfc7597 has a little different from the standard version. Change-Id: Ide3692ffd763c1741c96134b5df42446045f85bf Signed-off-by: Ken Zhu diff -Nur a/system.c netifd-2019-08-05-5e02f944/system.c --- a/system.c 2020-11-11 17:40:14.360936791 -0800 +++ netifd-2019-08-05-5e02f944/system.c 2020-11-11 17:40:28.996873250 -0800 @@ -89,9 +89,10 @@ .params = sixrd_data_attrs, }; -static const struct blobmsg_policy ipip6_data_attrs[__SIXRD_DATA_ATTR_MAX] = { +static const struct blobmsg_policy ipip6_data_attrs[__IPIP6_DATA_ATTR_MAX] = { [IPIP6_DATA_ENCAPLIMIT] = { .name = "encaplimit", .type = BLOBMSG_TYPE_STRING }, [IPIP6_DATA_FMRS] = { .name = "fmrs", .type = BLOBMSG_TYPE_ARRAY }, + [IPIP6_DATA_DRAFT03] = { .name = "draft03", .type = BLOBMSG_TYPE_INT32 }, }; const struct uci_blob_param_list ipip6_data_attr_list = { diff -Nur a/system.h netifd-2019-08-05-5e02f944/system.h --- a/system.h 2020-11-11 17:40:14.364936773 -0800 +++ netifd-2019-08-05-5e02f944/system.h 2020-11-11 17:40:28.996873250 -0800 @@ -77,6 +77,7 @@ enum ipip6_data { IPIP6_DATA_ENCAPLIMIT, IPIP6_DATA_FMRS, + IPIP6_DATA_DRAFT03, __IPIP6_DATA_ATTR_MAX }; diff -Nur a/system-linux.c netifd-2019-08-05-5e02f944/system-linux.c --- a/system-linux.c 2020-11-11 17:40:14.360936791 -0800 +++ netifd-2019-08-05-5e02f944/system-linux.c 2020-11-11 17:45:05.427539372 -0800 @@ -2673,6 +2673,18 @@ } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) + unsigned int draft03 = 0; + if ((cur = tb[IPIP6_DATA_DRAFT03])) { + draft03 = blobmsg_get_u32(cur); + if (ttl > 255) + return -EINVAL; + if (draft03) + nla_put_u8(nlm, IFLA_IPTUN_DRAFT03, 1); + } + +#endif + #ifdef IFLA_IPTUN_FMR_MAX if ((cur = tb_data[IPIP6_DATA_FMRS])) { struct blob_attr *rcur;