X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-autoipd%2Fmain.c;h=eb71c3b97a14e22e6793565a0f1d2388924bf251;hb=4971db5ddc8125e484c3c55a76d6a49029c541b2;hp=01ccc79ef9dd6d3bb6b0d7496f4b740d9be66e8d;hpb=872947dffb0d1e5b23658ef118799c0ed55d8b27;p=catta diff --git a/avahi-autoipd/main.c b/avahi-autoipd/main.c index 01ccc79..eb71c3b 100644 --- a/avahi-autoipd/main.c +++ b/avahi-autoipd/main.c @@ -1144,9 +1144,13 @@ static int loop(int iface, uint32_t addr) { for (i = 0; i < ETHER_ADDRLEN; i++) a += hw_address[i]*i; + a = (a % 0xFE00) + 0x0100; + addr = htonl(IPV4LL_NETWORK | (uint32_t) a); } + assert(is_ll_address(addr)); + set_state(st, 1, addr); daemon_log(LOG_INFO, "Starting with address %s", inet_ntop(AF_INET, &addr, buf, sizeof(buf))); @@ -1277,7 +1281,7 @@ static int loop(int iface, uint32_t addr) { DEBUG(daemon_log(LOG_DEBUG, "Ignoring irrelevant ARP packet.")); } - } else if (event == EVENT_ROUTABLE_ADDR_CONFIGURED) { + } else if (event == EVENT_ROUTABLE_ADDR_CONFIGURED && !force_bind) { daemon_log(LOG_INFO, "A routable address has been configured."); @@ -1302,7 +1306,7 @@ static int loop(int iface, uint32_t addr) { elapse_time(&next_wakeup, 0, PROBE_WAIT*1000); next_wakeup_valid = 1; - } else if (event == EVENT_REFRESH_REQUEST && state == STATE_RUNNING && !force_bind) { + } else if (event == EVENT_REFRESH_REQUEST && state == STATE_RUNNING) { /* The user requested a reannouncing of the address by a SIGHUP */ daemon_log(LOG_INFO, "Reannouncing address.");