[LEDE-DEV] [PATCH v2 2/3] ipq806x: Add support for new device: tew827dru

J Mo jmomo at jmomo.net
Sat Sep 10 21:07:38 PDT 2016



On 09/10/2016 06:36 PM, J Mo wrote:
>>> diff --git 
>>> a/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac 
>>> b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
>>> new file mode 100644
>>> index 0000000..b4ed225
>>> --- /dev/null
>>> +++ b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
>>> @@ -0,0 +1,23 @@
>>> +#!/bin/sh
>>> +#
>>> +# Copyright (c) 2014 The Linux Foundation. All rights reserved.
>>> +#
>>> +
>>> +set_ether_mac() {
>>> +    . /lib/functions/uci-defaults.sh
>>> +    . /lib/ipq806x.sh
>>> +    . /lib/functions/system.sh
>>> +
>>> +    board=$(ipq806x_board_name)
>>> +
>>> +    case "$board" in
>>> +    tew827dru)
>>> +        # Set the correct ethernet MAC addresses per OEM intent.
>>> +        ifconfig eth0 hw ether $(mtd_get_mac_ascii APPSBLENV 
>>> wan_mac) 2>/dev/null
>>> +        ifconfig eth1 hw ether $(mtd_get_mac_ascii APPSBLENV 
>>> lan_mac) 2>/dev/null
>>> +        ;;
>>> +    esac
>>> +
>>> +}
>>> +
>>> +boot_hook_add preinit_main set_ether_mac
>>
>> Okay I guess I see what you are trying to do. But you doing it at the 
>> wrong place using the wrong functions. Please have a look at 
>> https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/lantiq/base-files/etc/board.d/02_network 
>> to see how to set the mac addresses properly.
>>
>
> Oh yea, that's much better.

Nevermind, your method does not address the problem. This probably has 
to be done in preinit or at least before any subinterfaces are created.

Other devices are already doing this, probably for the same reasons.

Right:

root at lede:/# ifconfig -a | egrep -i hwadd
br-lan    Link encap:Ethernet  HWaddr D8:EB:97:30:30:03
eth0      Link encap:Ethernet  HWaddr D8:EB:97:30:30:03
eth0.1    Link encap:Ethernet  HWaddr D8:EB:97:30:30:03
eth1      Link encap:Ethernet  HWaddr D8:EB:97:30:30:04
eth1.2    Link encap:Ethernet  HWaddr D8:EB:97:30:30:04

Wrong:

root at lede:/# ifconfig -a | egrep -i hwadd
br-lan    Link encap:Ethernet  HWaddr D8:EB:97:30:30:03
eth0      Link encap:Ethernet  HWaddr 00:03:7F:BA:DB:01
eth0.1    Link encap:Ethernet  HWaddr D8:EB:97:30:30:03
eth1      Link encap:Ethernet  HWaddr 00:03:7F:BA:DB:02
eth1.2    Link encap:Ethernet  HWaddr D8:EB:97:30:30:04




More information about the Lede-dev mailing list