diff options
author | Susant Sahani <ssahani@gmail.com> | 2015-10-25 09:30:17 +0530 |
---|---|---|
committer | Susant Sahani <ssahani@gmail.com> | 2015-10-25 09:30:17 +0530 |
commit | 2645f07d81e72acd65f32d582702dc4cbe54cac7 (patch) | |
tree | 227d7d2823435cdb4bf5282e1af81dfafb819b51 /src/network/networkd-netdev-vlan.c | |
parent | 931c7feac07aa0f8c1be02b4f746a568c9cae883 (diff) |
vlan: fix assert
Diffstat (limited to 'src/network/networkd-netdev-vlan.c')
-rw-r--r-- | src/network/networkd-netdev-vlan.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/network/networkd-netdev-vlan.c b/src/network/networkd-netdev-vlan.c index 195d1a944e..75fbdd355e 100644 --- a/src/network/networkd-netdev-vlan.c +++ b/src/network/networkd-netdev-vlan.c @@ -24,14 +24,17 @@ #include "networkd-netdev-vlan.h" static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) { - VLan *v = VLAN(netdev); + VLan *v; int r; assert(netdev); - assert(v); assert(link); assert(req); + v = VLAN(netdev); + + assert(v); + if (v->id <= VLANID_MAX) { r = sd_netlink_message_append_u16(req, IFLA_VLAN_ID, v->id); if (r < 0) @@ -42,12 +45,15 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin } static int netdev_vlan_verify(NetDev *netdev, const char *filename) { - VLan *v = VLAN(netdev); + VLan *v; assert(netdev); - assert(v); assert(filename); + v = VLAN(netdev); + + assert(v); + if (v->id > VLANID_MAX) { log_warning("VLAN without valid Id (%"PRIu64") configured in %s. Ignoring", v->id, filename); return -EINVAL; |