summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Härdeman2025-12-12 21:46:31 +0000
committerÁlvaro Fernández Rojas2025-12-13 10:48:02 +0000
commit1ff1328a4fc1baca2e0040fe84ca4664dbca69d7 (patch)
tree1125ebd72d6b7483c4b9b25867d0d5b20e00cc6a
parent74f00bf43eab809944e7670b148b11e6cade8321 (diff)
downloadodhcpd-1ff1328a4fc1baca2e0040fe84ca4664dbca69d7.tar.gz
odhcpd: fix captive_portal_uri reset
odhcpd_reload() calls clean_interface() which does a memset() on the given struct iface from iface->ra onwards, so captive_portal_uri and captive_portal_uri_len have to be below iface->ra in order to be zeroed on reload. Otherwise, iface->captive_portal_uri will be free():d, but iface->captive_portal_uri_len could still be > 0. This is a bit of a footgun (one wouldn't normally expect the order of struct members to matter), and should probably be dealt with in a more thorough manner, but I've just done the minimum and added a warning in src/odhcpd.h for now, (cherry picked from commit cf51aeb93220672d54d0d0f3707710bf544801e2) Signed-off-by: David Härdeman <david@hardeman.nu> Link: https://github.com/openwrt/odhcpd/pull/345 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-rw-r--r--src/odhcpd.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/odhcpd.h b/src/odhcpd.h
index 7b6ac6c..86375ab 100644
--- a/src/odhcpd.h
+++ b/src/odhcpd.h
@@ -391,9 +391,7 @@ struct interface {
struct avl_tree dhcpv4_leases;
struct list_head dhcpv4_fr_ips;
- // RFC8910
- char *captive_portal_uri;
- size_t captive_portal_uri_len;
+ /* NOTE: everything from this point is zeroed on odhcpd_reload() */
// Services
enum odhcpd_mode ra;
@@ -494,6 +492,10 @@ struct interface {
struct ra_pio *pios;
size_t pio_cnt;
bool pio_update;
+
+ // RFC8910
+ char *captive_portal_uri;
+ size_t captive_portal_uri_len;
};
extern struct avl_tree interfaces;