Only bring down the interface at startup time if it is not already up and

running.  ndhc does its job entirely with raw sockets before a lease is
established, so it will work just fine, and this change allows for the dhcp
client to be re-run without causing downtime on an interface.
This commit is contained in:
Nicholas J. Kain 2011-07-02 04:58:58 -04:00
parent 46ed7f5998
commit d304fb6b38
3 changed files with 10 additions and 9 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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);