Skip to content

Commit

Permalink
Trigger topo change on every link up after link down
Browse files Browse the repository at this point in the history
This causes DHCP renewals to happen when you disconnect/reconnect
cables or re-establish wifi connections on a bridge.

Signed-off-by: James Haggerty <[email protected]>
  • Loading branch information
wryun committed Sep 30, 2024
1 parent 24f9a93 commit 85bd4f9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct bridge_member {
uint16_t pvid;
bool present;
bool active;
bool has_link_down;
char name[];
};

Expand Down Expand Up @@ -782,6 +783,11 @@ bridge_member_cb(struct device_user *dep, enum device_event ev)
DEV_OPT_MTU | DEV_OPT_MTU6);
break;
case DEV_EVENT_LINK_UP:
if (!bst->has_vlans && !dev->settings.auth && bm->has_link_down) {
device_broadcast_event(&bst->dev, DEV_EVENT_TOPO_CHANGE);
}
bm->has_link_down = false;

if (!bst->has_vlans)
break;

Expand All @@ -791,10 +797,11 @@ bridge_member_cb(struct device_user *dep, enum device_event ev)
uloop_timeout_set(&bm->check_timer, 1000);
break;
case DEV_EVENT_LINK_DOWN:
if (!dev->settings.auth)
break;
bm->has_link_down = true;

if (dev->settings.auth)
bridge_disable_member(bm, true);

bridge_disable_member(bm, true);
break;
case DEV_EVENT_REMOVE:
if (dep->hotplug && !dev->sys_present) {
Expand Down

0 comments on commit 85bd4f9

Please sign in to comment.