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 [ "$(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 [ "$(nvram get boardnum)" = "45" ] && {
36 debug "### wl-500g deluxe hacks ###"
37 NVRAM_vlan0hwname="et0"
38 NVRAM_vlan1hwname="et0"
39 FAILSAFE_ifnames="vlan0 vlan1 eth2"
43 # hacks for wap54g hardware
44 [ "$(nvram get boardnum)" = "2" ] || \
45 [ "$(nvram get boardnum)" = "1024" ] && {
46 debug "### wap54g hack ###"
47 NVRAM_wan_ifname="none"
48 FAILSAFE_ifnames="eth0 eth1"
51 # hacks for buffalo wla2-g54l
52 [ "$(nvram get boardnum)" = "00" ] && \
53 [ "$(nvram get product_name)" = "Product_name" ] && {
54 debug "### wla2-g54l hacks ###"
55 NVRAM_wan_ifname="none"
56 NVRAM_lan_ifnames="vlan0"
59 # hack for asus wl-500g hardware
60 [ "$(nvram get boardnum)" = "asusX" ] && \
61 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
62 FAILSAFE_ifnames="eth0 eth2"
65 # defaults if lan_ifname is missing
66 [ -z "$(nvram get lan_ifname)" ] && {
67 NVRAM_lan_ifname="br0"
68 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
71 # defaults if wan_ifname is missing
72 [ -z "$(nvram get wan_ifname)" ] && {
73 NVRAM_wan_ifname="vlan1"
74 NVRAM_wan_proto="dhcp"
77 # failsafe if reset is held
78 [ "$FAILSAFE" = "true" ] && {
79 echo "### YOU ARE IN FAILSAFE MODE ####"
80 NVRAM_lan_ifname="br0"
81 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1 eth2 eth3"}
82 NVRAM_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"}
83 NVRAM_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"}
84 NVRAM_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}
85 NVRAM_wan_ifname="none"
86 NVRAM_wifi_ifname="none"