diff options
-rw-r--r-- | src/config.c | 28 | ||||
-rw-r--r-- | src/ndp.c | 4 | ||||
-rw-r--r-- | src/odhcpd.c | 2 |
3 files changed, 30 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c index 195a9a4..05eb824 100644 --- a/src/config.c +++ b/src/config.c @@ -555,6 +555,23 @@ void odhcpd_reload(void) ubus_apply_network(); #endif + bool any_dhcpv6_slave = false, any_ra_slave = false, any_ndp_slave = false; + + // Test for + list_for_each_entry(i, &interfaces, head) { + if (i->master) + continue; + + if (i->dhcpv6 == RELAYD_HYBRID || i->dhcpv6 == RELAYD_RELAY) + any_dhcpv6_slave = true; + + if (i->ra == RELAYD_HYBRID || i->ra == RELAYD_RELAY) + any_ra_slave = true; + + if (i->ndp == RELAYD_HYBRID || i->ndp == RELAYD_RELAY) + any_ndp_slave = true; + } + // Evaluate hybrid mode for master list_for_each_entry(i, &interfaces, head) { if (!i->master) @@ -569,12 +586,21 @@ void odhcpd_reload(void) if (i->dhcpv6 == RELAYD_HYBRID) i->dhcpv6 = hybrid_mode; + if (i->dhcpv6 == RELAYD_RELAY && !any_dhcpv6_slave) + i->dhcpv6 = RELAYD_DISABLED; + if (i->ra == RELAYD_HYBRID) i->ra = hybrid_mode; + if (i->ra == RELAYD_RELAY && !any_ra_slave) + i->ra = RELAYD_DISABLED; + if (i->ndp == RELAYD_HYBRID) i->ndp = hybrid_mode; + if (i->ndp == RELAYD_RELAY && !any_ndp_slave) + i->ndp = RELAYD_DISABLED; + if (i->dhcpv6 == RELAYD_RELAY || i->ra == RELAYD_RELAY || i->ndp == RELAYD_RELAY) master = i; } @@ -593,7 +619,7 @@ void odhcpd_reload(void) if (i->ndp == RELAYD_HYBRID) i->ndp = (master && master->ndp == RELAYD_RELAY) ? - RELAYD_RELAY : RELAYD_SERVER; + RELAYD_RELAY : RELAYD_DISABLED; setup_router_interface(i, true); setup_dhcpv6_interface(i, true); @@ -234,7 +234,7 @@ static void handle_solicit(void *addr, void *data, size_t len, char ipbuf[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &req->nd_ns_target, ipbuf, sizeof(ipbuf)); - syslog(LOG_NOTICE, "Got a NS for %s", ipbuf); + syslog(LOG_DEBUG, "Got a NS for %s", ipbuf); uint8_t mac[6]; odhcpd_get_mac(iface, mac); @@ -246,7 +246,7 @@ static void handle_solicit(void *addr, void *data, size_t len, struct ndp_neighbor *n = find_neighbor(&req->nd_ns_target, false); if (n && (n->iface || abs(n->timeout - now) < 5)) { - syslog(LOG_NOTICE, "%s is on %s", ipbuf, + syslog(LOG_DEBUG, "%s is on %s", ipbuf, (n->iface) ? n->iface->ifname : "<pending>"); if (!n->iface || n->iface == iface) return; diff --git a/src/odhcpd.c b/src/odhcpd.c index 6512e61..f40cea0 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -52,7 +52,7 @@ static int urandom_fd = -1; int main() { openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON); - setlogmask(LOG_UPTO(LOG_INFO)); + setlogmask(LOG_UPTO(LOG_WARNING)); uloop_init(); if (getuid() != 0) { |