[OpenWrt-Devel] [PATCH] comgt: NCM protocol propagate defaultroute, peerdns, metric to dynamic ifaces

Jakub Janco kubco2 at gmail.com
Mon Feb 8 05:57:00 EST 2016


NCM protocol now propagate defaultroute, peerdns, metric to its dynamic dhcp ifaces to maintain these options defined in /etc/config/network.

Signed-off-by: Jakub Janco <kubco2 at gmail.com>
---
 package/network/utils/comgt/files/ncm.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh
index 571cfaa..0157f26 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -26,8 +26,8 @@ proto_ncm_setup() {
 
 	local manufacturer initialize setmode connect ifname devname devpath
 
-	local device apn auth username password pincode delay mode pdptype ipv6
-	json_get_vars device apn auth username password pincode delay mode pdptype ipv6
+	local device apn auth username password pincode delay mode pdptype ipv6 defaultroute peerdns metric
+	json_get_vars device apn auth username password pincode delay mode pdptype ipv6 defaultroute peerdns metric
 	
 	if [ "$ipv6" = 0 ]; then
 		ipv6=""
@@ -141,6 +141,9 @@ proto_ncm_setup() {
 	json_add_string name "${interface}_4"
 	json_add_string ifname "@$interface"
 	json_add_string proto "dhcp"
+	[ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
+	[ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
+	[ -n "$metric" ] && json_add_int metric "$metric"
 	ubus call network add_dynamic "$(json_dump)"
 
 	[ -n "$ipv6" ] && {
@@ -148,6 +151,9 @@ proto_ncm_setup() {
 		json_add_string name "${interface}_6"
 		json_add_string ifname "@$interface"
 		json_add_string proto "dhcpv6"
+		[ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
+		[ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
+		[ -n "$metric" ] && json_add_int metric "$metric"
 		json_add_string extendprefix 1
 		ubus call network add_dynamic "$(json_dump)"
 	}
-- 
2.1.4
_______________________________________________
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