From 80b381a1c6598709dc5d1633b72651b2424915ce Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Wed, 3 Jun 2026 10:38:49 -0300 Subject: [PATCH] unbreak IPv6 and its tests --- mongoose.c | 3 ++- src/net_builtin.c | 3 ++- test/mip_test.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mongoose.c b/mongoose.c index c28921d7..c8b91d25 100644 --- a/mongoose.c +++ b/mongoose.c @@ -8307,7 +8307,7 @@ static void rx_ndp_ra(struct mg_tcpip_if *ifp, struct pkt *pkt) { (void) pref_lifetime; gotprefix = true; - if (prefix_len != ifp->prefix || !match_prefix(prefix, ifp->prefix, ifp->prefix_len)) + if (prefix_len != ifp->prefix_len || !match_prefix(prefix, ifp->prefix, ifp->prefix_len)) changed = true; } opts += length; @@ -8395,6 +8395,7 @@ static void onstate6change(struct mg_tcpip_if *ifp) { (struct mg_addr *) &ip6_allrouters), ifp->ip6, (uint64_t *) ip6_allrouters.addr.ip6, false, ifp->mac); + } if (ifp->is_ip6_changed) { struct mg_connection *c; for (c = ifp->mgr->conns; c != NULL; c = c->next) { diff --git a/src/net_builtin.c b/src/net_builtin.c index 340bd2d0..de8907a9 100644 --- a/src/net_builtin.c +++ b/src/net_builtin.c @@ -998,7 +998,7 @@ static void rx_ndp_ra(struct mg_tcpip_if *ifp, struct pkt *pkt) { (void) pref_lifetime; gotprefix = true; - if (prefix_len != ifp->prefix || !match_prefix(prefix, ifp->prefix, ifp->prefix_len)) + if (prefix_len != ifp->prefix_len || !match_prefix(prefix, ifp->prefix, ifp->prefix_len)) changed = true; } opts += length; @@ -1086,6 +1086,7 @@ static void onstate6change(struct mg_tcpip_if *ifp) { (struct mg_addr *) &ip6_allrouters), ifp->ip6, (uint64_t *) ip6_allrouters.addr.ip6, false, ifp->mac); + } if (ifp->is_ip6_changed) { struct mg_connection *c; for (c = ifp->mgr->conns; c != NULL; c = c->next) { diff --git a/test/mip_test.c b/test/mip_test.c index 35f8a813..270703a8 100644 --- a/test/mip_test.c +++ b/test/mip_test.c @@ -83,7 +83,7 @@ static void test_statechange(void) { } #if MG_ENABLE_IPV6 static void mif6_fn(struct mg_tcpip_if *ifp, int ev, void *ev_data) { - if (ev == MG_TCPIP_EV_STATE_CHANGE) { + if (ev == MG_TCPIP_EV_STATE6_CHANGE) { ASSERT(*(uint8_t *) ev_data == MG_TCPIP_STATE_REQ); executed = true; }