diff options
| author | Paul Donald | 2025-11-02 16:40:14 +0000 |
|---|---|---|
| committer | Álvaro Fernández Rojas | 2025-11-03 07:17:01 +0000 |
| commit | ee4f0df6bd686bf58594fca394dfaf3ba153d92c (patch) | |
| tree | cc58a0d5ffe21f65235203cddbe4dd29219083a7 | |
| parent | d174e25e85a1fd703c36f39e154042cbc0a3e36a (diff) | |
| download | odhcpd-ee4f0df6bd686bf58594fca394dfaf3ba153d92c.tar.gz | |
netlink: Store interface MTU at link change
This is used for clamping MTU values.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/odhcpd/pull/296
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
| -rw-r--r-- | src/netlink.c | 7 | ||||
| -rw-r--r-- | src/odhcpd.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/netlink.c b/src/netlink.c index 5b3dc66..6de9ae7 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -257,6 +257,13 @@ static int handle_rtm_link(struct nlmsghdr *hdr) iface->ifflags = ifi->ifi_flags; + /* store current MTU if available */ + if (nla[IFLA_MTU]) { + iface->if_mtu = nla_get_u32(nla[IFLA_MTU]); + debug("Netlink setting interface '%s' if_mtu MTU to %d", + iface->name, iface->if_mtu); + } + /* * Assume for link event of the same index, that link changed * and reload services to enable or disable them based on the diff --git a/src/odhcpd.h b/src/odhcpd.h index 55107e5..e503029 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -333,6 +333,7 @@ struct interface { int ifindex; char *ifname; const char *name; + uint32_t if_mtu; // IPv6 runtime data struct odhcpd_ipaddr *addr6; |