]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/dhcpv6.c
Ignore multiple MAP-E instances for now and output DMR / BR for every rule
[odhcp6c.git] / src / dhcpv6.c
index 6e5e8ba88ecec32c0fd2edaddb500c0dfe7495c6..7c6da00c3d3e6ef723e0f23a13f58847e0f606d6 100644 (file)
@@ -178,6 +178,11 @@ int init_dhcpv6(const char *ifname, unsigned int options, int sol_timeout)
 #endif
 #ifdef EXT_CER_ID
                        htons(DHCPV6_OPT_CER_ID),
+#endif
+#ifdef EXT_S46
+                       htons(DHCPV6_OPT_S46_CONT_MAPE),
+                       htons(DHCPV6_OPT_S46_CONT_MAPT),
+                       htons(DHCPV6_OPT_S46_CONT_LW),
 #endif
                };
                odhcp6c_add_state(STATE_ORO, oro, sizeof(oro));
@@ -914,6 +919,9 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig, _unused const int rc,
                odhcp6c_clear_state(STATE_SIP_FQDN);
                odhcp6c_clear_state(STATE_AFTR_NAME);
                odhcp6c_clear_state(STATE_CER);
+               odhcp6c_clear_state(STATE_S46_MAPT);
+               odhcp6c_clear_state(STATE_S46_MAPE);
+               odhcp6c_clear_state(STATE_S46_LW);
        }
 
        // Parse and find all matching IAs
@@ -1019,6 +1027,17 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig, _unused const int rc,
                        struct in6_addr any = IN6ADDR_ANY_INIT;
                        if (memcmp(&cer_id->addr, &any, sizeof(any)))
                                odhcp6c_add_state(STATE_CER, &cer_id->addr, sizeof(any));
+#endif
+#ifdef EXT_S46
+               } else if (otype == DHCPV6_OPT_S46_CONT_MAPT) {
+                       odhcp6c_add_state(STATE_S46_MAPT, odata, olen);
+               } else if (otype == DHCPV6_OPT_S46_CONT_MAPE) {
+                       size_t mape_len;
+                       odhcp6c_get_state(STATE_S46_MAPE, &mape_len);
+                       if (mape_len == 0)
+                               odhcp6c_add_state(STATE_S46_MAPE, odata, olen);
+               } else if (otype == DHCPV6_OPT_S46_CONT_LW) {
+                       odhcp6c_add_state(STATE_S46_LW, odata, olen);
 #endif
                } else if (otype != DHCPV6_OPT_CLIENTID &&
                                otype != DHCPV6_OPT_SERVERID) {
@@ -1370,8 +1389,7 @@ int dhcpv6_promote_server_cand(void)
        size_t cand_len;
        struct dhcpv6_server_cand *cand = odhcp6c_get_state(STATE_SERVER_CAND, &cand_len);
        uint16_t hdr[2];
-       int ret = (na_mode == IA_MODE_NONE && pd_mode == IA_MODE_NONE) ?
-                       DHCPV6_STATELESS : DHCPV6_STATEFUL;
+       int ret = DHCPV6_STATELESS;
 
        // Clear lingering candidate state info
        odhcp6c_clear_state(STATE_SERVER_ID);