diff --git a/ndhc/ndhc.c b/ndhc/ndhc.c index 6a9798f..a6c1596 100644 --- a/ndhc/ndhc.c +++ b/ndhc/ndhc.c @@ -304,7 +304,8 @@ int main(int argc, char **argv) "cap_net_bind_service,cap_net_broadcast,cap_net_raw=ep"); drop_root(uid, gid); - ifchange(NULL, IFCHANGE_DECONFIG); + if (cs.ifsPrevState != IFS_UP) + ifchange(NULL, IFCHANGE_DECONFIG); do_work(); return EXIT_SUCCESS; // Never reached. diff --git a/ndhc/netlink.c b/ndhc/netlink.c index 998b152..f6f6b99 100644 --- a/ndhc/netlink.c +++ b/ndhc/netlink.c @@ -40,14 +40,6 @@ #include "arp.h" #include "log.h" -enum { - IFS_NONE = 0, - IFS_UP, - IFS_DOWN, - IFS_SHUT, - IFS_REMOVED -}; - static struct mnl_socket *mls; static void nl_close(struct client_state_t *cs) diff --git a/ndhc/netlink.h b/ndhc/netlink.h index 35fcedf..fe5bc30 100644 --- a/ndhc/netlink.h +++ b/ndhc/netlink.h @@ -22,6 +22,14 @@ #include "state.h" +enum { + IFS_NONE = 0, + IFS_UP, + IFS_DOWN, + IFS_SHUT, + IFS_REMOVED +}; + int nl_open(struct client_state_t *cs); void handle_nl_message(struct client_state_t *cs); int nl_getifdata(const char *ifname, struct client_state_t *cs);