summaryrefslogtreecommitdiffstats
path: root/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-06-04 23:54:15 +0000
committerRoy Marples <roy@marples.name>2014-06-04 23:54:15 +0000
commitd05215aa288607dbf55c879b00d2c0d115764644 (patch)
treef71a13f35db72e8d7cc3dba082c183d8e0294aee /if.c
parent5c097200ef1daffe7f989b10f0120e97290cc173 (diff)
downloaddhcpcd-d05215aa288607dbf55c879b00d2c0d115764644.tar.xz
Add an IPv6 link-local address before upping the interface if needed.
Bring an interface up when we start it and not during discovery. As such, stop waiting on carrier for a second if we did.
Diffstat (limited to 'if.c')
-rw-r--r--if.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/if.c b/if.c
index f4b8c7a9..7d5f3896 100644
--- a/if.c
+++ b/if.c
@@ -132,8 +132,8 @@ if_carrier(struct interface *iface)
return r;
}
-static int
-up_interface(struct interface *iface)
+int
+if_up(struct interface *ifp)
{
struct ifreq ifr;
int s, r;
@@ -144,7 +144,7 @@ up_interface(struct interface *iface)
if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
return -1;
memset(&ifr, 0, sizeof(ifr));
- strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
#ifdef __linux__
/* We can only bring the real interface up */
if ((p = strchr(ifr.ifr_name, ':')))
@@ -159,7 +159,7 @@ up_interface(struct interface *iface)
if (ioctl(s, SIOCSIFFLAGS, &ifr) == 0)
r = 0;
}
- iface->flags = (unsigned int)ifr.ifr_flags;
+ ifp->flags = (unsigned int)ifr.ifr_flags;
}
close(s);
return r;
@@ -296,20 +296,6 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
strlcpy(ifp->name, p, sizeof(ifp->name));
ifp->flags = ifa->ifa_flags;
- /* Bring the interface up if not already */
- if (!(ifp->flags & IFF_UP)
-#ifdef SIOCGIFMEDIA
- && if_carrier(ifp) != LINK_UNKNOWN
-#endif
- )
- {
- if (up_interface(ifp) == 0)
- ctx->options |= DHCPCD_WAITUP;
- else
- syslog(LOG_ERR, "%s: up_interface: %m",
- ifp->name);
- }
-
sdl_type = 0;
/* Don't allow loopback unless explicit */
if (ifp->flags & IFF_LOOPBACK) {