pccard_ether revision 67221
114596Snate#!/bin/sh - 214596Snate# 350472Speter# $FreeBSD: head/etc/pccard_ether 67221 2000-10-16 19:11:11Z joe $ 438738Sbrian# 567221Sjoe# pccard_ether interfacename [start|stop] [ifconfig option] 614596Snate# 767221Sjoe# example: pccard_ether ep0 start -link0 814596Snate# 914596Snate 1067221Sjoestop_dhcp() { 1167221Sjoe if [ -r /sbin/dhclient ]; then 1267221Sjoe pidfile="/var/run/dhclient.${interface}.pid" 1367221Sjoe if [ -s ${pidfile} ]; then 1467221Sjoe kill `cat ${pidfile}` 1567221Sjoe rm ${pidfile} 1667221Sjoe fi 1767221Sjoe elif [ -r /usr/local/sbin/dhcpc ]; then 1867221Sjoe pidfile="/var/run/dhcpc.${interface}.pid" 1967221Sjoe if [ -s ${pidfile} ]; then 2067221Sjoe kill `cat ${pidfile}` 2167221Sjoe rm ${pidfile} 2267221Sjoe fi 2367221Sjoe fi 2467221Sjoe} 2567221Sjoe 2667221Sjoestart_dhcp() { 2767221Sjoe stop_dhcp 2867221Sjoe if [ -r /sbin/dhclient ]; then 2967221Sjoe pidfile="/var/run/dhclient.${interface}.pid" 3067221Sjoe /sbin/dhclient -pf ${pidfile} $interface 3167221Sjoe elif [ -r /usr/local/sbin/dhcpc ]; then 3267221Sjoe /usr/local/sbin/dhcpc $interface 3367221Sjoe else 3467221Sjoe echo "DHCP client software not available (isc-dhcp2)" 3567221Sjoe fi 3667221Sjoe} 3767221Sjoe 3843849Sjkh# Suck in the configuration variables 3951231Ssheldonh# 4051231Ssheldonhif [ -r /etc/defaults/rc.conf ]; then 4143849Sjkh . /etc/defaults/rc.conf 4259674Ssheldonh source_rc_confs 4351231Ssheldonhelif [ -r /etc/rc.conf ]; then 4427117Sjkh . /etc/rc.conf 4514596Snatefi 4614596Snate 4757144Snsayerinterface=$1 4857144Snsayershift 4967221Sjoestartstop=$2 5067221Sjoeshift 5157144Snsayer 5267221Sjoecase ${startstop} in 5367221Sjoe[Ss][Tt][Aa][Rr][Tt] | '') 5467221Sjoe case ${pccard_ifconfig} in 5567221Sjoe [Nn][Oo] | '') 5667221Sjoe ;; 5767221Sjoe [Dd][Hh][Cc][Pp]) 5867221Sjoe start_dhcp 5967221Sjoe ;; 6067221Sjoe *) 6167221Sjoe ifconfig ${interface} ${pccard_ifconfig} $* 6267221Sjoe ;; 6367221Sjoe esac 6431297Snate 6567221Sjoe case ${defaultrouter} in 6667221Sjoe [Nn][Oo] | '') 6767221Sjoe ;; 6867221Sjoe *) 6967221Sjoe static_routes="default ${static_routes}" 7067221Sjoe route_default="default ${defaultrouter}" 7167221Sjoe ;; 7267221Sjoe esac 7351231Ssheldonh 7467221Sjoe # Set up any static routes. 7567221Sjoe # 7667221Sjoe if [ -n "${static_routes}" ]; then 7767221Sjoe # flush beforehand, just in case.... 7867221Sjoe route -n flush 7967221Sjoe arp -d -a 8067221Sjoe for i in ${static_routes}; do 8167221Sjoe eval route_args=\$route_${i} 8267221Sjoe route add ${route_args} 8367221Sjoe done 8467221Sjoe fi 8563308Sume 8667221Sjoe # IPv6 setup 8767221Sjoe case ${ipv6_enable} in 8863308Sume [Yy][Ee][Ss]) 8967221Sjoe case ${ipv6_gateway_enable} in 9067221Sjoe [Yy][Ee][Ss]) 9167221Sjoe ;; 9267221Sjoe *) 9367221Sjoe sysctl -w net.inet6.ip6.forwarding=0 9467221Sjoe sysctl -w net.inet6.ip6.accept_rtadv=1 9567221Sjoe ifconfig ${interface} up 9667221Sjoe rtsol ${interface} 9767221Sjoe ;; 9867221Sjoe esac 9963308Sume ;; 10063308Sume esac 10163308Sume ;; 10267221Sjoe# Stop the interface 10367221Sjoe*) 10467221Sjoe /sbin/ifconfig $device delete 10567221Sjoe stop_dhcp 10667221Sjoe ;; 10763308Sumeesac 108