From d01b104d48a6d10b42aaa4a3b8abfe8ca72d69f1 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Wed, 30 Mar 2011 05:24:16 -0400 Subject: [PATCH] Handle netlink interface-up notification for non-DS_BOUND states. --- ndhc/netlink.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ndhc/netlink.c b/ndhc/netlink.c index 6331a6e..85be768 100644 --- a/ndhc/netlink.c +++ b/ndhc/netlink.c @@ -24,6 +24,7 @@ #include #include "netlink.h" +#include "ifchange.h" #include "log.h" #define NLMSG_RECVSIZE 8192 @@ -123,18 +124,29 @@ static void nl_handlemsg(struct nlmsghdr *msg, unsigned int len, cs->ifsPrevState = IFS_UP; /* * If we have a lease, then check to see - * if our gateway is still valid. If it fails, - * state -> INIT_REBOOT. + * if our gateway is still valid (via ARP). + * If it fails, state -> INIT. * * If we don't have a lease, state -> INIT. - */ + */ + if (cs->dhcpState == DS_BOUND) { + /* arp_check_gw(cs); */ + } else if (cs->dhcpState != DS_INIT_SELECTING) { + // Same as packet.c: line 258 + ifchange(NULL, IFCHANGE_DECONFIG); + cs->dhcpState = DS_INIT_SELECTING; + cs->timeout = 0; + cs->requestedIP = 0; + cs->packetNum = 0; + change_listen_mode(cs, LM_RAW); + } } } else { if (cs->ifsPrevState != IFS_DOWN) { cs->ifsPrevState = IFS_DOWN; /* * state -> DOWN - */ + */ } } } else {