| 1 |
drobbins |
2 |
#!/sbin/runscript
|
| 2 |
|
|
|
| 3 |
drobbins |
14 |
IFACE=${1##*.}
|
| 4 |
drobbins |
2 |
IFACE=${IFACE/-dhcp/}
|
| 5 |
|
|
#IFACE should now be equal to the name of the interface.
|
| 6 |
|
|
#(grabbed from script name)
|
| 7 |
|
|
|
| 8 |
|
|
#You can also add additional network commands to the two functions below,
|
| 9 |
|
|
#such as firewall settings or additional routing commands.
|
| 10 |
|
|
|
| 11 |
|
|
start() {
|
| 12 |
|
|
ebegin "Bringing ${IFACE} up using DHCP"
|
| 13 |
|
|
/sbin/dhcpcd $IFACE
|
| 14 |
|
|
|
| 15 |
|
|
#enabling rp_filter causes wacky packets to be auto-dropped by
|
| 16 |
|
|
#the kernel
|
| 17 |
|
|
if [ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter ]
|
| 18 |
|
|
then
|
| 19 |
|
|
echo 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
|
| 20 |
|
|
fi
|
| 21 |
|
|
eend
|
| 22 |
|
|
}
|
| 23 |
|
|
|
| 24 |
|
|
stop() {
|
| 25 |
|
|
ebegin "Bringing ${IFACE} down"
|
| 26 |
|
|
kill `cat /var/run/dhcpcd-${IFACE}.pid`
|
| 27 |
|
|
eend
|
| 28 |
|
|
}
|