X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Frouter.c;h=36267bea6d36269ac96866e83cb6484d776096d6;hp=a09e107a05f7548d22eaf5ac83749cbdfe232d39;hb=68ee0b59040625d2ab5830b1c1cc8eca2da0dcf1;hpb=237f1f45d58c1ad4ef9ce6ce4960dfe60dcf1023 diff --git a/src/router.c b/src/router.c index a09e107..36267be 100644 --- a/src/router.c +++ b/src/router.c @@ -35,7 +35,7 @@ static void handle_icmpv6(void *addr, void *data, size_t len, static void trigger_router_advert(struct uloop_timeout *event); static void sigusr1_refresh(int signal); -static struct odhcpd_event router_event = {{.fd = -1}, handle_icmpv6, NULL}; +static struct odhcpd_event router_event = {.uloop = {.fd = -1}, .handle_dgram = handle_icmpv6, }; static FILE *fp_route = NULL; #define RA_IOV_LEN 6 @@ -263,8 +263,8 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add else if (parse_routes(addrs, ipcnt)) adv.h.nd_ra_router_lifetime = htons(1); - syslog(LOG_INFO, "Initial router lifetime %d, %d address(es) available", - ntohs(adv.h.nd_ra_router_lifetime), ipcnt); + syslog(LOG_INFO, "Initial RA router lifetime %d, %d address(es) available on %s", + ntohs(adv.h.nd_ra_router_lifetime), (int)ipcnt, iface->ifname); } // Construct Prefix Information options @@ -282,8 +282,8 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add char namebuf[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, addr, namebuf, sizeof(namebuf)); - syslog(LOG_INFO, "Address %s (prefix %d, valid %u) not suitable", - namebuf, addr->prefix, addr->valid); + syslog(LOG_INFO, "Address %s (prefix %d, valid %u) not suitable as RA prefix on %s", + namebuf, addr->prefix, addr->valid, iface->ifname); continue; } @@ -309,12 +309,12 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add uint32_t this_lifetime = TIME_LEFT(addr->valid, now); if (this_lifetime > UINT16_MAX) this_lifetime = UINT16_MAX; - if (((addr->addr.s6_addr[0] & 0xfe) != 0xfc || iface->default_router) + if ((!IN6_IS_ADDR_ULA(&addr->addr) || iface->default_router) && adv.h.nd_ra_router_lifetime && ntohs(adv.h.nd_ra_router_lifetime) < this_lifetime) { adv.h.nd_ra_router_lifetime = htons(this_lifetime); - syslog(LOG_DEBUG, "Updating router lifetime to %d", this_lifetime); + syslog(LOG_INFO, "Updating RA router lifetime to %d on %s", this_lifetime, iface->ifname); } odhcpd_bmemcpy(&p->nd_opt_pi_prefix, &addr->addr,