summaryrefslogtreecommitdiffstats
path: root/ipv6rs.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2013-02-04 13:30:35 +0000
committerRoy Marples <roy@marples.name>2013-02-04 13:30:35 +0000
commitaae24feb3d75af5ac07a97959c944f3d5537fdd6 (patch)
treeb8effb23300a215983c453f14e71c88283d97028 /ipv6rs.c
parente88c525f5026816627d4892e8c4595e6becebd91 (diff)
downloaddhcpcd-aae24feb3d75af5ac07a97959c944f3d5537fdd6.tar.xz
It's now possible to compile out IPv4 and IPv6 support by passing
--disable-ipv4 or --disable-ipv6 to configure.
Diffstat (limited to 'ipv6rs.c')
-rw-r--r--ipv6rs.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/ipv6rs.c b/ipv6rs.c
index cbf93b6c..67d6dfcf 100644
--- a/ipv6rs.c
+++ b/ipv6rs.c
@@ -125,7 +125,7 @@ ipv6rs_cleanup(void)
}
#endif
-int
+static int
ipv6rs_open(void)
{
int on;
@@ -379,7 +379,7 @@ add_router(struct ra *router)
}
/* ARGSUSED */
-void
+static void
ipv6rs_handledata(_unused void *arg)
{
ssize_t len, l, m, n, olen;
@@ -1127,3 +1127,26 @@ ipv6rs_drop(struct interface *ifp)
script_runreason(ifp, "ROUTERADVERT");
}
}
+
+int
+ipv6rs_init(void)
+{
+ int fd;
+
+ fd = ipv6rs_open();
+ if (fd == -1) {
+ syslog(LOG_ERR, "ipv6rs: %m");
+ options &= ~(DHCPCD_IPV6RS |
+ DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT);
+ return -1;
+ }
+
+ eloop_event_add(fd, ipv6rs_handledata, NULL);
+ // atexit(restore_rtadv);
+
+ if (options & DHCPCD_IPV6RA_OWN ||
+ options & DHCPCD_IPV6RA_OWN_DEFAULT)
+ return ipv6ns_init();
+
+ return 0;
+}