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

luci-mod-network: handle missing dnsrr hexdata as empty string #7532

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

dannil
Copy link
Contributor

@dannil dannil commented Jan 6, 2025

If the value returned from UCI was falsy, it became an empty array instead of an empty string, which crashed the UI when trying to invoke the non-existing replace instance function on the value.

First observed here https://forum.openwrt.org/t/openwrt-24-10-0-rc4-fourth-release-candidate/219368/145?u=dannil

Before:

Screen.Recording.2025-01-06.171646.mp4
root@labmouse:~# cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'
        option confdir '/tmp/dnsmasq.d'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config dnsrr

After:

Screen.Recording.2025-01-06.172123.mp4
root@labmouse:~# cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'
        option confdir '/tmp/dnsmasq.d'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config dnsrr
        option dnsrr 'r1.labmouse.lan.'
        option rrnumber '64'
        option hexdata '666f6f626172'

  • This PR is not from my main or master branch 💩, but a separate branch ✅
  • Each commit has a valid ✒️ Signed-off-by: <my@email.address> row (via git commit --signoff)
  • Each commit and PR title has a valid 📝 <package name>: title first line subject for packages
  • Incremented 🆙 any PKG_VERSION in the Makefile N/A
  • Tested on: (x86/64, 24.10.0-rc4, Firefox) ✅
  • ( Preferred ) Mention: @ the original code author for feedback @systemcrash
  • ( Preferred ) Screenshot or mp4 of changes:
  • ( Optional ) Closes: e.g. openwrt/luci#issue-number
  • ( Optional ) Depends on: e.g. openwrt/packages#pr-number in sister repo
  • Description: (describe the changes proposed in this PR)

@dannil dannil force-pushed the dnsrr-hexcode-missing branch from 5e5e8fe to 16d1a0b Compare January 6, 2025 16:49
If the value returned from UCI was falsy, it became an empty array instead
of an empty string, which crashed the UI when trying to invoke the
non-existing replace instance function on the value.

Signed-off-by: Daniel Nilsson <dannil+github@protonmail.com>
@dannil dannil force-pushed the dnsrr-hexcode-missing branch from 16d1a0b to bd938da Compare January 6, 2025 16:51
@dannil dannil changed the title luci-mod-network: handle missing dnsrr hexcode as empty string luci-mod-network: handle missing dnsrr hexdata as empty string Jan 6, 2025
@systemcrash systemcrash merged commit c9cc773 into openwrt:master Jan 6, 2025
5 checks passed
@systemcrash
Copy link
Contributor

Good catch! Merged. Thanks @dannil

@dannil dannil deleted the dnsrr-hexcode-missing branch January 6, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants