olsrd: hotplug script works for IPv4 and IPv6
This should fix issue #16
This commit is contained in:
parent
93f819de32
commit
ca16d8c8e1
1 changed files with 14 additions and 6 deletions
|
@ -5,8 +5,8 @@ olsrd_list_configured_interfaces()
|
|||
local i=0
|
||||
local interface
|
||||
|
||||
while interface="$( uci -q get olsrd.@Interface[$i].interface )"; do {
|
||||
case "$( uci -q get olsrd.@Interface[$i].ignore )" in
|
||||
while interface="$( uci -q get $OLSRD.@Interface[$i].interface )"; do {
|
||||
case "$( uci -q get $OLSRD.@Interface[$i].ignore )" in
|
||||
1|on|true|enabled|yes)
|
||||
# is disabled
|
||||
;;
|
||||
|
@ -22,7 +22,7 @@ olsrd_list_configured_interfaces()
|
|||
olsrd_interface_already_in_config()
|
||||
{
|
||||
# e.g.: 'Interface "eth0.1" "eth0.2" "wlan0"'
|
||||
if grep -s ^'Interface ' '/var/etc/olsrd.conf' | grep -q "\"$DEVICE\""; then
|
||||
if grep -s ^'Interface ' '/var/etc/$OLSRD.conf' | grep -q "\"$DEVICE\""; then
|
||||
logger -t olsrd_hotplug -p daemon.debug "[OK] already_active: '$INTERFACE' => '$DEVICE'"
|
||||
return 0
|
||||
else
|
||||
|
@ -44,7 +44,7 @@ olsrd_interface_needs_adding()
|
|||
}
|
||||
} done
|
||||
|
||||
logger -t olsrd_hotplug -p daemon.debug "[OK] interface '$INTERFACE' => '$DEVICE' not used for olsrd"
|
||||
logger -t olsrd_hotplug -p daemon.debug "[OK] interface '$INTERFACE' => '$DEVICE' not used for $OLSRD"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,19 @@ case "$ACTION" in
|
|||
ifup)
|
||||
# only work after the first normal startup
|
||||
# also: no need to test, if enabled
|
||||
[ -e '/var/etc/olsrd.conf' ] && {
|
||||
OLSRD=olsrd4
|
||||
[ -e "/var/etc/$OLSRD.conf" ] && {
|
||||
# INTERFACE = e.g. 'wlanadhocRADIO1' or 'cfg144d8f'
|
||||
# DEVICE = e.g. 'wlan1-1'
|
||||
olsrd_interface_needs_adding && {
|
||||
. /etc/rc.common /etc/init.d/olsrd restart
|
||||
. /etc/rc.common /etc/init.d/$OLSRD restart
|
||||
}
|
||||
}
|
||||
|
||||
OLSRD=olsrd6
|
||||
[ -e "/var/etc/$OLSRD.conf" ] && {
|
||||
olsrd_interface_needs_adding && {
|
||||
. /etc/rc.common /etc/init.d/$OLSRD restart
|
||||
}
|
||||
}
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue