From 25935850cc1555c6c331eccb765edcede5248602 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 8 Dec 2021 16:30:56 -0500 Subject: [PATCH] Fix inifinte loop in esp32 RIO handling. (#12736) 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. --- examples/platform/esp32/route_hook/esp_route_hook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/esp32/route_hook/esp_route_hook.c b/examples/platform/esp32/route_hook/esp_route_hook.c index 201619f301a574..ab60fc23a8a55a 100644 --- a/examples/platform/esp32/route_hook/esp_route_hook.c +++ b/examples/platform/esp32/route_hook/esp_route_hook.c @@ -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;