changeset 2971:c106f733c6ea draft

Don't warn about CSR or host routes until we actually use a lease.
author Roy Marples <roy@marples.name>
date Sat, 28 Feb 2015 19:22:58 +0000
parents fe273325a201
children 7738b7a39516
files dhcp.c ipv4.c
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dhcp.c	Sat Feb 28 17:41:24 2015 +0000
+++ b/dhcp.c	Sat Feb 28 19:22:58 2015 +0000
@@ -593,7 +593,12 @@
 	if (p) {
 		routes = decode_rfc3442_rt(p, len);
 		if (routes) {
-			if (!(ifo->options & DHCPCD_CSR_WARNED)) {
+			const struct dhcp_state *state;
+
+			state = D_CSTATE(ifp);
+			if (!(ifo->options & DHCPCD_CSR_WARNED) &&
+			    !(state->added & STATE_FAKE))
+			{
 				syslog(LOG_DEBUG,
 				    "%s: using %sClassless Static Routes",
 				    ifp->name, csr);
--- a/ipv4.c	Sat Feb 28 17:41:24 2015 +0000
+++ b/ipv4.c	Sat Feb 28 19:22:58 2015 +0000
@@ -600,6 +600,7 @@
 	struct rt *rtp, *rtn;
 	const char *cp, *cp2, *cp3, *cplim;
 	struct if_options *ifo;
+	const struct dhcp_state *state;
 
 	if (rt == NULL) /* earlier malloc failed */
 		return NULL;
@@ -628,9 +629,12 @@
 		}
 		if (rtn != rtp)
 			continue;
+		state = D_CSTATE(ifp);
 		ifo = ifp->options;
 		if (ifp->flags & IFF_NOARP) {
-			if (!(ifo->options & DHCPCD_ROUTER_HOST_ROUTE_WARNED)) {
+			if (!(ifo->options & DHCPCD_ROUTER_HOST_ROUTE_WARNED) &&
+			    !(state->added & STATE_FAKE))
+			{
 				ifo->options |= DHCPCD_ROUTER_HOST_ROUTE_WARNED;
 				syslog(LOG_WARNING,
 				    "%s: forcing router %s through interface",
@@ -639,7 +643,9 @@
 			rtp->gate.s_addr = 0;
 			continue;
 		}
-		if (!(ifo->options & DHCPCD_ROUTER_HOST_ROUTE_WARNED)) {
+		if (!(ifo->options & DHCPCD_ROUTER_HOST_ROUTE_WARNED) &&
+		    !(state->added & STATE_FAKE))
+		{
 			ifo->options |= DHCPCD_ROUTER_HOST_ROUTE_WARNED;
 			syslog(LOG_WARNING,
 			    "%s: router %s requires a host route",