OpenWrt/LEDE Project

  • Status Closed
  • Percent Complete
  • Task Type Bug Report
  • Category Base system
  • Assigned To
    Hans Dedecker
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version All
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by morohe - 08.05.2021
Last edited by Hans Dedecker - 26.05.2021

FS#3789 - odhcpd: ra_mtu default value '0' causes error on config_parse_interface

Name the tree/revision/version
from 9dd5316deae6402de68ddc8a08d1a6b496101828

Currently the default value of ra_mtu is 0, but it causes an error in parsing the config file.

      int config_parse_interface(void *data, size_t len, const char *name, bool overwrite)
      ~ To line number 780~
      if ((c = tb[IFACE_ATTR_RA_MTU])) {
              uint32_t ra_mtu = blobmsg_get_u32(c);
              if (ra_mtu < 1280 || ra_mtu > 65535)
                      goto err;
              iface->ra_mtu = ra_mtu;

ra_mtu is checked with the following and it looks fine.

      static int send_router_advert(struct interface *iface, const struct in6_addr *from)
      ~to line number 477~
      if (mtu == 0)
              mtu = odhcpd_get_interface_config(iface->ifname, "mtu");
      if (mtu < 1280)
              mtu = 1280;

To fix this issue, my suggest is

1. Add write to syslog on parse error detail in config_parse_interface.
2. Fix ra_mtu default value is not zero, It’s 1280.
3. Remove detailed error check on parse, if always checked at the time of use.
4. Or set to default value on error.


Closed by  Hans Dedecker
26.05.2021 20:51
Reason for closing:  Fixed
Project Manager
Hans Dedecker commented on 08.05.2021 19:14

I fail to understand the issue as the code in config.c is only hit when a ra_mtu value is specified in the dhcp interface uci section; but this is not by default the case as the default config does not have a ra_mtu value (
One could indeed argue if an invalid ra_mtu is specified if this should be considered as a fatal error; maybe a better approach is just ignore it and write to syslog

morohe commented on 09.05.2021 00:13

Hi hans, Thank you reply.

Current README says ra_mtu default is '0'(first link)
and, luci was writing '0' to ra_mtu from 21.02.0-rc1.(second link, already reverted)

If ra_mtu is set to '0', subsequent RA settings will be ignored due to an error.
This will cause the IPv6 connection to fail. (third link)

I hope you agree write the error to syslog.


morohe commented on 01.06.2021 13:58

Fix is fine.
Thank you!


Available keyboard shortcuts


Task Details

Task Editing