X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Frstp.git;a=blobdiff_plain;f=bridge_track.c;fp=bridge_track.c;h=289fc412497387fa2a43a8ae31af82cce2672938;hp=efc23e5522de937b955e1856336d8a6eb06d1970;hb=968d3d40984d0279bce51259ce0e969adc7bda79;hpb=d19d0e359b26f0935e66b0c19b98c7e66fac9f34 diff --git a/bridge_track.c b/bridge_track.c index efc23e5..289fc41 100644 --- a/bridge_track.c +++ b/bridge_track.c @@ -476,13 +476,14 @@ static void set_if_up(struct ifdata *ifc, int up) /*------------------------------------------------------------*/ -int bridge_notify(int br_index, int if_index, int newlink, int up) +int bridge_notify(int br_index, int if_index, int newlink, + unsigned flags) { - if (up) - up = 1; - LOG("br_index %d, if_index %d, up %d", br_index, if_index, up); - struct ifdata *br = NULL; + + LOG("br_index %d, if_index %d, up %d running %d", + br_index, if_index, (flags & IFF_UP), flags & IFF_RUNNING); + if (br_index >= 0) { br = find_if(br_index); if (br && !br->is_bridge) { @@ -536,6 +537,8 @@ int bridge_notify(int br_index, int if_index, int newlink, int up) delete_if(ifc); return 0; } + int up = (flags & (IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING); + if (ifc->up != up) set_if_up(ifc, up); /* And speed and duplex */ } else { /* No br_index */ @@ -565,11 +568,18 @@ int bridge_notify(int br_index, int if_index, int newlink, int up) delete_if(ifc); return 0; } - if (ifc && ifc->up != up) { - if (ifc->is_bridge) - set_br_up(ifc, up); - else - set_if_up(ifc, up); + + if (ifc) { + if (ifc->is_bridge) { + int up = (flags & IFF_UP) != 0; + if (ifc->up != up) + set_br_up(ifc, up); + } else { + int up = (flags & (IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING); + + if (ifc->up != up) + set_if_up(ifc, up); + } } } }