Comments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #319 (closed defect: fixed)

Opened 21 months ago

Last modified 18 months ago

Multiple MAC addresses for the same ip adress

Reported by: anonymous Owned by:
Priority: major Milestone:
Component: LuCI Applications Keywords:
Cc:

Description (last modified by jow) (diff)

Dnsmasq supports to assign the same ip address different MAC addresses, unfortunately LuCI doesn't support this yet. It works in uCI when I edit it manually, however LuCI complains that the form isn't valid and won't save it, which is quite annoying.

The uCI entry looks something like this:

config 'host'

option 'name' 'test'
option 'mac' '00:00:00:00:00:00,ff:ff:ff:ff:ff:ff'
option 'ip' '192.168.0.1'

But whenever trying to edit the LuCI page it tells me "Some fields are invalid, cannot save values!".

As it works right away with uCI itself, the LuCI validation should be fixed, which shouldn't be that much work.

Attachments

Change History

Changed 18 months ago by vvitkov@…

I second this one.

It is a pretty useful scenario (laptop that is going to be connected over only wl or lan)

As far as looking at the code i can see that the problem lies with the validation of the field

file: /usr/lib/lua/luci/cbi/datatypes.lua
line: 123 (function macaddr)

besides being a little redundant (the internal for cycle is not needed as if it is not hex it will not match (and besides the lua supports %x) it could be fixed (probably) by just matching if it contains mac address pattern. i.e. something like:

function macaddr(val)

validmac = 0
-- loop over the val and match anything that looks like a MAC
for singlemac in val:gmatch ("%w+:%w+:%w+:%w+:%w+:%w+") do

-- print (singlemac)

-- check if really a mac (i.e. hex)
if singlemac and singlemac:match(

"[a-fA-F0-9]+:[a-fA-F0-9]+:[a-fA-F0-9]+:[a-fA-F0-9]+:[a-fA-F0-9]+:[a-fA-F0-9]+$"

) then
-- probably redundant and candidate for removal

-- local parts = util.split( singlemac, ":" )
-- for i = 1,6 do
-- parts[i] = tonumber( parts[i], 16 )
-- if parts[i] < 0 or parts[i] > 255 then
-- return false
-- end
-- end
-- print("true word is mac")

-- it is a valid one - mark it
validmac = 1

else
-- no it does not match the requirements for a mac - bail out directly and die

return false

end

end

-- print(valid)

-- do we have valid mac's at all? if so win
if validmac then

return true

end

end

comments left for comparison

Changed 18 months ago by jow

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)

Fixed with r8137, r8138. MACs must be given space spearated, the dnsmasq init script loops over the value and correctly builds a comma-separated argument from it.

Changed 18 months ago by vvitkov@…

Thanks works ok. Just tested it.

Add/Change #319 (Multiple MAC addresses for the same ip adress)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.