Fix the dhcp state bootstrapping when rfkill is set.

This commit is contained in:
Nicholas J. Kain 2015-02-13 18:07:14 -05:00
parent 79a97131bc
commit a8af406307

View File

@ -282,7 +282,7 @@ static void do_ndhc_work(void)
{
struct epoll_event events[NDHC_NUM_EP_FDS];
long long nowts;
int timeout;
int timeout = -1;
cs.epollFd = epoll_create1(0);
if (cs.epollFd < 0)
@ -299,9 +299,11 @@ static void do_ndhc_work(void)
epoll_add(cs.epollFd, sockdStream[0]);
if (client_config.enable_rfkill && cs.rfkillFd != -1)
epoll_add(cs.epollFd, cs.rfkillFd);
start_dhcp_listen(&cs);
nowts = curms();
goto jumpstart;
if (!cs.rfkill_set) {
start_dhcp_listen(&cs);
nowts = curms();
goto jumpstart;
}
for (;;) {
int r = epoll_wait(cs.epollFd, events, NDHC_NUM_EP_FDS, timeout);
@ -360,6 +362,13 @@ static void do_ndhc_work(void)
timeout = 0;
}
if (cs.rfkill_set) {
// We can't do anything until the rfkill is gone.
if (timeout <= 0)
timeout = -1;
break;
}
if (!timeout) {
jumpstart:
timeout_action(&cs, nowts);