]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only warn about adding a host route to the router the once.
authorRoy Marples <roy@marples.name>
Fri, 27 Feb 2015 14:58:13 +0000 (14:58 +0000)
committerRoy Marples <roy@marples.name>
Fri, 27 Feb 2015 14:58:13 +0000 (14:58 +0000)
dhcp.c
if-options.h
ipv4.c

diff --git a/dhcp.c b/dhcp.c
index 88f7f59d2e8f11202922210dbc40c9b33a5daa14..0caa1e00f828f2ea9959ac0777a05438a04e6b3b 100644 (file)
--- 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
index 41d2dca147372494618b680c17e1e2d635b28a10..bc3dc5434698d320f55cd2d90bd3107b6e10b2ba 100644 (file)
 #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 4f76ffc7bc435b7400d98de5013aca76f347e04b..6fc010dd195f51180165af7e7d0524644297a394 100644 (file)
--- 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__);