]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/bridge/br_netlink.c
bridge: netlink: check vlan_default_pvid range
[karo-tx-linux.git] / net / bridge / br_netlink.c
index a572db710d4eb68a03ba0d9d958f41f931aff6b9..574f78824d8a2ae53751bbe1849e53502bc575be 100644 (file)
@@ -133,6 +133,8 @@ static inline size_t br_port_info_size(void)
                + nla_total_size(1)     /* IFLA_BRPORT_MCAST_TO_UCAST */
                + nla_total_size(1)     /* IFLA_BRPORT_LEARNING */
                + nla_total_size(1)     /* IFLA_BRPORT_UNICAST_FLOOD */
+               + nla_total_size(1)     /* IFLA_BRPORT_MCAST_FLOOD */
+               + nla_total_size(1)     /* IFLA_BRPORT_BCAST_FLOOD */
                + nla_total_size(1)     /* IFLA_BRPORT_PROXYARP */
                + nla_total_size(1)     /* IFLA_BRPORT_PROXYARP_WIFI */
                + nla_total_size(1)     /* IFLA_BRPORT_VLAN_TUNNEL */
@@ -633,6 +635,8 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = {
        [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 },
        [IFLA_BRPORT_MULTICAST_ROUTER] = { .type = NLA_U8 },
        [IFLA_BRPORT_MCAST_TO_UCAST] = { .type = NLA_U8 },
+       [IFLA_BRPORT_MCAST_FLOOD] = { .type = NLA_U8 },
+       [IFLA_BRPORT_BCAST_FLOOD] = { .type = NLA_U8 },
 };
 
 /* Change the state of the port and notify spanning tree */
@@ -831,6 +835,13 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
                        return -EPROTONOSUPPORT;
                }
        }
+
+       if (data[IFLA_BR_VLAN_DEFAULT_PVID]) {
+               __u16 defpvid = nla_get_u16(data[IFLA_BR_VLAN_DEFAULT_PVID]);
+
+               if (defpvid >= VLAN_VID_MASK)
+                       return -EINVAL;
+       }
 #endif
 
        return 0;