mirror of
https://git.openwrt.org/feed/routing.git
synced 2025-01-09 04:07:48 +08:00
olsrd: added hotplug script, which is needed for openwrt >= r38023 - otherwise it can happen that several interfaces are not known to olsrd at boottime
This commit is contained in:
parent
fd336abf54
commit
6bdbd50aaf
@ -175,6 +175,8 @@ define Package/olsrd/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/olsrd $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/olsrd.init $(1)/etc/init.d/olsrd
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/olsrd.hotplug.sh $(1)/etc/hotplug.d/iface/50-olsrd
|
||||
endef
|
||||
|
||||
define Package/olsrd-mod-arprefresh/install
|
||||
|
50
olsrd/files/olsrd.hotplug.sh
Executable file
50
olsrd/files/olsrd.hotplug.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
/etc/init.d/olsrd enabled || exit 0
|
||||
|
||||
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
|
||||
1|on|true|enabled|yes)
|
||||
# is disabled
|
||||
;;
|
||||
*)
|
||||
echo "$interface"
|
||||
;;
|
||||
esac
|
||||
|
||||
i=$(( $i + 1 ))
|
||||
} done
|
||||
}
|
||||
|
||||
olsrd_interface_needs_adding()
|
||||
{
|
||||
local interface="$1" # e.g. wlanadhocRADIO1
|
||||
local device="$2" # e.g. wlan1-1
|
||||
local myif
|
||||
local config="/var/etc/olsrd.conf"
|
||||
|
||||
for myif in $(olsrd_list_configured_interfaces); do {
|
||||
[ "$myif" = "$interface" ] && {
|
||||
if grep -s ^'Interface ' "$config" | grep -q "\"$device\""; then
|
||||
logger -t olsrd_hotplug -p daemon.debug "[OK] already_active: $INTERFACE => $DEVICE"
|
||||
return 1
|
||||
else
|
||||
logger -t olsrd_hotplug -p daemon.info "[OK] ifup: $INTERFACE => $DEVICE"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
} done
|
||||
|
||||
logger -t olsrd_hotplug -p daemon.debug "[OK] interface $INTERFACE not used for olsrd"
|
||||
return 1
|
||||
}
|
||||
|
||||
olsrd_interface_needs_adding "$INTERFACE" "$DEVICE" && {
|
||||
/etc/init.d/olsrd restart
|
||||
}
|
Loading…
Reference in New Issue
Block a user