diff --git a/src/packages/fff/fff-babeld/Makefile b/src/packages/fff/fff-babeld/Makefile index fef12122..68b1d5a6 100644 --- a/src/packages/fff/fff-babeld/Makefile +++ b/src/packages/fff/fff-babeld/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff-babeld -PKG_RELEASE:=7 +PKG_RELEASE:=8 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-babeld/files/etc/config/babeld b/src/packages/fff/fff-babeld/files/etc/config/babeld deleted file mode 100644 index a62788a0..00000000 --- a/src/packages/fff/fff-babeld/files/etc/config/babeld +++ /dev/null @@ -1,40 +0,0 @@ -config general - option export_table '10' - option import_table '10' - option first_table_number '100' - option local_port '33123' - -config interface - option type 'wired' - -config filter - option type 'redistribute' - option local 'true' - option ip '10.50.0.0/16' - -config filter - option type 'redistribute' - option local 'true' - option ip '10.83.0.0/16' - -config filter - option type 'redistribute' - option local 'true' - option ip 'fd43:5602:29bd::/48' - -config filter - option type 'redistribute' - option local 'true' - option action 'deny' - -config filter - option type 'redistribute' - option ip '10.50.0.0/16' - -config filter - option type 'redistribute' - option ip '10.83.0.0/16' - -config filter - option type 'redistribute' - option ip 'fd43:5602:29bd::/48' diff --git a/src/packages/fff/fff-babeld/files/etc/uci-defaults/02-network-rules b/src/packages/fff/fff-babeld/files/etc/uci-defaults/02-network-rules index f1eaeb31..5f8d8781 100644 --- a/src/packages/fff/fff-babeld/files/etc/uci-defaults/02-network-rules +++ b/src/packages/fff/fff-babeld/files/etc/uci-defaults/02-network-rules @@ -1,44 +1,41 @@ -uci batch </etc/config/babeld + +uci batch >/dev/null </dev/null +uci set babeld.@filter[-1].type=redistribute +uci set babeld.@filter[-1].action=deny +uci set babeld.@filter[-1].local=true + +babel_add_ipfilter 10.50.0.0/16 +babel_add_ipfilter 10.83.0.0/16 +babel_add_ipfilter fd43:5602:29bd::/48 + +babel_add_rule src 10.50.0.0/16 10 20 +babel_add_rule dest 10.50.0.0/16 10 20 +babel_add_rule src 10.83.0.0/16 10 20 +babel_add_rule dest 10.83.0.0/16 10 20 +babel_add_rule in client 10 31 +babel_add_rule6 src fc00::/7 10 20 +babel_add_rule6 dest fc00::/7 10 20 +babel_add_rule6 in client 10 31 + +uci commit babeld uci commit network exit 0 diff --git a/src/packages/fff/fff-babeld/files/lib/functions/fff/babel b/src/packages/fff/fff-babeld/files/lib/functions/fff/babel index 3b2c7dac..5e5c9e75 100644 --- a/src/packages/fff/fff-babeld/files/lib/functions/fff/babel +++ b/src/packages/fff/fff-babeld/files/lib/functions/fff/babel @@ -1,3 +1,56 @@ +babel_add_ipfilter() { + [ "$#" -ne "1" ] && return 1 + + local ip=$1 + + uci add babeld filter >/dev/null + uci set babeld.@filter[-1].type=redistribute + uci set babeld.@filter[-1].ip="$ip" + + return 0 +} + +babel_add_local_ipfilter() { + [ "$#" -ne "1" ] && return 1 + + babel_add_ipfilter "$1" || return 1 + uci set babeld.@filter[-1].local=true + + return 0 +} + +babel_add_rule() { + [ "$#" -ne "4" ] && return 1 + + local param="$1" + local value="$2" + local table="$3" + local prio="$4" + + uci add network rule >/dev/null + uci set network.@rule[-1]."$param"="$value" + uci set network.@rule[-1].lookup="$table" + uci set network.@rule[-1].priority="$prio" + + return 0 +} + +babel_add_rule6() { + [ "$#" -ne "4" ] && return 1 + + local param="$1" + local value="$2" + local table="$3" + local prio="$4" + + uci add network rule6 >/dev/null + uci set network.@rule6[-1]."$param"="$value" + uci set network.@rule6[-1].lookup="$table" + uci set network.@rule6[-1].priority="$prio" + + return 0 +} + babel_add_iifrules() { [ "$#" -ne "1" ] && return 1