summaryrefslogtreecommitdiffstats
path: root/src/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-06-18 21:15:15 +0100
committerRoy Marples <roy@marples.name>2020-06-18 21:15:15 +0100
commit009dc39be56be9b2fae857e64aa55c20f2842d13 (patch)
tree6085381f2e63161a8aa72f49eaac34f255f970be /src/if-bsd.c
parent3f9355273c90c21bb1fdaa8bac9776f8195301b2 (diff)
downloaddhcpcd-009dc39be56be9b2fae857e64aa55c20f2842d13.tar.xz
dhcpcd: Add an option to poll the interface carrier state
Only to be used if the interface does not report carrier state changes for whatever reason.
Diffstat (limited to 'src/if-bsd.c')
-rw-r--r--src/if-bsd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index 090b587b..5e748a4e 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -358,6 +358,10 @@ if_carrier(struct interface *ifp)
{
struct ifmediareq ifmr = { .ifm_status = 0 };
+ /* Not really needed, but the other OS update flags here also */
+ if (if_getflags(ifp) == -1)
+ return LINK_UNKNOWN;
+
strlcpy(ifmr.ifm_name, ifp->name, sizeof(ifmr.ifm_name));
if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFMEDIA, &ifmr) == -1 ||
!(ifmr.ifm_status & IFM_AVALID))