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
13 for type in lan wifi wan pppoe
17 eval ${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 ###"
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 ###"
39 FAILSAFE_ifnames="vlan0 eth1"
44 # hacks for asus wl-300g
45 [ "$(nvram get productid)" = "WL300g" ] && {
46 debug "### wl-300g hacks ###"
47 lan_ifnames="eth0 eth2"
51 # hacks for wap54g hardware
52 [ "$(nvram get boardnum)" = "2" \
53 -o "$(nvram get boardnum)" = "1024" ] && {
54 debug "### wap54g hack ###"
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 ###"
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)" ] && {
77 lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
80 # defaults if wan_ifname is missing
81 [ -z "$(nvram get wan_ifname)" ] && {
86 DEFAULT_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"}
87 DEFAULT_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"}
88 DEFAULT_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}
90 # failsafe if reset is held
91 [ "$FAILSAFE" = "true" ] && {
92 echo "### YOU ARE IN FAILSAFE MODE ####"
94 lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1 eth2 eth3"}
95 lan_ipaddr=$DEFAULT_lan_ipaddr
96 lan_netmask=$DEFAULT_lan_netmask
97 lan_hwaddr=$DEFAULT_lan_hwaddr