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 [ "$(nvram get boardnum)" = "asusX" ] && \
10 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
14 # linksys bug; remove when not using static configuration for lan
15 NVRAM_lan_proto="static"
17 # hacks for wrt54g 1.x hardware
18 [ "$(nvram get boardnum)" = "42" ] && \
19 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
21 # remap eth0 => vlan2, eth1 => vlan1
24 debug "### wrt54g 1.x hack ###"
25 NVRAM_vlan1hwname="et0"
26 NVRAM_vlan2hwname="et0"
27 FAILSAFE_ifnames="vlan1 vlan2 eth2"
30 eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
33 for type in lan wifi wan pppoe
40 # hacks for wap54g hardware
41 [ "$(nvram get boardnum)" = "2" ] || \
42 [ "$(nvram get boardnum)" = "1024" ] && {
43 debug "### wap54g hack ###"
44 NVRAM_wan_ifname="none"
45 FAILSAFE_ifnames="eth0 eth1"
48 # hack for asus wl-500g hardware
50 FAILSAFE_lan_ifnames="eth0 eth2"
53 # defaults if lan_ifname is missing
54 [ -z "$(nvram get lan_ifname)" ] && {
55 NVRAM_lan_ifname="br0"
56 NVRAM_lan_ifnames=${FAILSAFE_lan_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
59 # defaults if wan_ifname is missing
60 [ -z "$(nvram get wan_ifname)" ] && {
61 NVRAM_wan_ifname="vlan1"
62 NVRAM_wan_proto="dhcp"
64 NVRAM_wan_ifname="eth1"
68 # failsafe if reset is held
69 [ "$FAILSAFE" = "true" ] && {
70 echo "### YOU ARE IN FAILSAFE MODE ####"
71 NVRAM_lan_ifname="br0"
72 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1"}
73 NVRAM_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"}
74 NVRAM_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"}
75 NVRAM_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}
76 NVRAM_wan_ifname="none"
77 NVRAM_wifi_ifname="none"