netifd: vxlan: add most missing boolean options
authorJohannes Kimmel <fff@bareminimum.eu>
Fri, 4 Sep 2020 02:59:42 +0000 (04:59 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 12 Sep 2020 19:14:03 +0000 (21:14 +0200)
adds the folloing missing options:
  - learning
  - rsc
  - proxy
  - l2miss
  - l3miss
  - gbp

See ip-link(3) for their meaning.

still missing:
  - external
  - gpe

I'm not sure how to handle them at the moment. It's unclear to me what
IFLA_VXLAN_* value corresponds to the 'external' option and according to
the manpage, gpe depends on it.

Signed-off-by: Johannes Kimmel <fff@bareminimum.eu>
system-linux.c
system.c
system.h

index d87a9eee3e0eddfcc55eceb0b724cddb459412ba..c232c5f04fca9c9ca320d880eadb18ccf3f9c88a 100644 (file)
@@ -3077,10 +3077,14 @@ static void system_vxlan_map_bool_attr(struct nl_msg *msg, struct blob_attr **tb
        struct blob_attr *cur;
        if ((cur = tb_data[vxlandatatype])) {
                bool val = blobmsg_get_bool(cur);
-               if (invert) {
+               if (invert)
                        val = !val;
-               }
-               nla_put_u8(msg, attrtype, val);
+
+               if ((attrtype == IFLA_VXLAN_GBP) && val)
+                       nla_put_flag(msg, attrtype);
+               else 
+                       nla_put_u8(msg, attrtype, val);
+
        }
 }
 
@@ -3224,6 +3228,12 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
        system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_CSUM, VXLAN_DATA_ATTR_TXCSUM, false);
        system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, VXLAN_DATA_ATTR_RXCSUM, true);
        system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, VXLAN_DATA_ATTR_TXCSUM, true);
+       system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_LEARNING, VXLAN_DATA_ATTR_LEARNING, false);
+       system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_RSC , VXLAN_DATA_ATTR_RSC, false);
+       system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_PROXY , VXLAN_DATA_ATTR_PROXY, false);
+       system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_L2MISS , VXLAN_DATA_ATTR_L2MISS, false);
+       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[TUNNEL_ATTR_TOS])) {
                char *str = blobmsg_get_string(cur);
index 4133e553461b390511fee4c201bb6c952a05ed61..95721e1257d8795d74bbd2fe19ffbec82fbeec3e 100644 (file)
--- a/system.c
+++ b/system.c
@@ -40,6 +40,12 @@ static const struct blobmsg_policy vxlan_data_attrs[__VXLAN_DATA_ATTR_MAX] = {
        [VXLAN_DATA_ATTR_TXCSUM] = { .name = "txcsum", .type = BLOBMSG_TYPE_BOOL },
        [VXLAN_DATA_ATTR_SRCPORTMIN] = { .name = "srcportmin", .type = BLOBMSG_TYPE_INT32 },
        [VXLAN_DATA_ATTR_SRCPORTMAX] = { .name = "srcportmax", .type = BLOBMSG_TYPE_INT32 },
+       [VXLAN_DATA_ATTR_LEARNING] = { .name = "learning", .type = BLOBMSG_TYPE_BOOL },
+       [VXLAN_DATA_ATTR_RSC] = { .name = "rsc", .type = BLOBMSG_TYPE_BOOL },
+       [VXLAN_DATA_ATTR_PROXY] = { .name = "proxy", .type = BLOBMSG_TYPE_BOOL },
+       [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 },
 };
 
 const struct uci_blob_param_list vxlan_data_attr_list = {
index bf9e1d76200e85aeb8756ddce87d902c3bc096a2..290c2e553921886c59945ab3f6068a3b21233e19 100644 (file)
--- a/system.h
+++ b/system.h
@@ -46,6 +46,12 @@ enum vxlan_data {
        VXLAN_DATA_ATTR_TXCSUM,
        VXLAN_DATA_ATTR_SRCPORTMIN,
        VXLAN_DATA_ATTR_SRCPORTMAX,
+       VXLAN_DATA_ATTR_LEARNING,
+       VXLAN_DATA_ATTR_RSC,
+       VXLAN_DATA_ATTR_PROXY,
+       VXLAN_DATA_ATTR_L2MISS,
+       VXLAN_DATA_ATTR_L3MISS,
+       VXLAN_DATA_ATTR_GBP,
        __VXLAN_DATA_ATTR_MAX
 };