struct blob_attr *config_data;
bool has_macaddr;
bool force_active;
+ bool reset_primary;
bool active;
};
struct device *dev, bool hotplug)
{
struct bonding_port *bp;
+ struct bonding_config *cfg = &bdev->config;
bp = calloc(1, sizeof(*bp) + strlen(name) + 1);
if (!bp)
bp->dev.hotplug = hotplug;
strcpy(bp->name, name);
bp->dev.dev = dev;
+
+ if (cfg->primary != NULL) {
+ bp->set_primary = strcmp(cfg->primary, name) == 0;
+ }
+
vlist_add(&bdev->ports, &bp->node, bp->name);
/*
* Need to look up the bonding port again as the above
}
vlist_flush(&bdev->ports);
+ if (bdev->reset_primary) {
+ bonding_reset_primary(bdev);
+ bdev->reset_primary = false;
+ }
+
if (bdev->n_failed)
uloop_timeout_set(&bdev->retry, 100);
}
{
struct bonding_port *bp;
struct device *dev;
+ struct bonding_device *bdev = container_of(tree, struct bonding_device, ports);
if (node_new) {
bp = container_of(node_new, struct bonding_port, node);
if (node_old) {
+ struct bonding_port *bp_old;
+
+ bp_old = container_of(node_old, struct bonding_port, node);
+ if (bp_old->set_primary != bp->set_primary) {
+ bp_old->set_primary = bp->set_primary;
+ bdev->reset_primary = true;
+ }
+
free(bp);
return;
}