3 # This file handles the NVRAM quirks of various hardware.
4 # THIS FILE IS NOT A REPLACEMENT FOR NVRAM
6 # Load sysconf defaults
7 [ -f /etc/sysconf ] && . /etc/sysconf
9 # linksys bug; remove when not using static configuration for lan
10 NVRAM_lan_proto="static"
12 # hacks for wrt54g 1.x hardware
13 [ "$(nvram get boardnum)" = "42" ] && \
14 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
16 # remap eth0 => vlan2, eth1 => vlan1
19 debug "### wrt54g 1.x hack ###"
20 NVRAM_vlan1hwname="et0"
21 NVRAM_vlan2hwname="et0"
22 FAILSAFE_ifnames="vlan1 vlan2 eth2"
25 eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
28 for type in lan wifi wan pppoe
35 # hacks for wap54g hardware
36 [ "$(nvram get boardnum)" = "2" ] || \
37 [ "$(nvram get boardnum)" = "1024" ] && {
38 debug "### wap54g hack ###"
39 NVRAM_wan_ifname="none"
40 FAILSAFE_ifnames="eth0 eth1"
43 # hacks for buffalo wla2-g54l
44 [ "$(nvram get boardnum)" = "00" ] && \
45 [ "$(nvram get product_name)" = "Product_name" ] && {
46 debug "### wla2-g54l hacks ###"
47 NVRAM_lan_ifnames="vlan0"
48 NVRAM_wan_ifname="none"
51 # hack for asus wl-500g hardware
52 [ "$(nvram get boardnum)" = "asusX" ] && \
53 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
54 FAILSAFE_lan_ifnames="eth0 eth2"
57 # hacks for asus wl-500g deluxe
58 [ "$(nvram get boardtype)" = "bcm95365r" ] && \
59 [ "$(nvram get boardnum)" = "45" ] && {
60 debug "### wl-500g deluxe hacks ###"
61 NVRAM_vlan0hwname="et0"
62 NVRAM_vlan1hwname="et0"
63 NVRAM_lan_ifnames="vlan0 eth1"
64 [ "$(nvram get wan_ifname)" = "eth0.1" ] && {
65 NVRAM_wan_ifname="vlan1"
69 # defaults if lan_ifname is missing
70 [ -z "$(nvram get lan_ifname)" ] && {
71 NVRAM_lan_ifname="br0"
72 NVRAM_lan_ifnames=${FAILSAFE_lan_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
75 # defaults if wan_ifname is missing
76 [ -z "$(nvram get wan_ifname)" ] && {
77 NVRAM_wan_ifname="vlan1"
78 NVRAM_wan_proto="dhcp"
80 NVRAM_wan_ifname="eth1"
84 # failsafe if reset is held
85 [ "$FAILSAFE" = "true" ] && {
86 echo "### YOU ARE IN FAILSAFE MODE ####"
87 NVRAM_lan_ifname="br0"
88 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1"}
89 NVRAM_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"}
90 NVRAM_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"}
91 NVRAM_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}
92 NVRAM_wan_ifname="none"
93 NVRAM_wifi_ifname="none"