]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcpcd: log carrier lost once more
authorRoy Marples <roy@marples.name>
Tue, 22 Sep 2020 12:08:32 +0000 (13:08 +0100)
committerRoy Marples <roy@marples.name>
Tue, 22 Sep 2020 12:08:32 +0000 (13:08 +0100)
src/dhcpcd.c

index d573d3a96d2f90ef9a26929a04e7e847e9685414..b49cf95c7280acacb19b1865179621b183b640d2 100644 (file)
@@ -727,6 +727,8 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
 
        if (carrier == LINK_DOWN || (ifp->flags & IFF_UP) == 0) {
                if (ifp->carrier != LINK_DOWN) {
+                       int oldcarrier = ifp->carrier;
+
 #ifdef NOCARRIER_PRESERVE_IP
                        if (ifp->flags & IFF_UP &&
                            !(ifp->options->options & DHCPCD_ANONYMOUS))
@@ -736,7 +738,7 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
                                ifp->carrier = LINK_DOWN;
                        if (!ifp->active)
                                return;
-                       if (ifp->carrier == LINK_UP)
+                       if (oldcarrier == LINK_UP)
                                loginfox("%s: carrier lost", ifp->name);
                        script_runreason(ifp, "NOCARRIER");
 #ifdef NOCARRIER_PRESERVE_IP