summaryrefslogtreecommitdiffstats
path: root/src/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-04-14 12:54:16 +0300
committerRoy Marples <roy@marples.name>2019-04-14 12:54:16 +0300
commit56c84b0a0f85f41d5885439546e32b36c301c387 (patch)
treea6b2e62b5de052b18784ae780393c2bb862bd4df /src/if.c
parentf802fb1da2b8ddae6a4754f8e91f944ce24cf0e2 (diff)
downloaddhcpcd-56c84b0a0f85f41d5885439546e32b36c301c387.tar.xz
sun: Fix carrier detection, MTU detection and plumbing
dhcpcd no longer needs ifconfig to do the initial plumbing.
Diffstat (limited to 'src/if.c')
-rw-r--r--src/if.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/if.c b/src/if.c
index 95067c77..783a92bb 100644
--- a/src/if.c
+++ b/src/if.c
@@ -136,9 +136,15 @@ if_carrier(struct interface *ifp)
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
- if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFFLAGS, &ifr) == -1)
+ r = ioctl(ifp->ctx->pf_inet_fd, SIOCGIFFLAGS, &ifr);
+ if (r != -1)
+ ifp->flags = (unsigned int)ifr.ifr_flags;
+
+#ifdef __sun
+ return if_carrier_os(ifp);
+#else
+ if (r == -1)
return LINK_UNKNOWN;
- ifp->flags = (unsigned int)ifr.ifr_flags;
#ifdef SIOCGIFMEDIA
memset(&ifmr, 0, sizeof(ifmr));
@@ -155,6 +161,7 @@ if_carrier(struct interface *ifp)
#else
r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_DOWN;
#endif
+#endif /* __sun */
return r;
}
@@ -711,6 +718,11 @@ if_domtu(const struct interface *ifp, short int mtu)
int r;
struct ifreq ifr;
+#ifdef __sun
+ if (mtu == 0)
+ return if_mtu_os(ifp);
+#endif
+
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
ifr.ifr_mtu = mtu;