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