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

MAC address incorrect in luci advanced menus (1.2rc1) #467

Open
andygunn opened this issue May 18, 2015 · 5 comments
Open

MAC address incorrect in luci advanced menus (1.2rc1) #467

andygunn opened this issue May 18, 2015 · 5 comments
Labels
Milestone

Comments

@andygunn
Copy link

In Advanced -> Network -> Interfaces, the MAC address for the mesh interface (wlan0) shows up as 00:00:00:00:00:00, rather than the proper MAC address (which can be seen when running the ifconfig command from the command line).

First noticed by Protagonistics, relayed in IRC.

@andygunn andygunn added the bug label May 18, 2015
@andygunn andygunn added this to the Router-1.2 milestone May 18, 2015
@seamustuohy
Copy link
Collaborator

If you have a router handy, can you tell me the section name? I am eating lunch right now and can see if I can find something. This also, as an advanced menu item, might be an upstream bug we want to file if we can isolate the problem.

@andygunn
Copy link
Author

Not sure what you mean by section name, but a screenshot is here:
mac address error

Agreed it might be upstream, but not sure.

@jheretic
Copy link
Member

@andygunn section name is the name is the name of the config section in a UCI file, i.e. in /etc/config/network particular interfaces would be defined as:

config '' ''

Where '' is what (I believe) @elationfoundation is talking about, unless it's an anonymous section.

@andygunn
Copy link
Author

Ah, ok.

root@CassCo-3rdStreet-NanoLocoM5:/etc/config# cat network 

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option proto 'commotion'
    option class 'client'
    option type 'bridge'
    option bridge_empty '1'

config interface 'wan'
    option ifname 'eth0'
    option proto 'commotion'
    option class 'wired'
    option dhcp 'none'
    option ipaddr '192.168.101.5'
    option netmask '255.255.255.0'
    option meshed '1'

config interface 'thisnode'
    option ifname 'br-lan'
    option proto 'static'
    option ipaddr '169.254.140.121'
    option netmask '255.255.0.0'

config interface 'testbed5'
    option class 'mesh'
    option proto 'commotion'
    option profile 'testbed5'

@seamustuohy
Copy link
Collaborator

Thanks Andy!

Here is the code you are looking for:

function interface.mac(self)
    return (self:_ubus("macaddr") or "00:00:00:00:00:00"):upper()
end

And, here is that Ubus code that is returning None, causing the "00:00:00:00:00:00" to be returned

function interface._ubus(self, field)
    if not _ubusdevcache[self.ifname] then
        _ubusdevcache[self.ifname] = utl.ubus("network.device", "status",
                                                                     { name = self.ifname })
    end
    if _ubusdevcache[self.ifname] and field then
        return _ubusdevcache[self.ifname][field]
    end
    return _ubusdevcache[self.ifname]
end

That should help you guys explore the issue. Don't have a Commotion router to do any exploration on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants