fff-layer3-config: Add routerip option #136

Closed
fbl wants to merge 1 commits from fbl:routerip into master
5 changed files with 43 additions and 4 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-babeld
PKG_RELEASE:=7
PKG_RELEASE:=8
include $(INCLUDE_DIR)/package.mk

View File

@ -22,6 +22,11 @@ config filter
option local 'true'
option ip 'fd43:5602:29bd::/48'
config filter
option type 'redistribute'
option local 'true'
option if 'lo'
config filter
option type 'redistribute'
option local 'true'

View File

@ -36,11 +36,14 @@ babel_add_peeraddr() {
if peer_ip=$(uci -q get gateway.@gateway[0].peer_ip); then
uci add_list "$option"="$peer_ip"
elif router_ip=$(uci -q get gateway.meta.router_ip); then
# use router_ip if no peer_ip is set
uci add_list "$option"="$router_ip"
elif ipaddr=$(uci -q get gateway.@client[0].ipaddr); then
# use ipaddr (without subnet) if no peer_ip set
# use client interface address (without subnet) if no router_ip is set
uci add_list "$option"=$(echo $ipaddr | cut -d / -f1)
else
echo "WARNING: Neither peer_ip nor ipaddr set! IPv4 routing is not possible."
echo "WARNING: No peer_ip, router_ip or client interface ipaddr set! IPv4 routing is not possible."
return 1
fi

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-layer3-config
PKG_RELEASE:=7
PKG_RELEASE:=8
include $(INCLUDE_DIR)/package.mk

View File

@ -0,0 +1,31 @@
configure() {
local router_ip
local router_ip6
# clean old addresses
uci -q del network.loopback.ipaddr
uci -q del network.loopback.ip6addr
# remove netmask entry that ships by default
uci -q del network.loopback.netmask
# add router_ip
router_ip=$(uci -q get gateway.meta.router_ip)
for ip in $router_ip; do
uci -q add_list network.loopback.ipaddr="$ip"
done
# add router_ip6
router_ip6=$(uci -q get gateway.meta.router_ip6)
for ip in $router_ip6; do
uci -q add_list network.loopback.ip6addr="$ip"
done
}
apply() {
uci commit network
}
revert() {
uci revert network
}