summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Donald2025-10-30 00:53:44 +0000
committerÁlvaro Fernández Rojas2025-11-03 07:17:12 +0000
commit1ef9e0e610d5ee586173991390e4a19d281379ea (patch)
treeafabb820b0d48347cc014b84a3930b8130e834a0
parent1480c09ee0aaca2d00db74af6b5f468cb409e064 (diff)
downloadodhcpd-1ef9e0e610d5ee586173991390e4a19d281379ea.tar.gz
router: utilize interface ra_mtu for RA
MTU is now set at configure time. Change ra_mtu to uint32 since it never stores a negative value. 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/odhcpd.h2
-rw-r--r--src/router.c10
2 files changed, 3 insertions, 9 deletions
diff --git a/src/odhcpd.h b/src/odhcpd.h
index e503029..3659f08 100644
--- a/src/odhcpd.h
+++ b/src/odhcpd.h
@@ -406,7 +406,7 @@ struct interface {
uint32_t ra_reachabletime;
uint32_t ra_retranstime;
uint32_t ra_hoplimit;
- int ra_mtu;
+ uint32_t ra_mtu;
uint32_t max_preferred_lifetime;
uint32_t max_valid_lifetime;
diff --git a/src/router.c b/src/router.c
index f841b2f..82d3187 100644
--- a/src/router.c
+++ b/src/router.c
@@ -569,7 +569,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr
* for shortest lived prefix
*/
uint32_t lowest_found_lifetime = UINT32_MAX, highest_found_lifetime = 0, maxival, ra_lifetime;
- int msecs, mtu = iface->ra_mtu, hlim = iface->ra_hoplimit;
+ int msecs, hlim = iface->ra_hoplimit;
bool default_route = false;
bool valid_prefix = false;
char buf[INET6_ADDRSTRLEN];
@@ -602,13 +602,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr
adv.mtu.nd_opt_mtu_type = ND_OPT_MTU;
adv.mtu.nd_opt_mtu_len = 1;
- if (mtu == 0)
- mtu = odhcpd_get_interface_config(iface->ifname, "mtu");
-
- if (mtu < 1280)
- mtu = 1280;
-
- adv.mtu.nd_opt_mtu_mtu = htonl(mtu);
+ adv.mtu.nd_opt_mtu_mtu = htonl(iface->ra_mtu);
iov[IOV_RA_ADV].iov_base = (char *)&adv;
iov[IOV_RA_ADV].iov_len = sizeof(adv);