[openwrt/openwrt] comgt-ncm: fix setting ip[46]table and MTU

LEDE Commits lede-commits at lists.infradead.org
Thu Dec 25 07:24:57 PST 2025


hauke pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/c8b98eab98a189ae17c2221067777739a39cd603

commit c8b98eab98a189ae17c2221067777739a39cd603
Author: Alexander Patrakov <patrakov at gmail.com>
AuthorDate: Sun Sep 28 03:59:41 2025 +0800

    comgt-ncm: fix setting ip[46]table and MTU
    
    The ncm proto handler ignored ip4table, ip6table, and mtu settings.
    
    The fix is based on the existing code in the mbim proto handler.
    
    Fixes: #20216.
    Signed-off-by: Alexander Patrakov <patrakov at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/20217
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
    (cherry picked from commit b289edd84b3849ce6819e9eb078ab2f3e32f306f)
---
 package/network/utils/comgt/files/ncm.sh | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh
index a986973838..9cb5b1e662 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -22,6 +22,7 @@ proto_ncm_init_config() {
 	proto_config_add_boolean sourcefilter
 	proto_config_add_boolean delegate
 	proto_config_add_int profile
+	proto_config_add_int mtu
 	proto_config_add_defaults
 }
 
@@ -30,8 +31,8 @@ proto_ncm_setup() {
 
 	local connect context_type devname devpath finalize ifpath initialize manufacturer setmode
 
-	local delegate sourcefilter $PROTO_DEFAULT_OPTIONS
-	json_get_vars delegate sourcefilter $PROTO_DEFAULT_OPTIONS
+	local delegate ip4table ip6table mtu sourcefilter $PROTO_DEFAULT_OPTIONS
+	json_get_vars delegate ip4table ip6table mtu sourcefilter $PROTO_DEFAULT_OPTIONS
 
 	local apn auth delay device ifname mode password pdptype pincode profile username
 	json_get_vars apn auth delay device ifname mode password pdptype pincode profile username
@@ -192,9 +193,9 @@ proto_ncm_setup() {
 		json_add_string ifname "@$interface"
 		json_add_string proto "dhcp"
 		proto_add_dynamic_defaults
-		[ -n "$zone" ] && {
-			json_add_string zone "$zone"
-		}
+		[ -n "$zone" ] && json_add_string zone "$zone"
+		[ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
+
 		json_close_object
 		ubus call network add_dynamic "$(json_dump)"
 	}
@@ -208,13 +209,18 @@ proto_ncm_setup() {
 		[ "$delegate" = "0" ] && json_add_boolean delegate "0"
 		[ "$sourcefilter" = "0" ] && json_add_boolean sourcefilter "0"
 		proto_add_dynamic_defaults
-		[ -n "$zone" ] && {
-			json_add_string zone "$zone"
-		}
+		[ -n "$zone" ] && json_add_string zone "$zone"
+		[ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
+
 		json_close_object
 		ubus call network add_dynamic "$(json_dump)"
 	}
 
+	[ -n "$mtu" -a "$mtu" != 0 ] && {
+		echo "Setting MTU of $ifname to $mtu"
+		/sbin/ip link set dev $ifname mtu $mtu
+	}
+
 	[ -n "$finalize" ] && {
 		eval COMMAND="$finalize" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
 			echo "Failed to configure modem"




More information about the lede-commits mailing list