From 7f7fd4244c5480c9c5aca3d52980cb6088e820cd Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Sat, 25 Mar 2023 03:20:11 +0700 Subject: [PATCH 1/2] wwan/ofono: correct MMS proxy property lookup The property name under `Settings` dict is just `Proxy`, unlike the one outside which is `MessageProxy`. See [1]. [1] https://kernel.googlesource.com/pub/scm/network/ofono/ofono/+/refs/heads/master/doc/connman-api.txt#253 Fixes: a6e81af87f18 ('wwan: add support for using oFono as a modem manager') (cherry picked from commit 264fed47782863ca85841fcf737845decbb9c54c) --- src/core/devices/wwan/nm-modem-ofono.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/devices/wwan/nm-modem-ofono.c b/src/core/devices/wwan/nm-modem-ofono.c index 33a19e9366..edc5cbc0f9 100644 --- a/src/core/devices/wwan/nm-modem-ofono.c +++ b/src/core/devices/wwan/nm-modem-ofono.c @@ -1320,8 +1320,8 @@ handle_settings(NMModemOfono *self, GVariant *v_dict) } } - if (g_variant_lookup(v_dict, "MessageProxy", "&s", &s)) { - _LOGI("MessageProxy: %s", s); + if (g_variant_lookup(v_dict, "Proxy", "&s", &s)) { + _LOGI("(MMS) Proxy: %s", s); if (s && nm_inet_parse_bin(AF_INET, s, NULL, &address_network)) { const NMPlatformIP4Route mms_route = { .network = address_network, @@ -1335,7 +1335,7 @@ handle_settings(NMModemOfono *self, GVariant *v_dict) nm_l3_config_data_add_route_4(priv->l3cd_4, &mms_route); } else - _LOGW("invalid MessageProxy: %s", s); + _LOGW("invalid (MMS) Proxy: %s", s); } ret = TRUE; From 1fb2be6ada3d9b2b1fe6a6f0de9d75c3026a4ee8 Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Sat, 25 Mar 2023 04:18:51 +0700 Subject: [PATCH 2/2] wwan/ofono: account for port in the Proxy property (cherry picked from commit bb226d4ed1e9d5737e370d93e505a81bbfff6911) --- src/core/devices/wwan/nm-modem-ofono.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/devices/wwan/nm-modem-ofono.c b/src/core/devices/wwan/nm-modem-ofono.c index edc5cbc0f9..de105bbdd3 100644 --- a/src/core/devices/wwan/nm-modem-ofono.c +++ b/src/core/devices/wwan/nm-modem-ofono.c @@ -1320,9 +1320,18 @@ handle_settings(NMModemOfono *self, GVariant *v_dict) } } - if (g_variant_lookup(v_dict, "Proxy", "&s", &s)) { + if (g_variant_lookup(v_dict, "Proxy", "&s", &s) && s) { + gs_free char *proxy = g_strdup(s); + char *colon; + _LOGI("(MMS) Proxy: %s", s); - if (s && nm_inet_parse_bin(AF_INET, s, NULL, &address_network)) { + + /* Strip the port out. We can do this as we know this is IPv4. */ + colon = strchr(proxy, ':'); + if (colon) + *colon = '\0'; + + if (nm_inet_parse_bin(AF_INET, proxy, NULL, &address_network)) { const NMPlatformIP4Route mms_route = { .network = address_network, .plen = 32,