-#!/bin/sh
-setup_eth()
-{
- [ -f /proc/net/wl0 ] && {
- lsmod | grep wlcompat >&- || insmod wlcompat
- }
- iwconfig "$INTERFACE" 2>&- | grep -v 'no wireless' >&- && {
- /sbin/wifi
- }
- if="$(echo "$INTERFACE" | sed s,eth,et,)"
- ifconfig "$INTERFACE" up 2>&- >&-
- for vlan in $(seq 0 15); do
- [ "$(nvram get vlan${vlan}hwname)" = "$if" ] && \
- $DEBUG vconfig add "$INTERFACE" "$vlan"
- done
-}
-
-find_name()
-{
- pppoa_ifname="atm0" # hack for ppp over atm, which has no ${proto}_ifname
- interfaces="lan wan wifi $(nvram get ifnames)"
- for ifname in $interfaces; do
- IFTYPE="${ifname}"
- IFPROTO="$(nvram get ${IFTYPE}_proto)"
- IFACE="$(nvram get ${IFTYPE}_ifname)"
- case "$IFPROTO" in
- ""|none);;
- static|dhcp)
- [ "${IFACE}" = "$INTERFACE" ] && return 0
- [ "${IFACE%%[0-9]*}" = "br" ] && {
- for part in $(nvram get ${IFTYPE}_ifnames); do
- [ "$part" = "$INTERFACE" ] && return 0
- done
- }
- ;;
- *)
- [ "$(nvram get ${IFPROTO}_ifname)" = "$INTERFACE" \
- -a -x /sbin/ifup.${IFPROTO} ] && return 0
- ;;
- esac
- done
- IFACE=""
- IFTYPE=""
- IFPROTO=""
- return 255
-}
-
-do_ifup() {
- if="$3"
- if_proto="$(nvram get ${2}_proto)"
-
- pidfile=/var/run/${if}.pid
- [ -f $pidfile ] && $DEBUG kill $(cat $pidfile)