Hello,
I have a problem that all MAC addresses are 00:11:22:33:44:55 except wlan0,
which is correct. Should this patch help me? I added "nbg-419n" to the case
line:
case $(ramips_board_name) in
bc2 | nbg-419n | nw718)
extract_and_set_mac "factory" 4 "02:00:00:00:00:00"
but still all MACs are 00:11:22:33:44:55.
Nerijus
On Fri, 25 Nov 2011 12:20:37 +0100 Daniel Golle <[email protected]> wrote:
> Allow reading the Ethernet MAC address from different places in the firmware.
>
> Use parameters for partition name, offset and OR-mask, so support for more
> boards can be added easily.
>
> Signed-off-by: Daniel Golle <[email protected]>
>
> Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
> ===================================================================
> --- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
> (revision 29328)
> +++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
> (working copy)
> @@ -2,7 +2,7 @@
> # Copyright (C) 2011 OpenWrt.org
> #
>
> -nw718_set_mac() {
> +extract_and_set_mac() {
> local part
> local mac
>
> @@ -10,13 +10,13 @@
>
> . /etc/functions.sh
>
> - part=$(find_mtd_part "factory")
> + part=$(find_mtd_part "$1")
> [ -z $part ] && return
>
> - mac=$(dd bs=1 skip=4 count=6 if=$part 2>/dev/null | maccalc bin2mac)
> + mac=$(dd bs=1 skip=$2 count=6 if=$part 2>/dev/null | maccalc bin2mac)
> [ -z $mac ] && return
>
> - mac=$(maccalc or "$mac" "02:00:00:00:00:00")
> + mac=$(maccalc or "$mac" "$3")
> ifconfig eth0 hw ether $mac 2>/dev/null
> }
>
> @@ -24,9 +24,12 @@
> . /lib/ramips.sh
>
> case $(ramips_board_name) in
> bc2 | nw718)
> - nw718_set_mac
> + extract_and_set_mac "factory" 4 "02:00:00:00:00:00"
> ;;
> + hw550-3g)
> + extract_and_set_mac "factory" 40 "00:00:00:00:00:00"
> + ;;
> esac
> }
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel