changeset 2473:3a21f982379d draft

Fix sending DHCPv6
author Roy Marples <roy@marples.name>
date Mon, 05 May 2014 21:21:31 +0000
parents bf549b4eec69
children f27dd8bf4885
files script.c
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/script.c	Mon May 05 20:18:14 2014 +0000
+++ b/script.c	Mon May 05 21:21:31 2014 +0000
@@ -519,36 +519,41 @@
 }
 
 int
-send_interface(int fd, const struct interface *iface)
+send_interface(int fd, const struct interface *ifp)
 {
 	const char *reason;
 	int retval = 0;
 	int onestate = 0;
 #ifdef INET
-	const struct dhcp_state *state = D_CSTATE(iface);
+	const struct dhcp_state *d = D_CSTATE(ifp);
+#endif
+#ifdef INET6
+	const struct dhcp6_state *d6 = D6_CSTATE(ifp);
+#endif
 
-	if (state) {
+#ifdef INET
+	if (d) {
 		onestate = 1;
-		if (send_interface1(fd, iface, state->reason) == -1)
+		if (send_interface1(fd, ifp, d->reason) == -1)
 			retval = -1;
 	}
 #endif
 
 #ifdef INET6
-	if (ipv6nd_has_ra(iface)) {
+	if (ipv6nd_has_ra(ifp)) {
 		onestate = 1;
-		if (send_interface1(fd, iface, "ROUTERADVERT") == -1)
+		if (send_interface1(fd, ifp, "ROUTERADVERT") == -1)
 			retval = -1;
 	}
-	if (D6_STATE_RUNNING(iface)) {
+	if (D6_STATE_RUNNING(ifp)) {
 		onestate = 1;
-		if (send_interface1(fd, iface, "INFORM6") == -1)
+		if (send_interface1(fd, ifp, d6->reason) == -1)
 			retval = -1;
 	}
 #endif
 
 	if (!onestate) {
-		switch (iface->carrier) {
+		switch (ifp->carrier) {
 		case LINK_UP:
 			reason = "CARRIER";
 			break;
@@ -559,7 +564,7 @@
 			reason = "UNKNOWN";
 			break;
 		}
-		if (send_interface1(fd, iface, reason) == -1)
+		if (send_interface1(fd, ifp, reason) == -1)
 			retval = -1;
 	}
 	return retval;