diff options
author | Tom Gundersen <teg@jklm.no> | 2015-10-25 14:35:40 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-10-25 14:35:40 +0100 |
commit | 1e23792147b675cf6d3d7e85d02ba3d4dcc886c1 (patch) | |
tree | ce05af47b9489f6516c8ad7baa079d73d11575e6 /src/network/networkd-netdev-vlan.c | |
parent | 7c8871d31510865e40c8628ef765996202a3cc00 (diff) | |
parent | c2353b2f2f03b131d99491f458f439e4c65825c9 (diff) |
Merge pull request #1668 from ssahani/net1
networkd: fix asserts
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; |