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"
13 for type in lan wifi wan pppoe
17 eval NVRAM_${type}_ifname$s=\"$(nvram get ${type}_ifname$s|sed s/$1/$2/g)\"
22 # hacks for wrt54g 1.x hardware
23 [ "$(nvram get boardnum)" = "42" \
24 -a "$(nvram get boardtype)" = "bcm94710dev" ] && {
25 debug "### wrt54g 1.x hack ###"
26 NVRAM_vlan1hwname="et0"
27 NVRAM_vlan2hwname="et0"
28 FAILSAFE_ifnames="vlan1 vlan2 eth2"
33 # hacks for asus wl-500g deluxe
34 [ "$(nvram get boardtype)" = "bcm95365r" \
35 -a "$(nvram get boardnum)" = "45" ] && {
36 debug "### wl-500g deluxe hacks ###"
37 NVRAM_vlan0hwname="et0"
38 NVRAM_vlan1hwname="et0"
39 FAILSAFE_ifnames="vlan0 eth1"
44 # hacks for asus wl-300g
45 [ "$(nvram get productid)" = "WL300g" ] && {
46 debug "### wl-300g hacks ###"
47 NVRAM_lan_ifnames="eth0 eth2"
48 NVRAM_wan_ifname="none"
51 # hacks for wap54g hardware
52 [ "$(nvram get boardnum)" = "2" \
53 -o "$(nvram get boardnum)" = "1024" ] && {
54 debug "### wap54g hack ###"
55 NVRAM_wan_ifname="none"
56 FAILSAFE_ifnames="eth0 eth1"
59 # hacks for buffalo wla2-g54l
60 [ "$(nvram get boardnum)" = "00" \
61 -a "$(nvram get product_name)" = "Product_name" \
62 -o "$(nvram get product_name)" = "WLA2-G54L" ] && {
63 debug "### wla2-g54l hacks ###"
64 NVRAM_wan_ifname="none"
65 NVRAM_lan_ifnames="vlan0"
68 # hack for asus wl-500g hardware
69 [ "$(nvram get boardnum)" = "asusX" \
70 -a "$(nvram get boardtype)" = "bcm94710dev" ] && {
71 FAILSAFE_ifnames="eth0 eth2"
74 # defaults if lan_ifname is missing
75 [ -z "$(nvram get lan_ifname)" ] && {
76 NVRAM_lan_ifname="br0"
77 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
80 # defaults if wan_ifname is missing
81 [ -z "$(nvram get wan_ifname)" ] && {
82 NVRAM_wan_ifname="vlan1"
83 NVRAM_wan_proto="dhcp"
86 # failsafe if reset is held
87 [ "$FAILSAFE" = "true" ] && {
88 echo "### YOU ARE IN FAILSAFE MODE ####"
89 NVRAM_lan_ifname="br0"
90 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1 eth2 eth3"}
91 NVRAM_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"}
92 NVRAM_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"}
93 NVRAM_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}
94 NVRAM_wan_ifname="none"
95 NVRAM_wifi_ifname="none"