[OpenWrt-Devel] uci_validate_section/ubox/validate does not understand link-local IPv6 addresses

mail at adrianschmutzler.de mail at adrianschmutzler.de
Sat Jan 26 13:26:51 EST 2019

Hi all,


this is concerning the ubox package. If there is a more specific mailing list/issue tracker for this, please tell me so.


We have found that the during validation of an NTP server in [1], the validation as “host” fails if the “host” is a link-local IPv6 address.


If you track the issue through the various wrappers, it narrows down to

inet_pton(AF_INET6, s->value, &a);

in [2].


Eventually, the problem is inet_pton not understanding the scope ID present in a link-local IPv6 address.


From googling how to address this, a possible solution would be a switch to getaddrinfo [3].

Another (less desirable) solution would be to just split at the % and then only validate the left part; however, I cannot judge whether this is easy to do in C.


Since I’m not very confident about my C capabilities and I did not find a way to build the ubox package separately (for testing), I hope someone is interested in having a look into this.







[1] https://github.com/openwrt/openwrt/blob/master/package/utils/busybox/files/sysntpd#L31

[2] https://git.openwrt.org/?p=project/ubox.git;a=blob;f=validate/validate.c;h=e72b8117ecd8b680778b0f5c7637ed6546a7736b;hb=876c7f5bfb9b13d48e6d7960dd114082a0a95a6d#l398

[3] http://man7.org/linux/man-pages/man3/getaddrinfo.3.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20190126/6c992d21/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20190126/6c992d21/attachment.sig>
-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list