Skip to content

Commit

Permalink
Fix inifinte loop in esp32 RIO handling. (#12736)
Browse files Browse the repository at this point in the history
If the router is advertising a default prefix (::/0), the route
handler is going into an infinite loop.

Route information options can only have one prefix anyway, so the
loop here is overkill and likely to introduce bad routes. Changing
this to a simple check.

Test: Configured radvd to advertise a default route, saw infinite
      loop on upstream, no problems with this code. Regular routes
      are being processed correctly.
  • Loading branch information
cecille authored Dec 8, 2021
1 parent e9add41 commit a5f849c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/platform/esp32/route_hook/esp_route_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void ra_recv_handler(struct netif * netif, const uint8_t * icmp_payload,
uint8_t rio_data_len = opt_len - sizeof(rio_header_t);

ESP_LOGI(TAG, "Received RIO");
for (; rio_data_len >= prefix_len_bytes; rio_data_len -= prefix_len_bytes, rio_data += prefix_len_bytes)
if (rio_data_len >= prefix_len_bytes)
{
ip6_addr_t prefix;
esp_route_entry_t route;
Expand Down

0 comments on commit a5f849c

Please sign in to comment.