Skip to content

Commit c8b98ea

Browse files
patrakovhauke
authored andcommitted
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 <[email protected]> Link: openwrt/openwrt#20217 Signed-off-by: Hauke Mehrtens <[email protected]> (cherry picked from commit b289edd)
1 parent 116083d commit c8b98ea

File tree

1 file changed

+14
-8
lines changed
  • package/network/utils/comgt/files

1 file changed

+14
-8
lines changed

package/network/utils/comgt/files/ncm.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ proto_ncm_init_config() {
2222
proto_config_add_boolean sourcefilter
2323
proto_config_add_boolean delegate
2424
proto_config_add_int profile
25+
proto_config_add_int mtu
2526
proto_config_add_defaults
2627
}
2728

@@ -30,8 +31,8 @@ proto_ncm_setup() {
3031

3132
local connect context_type devname devpath finalize ifpath initialize manufacturer setmode
3233

33-
local delegate sourcefilter $PROTO_DEFAULT_OPTIONS
34-
json_get_vars delegate sourcefilter $PROTO_DEFAULT_OPTIONS
34+
local delegate ip4table ip6table mtu sourcefilter $PROTO_DEFAULT_OPTIONS
35+
json_get_vars delegate ip4table ip6table mtu sourcefilter $PROTO_DEFAULT_OPTIONS
3536

3637
local apn auth delay device ifname mode password pdptype pincode profile username
3738
json_get_vars apn auth delay device ifname mode password pdptype pincode profile username
@@ -192,9 +193,9 @@ proto_ncm_setup() {
192193
json_add_string ifname "@$interface"
193194
json_add_string proto "dhcp"
194195
proto_add_dynamic_defaults
195-
[ -n "$zone" ] && {
196-
json_add_string zone "$zone"
197-
}
196+
[ -n "$zone" ] && json_add_string zone "$zone"
197+
[ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
198+
198199
json_close_object
199200
ubus call network add_dynamic "$(json_dump)"
200201
}
@@ -208,13 +209,18 @@ proto_ncm_setup() {
208209
[ "$delegate" = "0" ] && json_add_boolean delegate "0"
209210
[ "$sourcefilter" = "0" ] && json_add_boolean sourcefilter "0"
210211
proto_add_dynamic_defaults
211-
[ -n "$zone" ] && {
212-
json_add_string zone "$zone"
213-
}
212+
[ -n "$zone" ] && json_add_string zone "$zone"
213+
[ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
214+
214215
json_close_object
215216
ubus call network add_dynamic "$(json_dump)"
216217
}
217218

219+
[ -n "$mtu" -a "$mtu" != 0 ] && {
220+
echo "Setting MTU of $ifname to $mtu"
221+
/sbin/ip link set dev $ifname mtu $mtu
222+
}
223+
218224
[ -n "$finalize" ] && {
219225
eval COMMAND="$finalize" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
220226
echo "Failed to configure modem"

0 commit comments

Comments
 (0)