@@ -1263,32 +1263,38 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac
12631263
12641264
12651265 /* Was only a solicitation: mark binding for removal in 60 seconds */
1266- if (assigned && hdr -> msg_type == DHCPV6_MSG_SOLICIT && !rapid_commit ) {
1267-
1268- a -> bound = false;
1269- a -> valid_until = now + 60 ;
1270-
1271- } else if (assigned &&
1272- ((hdr -> msg_type == DHCPV6_MSG_SOLICIT && rapid_commit ) ||
1273- hdr -> msg_type == DHCPV6_MSG_REQUEST ||
1274- hdr -> msg_type == DHCPV6_MSG_REBIND )) {
1275-
1276- if (hostname_len > 0 && (!a -> lease_cfg || !a -> lease_cfg -> hostname )) {
1277-
1278- char * tmp = realloc (a -> hostname , hostname_len + 1 );
1279- if (tmp ) {
1280- a -> hostname = tmp ;
1281- memcpy (a -> hostname , hostname , hostname_len );
1282- a -> hostname [hostname_len ] = 0 ;
1283- a -> hostname_valid = odhcpd_hostname_valid (a -> hostname );
1266+ if (assigned ) {
1267+ switch (hdr -> msg_type ) {
1268+ case DHCPV6_MSG_SOLICIT :
1269+ if (!rapid_commit ) {
1270+ a -> bound = false;
1271+ a -> valid_until = now + 60 ;
1272+ break ;
1273+ }
1274+ _o_fallthrough ;
1275+
1276+ case DHCPV6_MSG_REQUEST :
1277+ case DHCPV6_MSG_REBIND :
1278+ if (hostname_len > 0 && (!a -> lease_cfg || !a -> lease_cfg -> hostname )) {
1279+
1280+ char * tmp = realloc (a -> hostname , hostname_len + 1 );
1281+ if (tmp ) {
1282+ a -> hostname = tmp ;
1283+ memcpy (a -> hostname , hostname , hostname_len );
1284+ a -> hostname [hostname_len ] = 0 ;
1285+ a -> hostname_valid = odhcpd_hostname_valid (a -> hostname );
1286+ }
12841287 }
1285- }
12861288
1287- a -> accept_fr_nonce = accept_reconf ;
1288- a -> bound = true;
1289- apply_lease (a , true);
1289+ a -> accept_fr_nonce = accept_reconf ;
1290+ a -> bound = true;
1291+ apply_lease (a , true);
1292+ break ;
12901293
1291- } else if (!assigned ) {
1294+ default :
1295+ break ;
1296+ }
1297+ } else {
12921298 /* Clean up failed assignment */
12931299 dhcpv6_free_lease (a );
12941300 a = NULL ;
0 commit comments