[PATCH 4/4] netifd: vxlan: add aging and maxaddress options

Johannes Kimmel fff at bareminimum.eu
Thu Sep 3 22:59:43 EDT 2020


For both options the values can just be passed to the kernel. All
unsigned values are accepted, thus no range checking required.

Signed-off-by: Johannes Kimmel <fff at bareminimum.eu>
---
 system-linux.c | 10 ++++++++++
 system.c       |  2 ++
 system.h       |  2 ++
 3 files changed, 14 insertions(+)

diff --git a/system-linux.c b/system-linux.c
index a68af63..c497509 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -3235,6 +3235,16 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
 	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_L3MISS , VXLAN_DATA_ATTR_L3MISS, false);
 	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_GBP , VXLAN_DATA_ATTR_GBP, false);
 
+	if ((cur = tb_data[VXLAN_DATA_ATTR_AGEING])) {
+		uint32_t ageing = blobmsg_get_u32(cur);
+		nla_put_u32(msg, IFLA_VXLAN_AGEING, ageing);
+	}
+
+	if ((cur = tb_data[VXLAN_DATA_ATTR_LIMIT])) {
+		uint32_t maxaddress = blobmsg_get_u32(cur);
+		nla_put_u32(msg, IFLA_VXLAN_LIMIT, maxaddress);
+	}
+
 	if ((cur = tb[TUNNEL_ATTR_TOS])) {
 		char *str = blobmsg_get_string(cur);
 		unsigned tos = 1;
diff --git a/system.c b/system.c
index 95721e1..834748e 100644
--- a/system.c
+++ b/system.c
@@ -46,6 +46,8 @@ static const struct blobmsg_policy vxlan_data_attrs[__VXLAN_DATA_ATTR_MAX] = {
 	[VXLAN_DATA_ATTR_L2MISS] = { .name = "l2miss", .type = BLOBMSG_TYPE_BOOL },
 	[VXLAN_DATA_ATTR_L3MISS] = { .name = "l3miss", .type = BLOBMSG_TYPE_BOOL },
 	[VXLAN_DATA_ATTR_GBP] = { .name = "gbp", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_AGEING] = { .name = "ageing", .type = BLOBMSG_TYPE_INT32 },
+	[VXLAN_DATA_ATTR_LIMIT] = { .name = "maxaddress", .type = BLOBMSG_TYPE_INT32 },
 };
 
 const struct uci_blob_param_list vxlan_data_attr_list = {
diff --git a/system.h b/system.h
index 290c2e5..52161a8 100644
--- a/system.h
+++ b/system.h
@@ -52,6 +52,8 @@ enum vxlan_data {
 	VXLAN_DATA_ATTR_L2MISS,
 	VXLAN_DATA_ATTR_L3MISS,
 	VXLAN_DATA_ATTR_GBP,
+	VXLAN_DATA_ATTR_AGEING,
+	VXLAN_DATA_ATTR_LIMIT,
 	__VXLAN_DATA_ATTR_MAX
 };
 
-- 
2.28.0




More information about the openwrt-devel mailing list