openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.26k stars 2.5k forks source link

LUCI DHCP Entries with multiple MAC not using new format #4582

Closed fzinken closed 2 months ago

fzinken commented 3 years ago

Bug Description When entering a DHCP Static Lease with multiple MAC addresses LUCI adds it to /etc/config/dhcp in the old format.

Example config Screenshot from 2020-11-07 00-27-16

LUCI generated

config host
    option mac 'AA:AA:AA:AA:AA:AA BB:BB:BB:BB:BB:BB'
    option name 'Test'
    option dns '1'
    option ip '192.168.100.100'

New Format

config host
    list mac 'AA:AA:AA:AA:AA:AA'
        list mac 'BB:BB:BB:BB:BB:BB'
    option name 'Test'
    option dns '1'
    option ip '192.168.100.100'

LUCI also only show it correct if the new format is being used.

LUCI display after saving Screenshot from 2020-11-07 00-27-55

LUCI display after manual correction Screenshot from 2020-11-07 00-38-16

Ansuel commented 3 years ago

Thx for the report, to be more precise, the bug is in the fact that the custom form permit to insert a list of mac split with a space. Luci detect only the list form. Should be an easy fix.

Ansuel commented 3 years ago

@fzinken had the time to test this and to my surprise I can't reproduce this. With your config the ui can correctly show the 2 mac. Can you confirm this?

fzinken commented 3 years ago

@fzinken had the time to test this and to my surprise I can't reproduce this. With your config the ui can correctly show the 2 mac. Can you confirm this?

I am confused, you mean you can generate a double MAC entry with LUCI and it is correctly shown? You mean this config LUCI generated is working for you?

Ansuel commented 3 years ago

@fzinken Yes. Are you on master or on stable?

fzinken commented 3 years ago

Are you on master or on stable?

Assume stable. luci - git-20.247.75781-0d0ab01-1

hnyman commented 3 years ago

Assume stable. luci - git-20.247.75781-0d0ab01-1

Yep, 0d0ab01 is from stable 19.07 branch

SampsonF commented 3 years ago

I have the same issue.

OpenWrt 19.07.7 r11306-c4a6851c72 / LuCI openwrt-19.07 branch git-21.062.76689-a607f9c

1.) Entry with old option format do not display correctly



3.)  Create a static entry using Luci
- Luci only accept custom input of MAC, in the format of "mac1 mac2"
- after it is save, check /etc/config/dhcp, the entry in for old option format as in 1.) is created.  Thus Luci will show the entry as "non" in MAC field once created.
tommie commented 2 years ago

IIUC

MkQtS commented 2 months ago

Partially solved in https://github.com/openwrt/luci/commit/d5db17361a556f9c7eda8fa1a0b0c59d57034633

But when click Set Static in Active DHCP Leases on http://openwrt.lan/cgi-bin/luci/admin/status/overview, luci still executes uci set dhcp.@host[-1].mac='xxx' instead of uci add_list dhcp.@host[-1].mac='xxx'

@systemcrash Could you please update it?

systemcrash commented 2 months ago

Good catch! Should be fixed now, I think. See cef99564086caf0aa07dcd8753e0b505504687c1