wwan: ofono: add support for notifying NM about APN

Signed-off-by: Muhammad Asif <thevancedgamer@mentallysanemainliners.org>
This commit is contained in:
Muhammad Asif 2025-12-22 02:32:08 +05:00
parent 0951002172
commit 33357f8247

View file

@ -61,6 +61,7 @@ typedef struct {
char *mnc;
char *mcc;
char *operator_code;
char *apn;
gboolean modem_online;
gboolean modem_powered;
@ -1677,11 +1678,13 @@ static void
context_properties_cb(GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
{
NMModemOfono *self = user_data;
NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE(self);
gs_free_error GError *error = NULL;
gs_unref_variant GVariant *properties = NULL;
gs_unref_variant GVariant *settings = NULL;
gs_unref_variant GVariant *v_dict = NULL;
gboolean active;
gchar *apn = NULL;
properties = g_dbus_proxy_call_finish(proxy, result, &error);
@ -1702,6 +1705,14 @@ context_properties_cb(GDBusProxy *proxy, GAsyncResult *result, gpointer user_dat
goto error;
}
if (g_variant_lookup(v_dict, "AccessPointName", "&s", &apn)) {
if (priv->apn)
g_free(priv->apn);
priv->apn = g_strdup(apn);
_nm_modem_set_apn(NM_MODEM(self), priv->apn);
}
if (active) {
_LOGD("ofono: connection is already Active");
@ -2006,6 +2017,9 @@ dispose(GObject *object)
g_free(priv->operator_code);
priv->operator_code = NULL;
g_free(priv->apn);
priv->apn = NULL;
g_strfreev(priv->available_technologies);
priv->available_technologies = NULL;