dhcp: start minisatip after dhcp obtained ip address
This commit is contained in:
parent
b86c6ec039
commit
2e5e6a4eb7
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
BUILD=4
|
BUILD=5
|
||||||
VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD)
|
VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD)
|
||||||
CPUS=4
|
CPUS=4
|
||||||
STLINUX=/opt/STM/STLinux-2.4
|
STLINUX=/opt/STM/STLinux-2.4
|
||||||
|
@ -8,22 +8,32 @@ test -n "$subnet" && NETMASK="netmask $subnet"
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
deconfig)
|
deconfig)
|
||||||
|
logger -p local0.notice "DHCP deconfig"
|
||||||
grep -q -v ip= /proc/cmdline
|
grep -q -v ip= /proc/cmdline
|
||||||
if test $? -eq 0; then
|
if test $? -eq 0; then
|
||||||
/sbin/ifconfig $interface up
|
ifconfig $interface up
|
||||||
fi
|
fi
|
||||||
grep -q -v nfsroot= /proc/cmdline
|
grep -q -v nfsroot= /proc/cmdline
|
||||||
if test $? -eq 0; then
|
if test $? -eq 0; then
|
||||||
/sbin/ifconfig $interface 0.0.0.0
|
ifconfig $interface 0.0.0.0
|
||||||
fi
|
fi
|
||||||
|
rm -f /tmp/satip-network
|
||||||
|
killall -9 minisatip 2> /dev/null
|
||||||
;;
|
;;
|
||||||
leasefail|nak)
|
leasefail|nak)
|
||||||
|
logger -p local0.notice "DHCP $1"
|
||||||
;;
|
;;
|
||||||
renew|bound)
|
renew|bound)
|
||||||
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
|
old=$(ifconfig $interface | head -2 | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)
|
||||||
|
logger -p local0.notice "DHCP $1 ('$ip' '$BROADCAST' '$NETMASK' | '$router' '$dns') replacing '$old'"
|
||||||
|
if test "$old" != "$ip" -a -r /tmp/satip-network; then
|
||||||
|
logger -p local0.notice "DHCP IPv4 changed, killing minisatip"
|
||||||
|
rm -f /tmp/satip-network
|
||||||
|
killall -9 minisatip 2> /dev/null
|
||||||
|
fi
|
||||||
|
ifconfig $interface $ip $BROADCAST $NETMASK
|
||||||
if test -n "$router" ; then
|
if test -n "$router" ; then
|
||||||
echo "deleting routers"
|
while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do
|
||||||
while route del default gw 0.0.0.0 dev $interface ; do
|
|
||||||
:
|
:
|
||||||
done
|
done
|
||||||
for i in $router ; do
|
for i in $router ; do
|
||||||
@ -33,9 +43,12 @@ renew|bound)
|
|||||||
echo -n > $RESOLV_CONF
|
echo -n > $RESOLV_CONF
|
||||||
test -n "$domain" && echo "search $domain" >> $RESOLV_CONF
|
test -n "$domain" && echo "search $domain" >> $RESOLV_CONF
|
||||||
for i in $dns ; do
|
for i in $dns ; do
|
||||||
echo "adding dns $i"
|
|
||||||
echo "nameserver $i" >> $RESOLV_CONF
|
echo "nameserver $i" >> $RESOLV_CONF
|
||||||
done
|
done
|
||||||
|
# notify satip init script
|
||||||
|
echo "ok" | nc 127.0.0.1 999 2> /dev/null
|
||||||
|
sleep 0.5
|
||||||
|
echo "ok" | nc 127.0.0.1 999 2> /dev/null
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
test -r /etc/sysconfig/config && . /etc/sysconfig/config
|
test -r /etc/sysconfig/config && . /etc/sysconfig/config
|
||||||
|
|
||||||
if test "$IPV4" = "dhcp"; then
|
if test "$IPV4" = "dhcp"; then
|
||||||
exec /sbin/udhcpc -f -S -p /tmp/udhcpc.pid -s /etc/init.d/dhcpc-event
|
exec /sbin/udhcpc -f -S -p /var/run/udhcpc.pid -s /etc/init.d/dhcpc-event
|
||||||
else
|
else
|
||||||
ifconfig eth0 $IPV4 netmask $IPV4_NETMASK broadcast $IPV4_BROADCAST
|
ifconfig eth0 $IPV4 netmask $IPV4_NETMASK broadcast $IPV4_BROADCAST
|
||||||
route add default gw $IPV4_GATEWAY
|
route add default gw $IPV4_GATEWAY
|
||||||
@ -12,3 +12,11 @@ fi
|
|||||||
if test -r /etc/sysconfig/resolv.conf; then
|
if test -r /etc/sysconfig/resolv.conf; then
|
||||||
ln -s sysconfig/resolv.conf /etc/resolv.conf
|
ln -s sysconfig/resolv.conf /etc/resolv.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# notify satip init script
|
||||||
|
touch /tmp/satip-network
|
||||||
|
echo "ok" | nc 127.0.0.1 999 2> /dev/null
|
||||||
|
sleep 0.5
|
||||||
|
echo "ok" | nc 127.0.0.1 999 2> /dev/null
|
||||||
|
sleep 1
|
||||||
|
echo "ok" | nc 127.0.0.1 999 2> /dev/null
|
||||||
|
@ -8,6 +8,9 @@ fi
|
|||||||
|
|
||||||
cd /tmp
|
cd /tmp
|
||||||
while test ! -f /tmp/nosatip; do
|
while test ! -f /tmp/nosatip; do
|
||||||
|
while ! test -r /tmp/satip-network; do
|
||||||
|
nc -l 127.0.0.1:999 -e /etc/init.d/satip-network
|
||||||
|
done
|
||||||
minisatip -f -g $MINISATIP_OPTS
|
minisatip -f -g $MINISATIP_OPTS
|
||||||
logger "minisatip exited $?, restarting"
|
logger "minisatip exited $?, restarting"
|
||||||
done
|
done
|
||||||
|
6
fs-add/etc/init.d/satip-network
Executable file
6
fs-add/etc/init.d/satip-network
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
read i
|
||||||
|
if test "$i" = "ok"; then
|
||||||
|
touch /tmp/satip-network
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user