- // Evaluate hybrid mode for master
- struct interface *master = NULL, *i;
- list_for_each_entry(i, &interfaces, head) {
- if (!i->master)
- continue;
+ 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)
+ continue;
+
+ enum odhcpd_mode hybrid_mode = RELAYD_DISABLED;
+#ifdef WITH_UBUS
+ if (!ubus_has_prefix(i->name, i->ifname))
+ hybrid_mode = RELAYD_RELAY;
+#endif
+
+ if (i->dhcpv6 == RELAYD_HYBRID)
+ i->dhcpv6 = hybrid_mode;