Ticket #10861: dir-320.mac-fixup.patch

File dir-320.mac-fixup.patch, 2.1 KB (added by Kir Kalganov <openwrt@…>, 6 years ago)
  • package/nvram/files/nvram.init

    diff --git a/package/nvram/files/nvram.init b/package/nvram/files/nvram.init
    index 0267a80..74099d1 100755
    a b start() { 
    8888                awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') 
    8989        } 
    9090 
     91        [ -f /proc/diag/model ] && 
     92          [ "$(cat /proc/diag/model)" = "D-Link DIR-320" ] && 
     93          [ "$(nvram get et0macaddr)" = "00:90:4c:c0:" ] && 
     94          [ "$(nvram get il0macaddr)" != "00:90:4c:c1:" ] && { 
     95                # et0macaddr = il0macaddr+2 
     96                nvram set et0macaddr=$(nvram get il0macaddr| 
     97                awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') 
     98                COMMIT=1 
     99        } 
     100 
    91101        [ "$COMMIT" = "1" ] && nvram commit 
    92102} 
  • target/linux/brcm-2.4/base-files/etc/init.d/netconfig

    diff --git a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig
    index d7839b6..e0e60c7 100755
    a b start() { 
    9393                } 
    9494        } 
    9595 
    96         ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") || ($1 ~ /macaddr/) { 
     96        ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardrev") || ($1 == "boardflags") || ($1 ~ /macaddr/) { 
    9797                nvram[$1] = $2 
    9898        } 
    9999 
    start() { 
    206206                        c["vlan0ports"] = "0 1 2 3 5" 
    207207                        c["vlan1ports"] = "4 5" 
    208208                } 
     209                if (model == "D-Link DIR-320") { 
     210                        if (nvram["il0macaddr"] == "00:90:4c:c1:") { 
     211                                print "#### Your " model " seems to have nvram cleared" 
     212                                print "# There is unfortunately no way to resore MAC-address automatically" 
     213                                print "# The original configuration is as the following" 
     214                                print "# LAN-MAC = Wireless-MAC = il0macaddr = MAC address on the label on router bottom cover" 
     215                                print "# WAN-MAC = et0macaddr = il0macaddr + 2" 
     216                                print "# to restore the original MAC-address type" 
     217                                print "# nvram set il0macaddr=<MAC on the label>; nvram commit; rm /etc/config/network; reboot" 
     218                                print "" 
     219                        } else { 
     220                                if (nvram["il0macaddr"] ~ mac_check) { 
     221                                        c["wan_macaddr"] = macinc(nvram["il0macaddr"]) 
     222                                } 
     223                        } 
     224                } 
    209225 
    210226                if (c["vlan0ports"] || c["vlan1ports"]) { 
    211227                        print "#### VLAN configuration "