From: Roy Marples Date: Fri, 27 Feb 2015 14:58:13 +0000 (+0000) Subject: Only warn about adding a host route to the router the once. X-Git-Tag: v6.8.0~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd8a1475f814b99d274a0c7360e7200014ae2f20;p=thirdparty%2Fdhcpcd.git Only warn about adding a host route to the router the once. --- diff --git a/dhcp.c b/dhcp.c index 88f7f59d..0caa1e00 100644 --- a/dhcp.c +++ b/dhcp.c @@ -1813,7 +1813,8 @@ dhcp_rebind(void *arg) state->state = DHS_REBIND; eloop_timeout_delete(ifp->ctx->eloop, send_renew, ifp); state->lease.server.s_addr = 0; - ifp->options->options &= ~ DHCPCD_CSR_WARNED; + ifp->options->options &= ~(DHCPCD_CSR_WARNED | + DHCPCD_ROUTER_HOST_ROUTE_WARNED); send_rebind(ifp); } @@ -2192,7 +2193,8 @@ dhcp_drop(struct interface *ifp, const char *reason) free(state->old); state->old = NULL; state->lease.addr.s_addr = 0; - ifp->options->options &= ~ DHCPCD_CSR_WARNED; + ifp->options->options &= ~(DHCPCD_CSR_WARNED | + DHCPCD_ROUTER_HOST_ROUTE_WARNED); } static void diff --git a/if-options.h b/if-options.h index 41d2dca1..bc3dc543 100644 --- a/if-options.h +++ b/if-options.h @@ -107,6 +107,7 @@ #define DHCPCD_PFXDLGONLY (1ULL << 52) #define DHCPCD_PFXDLGMIX (1ULL << 53) #define DHCPCD_IPV6RA_AUTOCONF (1ULL << 54) +#define DHCPCD_ROUTER_HOST_ROUTE_WARNED (1ULL << 55) extern const struct option cf_options[]; diff --git a/ipv4.c b/ipv4.c index 4f76ffc7..6fc010dd 100644 --- a/ipv4.c +++ b/ipv4.c @@ -599,6 +599,7 @@ add_router_host_route(struct rt_head *rt, const struct interface *ifp) { struct rt *rtp, *rtn; const char *cp, *cp2, *cp3, *cplim; + struct if_options *ifo; if (rt == NULL) /* earlier malloc failed */ return NULL; @@ -627,15 +628,23 @@ add_router_host_route(struct rt_head *rt, const struct interface *ifp) } if (rtn != rtp) continue; + ifo = ifp->options; if (ifp->flags & IFF_NOARP) { - syslog(LOG_WARNING, - "%s: forcing router %s through interface", - ifp->name, inet_ntoa(rtp->gate)); + if (!(ifo->options & DHCPCD_ROUTER_HOST_ROUTE_WARNED)) { + ifo->options |= DHCPCD_ROUTER_HOST_ROUTE_WARNED; + syslog(LOG_WARNING, + "%s: forcing router %s through interface", + ifp->name, inet_ntoa(rtp->gate)); + } rtp->gate.s_addr = 0; continue; } - syslog(LOG_WARNING, "%s: router %s requires a host route", - ifp->name, inet_ntoa(rtp->gate)); + if (!(ifo->options & DHCPCD_ROUTER_HOST_ROUTE_WARNED)) { + ifo->options |= DHCPCD_ROUTER_HOST_ROUTE_WARNED; + syslog(LOG_WARNING, + "%s: router %s requires a host route", + ifp->name, inet_ntoa(rtp->gate)); + } rtn = malloc(sizeof(*rtn)); if (rtn == NULL) { syslog(LOG_ERR, "%s: %m", __func__);