diff options
| author | Roy Marples <roy@marples.name> | 2020-01-25 13:27:36 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-01-25 13:27:36 +0000 |
| commit | 3c348f209e856fe4a507a28d75d8338b5f0b6359 (patch) | |
| tree | 90027ff9c001b43925430019b1293b7ae7310c97 /src/dhcpcd.c | |
| parent | 6b6753c4726fcbde412052410eeea965df7ebf27 (diff) | |
| download | dhcpcd-3c348f209e856fe4a507a28d75d8338b5f0b6359.tar.xz | |
dhcpcd: For anonymous do not bring interface up if was down
We need to bring the interface down on carrier loss to change the
hardware address, but we should only bring it up again if it was
up previously.
After all it's really an administrative flag.
Diffstat (limited to 'src/dhcpcd.c')
| -rw-r--r-- | src/dhcpcd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c index df2aff95..20ade526 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -728,10 +728,14 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags, #endif dhcpcd_drop(ifp, 0); if (ifp->options->options & DHCPCD_ANONYMOUS) { - if_down(ifp); + bool was_up = ifp->flags & IFF_UP; + + if (was_up) + if_down(ifp); if (if_randomisemac(ifp) == -1 && errno != ENXIO) logerr(__func__); - if_up(ifp); + if (was_up) + if_up(ifp); } } } else if (carrier == LINK_UP && ifp->flags & IFF_UP) { |
