3 # This file handles the NVRAM quirks of various hardware.
4 # THIS FILE IS NOT A REPLACEMENT FOR NVRAM
6 [ "$(nvram get boardnum)" = "asusX" ] && \
7 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
11 # linksys bug; remove when not using static configuration for lan
12 NVRAM_lan_proto="static"
14 # hacks for wrt54g 1.x hardware
15 [ "$(nvram get boardnum)" = "42" ] && \
16 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
18 # remap eth0 => vlan2, eth1 => vlan1
21 debug "### wrt54g 1.x hack ###"
22 NVRAM_vlan1hwname="et0"
23 NVRAM_vlan2hwname="et0"
24 FAILSAFE_ifnames="vlan1 vlan2 eth2"
27 eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
30 for type in lan wifi wan pppoe
37 # hacks for wap54g hardware
38 [ "$(nvram get boardnum)" = "2" ] || \
39 [ "$(nvram get boardnum)" = "1024" ] && {
40 debug "### wap54g hack ###"
41 NVRAM_wan_ifname="none"
42 FAILSAFE_ifnames="eth0 eth1"
45 # hack for asus wl-500g hardware
47 FAILSAFE_lan_ifnames="eth0 eth2"
50 # defaults if lan_ifname is missing
51 [ -z "$(nvram get lan_ifname)" ] && {
52 NVRAM_lan_ifname="br0"
53 NVRAM_lan_ifnames=${FAILSAFE_lan_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
56 # defaults if wan_ifname is missing
57 [ -z "$(nvram get wan_ifname)" ] && {
58 NVRAM_wan_ifname="vlan1"
59 NVRAM_wan_proto="dhcp"
61 NVRAM_wan_ifname="eth1"
65 # failsafe if reset is held
66 [ "$FAILSAFE" = "true" ] && {
67 echo "### YOU ARE IN FAILSAFE MODE ####"
68 NVRAM_lan_ifname="br0"
69 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1"}
70 NVRAM_lan_ipaddr="192.168.1.1"
71 NVRAM_lan_netmask="255.255.255.0"
72 NVRAM_lan_hwaddr="00:0B:AD:0A:DD:00"
73 NVRAM_wan_ifname="none"
74 NVRAM_wifi_ifname="none"