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 nulled #41

Closed
docbee63 opened this issue Mar 21, 2018 · 15 comments
Closed

MAC address nulled #41

docbee63 opened this issue Mar 21, 2018 · 15 comments

Comments

@docbee63
Copy link

docbee63 commented Mar 21, 2018

With the friendly help from this feed I got WiFi basically working on a MR3020V3.
Only thing the precompiled mt7628.ko does not read out correctly is the MAC.

apcli0    Link encap:Ethernet  HWaddr 02:00:00:00:00:00  
          inet addr:192.168.123.250  Bcast:192.168.123.255  Mask:255.255.255.0
          inet6 addr: fe80::ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ra0       Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:6

I tried setting MAC manually with "ifconfig apcli0 hw ether 12:23:34:45:56:67" but only get a "SIOCSIFHWADDR: Not supported" error. Adding MAC as an option to /etc/config/network" gets also ignored.

Any idea how I can change the MAC to the one "eth0" is showing?

@docbee63
Copy link
Author

I also tried with "macchanger". As expected also no avail :-(
"[ERROR] Could not change MAC: interface up or insufficient permissions: Not supported"

Can the mt7628.ko somehow be redirected where on the mtd devices to read the MAC from? Or can I give the mac as a parameter when installing the kernel module? As I don't have the mt7628 sources, I can't find out myself :-(

@ZiqiangYu
Copy link
Collaborator

did you have /lib/firmware/mt7628.eeprom.bin in your board? it is the hw parameter. and mac is in it..

@docbee63
Copy link
Author

docbee63 commented Mar 25, 2018

Thanks for the suggestion. The vocore system I have does not have a "/lib/firmware/*.bin" file and there the mt7628 assigns the correct MAC to ra0. When I use the same setup on my TL-MR3020V3 I get a nulled MAC.

As far as I can see the MAC to be used is stored in different flash areas, as factory is located in /dev/mtd6 on MR3020V3 while it is located in /dev/mtd2 on vocore. This again brings up the question, where the pre-compiled mt7628.ko is looking up the MAC from and how I might be able to tell it the MAC to use.

@docbee63
Copy link
Author

I also included a "/lib/firmware/mt7628.eeprom.bin" and as an alternative a "mt7628.eeprom" file but as expected, no change. I would really love to get a hint from someone knowing the source of the mt7628.ko how to tell this driver the mac for "ra0" interface. Any idea?

@ZiqiangYu
Copy link
Collaborator

ZiqiangYu commented Mar 25, 2018

where did you get the /lib/firmware/mt7628.eeprom.bin? it should be dumped form /dev/mtd6 on MR3020V3 use hexdump or other tools.it is the factory rf parameter. the mac is is in the following feild(take mt7615 for example).
root@OpenWrt:/lib/firmware# hexdump mt7615.1.eeprom.bin
0000000 7615 0090 0c00 2643 0060 7615 14c3 8000
0000010 0002 14c3 7615 2203 ffff 0423 020d 028f

@docbee63
Copy link
Author

Thanks. Hexdump is not suited to extract a file, but to inspect it. I guess you are talking about dd and I am pretty familiar with this ;-)

dmesg tells me NOR flash partions as follows:

[    0.323486] Creating 4 MTD partitions on "spi32766.0":
[    0.328701] 0x000000000000-0x000000020000 : "boot"
[    0.335192] 0x000000020000-0x0000007c0000 : "firmware"
[    0.391267] 2 tplink-fw partitions found on MTD device firmware
[    0.397294] 0x000000020000-0x00000016b1b4 : "kernel"
[    0.403827] 0x00000016b1b4-0x0000007c0000 : "rootfs"
[    0.410603] mtd: device 3 (rootfs) set to be root filesystem
[    0.416871] 1 squashfs-split partitions found on MTD device rootfs
[    0.423214] 0x000000540000-0x0000007c0000 : "rootfs_data"
[    0.430248] 0x0000007c0000-0x0000007d0000 : "config"
[    0.437000] 0x0000007d0000-0x000000800000 : "factory"

factory partition is "/dev/mtd6". Looking into that we find:

00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
0000f100  7c 8b ca 6c 9f 5e ff ff  ff ff ff ff ff ff ff ff  ||..l.^..........|
0000f110  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
0000f200  09 a8 25 01 00 00 00 00  ff ff ff ff ff ff ff ff  |..%.............|
0000f210  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*

Which is fine as the default dts file for kernel compilation says to expect MAC at 0xf100 in "factory" partition:

&wmac {
        status = "okay";
        mtd-mac-address = <&factory 0xf100>;
        mediatek,mtd-eeprom = <&factory 0x20000>;
};

@ZiqiangYu
Copy link
Collaborator

the correct mt7628 rf parameter should be like this:
ziqiang@ziqiang:~/Router/mpkg/drivers/tm7628/files/lib/firmware$ hexdump mt7628.eeprom.bin
0000000 7628 0200 0c00 e143 2876 0000 0000 0000
0000010 ffff ffff ffff ffff ffff ffff ffff ffff
0000020 0000 0000 0020 0000 0c00 e143 2976 0c00
0000030 e143 2a76 3422 2000 ffff 0100 0000 0000
0000040 0000 0022 0000 0000 0030 0000 0000 0000
0000050 0082 9400 b040 cac0 0023 0000 ca40 0023
0000060 0000 0000 0000 0000 0000 0000 0000 0000
......

in order to dump the correct rf parameter, you must know the factory mtd block, and shold have the correct partion for mtd block. maybe isn't not easy.

you can download one from https://github.com/dcboy/mt7628-p4rev-120395/blob/master/src/eeprom/MT7628_EEPROM_20140317.bin, and rename it to /lib/firmware/mt7628.eeprom.bin. be careful, the mac in this file is null, you can edit the mac feild to what you want.

@docbee63
Copy link
Author

thanks again for your patience. I downloaded your file and included the MAC:

# hexdump mt7628.eeprom.bin 
0000000 7628 0001 8b7c 6cca 5d9f 0000 0000 0000
0000010 ffff ffff ffff ffff ffff ffff ffff ffff
0000020 0000 0000 0020 0000 0000 0000 0000 0000
0000030 0000 0000 3422 2000 ffff 0100 0000 0000
0000040 0000 0022 0000 0000 0030 0000 0000 0000
0000050 0081 9400 b040 c640 0027 0000 c5c0 0027
0000060 ffff ffff ffff ffff ffff ffff ffff ffff
*
00000a0 c6c6 c4c4 c0c4 c4c0 c4c4 c0c4 c0c0 0000
00000b0 ffff ffff ffff ffff ffff ffff ffff ffff
*
00000f0 0000 0000 009b 8800 0000 0000 0000 0000
0000100 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000120 0000 0000 0000 0000 0000 0000 0000 0077
0000130 1d11 1d11 7f15 7f15 7f17 7f17 3b10 3b10
0000140 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000200

Unfortunately, the MAC inside "/lib/firmware/mt7628.eeprom.bin" is not used at all. After a rebbot "ifconfig" tells me:

ra0       Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:6 

@ZiqiangYu
Copy link
Collaborator

add a line in wireless/mt7628/mt7628.dat as follow and try again:
E2pAccessMode=2

i'm not should where is the problem ,you can post the start up log, it may be help

@docbee63
Copy link
Author

docbee63 commented Mar 25, 2018

I added MAC to all three MAC positions (+4, +40, +46) into the file:

# hexdump /lib/firmware/mt7628.eeprom.bin
0000000 7628 0001 8b7c 6cca 5d9f 0000 0000 0000
0000010 ffff ffff ffff ffff ffff ffff ffff ffff
0000020 0000 0000 0020 0000 8b7c 6cca 5d9f 8b7c
0000030 6cca 5d9f 3422 2000 ffff 0100 0000 0000
0000040 0000 0022 0000 0000 0030 0000 0000 0000
0000050 0081 9400 b040 c640 0027 0000 c5c0 0027
0000060 ffff ffff ffff ffff ffff ffff ffff ffff
*
00000a0 c6c6 c4c4 c0c4 c4c0 c4c4 c0c4 c0c0 0000
00000b0 ffff ffff ffff ffff ffff ffff ffff ffff
*
00000f0 0000 0000 009b 8800 0000 0000 0000 0000
0000100 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000120 0000 0000 0000 0000 0000 0000 0000 0077
0000130 1d11 1d11 7f15 7f15 7f17 7f17 3b10 3b10
0000140 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000200

...and also copied that file into "/etc/wireless/mt7628" directory, and added the "E2pAccessMode=2" into my "/etc/wireless/mt7628/mt7628.dat".

But after reboot wireless adapters still show up with a nulled MAC.

Kernel boot log is as follows:

[    0.000000] Linux version 4.9.73 (boris@develop) (gcc version 5.5.0 (OpenWrt GCC 5.5.0 r5669-a367645) ) #0 Tue Jan 2 16:22:19 2018
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is TP-Link TL-MR3020v3
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 803f7174, node_mem_map 81000020
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00052180
[    0.000000] Readback ErrCtl register=00052180
[    0.000000] Memory: 60440K/65536K available (3149K kernel code, 159K rwdata, 756K rodata, 152K init, 209K bss, 5096K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource_probe: no matching clocksources found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007528] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.070042] pid_max: default: 32768 minimum: 301
[    0.074609] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080946] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.093491] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.102976] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.108902] pinctrl core: initialized pinctrl subsystem
[    0.114522] NET: Registered protocol family 16
[    0.138504] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.144194] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.149718] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.158781] clocksource: Switched to clocksource MIPS
[    0.164732] NET: Registered protocol family 2
[    0.169804] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.176493] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.182677] TCP: Hash tables configured (established 1024 bind 1024)
[    0.188876] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.194470] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.200782] NET: Registered protocol family 1
[    0.204963] PCI: CLS 0 bytes, default 32
[    0.207751] Crashlog allocated RAM at address 0x3f00000
[    0.213928] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.227899] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.233517] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.251216] io scheduler noop registered
[    0.254943] io scheduler deadline registered (default)
[    0.260747] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.267922] console [ttyS0] disabled
[    0.271410] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.280125] console [ttyS0] enabled
[    0.287123] bootconsole [early0] disabled
[    0.296327] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.306956] m25p80 spi32766.0: using chunked io (size=32)
[    0.312502] m25p80 spi32766.0: gd25q64 (8192 Kbytes)
[    0.317562] 4 ofpart partitions found on MTD device spi32766.0
[    0.323483] Creating 4 MTD partitions on "spi32766.0":
[    0.328698] 0x000000000000-0x000000020000 : "boot"
[    0.335189] 0x000000020000-0x0000007c0000 : "firmware"
[    0.391235] 2 tplink-fw partitions found on MTD device firmware
[    0.397261] 0x000000020000-0x00000016b1b4 : "kernel"
[    0.403795] 0x00000016b1b4-0x0000007c0000 : "rootfs"
[    0.410571] mtd: device 3 (rootfs) set to be root filesystem
[    0.416837] 1 squashfs-split partitions found on MTD device rootfs
[    0.423181] 0x000000540000-0x0000007c0000 : "rootfs_data"
[    0.430218] 0x0000007c0000-0x0000007d0000 : "config"
[    0.436971] 0x0000007d0000-0x000000800000 : "factory"
[    0.444458] libphy: Fixed MDIO Bus: probed
[    0.458373] rt3050-esw 10110000.esw: link changed 0x00
[    0.465089] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.474973] NET: Registered protocol family 10
[    0.482407] NET: Registered protocol family 17
[    0.486973] 8021q: 802.1Q VLAN Support v1.8
[    0.502067] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.510096] Freeing unused kernel memory: 152K
[    0.514600] This architecture does not have kernel memory protection.
[    1.728976] init: Console is alive
[    1.732645] init: - watchdog -
[    2.258786] random: fast init done
[    3.724103] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.841697] usbcore: registered new interface driver usbfs
[    3.847356] usbcore: registered new interface driver hub
[    3.852920] usbcore: registered new device driver usb
[    3.889911] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.905411] SCSI subsystem initialized
[    3.914196] ehci-platform: EHCI generic platform driver
[    3.929810] phy phy-10120000.usbphy.0: remote usb device wakeup disabled
[    3.936609] phy phy-10120000.usbphy.0: UTMI 16bit 30MHz
[    3.941952] ehci-platform 101c0000.ehci: EHCI Host Controller
[    3.947811] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    3.955979] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    3.988820] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    3.996201] hub 1-0:1.0: USB hub found
[    4.000406] hub 1-0:1.0: 1 port detected
[    4.008953] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.016688] ohci-platform: OHCI generic platform driver
[    4.022294] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    4.029250] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    4.037384] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    4.113779] hub 2-0:1.0: USB hub found
[    4.117997] hub 2-0:1.0: 1 port detected
[    4.129563] usbcore: registered new interface driver usb-storage
[    4.136323] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.146173] init: - preinit -
[    5.277854] rt3050-esw 10110000.esw: link changed 0x00
[    8.587205] mount_root: loading kmods from internal overlay
[    8.627941] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[    8.636587] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[    8.815106] rt3050-esw 10110000.esw: link changed 0x01
[    9.331029] jffs2: notice: (367) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    9.347364] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[    9.363178] block: extroot: not configured
[    9.531133] jffs2: notice: (364) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    9.548564] mount_root: loading kmods from internal overlay
[    9.587881] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[    9.601916] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[   10.089134] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   10.099722] block: extroot: not configured
[   10.105042] mount_root: switching to jffs2 overlay
[   10.146609] urandom-seed: Seeding with /etc/urandom.seed
[   10.270624] procd: - early -
[   10.273650] procd: - watchdog -
[   10.765221] rt3050-esw 10110000.esw: link changed 0x00
[   11.002378] procd: - watchdog -
[   11.005846] procd: - ubus -
[   11.501095] procd: - init -
[   11.899098] kmodloader: loading kernel modules from /etc/modules.d/*
[   11.926192] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   11.959230] hidraw: raw HID events driver (C) Jiri Kosina
[   11.972512] ip_tables: (C) 2000-2006 Netfilter Core Team
[   12.804554] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[   12.911107] rt3050-esw 10110000.esw: link changed 0x01
[   12.922686] usbcore: registered new interface driver usbhid
[   12.928344] usbhid: USB HID core driver
[   12.937082] usbcore: registered new interface driver usbserial
[   12.943178] usbcore: registered new interface driver usbserial_generic
[   12.949936] usbserial: USB Serial support registered for generic
[   12.974729] xt_time: kernel timezone is -0000
[   12.981112] usbcore: registered new interface driver ch341
[   12.986777] usbserial: USB Serial support registered for ch341-uart
[   12.995330] usbcore: registered new interface driver cp210x
[   13.001149] usbserial: USB Serial support registered for cp210x
[   13.011091] usbcore: registered new interface driver ftdi_sio
[   13.017027] usbserial: USB Serial support registered for FTDI USB Serial Device
[   13.033933] usbcore: registered new interface driver pl2303
[   13.039780] usbserial: USB Serial support registered for pl2303
[   13.049950] PPP generic driver version 2.4.2
[   13.056969] NET: Registered protocol family 24
[   13.066755] usbcore: registered new interface driver option
[   13.072619] usbserial: USB Serial support registered for GSM modem (1-port)
[   13.084848] kmodloader: done loading kernel modules from /etc/modules.d/*
[   14.764949] rt3050-esw 10110000.esw: link changed 0x00
[   16.843267] rt3050-esw 10110000.esw: link changed 0x01
[   18.764687] rt3050-esw 10110000.esw: link changed 0x00
[   20.873728] rt3050-esw 10110000.esw: link changed 0x01
[   22.764417] rt3050-esw 10110000.esw: link changed 0x00
[   24.002841] rt28xx_init, status=0
[   25.870853] rt3050-esw 10110000.esw: link changed 0x01
[   64.708855] random: crng init done

@docbee63
Copy link
Author

docbee63 commented Mar 25, 2018

Does your WiFi MAC change when you change the MAC in the "mt7628.eeprom.bin" file?

That would be a great test, if the MAC settings in "mt7628.eeprom.bin" are used at all, which I currently doubt (as the fine working vocore2 system I also have here to test with doesn't even have any files in "/lib/firmware" at all).

@ZiqiangYu
Copy link
Collaborator

if the E2pAccessMode=2 , of course it will change. you should post the wifi start log,then i'll see where is the problem.

@Nossiac
Copy link
Owner

Nossiac commented Mar 26, 2018

@ZiqiangYu @docbee63
AFAIK, the eeprom only holds the mac for ap interface (ra0, rai0, etc). "apcli" does not have an independent mac, its mac was calculated and set based on the ap interface.

And unfortunately, most mtk wifi drivers do not support customizing mac via ifconfig. Some necessary ioctl APIs are not implemented yet.

@docbee63
Copy link
Author

docbee63 commented Mar 26, 2018

I reflashed the factory partition so that the typical 512 byte eeprom section starting with "7628 ...." which is located at offset 0x20000 is copied to offset 0x0 and I patched in desired MACs at offsets 4, 40 and 46. Having done so, the MAC is used for "ra0" and a modified mac (added 0x02 on the MSB) is used for "apcli0". So for the moment I can live with this solution, but it would be much nicer if I could supply the 512 bytes eeprom data as a file without the need to remove the "read-only" tag in the kernel dtsi files to have factory partition flashable via "mtd write".

Is there a way to have the +2 increment on the MAC of the "apcli0" interface applied to the LSB instead of the MSB, where the vendor ID is coded inside the MAC?

Again, thanks for your help...

"factory" partition that works for MR3020v3:

0000000 7628 0200 8b7c 6cca 498c 0000 0000 0000
0000010 ffff ffff ffff ffff ffff ffff ffff ffff
0000020 0000 0000 0020 0000 8b7c 6cca 498c 8b7c
0000030 6cca 498c 3422 2000 ffff 0100 0000 0000
0000040 0000 0022 0000 0000 0030 0000 0000 0000
0000050 0000 9400 bc40 cac0 821e 8182 ca40 811e
0000060 8181 0000 0000 0000 0000 0000 0000 0000
0000070 0000 0000 0000 0000 0000 0000 0000 0000
*
00000a0 0000 0000 0000 0000 0000 0000 8181 0000
00000b0 0000 0000 0000 0000 0000 0000 0000 0000
00000c0 0000 0000 0000 0000 1a00 2a22 3531 3501
00000d0 4039 4d46 7f7f 007f 0000 0000 0000 0000
00000e0 1d11 1d11 351c 351c 351e 351e 1917 1917
00000f0 0002 0000 80b7 88ca 000a 0000 0000 0000
0000100 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000120 0000 0000 0000 0000 0000 0000 0000 0077
0000130 1d11 1d11 7f15 7f15 7f17 7f17 3b10 3b10
0000140 ffff ffff ffff ffff ffff ffff ffff ffff
*
000f100 8b7c 6cca 4a8c ffff ffff ffff ffff ffff
000f110 ffff ffff ffff ffff ffff ffff ffff ffff
*
000f200 fc3c 042a 0000 0000 ffff ffff ffff ffff
000f210 ffff ffff ffff ffff ffff ffff ffff ffff
*
0020000 7628 0200 0c00 e143 5076 0000 0000 0000
0020010 ffff ffff ffff ffff ffff ffff ffff ffff
0020020 0000 0000 0020 0000 0c00 e143 2976 0c00
0020030 e143 2a76 3422 2000 ffff 0100 0000 0000
0020040 0000 0022 0000 0000 0030 0000 0000 0000
0020050 0000 9400 bc40 cac0 821e 8182 ca40 811e
0020060 8181 0000 0000 0000 0000 0000 0000 0000
0020070 0000 0000 0000 0000 0000 0000 0000 0000
*
00200a0 0000 0000 0000 0000 0000 0000 8181 0000
00200b0 0000 0000 0000 0000 0000 0000 0000 0000
00200c0 0000 0000 0000 0000 1a00 2a22 3531 3501
00200d0 4039 4d46 7f7f 007f 0000 0000 0000 0000
00200e0 1d11 1d11 351c 351c 351e 351e 1917 1917
00200f0 0002 0000 80b7 88ca 000a 0000 0000 0000
0020100 ffff ffff ffff ffff ffff ffff ffff ffff
*
0020120 0000 0000 0000 0000 0000 0000 0000 0077
0020130 1d11 1d11 7f15 7f15 7f17 7f17 3b10 3b10
0020140 ffff ffff ffff ffff ffff ffff ffff ffff
*
0020200 0000 0000 0000 0000 0000 0000 0000 0000
*
0020400 ffff ffff ffff ffff ffff ffff ffff ffff
*
002fe00 0000 0000 0000 0000 0000 0000 0000 0000
*
0030000

This is how "ifconfig" reports now on "ra0" and "apcli0":

apcli0    Link encap:Ethernet  HWaddr 7E:8B:CA:0C:8C:49  
          inet addr:192.168.123.238  Bcast:192.168.123.255  Mask:255.255.255.0
          inet6 addr: fe80::7c8b:caff:fe0c:8c49/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ra0       Link encap:Ethernet  HWaddr 7C:8B:CA:6C:8C:49  
          inet6 addr: fe80::7e8b:caff:fe6c:8c49/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:6 

@ZiqiangYu
Copy link
Collaborator

Is there a way to have the +2 increment on the MAC of the "apcli0" interface applied to the LSB instead of the MSB, where the vendor ID is coded inside the MAC?

no, hw decided

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

No branches or pull requests

3 participants