Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
openwrt-bot opened this issue May 8, 2021 · 4 comments
Labels

Comments

@openwrt-bot
Copy link

morohe:

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 README.md 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.

Thanks.

@openwrt-bot
Copy link
Author

dedeckeh:

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 (https://github.com/openwrt/openwrt/blob/master/package/network/services/odhcpd/files/odhcpd.defaults)
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

@openwrt-bot
Copy link
Author

morohe:

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.

Thanks.

@openwrt-bot
Copy link
Author

@openwrt-bot
Copy link
Author

morohe:

Fix is fine.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant