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: invalid dnsmasq instance written to config #7199

Closed
hmoffatt opened this issue Jul 18, 2024 · 9 comments
Closed

luci-mod-network: invalid dnsmasq instance written to config #7199

hmoffatt opened this issue Jul 18, 2024 · 9 comments

Comments

@hmoffatt
Copy link

hmoffatt commented Jul 18, 2024

Static leases are saved with an invalid dnsmasq instance setting. The instance is saved by index, not by name, and does not end up in the resultiing dnsmasq config file.

Steps to reproduce:

  1. Go to network -> DHCP and DNS and create a second dnsmasq instance
  2. Create a static lease and choose one of the dnsmasq instances, rather than leaving it unspecified/
  3. Save and note the proposed config has instance '0', not the name
config host
	option name 'testmac'
	list mac '99:88:77:66:55:44'
	option instance '0'
  1. Apply and note that the static lease is not in the dnsmasq config file.

Actual behavior:

1.Selected instance is referenced by number, which does not work.

Expected behavior:

1.Selected instance is referenced by name, which does work.

Additional Information:

DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='23.05.2'
DISTRIB_REVISION='r23630-842932a63d'
DISTRIB_TARGET='mvebu/cortexa53'
DISTRIB_ARCH='aarch64_cortex-a53'
DISTRIB_DESCRIPTION='OpenWrt 23.05.2 r23630-842932a63d'
DISTRIB_TAINTS=''
@dannil
Copy link
Contributor

dannil commented Jul 18, 2024

Would you be able to test 23.05.3? It sounds like this was fixed with #6579 and cherry-picked to 23.05 with 5457561, which is after the 23.05.2 release but is included in 23.05.3.

@hmoffatt
Copy link
Author

hmoffatt commented Jul 18, 2024

That PR does look relevant, but I tried 23.05.3 and it seems unchanged. I also tried adding a new dnsmasq instance with the new version but static leases are still being assigned by index; the generated commands for a new instance and a static lease were

uci set dhcp.dns_foo=dnsmasq
uci set dhcp.dns_foo.rebind_protection='0'
uci set dhcp.dns_foo.localservice='0'
uci del dhcp.cfg34fe63.mac
uci add_list dhcp.cfg34fe63.mac='99:88:77:66:55:44'
uci set dhcp.cfg34fe63.instance='2'

and the lease still doesn't end up in the generated dnsmasq config.

root@router:/var/etc# cat /etc/openwrt_release 
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='23.05.3'
DISTRIB_REVISION='r23809-234f1a2efa'
DISTRIB_TARGET='mvebu/cortexa53'
DISTRIB_ARCH='aarch64_cortex-a53'
DISTRIB_DESCRIPTION='OpenWrt 23.05.3 r23809-234f1a2efa'
DISTRIB_TAINTS=''
root@router:/var/etc# opkg list | grep luci-mod-network
luci-mod-network - git-24.111.76511-ff6b275

@hmoffatt
Copy link
Author

I've tried now with 23.0.5 and I don't see any change unfortunately.

systemcrash added a commit that referenced this issue Jul 23, 2024
Closes #7199

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 5ab0cb1)
systemcrash added a commit that referenced this issue Jul 23, 2024
Closes #7199

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 5ab0cb1)
@systemcrash
Copy link
Contributor

Should be available in the repo tomorrow.

@hmoffatt
Copy link
Author

Thanks. I upgraded luci-mod-network:

root@router:~# opkg upgrade luci-mod-network
Upgrading luci-mod-network on root from git-24.111.76511-ff6b275 to git-24.205.48215-4f80a61...
Downloading https://downloads.openwrt.org/releases/23.05.4/packages/aarch64_cortex-a53/luci/luci-mod-network_git-24.205.48215-4f80a61_all.ipk
Configuring luci-mod-network.

It doesn't seem to be quite right. I see both my instances in the list when I edit a static lease, but if I edit a lease and save it without any changes the instance is lost.

image

image

@systemcrash
Copy link
Contributor

I don't observe those results. What you see happening is the mac getting re-written, since it's now (for simplicity) a list, and not a space separated field. All other properties are retained. You might need to toggle instance to another, save it, edit again and toggle back, save to get the result you need the first time.

@hmoffatt
Copy link
Author

Sorry yes I see what you mean now. Thanks.

@hmoffatt
Copy link
Author

What you see happening is the mac getting re-written

This seems to happen on every single edit now, btw. Even if I save the changes, next edit does exactly the same thing. Unrelated to this issue of course.

@systemcrash
Copy link
Contributor

Might be related to the mac verify function that runs. One could add a bit more code to prevent a new write.

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

No branches or pull requests

3 participants