[OpenWrt-Devel] [PATCH] netifd: add table argument to dhcp(v4)

Alexander Couzens lynxis at fe80.eu
Mon Sep 28 06:52:40 EDT 2015


table defines the specific routing table to modify.

Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 package/network/config/netifd/files/lib/netifd/dhcp.script   | 8 ++++----
 package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 6 ++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script
index b3a61e2..fe0972c 100755
--- a/package/network/config/netifd/files/lib/netifd/dhcp.script
+++ b/package/network/config/netifd/files/lib/netifd/dhcp.script
@@ -7,7 +7,7 @@
 set_classless_routes() {
 	local max=128
 	while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do
-		proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2" "$ip"
+		proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2" "$ip" "" "$ROUTING_TABLE"
 		max=$(($max-1))
 		shift 2
 	done
@@ -19,11 +19,11 @@ setup_interface () {
 	# TODO: apply $broadcast
 
 	for i in $router; do
-		proto_add_ipv4_route "$i" 32 "" "$ip"
-		proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
+		proto_add_ipv4_route "$i" 32 "" "$ip" "" "$ROUTING_TABLE"
+		proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip" "" "$ROUTING_TABLE"
 
 		for r in $CUSTOMROUTES; do
-			proto_add_ipv4_route "${r%%/*}" "${r##*/}" "$i" "$ip"
+			proto_add_ipv4_route "${r%%/*}" "${r##*/}" "$i" "$ip" "" "$ROUTING_TABLE"
 		done
 	done
 
diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 0e88af9..6aa0cda 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -20,14 +20,15 @@ proto_dhcp_init_config() {
 	proto_config_add_string zone
 	proto_config_add_string mtu6rd
 	proto_config_add_string customroutes
+	proto_config_add_string table
 }
 
 proto_dhcp_setup() {
 	local config="$1"
 	local iface="$2"
 
-	local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
-	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
+	local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes table
+	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes table
 
 	local opt dhcpopts
 	for opt in $reqopts; do
@@ -46,6 +47,7 @@ proto_dhcp_setup() {
 	[ -n "$zone" ] && proto_export "ZONE=$zone"
 	[ -n "$mtu6rd" ] && proto_export "MTU6RD=$mtu6rd"
 	[ -n "$customroutes" ] && proto_export "CUSTOMROUTES=$customroutes"
+	[ -n "$table" ] && proto_export "ROUTING_TABLE=$table"
 	[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
 
 	proto_export "INTERFACE=$config"
-- 
2.5.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list