You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
893 B
33 lines
893 B
![]()
16 years ago
|
#!/bin/sh
|
||
|
|
||
|
# loopback is always handled the same way
|
||
|
[ "$1" = "lo" ] && {
|
||
|
ip link set lo up
|
||
|
ip addr add 127.0.0.1/8 dev lo
|
||
|
exit 0
|
||
|
}
|
||
|
|
||
|
# spin through the kernel command line, looking for ip= lines
|
||
![]()
16 years ago
|
for p in $(cat /proc/cmdline); do
|
||
|
[ "${p%ip=*}" ] || continue
|
||
|
p=${p#ip=}
|
||
![]()
16 years ago
|
case $p in
|
||
![]()
16 years ago
|
none|off) exit 0;; # we were told to not configure anything
|
||
![]()
16 years ago
|
dhcp|on|any) >/net.$1.dhcp; exit 0;;
|
||
![]()
16 years ago
|
bootp|rarp|both) exit 0;; #dunno how to do this
|
||
|
*) echo ${ip#ip=} | \
|
||
|
(IFS=':' read client server gw netmask hostname device autoconf
|
||
|
if [ -z "$device" -o "$device" = "$1" ]; then
|
||
|
case $autoconf in
|
||
![]()
16 years ago
|
dhcp|on|any) >/net.$1.dhcp ;;
|
||
![]()
16 years ago
|
none|off|'') # do some basic configuration
|
||
|
ip link set $1 up
|
||
|
ip addr add $client/$netmask dev $1
|
||
|
[ "$gw" ] && ip route add default via $gw dev $1
|
||
|
>/net.$1.up ;;
|
||
|
esac
|
||
|
fi
|
||
|
) ;;
|
||
![]()
16 years ago
|
*) continue;;
|
||
|
esac
|
||
|
done
|