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-bond.c | |
parent | 7c8871d31510865e40c8628ef765996202a3cc00 (diff) | |
parent | c2353b2f2f03b131d99491f458f439e4c65825c9 (diff) |
Merge pull request #1668 from ssahani/net1
networkd: fix asserts
Diffstat (limited to 'src/network/networkd-netdev-bond.c')
-rw-r--r-- | src/network/networkd-netdev-bond.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c index f66c88c35e..afc1efdcf7 100644 --- a/src/network/networkd-netdev-bond.c +++ b/src/network/networkd-netdev-bond.c @@ -180,15 +180,18 @@ static uint8_t bond_xmit_hash_policy_to_kernel(BondXmitHashPolicy policy) { } static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { - Bond *b = BOND(netdev); + Bond *b; ArpIpTarget *target = NULL; int r, i = 0; assert(netdev); assert(!link); - assert(b); assert(m); + b = BOND(netdev); + + assert(b); + if (b->mode != _NETDEV_BOND_MODE_INVALID) { r = sd_netlink_message_append_u8(m, IFLA_BOND_MODE, bond_mode_to_kernel(b->mode)); @@ -382,9 +385,12 @@ int config_parse_arp_ip_target_address(const char *unit, static void bond_done(NetDev *netdev) { ArpIpTarget *t = NULL, *n = NULL; - Bond *b = BOND(netdev); + Bond *b; assert(netdev); + + b = BOND(netdev); + assert(b); LIST_FOREACH_SAFE(arp_ip_target, t, n, b->arp_ip_targets) @@ -394,9 +400,12 @@ static void bond_done(NetDev *netdev) { } static void bond_init(NetDev *netdev) { - Bond *b = BOND(netdev); + Bond *b; assert(netdev); + + b = BOND(netdev); + assert(b); b->mode = _NETDEV_BOND_MODE_INVALID; |