From patchwork Tue Apr 2 22:30:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614677 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1113FA41 for ; Tue, 2 Apr 2024 22:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097059; cv=none; b=fLcoURnYlhZbFl4Wj/BMMLkGkShu3h6X3VYJgeVg8PfB+g/A+IKB+gTR/Q47DkNDmxPP8dXcmnVvEIBw12PqvQtqd1+5xeBqQ5vx/Cyr7LpZe+HU4eHG9xe+WyhiLE8RgMmke+bf8KJju921xMGEZoroumdWVhOKgVYVmKWMVuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097059; c=relaxed/simple; bh=k66wIl80Zq7pvesYV2WYqme53htYmqrrAC4TAQW1GOE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=L8cz9cHntCbhw4AcsbNWZrQMP6KQ5EBsFpiSJvn47kZuQaZOw7GmFAEQKcSDWfJO4NCtwyopQmmaA2476VwDjnNbAek3I26IhO7wL/DeHD87e4xYFOZH7oqPlvP36V9Hl3XFpzvNhOk01m0bb42/YPcArzgLM1+ttV3y5NELD8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aRDBKkBF; arc=none smtp.client-ip=209.85.161.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aRDBKkBF" Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5a4f9f94e77so3738424eaf.3 for ; Tue, 02 Apr 2024 15:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097057; x=1712701857; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CM5RMKRwjluQFfMBQ0BEEs2Ff+8rNoL9zfjuwSlImdQ=; b=aRDBKkBFNEBxYYOdnPaC03HpdLPfcwC4YC3R/RcwFWI74LuzmhmeY899x4gfNVMzbF qVcQKGd+EQXf6Q5kYTx+PFzvTzkxHfL1Ial4oHk+Ffu1yiSJF4m62leNjmjc0/VNbkLB 9vAT/FkhA3g6UDO7Bygu2nvPnl0/97+Ggmu0MU1mfbUnLgJGOb/wWSdo4FQil20mL0Gh LF2d1MVqjyUvK8c2ArssTjNIutuSGUeIwVV+hZmZjBVMdW4gisyx5Kh4cKYGWmrj/vkM YfMZTD0TsHWLK2l8ur76c2ILuo5YEOuKdhOpCTvPfj2vaBX8UVQvL/2YEbTyW963x2jI lzWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097057; x=1712701857; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CM5RMKRwjluQFfMBQ0BEEs2Ff+8rNoL9zfjuwSlImdQ=; b=lMmM7Fjzs3g7uUpz8S2U1k3Fz6VQt3SZYeWxeWPCZlxtnuTScF3xcFCoQW61pBD9Si elwnCgQz3O1fysQ7GcDdqrloKZCRVVu6TiYgB/XBr0ovr2qmO52Q6Pg1TdU+VVendXd+ yAKEVOrnW5auFp8GnfiuVLoKlF+S0ihHOU9jVan0Cn1R+I5KD1rE+l+eNMmrP+83bA/U a/LIOypxmGA3EkZFWanPODySYWuCsqnuwKPCXzdDdu8l2+Y6HXbR2RlSp4xSxnD115RL n6amYtyNYpouo98Hkosng/TojWem0/z8DA7L9bamkWnAmZnolWxU8IBEisHehivMCfdb ti2w== X-Gm-Message-State: AOJu0YyFQXjjzNCFugLuAPH4of40+mtwYnboPi5bazZ6VCUCu8r7iO/D 4x/A88vRfguBwElmnED4EcJsu5SVuWd9x2mmHC9ldxMmfo8/xe3AZCRq6ZtK X-Google-Smtp-Source: AGHT+IEaDRYNGcejthMjIodecySAZrDQ4hnbHn71pH5oZR2JQKIeCNvf7DuBuqKjsn2VK9rfEb/k8w== X-Received: by 2002:a05:6820:2110:b0:5a7:c7e1:b603 with SMTP id cd16-20020a056820211000b005a7c7e1b603mr6216802oob.3.1712097056805; Tue, 02 Apr 2024 15:30:56 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:30:56 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 01/13] simutil: Convert eons APIs to use ell Date: Tue, 2 Apr 2024 17:30:26 -0500 Message-ID: <20240402223054.2819526-1-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 While here, also remove sim_eons_optimize() as it is no longer needed. The ell queue implementation natively supports pushing to the back of a linked list. Also tighten up some length checks and make 'length' arguments unsigned. --- src/network.c | 2 - src/simutil.c | 103 ++++++++++++++++++++------------------------ src/simutil.h | 15 ++++--- unit/test-simutil.c | 1 - 4 files changed, 54 insertions(+), 67 deletions(-) diff --git a/src/network.c b/src/network.c index 886e5bf0f9a3..629d5fb91eb8 100644 --- a/src/network.c +++ b/src/network.c @@ -1581,8 +1581,6 @@ static void sim_opl_read_cb(int ok, int length, int record, return; optimize: - sim_eons_optimize(netreg->eons); - for (l = netreg->operator_list; l; l = l->next) { struct network_operator_data *opd = l->data; const struct sim_eons_operator_info *eons_info; diff --git a/src/simutil.c b/src/simutil.c index 543ab9962ef2..f3fc18d9db29 100644 --- a/src/simutil.c +++ b/src/simutil.c @@ -36,10 +36,10 @@ #include "missing.h" struct sim_eons { - struct sim_eons_operator_info *pnn_list; - GSList *opl_list; - gboolean pnn_valid; - int pnn_max; + struct l_queue *opl_list; + bool pnn_valid; + uint32_t pnn_max; + struct sim_eons_operator_info pnn_list[]; }; struct spdi_operator { @@ -782,12 +782,12 @@ bool validate_utf8_tlv(const unsigned char *tlv) } static char *sim_network_name_parse(const unsigned char *buffer, int length, - gboolean *add_ci) + bool *add_ci) { char *ret = NULL; unsigned char dcs; int i; - gboolean ci = FALSE; + bool ci = FALSE; unsigned char *unpacked_buf; long num_char, written; int spare_bits; @@ -999,22 +999,18 @@ void sim_spdi_free(struct sim_spdi *spdi) g_free(spdi); } -static void pnn_operator_free(struct sim_eons_operator_info *oper) +struct sim_eons *sim_eons_new(uint32_t pnn_records) { - if (oper == NULL) - return; + struct sim_eons *eons = l_malloc(sizeof(struct sim_eons) + + sizeof(struct sim_eons_operator_info) * pnn_records); - l_free(oper->info); - l_free(oper->shortname); - l_free(oper->longname); -} + eons->pnn_valid = false; + eons->pnn_max = pnn_records; -struct sim_eons *sim_eons_new(int pnn_records) -{ - struct sim_eons *eons = g_new0(struct sim_eons, 1); + memset(eons->pnn_list, 0, + sizeof(struct sim_eons_operator_info) * pnn_records); - eons->pnn_list = g_new0(struct sim_eons_operator_info, pnn_records); - eons->pnn_max = pnn_records; + eons->opl_list = l_queue_new(); return eons; } @@ -1024,8 +1020,8 @@ gboolean sim_eons_pnn_is_empty(struct sim_eons *eons) return !eons->pnn_valid; } -void sim_eons_add_pnn_record(struct sim_eons *eons, int record, - const guint8 *tlv, int length) +void sim_eons_add_pnn_record(struct sim_eons *eons, uint32_t record, + const uint8_t *tlv, uint16_t length) { const unsigned char *name; int namelength; @@ -1053,9 +1049,9 @@ void sim_eons_add_pnn_record(struct sim_eons *eons, int record, eons->pnn_valid = TRUE; } -static struct opl_operator *opl_operator_alloc(const guint8 *record) +static struct opl_operator *opl_operator_alloc(const uint8_t *record) { - struct opl_operator *oper = g_new0(struct opl_operator, 1); + struct opl_operator *oper = l_new(struct opl_operator, 1); sim_parse_mcc_mnc(record, oper->mcc, oper->mnc); record += 3; @@ -1071,40 +1067,41 @@ static struct opl_operator *opl_operator_alloc(const guint8 *record) } void sim_eons_add_opl_record(struct sim_eons *eons, - const guint8 *contents, int length) + const uint8_t *contents, uint16_t length) { struct opl_operator *oper; + if (length < 8) + return; + oper = opl_operator_alloc(contents); - if (oper->id > eons->pnn_max) { - g_free(oper); + if (!oper->id || oper->id > eons->pnn_max) { + l_free(oper); return; } - eons->opl_list = g_slist_prepend(eons->opl_list, oper); -} - -void sim_eons_optimize(struct sim_eons *eons) -{ - eons->opl_list = g_slist_reverse(eons->opl_list); + l_queue_push_tail(eons->opl_list, oper); } void sim_eons_free(struct sim_eons *eons) { - int i; + uint32_t i; if (eons == NULL) return; - for (i = 0; i < eons->pnn_max; i++) - pnn_operator_free(eons->pnn_list + i); + for (i = 0; i < eons->pnn_max; i++) { + struct sim_eons_operator_info *oper = eons->pnn_list + i; - g_free(eons->pnn_list); + l_free(oper->info); + l_free(oper->shortname); + l_free(oper->longname); + } - g_slist_free_full(eons->opl_list, g_free); + l_queue_destroy(eons->opl_list, l_free); - g_free(eons); + l_free(eons); } static const struct sim_eons_operator_info * @@ -1112,46 +1109,38 @@ static const struct sim_eons_operator_info * const char *mcc, const char *mnc, gboolean have_lac, guint16 lac) { - GSList *l; + const struct l_queue_entry *entry; const struct opl_operator *opl; - int i; + unsigned int i; - for (l = eons->opl_list; l; l = l->next) { - opl = l->data; + for (entry = l_queue_get_entries(eons->opl_list); + entry; entry = entry->next) { + opl = entry->data; for (i = 0; i < OFONO_MAX_MCC_LENGTH; i++) if (mcc[i] != opl->mcc[i] && !(opl->mcc[i] == 'b' && mcc[i])) - break; - if (i < OFONO_MAX_MCC_LENGTH) - continue; + goto no_match; for (i = 0; i < OFONO_MAX_MNC_LENGTH; i++) if (mnc[i] != opl->mnc[i] && !(opl->mnc[i] == 'b' && mnc[i])) - break; - if (i < OFONO_MAX_MNC_LENGTH) - continue; + goto no_match; if (opl->lac_tac_low == 0 && opl->lac_tac_high == 0xfffe) - break; + goto found; if (have_lac == FALSE) continue; if ((lac >= opl->lac_tac_low) && (lac <= opl->lac_tac_high)) - break; + goto found; +no_match: } - if (l == NULL) - return NULL; - - opl = l->data; - - /* 0 is not a valid record id */ - if (opl->id == 0) - return NULL; + return NULL; +found: return &eons->pnn_list[opl->id - 1]; } diff --git a/src/simutil.h b/src/simutil.h index 9584d4d9cd62..8c34f9f36488 100644 --- a/src/simutil.h +++ b/src/simutil.h @@ -20,6 +20,7 @@ */ #include +#include #define SIM_EFSPN_DC_HOME_PLMN_BIT 0x1 #define SIM_EFSPN_DC_ROAMING_SPN_BIT 0x2 @@ -299,9 +300,9 @@ enum ber_tlv_data_encoding_type { struct sim_eons_operator_info { char *longname; - gboolean long_ci; + bool long_ci; char *shortname; - gboolean short_ci; + bool short_ci; char *info; }; @@ -460,18 +461,18 @@ gboolean ber_tlv_builder_recurse_comprehension(struct ber_tlv_builder *builder, void ber_tlv_builder_optimize(struct ber_tlv_builder *builder, unsigned char **pdu, unsigned int *len); -struct sim_eons *sim_eons_new(int pnn_records); -void sim_eons_add_pnn_record(struct sim_eons *eons, int record, - const guint8 *tlv, int length); +struct sim_eons *sim_eons_new(uint32_t pnn_records); +void sim_eons_add_pnn_record(struct sim_eons *eons, uint32_t record, + const uint8_t *tlv, uint16_t length); gboolean sim_eons_pnn_is_empty(struct sim_eons *eons); void sim_eons_add_opl_record(struct sim_eons *eons, - const guint8 *contents, int length); + const uint8_t *contents, uint16_t length); void sim_eons_optimize(struct sim_eons *eons); const struct sim_eons_operator_info *sim_eons_lookup_with_lac( struct sim_eons *eons, const char *mcc, const char *mnc, - guint16 lac); + uint16_t lac); const struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons, const char *mcc, const char *mnc); diff --git a/unit/test-simutil.c b/unit/test-simutil.c index 4199991a4d2a..365ef318d937 100644 --- a/unit/test-simutil.c +++ b/unit/test-simutil.c @@ -393,7 +393,6 @@ static void test_eons(void) g_assert(!sim_eons_pnn_is_empty(eons_info)); sim_eons_add_opl_record(eons_info, valid_efopl, sizeof(valid_efopl)); - sim_eons_optimize(eons_info); op_info = sim_eons_lookup(eons_info, "246", "82"); g_assert(op_info == NULL); From patchwork Tue Apr 2 22:30:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614678 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE44C3234 for ; Tue, 2 Apr 2024 22:30:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097060; cv=none; b=FwIQHRKWVM84a//8Zk3atfMeydIkPxfUCE4Wlh8C138JExd4boMGuHZ3nGS1G8QKw0/jhVBi5bF1484j+tlurShukcxJQrIJYsBwEUQ4EjRF+SumuOKjAlNJXNlgWYCCgp+WH+t325M31IfICkOHNmrewgt4ItPm2UTlqI662/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097060; c=relaxed/simple; bh=FyWc1Q0mtKOGVJ/yFXv3XkiWnhZ7+UwTfCoLIL0KW7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QSjESlGERZQkWMiwNg0IOsNtB5nfnsAnSnmPFRhO/DTv2UuzBpOAWMJQsY/0u/1uCUL88cFTOW7TA4mACdm7ypAPE17OhSaTr1X8OoOjGpkrfMRarjmEJw4XceYVccWB0LRYzeGz56Wjrpw7lyKORXPp/DXmdoCZQlFgERSz/c0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=abFEIR47; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="abFEIR47" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5a4f7a648dbso3653137eaf.3 for ; Tue, 02 Apr 2024 15:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097058; x=1712701858; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qc68nD8Sb1qaFbkAdFK1A6KnzHAVOaQGteOyPMwLjE0=; b=abFEIR47sNeDlzsiNeXuBhOOd0ULK5HNbzdkrbWbDdLzuIwyhiig/+cKWX6RBoQZJ6 uoYTP59obAycDvDf+DlY2hJa02QHVsp5xuQpvQcpRT2TwyjZlzTu7qvX69j5iP0hcEBi Vsy3OUQWzx+YHefsgNWkHYF8Hg5nZR9fCa+cGVTgC0I2LO6XJBqhK1JWmiWmWW3I+X+f N/7gi8En3X69lKy8ROSaMYlvVoVcQvt++NwUskwVRTgxz6vd0kWO5aE30RziobpTCPOg 8jQp21etOU5dlkh1gdwBzlYIbe0iEsU2F00AGJxd3Mnnkc/l63Jn6wjFWPhebmWhCHTw fX7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097058; x=1712701858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qc68nD8Sb1qaFbkAdFK1A6KnzHAVOaQGteOyPMwLjE0=; b=Adlh0OcxTU9QJJS+jaUzaxpmD6xck4X1ezLtOm/wnH5HdHMHlQyhYGHLgiZPC2eo9v 1wwIAEpU4WtiQErZ1z+SzTyrZjpSavWgA4I4XdJ/UF1MPMZ1oRmzCRPqbVWAjPm7KjwA Sqgebp+xhHAUeKlgHSvTsSFdEkqivsvU37RSyQMIaOVo23OmgdUwszdRNBSfX+vZ/fKx 1mQbf6SPVIsYbwxQWHY0LNaFVAdz2QdQple2pSXZy0y3MoaM2GmSI0KkbZdOFfkoz0NZ 4cktKD8WpDFJFEGV10Rm54d6sRb27v6Mg+Z0pYb7ZVrjnyKJ+/suY06fT2FZ+gouSPN2 0M5g== X-Gm-Message-State: AOJu0Ywnx4hvU2AE6LaFt9mkWnQRTZxA5fatrUKAavJ7iE9l+KyckysM gGIGCNjAvMPKy49CJGD04s46Is9AzR9mczO1hDoWUBuP0UPyfA5TH03enW7u X-Google-Smtp-Source: AGHT+IHdSnR2AWT0X/YKQKbRnZkUr9Uew/NhLuHOTx8oCmCbh+NFf9oKD+58mIUkAdQPaDvnKzNWEg== X-Received: by 2002:a05:6820:2903:b0:5a5:16e1:beb3 with SMTP id dp3-20020a056820290300b005a516e1beb3mr14831822oob.0.1712097057591; Tue, 02 Apr 2024 15:30:57 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:30:57 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 02/13] sim: Simplify SPN management logic Date: Tue, 2 Apr 2024 17:30:27 -0500 Message-ID: <20240402223054.2819526-2-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The current implementation kicks off reading of the SPN only if an spn watch has been registered. This made sense at the time since the only atoms that used spn were netreg and gprs. Typically they were initialized in the post_online state, which in effect delayed SPN reading until that time. With the introduction of provisioning inside the LTE atom, the spn watch is always registered for LTE modems (nearly all modems now and going forward). Simplify the SPN reading logic by reading it once the sim has been initialized by kicking off the read procedure inside sim_ready(). While here, remove tracking of cphs_spn_watch, ef_spn_watch and cphs_spn_short_watch. All sim file watches are automatically destroyed once the ofono_sim_context is destroyed. --- src/sim.c | 353 +++++++++++++++++++++++------------------------------- 1 file changed, 153 insertions(+), 200 deletions(-) diff --git a/src/sim.c b/src/sim.c index 8a97e87612d9..861cfe826f05 100644 --- a/src/sim.c +++ b/src/sim.c @@ -113,9 +113,6 @@ struct ofono_sim { char *spn; char *spn_dc; struct ofono_watchlist *spn_watches; - unsigned int ef_spn_watch; - unsigned int cphs_spn_watch; - unsigned int cphs_spn_short_watch; struct sim_fs *simfs; struct sim_fs *simfs_isim; @@ -139,13 +136,13 @@ struct ofono_sim { GSList *aid_sessions; GSList *aid_list; char *impi; - bool reading_spn : 1; bool language_prefs_update : 1; bool fixed_dialing : 1; bool barred_dialing : 1; bool sdn_ready : 1; bool initialized : 1; bool wait_initialized : 1; + bool spn_initialized : 1; }; struct cached_pin { @@ -1532,6 +1529,137 @@ static void sim_own_numbers_changed(int id, void *userdata) sim_own_numbers_update(sim); } +static void spn_watch_cb(gpointer data, gpointer user_data) +{ + struct ofono_watchlist_item *item = data; + struct ofono_sim *sim = user_data; + + if (item->notify) + ((ofono_sim_spn_cb_t) item->notify)(sim->spn, sim->spn_dc, + item->notify_data); +} + +static void sim_spn_set(struct ofono_sim *sim, const void *data, int length, + const unsigned char *dc) +{ + DBusConnection *conn = ofono_dbus_get_connection(); + const char *path = __ofono_atom_get_path(sim->atom); + + l_free(sim->spn); + sim->spn = NULL; + + l_free(sim->spn_dc); + sim->spn_dc = NULL; + + if (data == NULL) + goto notify; + + /* + * TS 31.102 says: + * + * the string shall use: + * + * - either the SMS default 7-bit coded alphabet as defined in + * TS 23.038 [5] with bit 8 set to 0. The string shall be left + * justified. Unused bytes shall be set to 'FF'. + * + * - or one of the UCS2 code options defined in the annex of TS + * 31.101 [11]. + * + * 31.101 has no such annex though. 51.101 refers to Annex B of + * itself which is not there either. 11.11 contains the same + * paragraph as 51.101 and has an Annex B which we implement. + */ + sim->spn = sim_string_to_utf8(data, length); + if (sim->spn == NULL) { + ofono_error("EFspn read successfully, but couldn't parse"); + goto notify; + } + + if (strlen(sim->spn) == 0) { + l_free(sim->spn); + sim->spn = NULL; + goto notify; + } + + if (dc) + sim->spn_dc = l_memdup(dc, 1); + +notify: + sim->spn_initialized = true; + + if (sim->spn) + ofono_dbus_signal_property_changed(conn, path, + OFONO_SIM_MANAGER_INTERFACE, + "ServiceProviderName", + DBUS_TYPE_STRING, &sim->spn); + + g_slist_foreach(sim->spn_watches->items, spn_watch_cb, sim); +} + +static void sim_cphs_spn_short_read_cb(int ok, int length, int record, + const unsigned char *data, + int record_length, void *user_data) +{ + struct ofono_sim *sim = user_data; + + if (!ok) { + sim_spn_set(sim, NULL, 0, NULL); + return; + } + + sim_spn_set(sim, data, length, NULL); +} + +static void sim_cphs_spn_read_cb(int ok, int length, int record, + const unsigned char *data, + int record_length, void *user_data) +{ + struct ofono_sim *sim = user_data; + + if (!ok) { + if (__ofono_sim_cphs_service_available(sim, + SIM_CPHS_SERVICE_SHORT_SPN)) + ofono_sim_read(sim->context, + SIM_EF_CPHS_SPN_SHORT_FILEID, + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, + sim_cphs_spn_short_read_cb, sim); + else + sim_spn_set(sim, NULL, 0, NULL); + + return; + } + + sim_spn_set(sim, data, length, NULL); +} + +static void sim_spn_read_cb(int ok, int length, int record, + const unsigned char *data, + int record_length, void *user_data) +{ + struct ofono_sim *sim = user_data; + + if (!ok) { + ofono_sim_read(sim->context, SIM_EF_CPHS_SPN_FILEID, + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, + sim_cphs_spn_read_cb, sim); + + return; + } + + sim_spn_set(sim, data + 1, length - 1, data); +} + +static void sim_spn_changed(int id, void *userdata) +{ + struct ofono_sim *sim = userdata; + + sim->spn_initialized = false; + ofono_sim_read(sim->context, SIM_EFSPN_FILEID, + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, + sim_spn_read_cb, sim); +} + static void sim_efimg_read_cb(int ok, int length, int record, const unsigned char *data, int record_length, void *userdata) @@ -1622,6 +1750,18 @@ static void sim_ready(enum ofono_sim_state new_state, void *user) ofono_sim_add_file_watch(sim->context, SIM_EFSDN_FILEID, sim_service_numbers_changed, sim, NULL); + /* Service Provider Name (EFspn and CPHS equivalents) */ + sim_spn_changed(SIM_EFSPN_FILEID, sim); + ofono_sim_add_file_watch(sim->context, SIM_EFSPN_FILEID, + sim_spn_changed, sim, NULL); + ofono_sim_add_file_watch(sim->context, SIM_EF_CPHS_SPN_FILEID, + sim_spn_changed, sim, NULL); + + if (__ofono_sim_cphs_service_available(sim, SIM_CPHS_SERVICE_SHORT_SPN)) + ofono_sim_add_file_watch(sim->context, + SIM_EF_CPHS_SPN_SHORT_FILEID, + sim_spn_changed, sim, NULL); + ofono_sim_read(sim->context, SIM_EFIMG_FILEID, OFONO_SIM_FILE_STRUCTURE_FIXED, sim_efimg_read_cb, sim); ofono_sim_add_file_watch(sim->context, SIM_EFIMG_FILEID, @@ -2611,37 +2751,6 @@ static void sim_free_early_state(struct ofono_sim *sim) } } -static void sim_spn_close(struct ofono_sim *sim) -{ - /* - * We have not initialized SPN logic at all yet, either because - * no netreg / gprs atom has been needed or we have not reached the - * post_sim state - */ - if (sim->ef_spn_watch == 0) - return; - - ofono_sim_remove_file_watch(sim->context, sim->ef_spn_watch); - sim->ef_spn_watch = 0; - - ofono_sim_remove_file_watch(sim->context, sim->cphs_spn_watch); - sim->cphs_spn_watch = 0; - - if (sim->cphs_spn_short_watch) { - ofono_sim_remove_file_watch(sim->context, - sim->cphs_spn_short_watch); - sim->cphs_spn_short_watch = 0; - } - - sim->reading_spn = false; - - l_free(sim->spn); - sim->spn = NULL; - - l_free(sim->spn_dc); - sim->spn_dc = NULL; -} - static void aid_session_free(gpointer data) { struct ofono_sim_aid_session *session = data; @@ -2709,7 +2818,14 @@ static void sim_free_main_state(struct ofono_sim *sim) sim->fixed_dialing = false; sim->barred_dialing = false; - sim_spn_close(sim); + /* Service Provider Name related */ + sim->spn_initialized = false; + + l_free(sim->spn); + sim->spn = NULL; + + l_free(sim->spn_dc); + sim->spn_dc = NULL; if (sim->context) { ofono_sim_context_free(sim->context); @@ -2929,163 +3045,6 @@ enum ofono_sim_state ofono_sim_get_state(struct ofono_sim *sim) return sim->state; } -static void spn_watch_cb(gpointer data, gpointer user_data) -{ - struct ofono_watchlist_item *item = data; - struct ofono_sim *sim = user_data; - - if (item->notify) - ((ofono_sim_spn_cb_t) item->notify)(sim->spn, sim->spn_dc, - item->notify_data); -} - -static inline void spn_watches_notify(struct ofono_sim *sim) -{ - if (sim->spn_watches->items) - g_slist_foreach(sim->spn_watches->items, spn_watch_cb, sim); - - sim->reading_spn = false; -} - -static void sim_spn_set(struct ofono_sim *sim, const void *data, int length, - const unsigned char *dc) -{ - DBusConnection *conn = ofono_dbus_get_connection(); - const char *path = __ofono_atom_get_path(sim->atom); - - l_free(sim->spn); - sim->spn = NULL; - - l_free(sim->spn_dc); - sim->spn_dc = NULL; - - if (data == NULL) - goto notify; - - /* - * TS 31.102 says: - * - * the string shall use: - * - * - either the SMS default 7-bit coded alphabet as defined in - * TS 23.038 [5] with bit 8 set to 0. The string shall be left - * justified. Unused bytes shall be set to 'FF'. - * - * - or one of the UCS2 code options defined in the annex of TS - * 31.101 [11]. - * - * 31.101 has no such annex though. 51.101 refers to Annex B of - * itself which is not there either. 11.11 contains the same - * paragraph as 51.101 and has an Annex B which we implement. - */ - sim->spn = sim_string_to_utf8(data, length); - if (sim->spn == NULL) { - ofono_error("EFspn read successfully, but couldn't parse"); - goto notify; - } - - if (strlen(sim->spn) == 0) { - l_free(sim->spn); - sim->spn = NULL; - goto notify; - } - - if (dc) - sim->spn_dc = l_memdup(dc, 1); - -notify: - if (sim->spn) - ofono_dbus_signal_property_changed(conn, path, - OFONO_SIM_MANAGER_INTERFACE, - "ServiceProviderName", - DBUS_TYPE_STRING, &sim->spn); - - spn_watches_notify(sim); -} - -static void sim_cphs_spn_short_read_cb(int ok, int length, int record, - const unsigned char *data, - int record_length, void *user_data) -{ - struct ofono_sim *sim = user_data; - - if (!ok) { - sim_spn_set(sim, NULL, 0, NULL); - return; - } - - sim_spn_set(sim, data, length, NULL); -} - -static void sim_cphs_spn_read_cb(int ok, int length, int record, - const unsigned char *data, - int record_length, void *user_data) -{ - struct ofono_sim *sim = user_data; - - if (!ok) { - if (__ofono_sim_cphs_service_available(sim, - SIM_CPHS_SERVICE_SHORT_SPN)) - ofono_sim_read(sim->context, - SIM_EF_CPHS_SPN_SHORT_FILEID, - OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, - sim_cphs_spn_short_read_cb, sim); - else - sim_spn_set(sim, NULL, 0, NULL); - - return; - } - - sim_spn_set(sim, data, length, NULL); -} - -static void sim_spn_read_cb(int ok, int length, int record, - const unsigned char *data, - int record_length, void *user_data) -{ - struct ofono_sim *sim = user_data; - - if (!ok) { - ofono_sim_read(sim->context, SIM_EF_CPHS_SPN_FILEID, - OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, - sim_cphs_spn_read_cb, sim); - - return; - } - - sim_spn_set(sim, data + 1, length - 1, data); -} - -static void sim_spn_changed(int id, void *userdata) -{ - struct ofono_sim *sim = userdata; - - if (sim->reading_spn) - return; - - sim->reading_spn = true; - ofono_sim_read(sim->context, SIM_EFSPN_FILEID, - OFONO_SIM_FILE_STRUCTURE_TRANSPARENT, - sim_spn_read_cb, sim); -} - -static void sim_spn_init(struct ofono_sim *sim) -{ - sim->ef_spn_watch = ofono_sim_add_file_watch(sim->context, - SIM_EFSPN_FILEID, sim_spn_changed, sim, - NULL); - - sim->cphs_spn_watch = ofono_sim_add_file_watch(sim->context, - SIM_EF_CPHS_SPN_FILEID, - sim_spn_changed, sim, NULL); - - if (__ofono_sim_cphs_service_available(sim, - SIM_CPHS_SERVICE_SHORT_SPN)) - sim->cphs_spn_short_watch = ofono_sim_add_file_watch( - sim->context, SIM_EF_CPHS_SPN_SHORT_FILEID, - sim_spn_changed, sim, NULL); -} - ofono_bool_t ofono_sim_add_spn_watch(struct ofono_sim *sim, unsigned int *id, ofono_sim_spn_cb_t cb, void *data, ofono_destroy_func destroy) @@ -3110,13 +3069,7 @@ ofono_bool_t ofono_sim_add_spn_watch(struct ofono_sim *sim, unsigned int *id, *id = watch_id; - if (sim->ef_spn_watch == 0) { - sim_spn_init(sim); - sim_spn_changed(0, sim); - return TRUE; - } - - if (sim->reading_spn) + if (!sim->spn_initialized) return TRUE; ((ofono_sim_spn_cb_t) item->notify)(sim->spn, sim->spn_dc, From patchwork Tue Apr 2 22:30:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614681 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 366B7A41 for ; Tue, 2 Apr 2024 22:30:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097063; cv=none; b=fZnwRbU9KC4xChzZQNibj4/slHFtdaZhoxyU3sOaE3Xf1rWYqX6lpJ+AnH3oZhOdOmU87O/TeH68TFLuVyd+t6Fjdra4e1q3bsEkn0zTudLNrDAIuZuNJOPQ7V0awDj2kE4qrfzrLGSTdAt7WgWqW53k0GuMVY5YuRR8vidgJ+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097063; c=relaxed/simple; bh=2jtwPV/0aXzMV9GYqTuankIWt+V0Hg7TZhCy2NTuGTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GStd3lKWgN/BJpIAc4QY+dOWYnjVDm1r4979kiyclkOHF+06tl8+JFASCSGgk3Uj3G/iwCjwzHKnxBv/Dua9bJ5pyJO+i4B8NraSvJV2SdiyXjaTyMaUjGk0oM+JYzWJ4ES7ZX2YLIKkGNhe++nU3LN9WQyaTbxz+bBAmE6wa0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cntPhSv+; arc=none smtp.client-ip=209.85.161.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cntPhSv+" Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5a467dae51dso2267763eaf.1 for ; Tue, 02 Apr 2024 15:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097059; x=1712701859; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dV/NNd6hDWilRoyKQx5/fF7EB7lNZqPai76qYnei/CY=; b=cntPhSv+glEG/64seBSAVZ0q/VOe0xvwLsgOi/nbWsUOt5LK5/9UnqUzNXYkS4A+2r PKC52ClXKsBsOZnjm3BD2LPOXE367ZYcGL86211piIaRSCvWYqqvo/DmbEWL2CzzdPt0 xWPlOdn/RKgVJp7wQ/SAtGTdig5GA14/0kGZiuS5lmLn10NYUNx8HLebNC1D+DO05Spj KttQytgen1wbcHSt4GmP0QWX8e9K5TyVIHtD8MWqUfUSZ98l3sJrS+ULNZKkykywyfYQ nQAsdL1ZMQwciScBiENiC6hid2K6b0USoms7eneq31mVa2iyHPLAOfFHxnAwcZMpdyG+ +Mcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097059; x=1712701859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dV/NNd6hDWilRoyKQx5/fF7EB7lNZqPai76qYnei/CY=; b=g1dO2oetuubDxL9U8i0B+hcQ+ckbt8RkT5doNOAzH6ZuvB+LTy49+C6vumMcZtgJ9q nMcPYxrfZil7JBYA03samlkiOOnSEwyCv/sLvowR+vz62t66xbyKKPY3Cr+ROtekK4DM a4T8LsXB9ZLigypGBYbJlg54SLkdhhhUCL7Bw1iy2UrgkkiCCeWpWh7lOAsVElJywWvf k262HTO1kJCq2KLaxB9vTXUKA85THNWOAlOLMpuyNOHUJdm9ETEJQEkvB55Q+RJijKIl JoNH7jcerynxZHmjHmwY3iZb24s95e/mGdWBV1fPbzM6bxQ+LM8bZE/5SVRwVjjBuGmz +2LQ== X-Gm-Message-State: AOJu0YyGkLaGLjUXhCi04+UuJZeKa9EO3oxUWAm3hd34/1gLfAyyeLQQ UUMT77xyCqEGMO8vS73jaEql23etoGifg8gmqIK24SgFl2tHoCknVneCPlW/ X-Google-Smtp-Source: AGHT+IFmMLzjBLH1KnBBEb2Oug5rhxxkVLZ16F8rARyLv03XLuIQ3zk1NcjjNWdfVnt4fDP8HpBnZQ== X-Received: by 2002:a05:6820:a05:b0:5a4:71b3:d090 with SMTP id ch5-20020a0568200a0500b005a471b3d090mr13096694oob.5.1712097058477; Tue, 02 Apr 2024 15:30:58 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:30:58 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 03/13] data: Remove AweSIM entry Date: Tue, 2 Apr 2024 17:30:28 -0500 Message-ID: <20240402223054.2819526-3-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It has the same MCC/MNC and APN settings as AT&T --- data/provision.json | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/data/provision.json b/data/provision.json index 77d5bb977254..6856ce0f0eaf 100644 --- a/data/provision.json +++ b/data/provision.json @@ -14425,30 +14425,6 @@ } ] }, - { - "name": "AweSIM", - "ids": [ - "310410" - ], - "apns": [ - { - "name": "AweSIM Internet", - "apn": "NXTGENPHONE", - "type": [ - "internet" - ] - }, - { - "name": "AweSIM MMS", - "apn": "NXTGENPHONE", - "type": [ - "mms" - ], - "mmsc": "http://mmsc.mobile.att.net", - "mmsproxy": "proxy.mobile.att.net:80" - } - ] - }, { "name": "Straight Talk", "ids": [ From patchwork Tue Apr 2 22:30:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614679 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36749179AF for ; Tue, 2 Apr 2024 22:31:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097061; cv=none; b=OSC3pD2+th16GyG7kDI3KIeM/xWRpqTReix8h/00W9bm//Yi2yEsNK4R7sDP6QlKtGlCEaeqLcMJAQL+883igTzB5H8xuCk5HCQpsLDilRCpeO+rEXVMsLauKinRnNdKJgzCXJIwAUrfd8b8WLhdSFBxQao9fcbiA3FKhUyx3DA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097061; c=relaxed/simple; bh=HKXA4XdTxGefTIGQ80/Qe1Utjgr/lo1uHDKL0Rd6KzM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s9LfKj9gej1VzwqvflsejE/nkQMu/rxWdyEkmLPV8QI/zOKlqpIve1m0Cmnojm9t7Xbjrnrn3OOYeeRZ+giiVXlbAWo+LVIh6PkjXeEA3WP7TgGYmjJxkOOXRkkLSMG6qpObzUCsoXEQT5q+bmI4Efr9WRyBl8OF8e2CT7JHCqg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H8e1YTxp; arc=none smtp.client-ip=209.85.161.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H8e1YTxp" Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5a4f9f94e77so3738432eaf.3 for ; Tue, 02 Apr 2024 15:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097059; x=1712701859; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dy33ebB5lB7yt6ni9z0zmRuorlB53ZnKc680YtOSEc0=; b=H8e1YTxpSOOV0oRgQF1bh1QS1WQrFl+6xaaCc+qXZa3Gpj1pc+NWt1aMeI+kYQm+1j 0iOPZRzHAJAAlOyrOugBpGHAzre3p2ZyVGLcAq0jub0RklYvyBXh5DIEd7R6kvm/BK6y DkT/lCkJnt82J9F+wZfJBUKcFDqDWgu8G9QW1jR4pZtEusSC7kHQBB7E1YpdBPWSWNC5 /vKVfkSVNZaeOhPj8Dp1Qs0N8UlYIgn4Si9heSS2O2DQrx1rat0WBI0OUhtj/pB1Ca0Z W1wKjYGHk+pFcxhJhVSvaHL2SzBw0GsyvaqlnpvDGlfQdznB/zfHsFjLDCDQ1iplO8Eg scuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097059; x=1712701859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dy33ebB5lB7yt6ni9z0zmRuorlB53ZnKc680YtOSEc0=; b=ARCFXLjEvkdn6EbJOi/fuxIcZHuUuuasPWFLx71A1VHSoNVXO6Avd0sSSukOwSnoET P8AAlJ7irDGXIK83okO2M6qIePoGtCEp1eqfe7+atPeIVCrA6EA5ObNqUT+JzzsdN6hr 3QYY+N6SyzBx6p8Da84nqjjZbV4l070ONue/0ZwF9aBh7Ibec4SXXwN9fk/ERV2Imk2y 7IYLeR/1qtoe19QFfOFVwka+Ra8oPLDrUon+EdOp3+UAPAs2qNEDG5++Svbv0Thq+Juf 4Fhw2kT8jd0PDtCLShc10H2cBkZeeXxb3pbGSrI9B2vcyee7a7XQhXwh9gu4XMv9O5Lv 0zpg== X-Gm-Message-State: AOJu0YxOxt+uL/v3JWFRDS5IZ7BYhdi8kGmgjtKoF9Jtbt/P7WAmMNcE oI1R0iaG0VmBstvPSvTCCtTuHYlcM9OzyB63jTMRuTFYfwpms9tzW0BpnFXY X-Google-Smtp-Source: AGHT+IGHz7eLFR5OEpl1CatCz+oYX1L4IagCHfNDTa+XUL2k0ElHP5ZWc6bpn5/j/UFMU0X3dEZevQ== X-Received: by 2002:a05:6820:285:b0:5a4:b99f:83c7 with SMTP id q5-20020a056820028500b005a4b99f83c7mr11282326ood.9.1712097059177; Tue, 02 Apr 2024 15:30:59 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:30:58 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 04/13] data: Mark some MVNOs via the "spn" attribute Date: Tue, 2 Apr 2024 17:30:29 -0500 Message-ID: <20240402223054.2819526-4-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Most likely these MVNOs use GID1/GID2 or some other magic to be auto-detected properly. Mark them using the SPN tag so major US carriers can be autodetected easier. --- data/provision.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/provision.json b/data/provision.json index 6856ce0f0eaf..e55ecc6f8d67 100644 --- a/data/provision.json +++ b/data/provision.json @@ -14372,6 +14372,7 @@ "ids": [ "310240" ], + "spn": "Ting", "apns": [ { "name": "Ting Data", @@ -14430,6 +14431,7 @@ "ids": [ "310410" ], + "spn": "Tracfone", "apns": [ { "apn": "att.mvno", @@ -14450,6 +14452,7 @@ "ids": [ "310260" ], + "spn": "SpeedTalk", "apns": [ { "name": "Cellular (MMS)", @@ -14480,6 +14483,7 @@ "ids": [ "310260" ], + "spn": "Mint", "apns": [ { "name": "mint", @@ -14495,6 +14499,7 @@ "ids": [ "310260" ], + "spn": "US Mobile", "apns": [ { "name": "US Mobile", From patchwork Tue Apr 2 22:30:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614680 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11DBF3234 for ; Tue, 2 Apr 2024 22:31:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097062; cv=none; b=jkWMNTqqOtItqUGStf0itkOlJEA0lNAQfMoaKBiqMD5YHCO9hU15m8Ut3eZrr0QXrgaDLLu3CZgnvcvMtMyXWewnd7B7WMdOJGFzdeI8ckdNIeBW0W5IpBod0UAn2kgubkZnEIpX4iciAQSFn6cyOiRsipwuqJT50se6STDxk9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097062; c=relaxed/simple; bh=IXf7Td7dakoDdaJxiHvJavMN42z6RyPBX+lN1+zJAfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eZMirRRBHJW3fVcUmaniK2c6Ew/NOwEeNm/BT6KTNkdigSF3YyLVZC59fybLEP34UILKQoIMkGkH+xJU5Bo0BZRBBf6DvIHwPGE3P/qKZuhK50eUnkMDzen1YGaUfw4vnQ0lqbQJ9kBz1HWWCk5+fl6ymiPV+LF6fMgzNMNzuD0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ma9qE3pK; arc=none smtp.client-ip=209.85.161.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ma9qE3pK" Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5a56710cdccso2731152eaf.3 for ; Tue, 02 Apr 2024 15:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097060; x=1712701860; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pWe+PUC/DUb/AqF6ebHjXINhmuIh08yUnFE+XOqSRwc=; b=Ma9qE3pKYVBHYJt3nj2GF9et85QWU9Mu+CBPA7U2PnRUvALjNIcI86QwGFtCzAp4Ck Ikw7D8RtHQngl0EJg9fa6YrtDm2kMsMtGAopbWR7NwVCkZ+kePYHHqWlvgteQbeUVcPy tXVDMhj9/zRVluFujHUSvd93BJVUJBN86AgrKxKeAJ8r8/xaAwKXAKWKVayEC8W249fn VKP1HFbjZWxoVSOcMpWYxnN8ZfL2QlZzLUizHwP/0gPV2c+hN98LlXH6UPdGCZWsWRX2 YogVefyi2dxeDPzdY9nOlc+MAdPXBRXzXlQARo/OEpDqOPCkcmfBLxFl7mSF77/79ypu TAAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097060; x=1712701860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pWe+PUC/DUb/AqF6ebHjXINhmuIh08yUnFE+XOqSRwc=; b=j4riOrFPIRFZMs3AR/sji/WG0F+S1FTdeBD5jMAQWd9ID/NsZR5W/pNAlii6Kgy/j8 9WPnbIaNwWyycG/rmGdo7reI8Za0+CCdpXTwWdLiBSOxRA+DeRjc8EizFjwEiFzUWHWc xN24g4WMT0USmaeYFHcBEo+EkRb6cMvyvMu2Mo/7lf2dMqodw1dLFeGCv3Jv5f5JlT0n pHGfUQbIiEuyDgYUcouTrb2o2NRMcC+zW3me2zhTcztHqV31gUdjGmVwN02WuPQapuX6 kONs3mENdLZ5cZ2g1p5e9zHGsVRpjRxWyzlqjdg0tejMqJg7OZ0pCu/Bpd5s1M+bW9Pr wCjQ== X-Gm-Message-State: AOJu0Yx4p/01rWskkuJu7W5oYJ3f6Q9hNASl4DnPEIqWUeCim2XOkJMY ++/YO1wk8DE86witUBtH4JRWudpr6oYnPZfky/mJII6/RMJ3Kfn7hrSEGh+n X-Google-Smtp-Source: AGHT+IFGMtIIpBcjENdmqk2vzIlXYy8MyuLKTgKeY4SfJpc9AaTSjpxSFe5LiHyVB6VXAYggUttdcw== X-Received: by 2002:a05:6820:1e17:b0:5a5:1f92:ba2b with SMTP id dh23-20020a0568201e1700b005a51f92ba2bmr13221220oob.2.1712097059935; Tue, 02 Apr 2024 15:30:59 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:30:59 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 05/13] data: Remove outdated T-mobile settings Date: Tue, 2 Apr 2024 17:30:30 -0500 Message-ID: <20240402223054.2819526-5-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- data/provision.json | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/data/provision.json b/data/provision.json index e55ecc6f8d67..80abd78e6507 100644 --- a/data/provision.json +++ b/data/provision.json @@ -14229,41 +14229,6 @@ "internet" ] }, - { - "name": "Internet/WebConnect", - "apn": "epc.tmobile.com", - "type": [ - "internet" - ] - }, - { - "name": "Web2Go/t-zones", - "apn": "wap.voicestream.com", - "type": [ - "internet" - ] - }, - { - "name": "Internet (old)", - "apn": "internet2.voicestream.com", - "type": [ - "internet" - ] - }, - { - "name": "Internet with VPN (old)", - "apn": "internet3.voicestream.com", - "type": [ - "internet" - ] - }, - { - "name": "Broadband", - "apn": "mobilenet", - "type": [ - "internet" - ] - }, { "name": "IoT", "apn": "iot.t-mobile.com", From patchwork Tue Apr 2 22:30:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614682 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A76961D529 for ; Tue, 2 Apr 2024 22:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097063; cv=none; b=iysIrKfoAMQt2Guqcd3jsaNq7TN4V8m8vY9OD5b0mq4g54RgIbAkYfyYqR7xHNDQR+ux56Xe3dN7xxpBX11HyBP7o6Funanps8e9JvppyD2Y+dca3csmsduAt3uFQfiM6N7fZ46NhOYrIsAmGlE+lccIBDktRVF7UE5mVyFfuz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097063; c=relaxed/simple; bh=8A/vRDi5jAwzUJ1AgQLwUt184NvPYujph9PsMG+FPJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q0y519UA3stAjI1al+1uLOdoEmELWUCkcblEljr2jcx4jrcrvZARfExUQbAh5czoySZ8tNX+1ZqWpbz2PgdS6w6+0lw5EUXFFKAE3M7UnoEg8qaKxBerQXtDfIiZLinJg48VmVJ+Cvyo+rWV+lDk4+L2v9JT7wCWwWvTmbsLdbE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OA6ZKQa0; arc=none smtp.client-ip=209.85.161.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OA6ZKQa0" Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5a470320194so3349408eaf.3 for ; Tue, 02 Apr 2024 15:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097060; x=1712701860; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ODeDIhWwvZpl8x9SSVdYHwsb69BrXgQE4y8wCTK2JIA=; b=OA6ZKQa0cxdrkgBeboliLXinO5rKFySITC+YIiu/2a+E7sryIR0kx7ctLNSoAVkUKH E//iFSf0KI3xUeKF206VlBCcN1LdfzJhxdRyBIJh39jtoReoLh5pnbvL5EVlu8lQRjis v2+IAgg9ypTBJBLIwy9m/InayOB6lFO+GPYOoovG3zO/U6ybr0IURliqi6VlWGF8LyZP bb1GMXfRkf+YOrRh00Ic2QgDMw+ncoNe98l5BU4R8T/HQv5dk7kf9QyvcJuCod9IcQf7 fHTmWHMJ2rQAHf5BIVAec5I3SfT356UnFcTfGC5ULfcBKOBkWHPpf7daOskO7qq50o1I c6Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097060; x=1712701860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ODeDIhWwvZpl8x9SSVdYHwsb69BrXgQE4y8wCTK2JIA=; b=du36kjql+lmRtCxReftlRadMabKYN0r6RDx0uAp07taLq7mKXewbTUc4k+Ca/ITTH4 E0acwNd1zx2nbSP1cOMVChgA586M4aBDm9x0xxXBDJvUWY9AgVkUlcBCdOvhqsTBDK+R gkBnjyaPRvu0x2sW94XIlUMphf8Z/GKkBjO9mRl0mc+5yZQUKOMVVQMkBUMqBTqUrLwb d6/O3kNMAtLzry9MV1cCYQRhOEu2lfKmXXV7MNIcN+kz+HaunbfzKYy9t1d96nTqXzBB 6cMx7iB38mI69r3Y1U4NzhDtRwdovVWr2oAw4KcWyCWbWXkg6Ujqr842iHvc9MZ43wQ3 MVbg== X-Gm-Message-State: AOJu0YxU0tJr0yxzWtZMLMFh9Mc9OYQwyPyHk5ngn8qZT+jI2U7a4nnS na4NNirXnyKDFRd03P5zKcF0XLoYNbAkE6IPzowB+S5Gf9TVcXVTigYX3mMY X-Google-Smtp-Source: AGHT+IGisd8cP5o+P2Vpy7y5TxO5frHhKmGfnQ2NyP2KmEE3TFAfBJg/fCcfNFRbYyFcFPmr1HoIdg== X-Received: by 2002:a05:6820:210d:b0:5a1:bb9d:56a7 with SMTP id cd13-20020a056820210d00b005a1bb9d56a7mr14013828oob.8.1712097060694; Tue, 02 Apr 2024 15:31:00 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:00 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 06/13] data: Remove RESELLER settings from AT&T Date: Tue, 2 Apr 2024 17:30:31 -0500 Message-ID: <20240402223054.2819526-6-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This seems to be yet another MVNO, remove it for now. --- data/provision.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/data/provision.json b/data/provision.json index 80abd78e6507..cef6e34e1ae3 100644 --- a/data/provision.json +++ b/data/provision.json @@ -14181,16 +14181,6 @@ "mmsc": "http://mmsc.mobile.att.net", "mmsproxy": "proxy.mobile.att.net:80" }, - { - "name": "RESELLER", - "apn": "RESELLER", - "type": [ - "internet", - "mms" - ], - "mmsc": "http://mmsc.mobile.att.net", - "mmsproxy": "proxy.mobile.att.net:80" - }, { "name": "AT&T M2M", "apn": "m2m005246.attz", From patchwork Tue Apr 2 22:30:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614683 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5947413FE7 for ; Tue, 2 Apr 2024 22:31:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097064; cv=none; b=mo+Amg5kpkcIrmGH1ONN9eFOsn1Ty9WBsJhgu8LhHNP0Bh38btHVQQJ65M0CBzx4aptkPeKh90LKAwMkACUgAYiEvjL0cOQ+pFuocxRPnXECreiw7NLzEtta5ZMieo8qRi94JeUpZEjaj9xnq9X0bMcVbi7H4dJIARuaI7EPlK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097064; c=relaxed/simple; bh=sTP3HQTlWVgoLKVHjbAHwN55h/yTrk0VgaPXBstLQQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lgzIQoUaGkrg306f+ZT2JMjggwOOsAoaRwVp4tlxEONqis2kxJQr+RjDMXXyz6VWYQNZMgmwoo84gjGuKnL7Cbx1uH5n/REe5pLTTndU3+T+7S4R+0pTEDonoWvIEDX8XF6L/4nYJVB1knSGQnAU3/SMaVoEnz94wbsgVesfZas= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=j3RQygws; arc=none smtp.client-ip=209.85.161.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j3RQygws" Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5a4f608432bso3620005eaf.2 for ; Tue, 02 Apr 2024 15:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097061; x=1712701861; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OJegCb221tkm/+wPfRA3j/tohFSI41UxlLHaLAgSOr0=; b=j3RQygwsodEZ3eczA4fEk4sWXSRdbiArX5OpDOwX3i9aalwKQUcNz9CcZ81fJrF185 f+tlMv+9R7NgYIV//sxoeMGV1e6k32tFSGziH3xahbOveRbPBe63RChouqS1doi0+/WF irkD1VODATPSRxRc2ecE/udpLp+VdP4kqZ2ClgGSj7f3UT8I0+fQx8nJbMIVpbt03EUj Ti19W1cklQ2td7ioOPqhQJooLekprec0ZhNB5OJRTmR+Wd6oB/HX93rSHK/y+LOnXcdE S0kDiZEpOofxsCL8xxyyuzCTXyDoBkE22Ha80u3o1nWQAa2O2uOLRv3/KnnHBMXCXsrO JNKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097061; x=1712701861; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OJegCb221tkm/+wPfRA3j/tohFSI41UxlLHaLAgSOr0=; b=mkfWDKaFXOKSFU7+VoT5HE5E3G0xUcjFjokM6HVhTBhND/OpbHHWBLDO/0aZVdfq26 w0EMC3u7YJWHi6CbC7q1OxGc7Z5M0lhWUwamsRidCCAXZlfR+pG2nblKki8SA4e/IXtZ QSOa8VIGmYGs9ceR7tTDBhtXyk8mnZWikA2Y0R8pb7z25c3PdIdcGduOUGKY0gbIDbnU /1VTbodW0wJlneF57aOoxUGJCJTFiu6FJW4dfHgdfFlVEiXp3zQNEqj2Dlzk4fmO9mni KKfcvwUrPgXs50cqX7Xl3xTdvCvhxI3yRGg+9iZvdztJtSn9DDxf5c6bqJBD5/XKy1X9 7hAg== X-Gm-Message-State: AOJu0YwN5BvbvRYpRjKjoAjfrtucoq3w9fC1/a3mRVr3Pyb+I5lHZfCk sWMCPuI8zTpngDDLI04WHIPSDcBSouZGxfTenTDVlVnHvljJ11ePJ2jh7C/E X-Google-Smtp-Source: AGHT+IGXC51caBexEnNaf7hhscNffkUx6jePOpLyx8We/m697OaSIaeCrqNlcqQhHdYd4gWidypb1g== X-Received: by 2002:a05:6820:1e03:b0:5a5:23fb:4487 with SMTP id dh3-20020a0568201e0300b005a523fb4487mr12976735oob.2.1712097061346; Tue, 02 Apr 2024 15:31:01 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:01 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 07/13] provisiontool: Add support for context tags Date: Tue, 2 Apr 2024 17:30:32 -0500 Message-ID: <20240402223054.2819526-7-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since this changes the size of the context structure, bump the version number generated by provisiontool. --- tools/provisiontool | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/provisiontool b/tools/provisiontool index 2067a66a9951..c08b9c4b9712 100755 --- a/tools/provisiontool +++ b/tools/provisiontool @@ -24,7 +24,8 @@ class ProviderInfo: 'mmsproxy', 'authentication', 'username', - 'password'] ) } + 'password', + 'tags'] ) } @classmethod def rawimport(cls, entry): @@ -228,12 +229,13 @@ class ProvisionContext(ctypes.LittleEndianStructure): ('username_offset', ctypes.c_uint64), ('password_offset', ctypes.c_uint64), ('mmsproxy_offset', ctypes.c_uint64), - ('mmsc_offset', ctypes.c_uint64) + ('mmsc_offset', ctypes.c_uint64), + ('tags_offset', ctypes.c_uint64), ] authentication_dict = { 'chap' : 0, 'pap' : 1, 'none' : 2 } protocol_dict = { 'ipv4' : 0, 'ipv6' : 1, 'ipv4v6' : 2 } - attrs = ['name', 'apn', 'username', 'password', 'mmsproxy', 'mmsc'] + attrs = ['name', 'apn', 'username', 'password', 'mmsproxy', 'mmsc', 'tags'] @classmethod def type_to_context_type(cls, types): @@ -515,7 +517,7 @@ class ProvisionDatabase(ctypes.LittleEndianStructure): visitor.visit(self.tree.root) self.tree.traverse(visitor) - self.version = 1 + self.version = 2 self.header_size = ctypes.sizeof(ProvisionDatabase) self.file_size = self.header_size self.node_struct_size = ctypes.sizeof(ProvisionNode) From patchwork Tue Apr 2 22:30:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614684 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 441511E531 for ; Tue, 2 Apr 2024 22:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097064; cv=none; b=R/MkOBzCaTzcvdYnzBoKYysj9pvu/4W7iTHLf4ZNkSdhdCaoOmm77rTOhA7TvDxWmkdbbSNGSg4iaQitzA9FeUqVpFiYBefe7sgbUXmPiEzIjVc+DHUtLVHRdzWRGqkC+gD2DD6yiLXe2tqdDw7NzSnZwEKFZ6U2vI1FghNZiPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097064; c=relaxed/simple; bh=0aAddjk+DQaTyafitGVRRtXwILGmckal0Ks7YWPDmuE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pOlvJHTMcCxsLOMCLbhXRyoIiG1JW91RWGtpkH971CHDPRM22jyEeexc9/zrRf16qIhBlziYfw3fssVZaBM78yEEe5h2TvPlUsh9LMrtpzSeLNNWiH4sJohJmz2w/a+lfIHe0xoTxkjH416jtrWmHO5tLdCWvWV1l2Vubqso6bc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P9PXS9Ef; arc=none smtp.client-ip=209.85.167.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P9PXS9Ef" Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3c36dcb305cso158695b6e.0 for ; Tue, 02 Apr 2024 15:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097062; x=1712701862; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1EkF06I5JL6MFmmvaFOa6KYE773pkMsKR92nX9SPalQ=; b=P9PXS9Ef7KJFPQnNPF57x1q6DJtZ4Fe8u4zp+Wslr9KGCA8x9wVJpOxcPvYuXXJRDI 0chejsPwBGx7RrqzJr4fzCjkcxaTJCiYiQccuYEfpyMxVFzlXCiz4q7/OPQsmZ3DOwrQ RYHuNCXpuADhwGoJBc74gD1h618SO1OWUwKDE+aBtrSW7/wbDFTC7abnuTaHvYranMtE mMObuW8cpU9NBkpo18zHY+btEc7EK2+D2giCsOK7FNFU39NKucoO5GGxry8LEVXHl1cP ewaE/2Za1DVmXJudLHm+IHtNfd7XNTpVu6KksGUaQd2U0/Qr7fjdK5Qa5rMoi7DW/K0E 0c8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097062; x=1712701862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1EkF06I5JL6MFmmvaFOa6KYE773pkMsKR92nX9SPalQ=; b=XbZ+hIu6nINb/bhOvG/Fu73iiZ8PgO9m6L2FV65G90wrRESE4nQ3cCpoA+POVteoxe q6Ez+WfjOfAUT3KvnBtkvujfSQC57rX/oTuwGnlbmCSDHSS7q+Rtafq4Z8tEkeThfN4T hZidNA5NdPRwbmTl+Ny4Iw9MjQh9gK7gXB3Wvp4tdrzjyxjvheDU/KfLsV9mw8yjsAv4 Zg4jKljOucEtzLcA+HAkxicxBoMGwWWxfx/p4Em09OjAJ2lp+IiXnmuIySb0d8oA2y8H huPnuXlvRimDkGSYdwty6/hqdt3EUzR7ZTURjzB90FdkkDlOcmYm/GEegj+0MVencfT7 DvTg== X-Gm-Message-State: AOJu0YxqO0M6I0xQ/1qjfImYzGtf1dR5IRpr6Tl8lfnXPFPHDKZiEgPu RL5V6OLW4FkHslpVp+O5aHqjp3JdiUN+K3NbHYXfKCcq3Em0xjKxC+l64h1C X-Google-Smtp-Source: AGHT+IHqwBMXqSRAp5f/DfxzNVk8gG+AOv8uy3GEoANIA/qej1nnLiMCyhdugqNG8QkjcljR4Zog+w== X-Received: by 2002:aca:2103:0:b0:3c4:ea71:fe5f with SMTP id 3-20020aca2103000000b003c4ea71fe5fmr297537oiz.9.1712097062173; Tue, 02 Apr 2024 15:31:02 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:01 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 08/13] provisiondb: Add tags_filter support Date: Tue, 2 Apr 2024 17:30:33 -0500 Message-ID: <20240402223054.2819526-8-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Also update unit tests and other users of provisiondb APIs due to the API change. --- src/provision.c | 3 ++- src/provisiondb.c | 57 ++++++++++++++++++++++++++++++++++--------- src/provisiondb.h | 2 ++ tools/lookup-apn.c | 2 +- unit/test-provision.c | 15 +++++++----- 5 files changed, 60 insertions(+), 19 deletions(-) diff --git a/src/provision.c b/src/provision.c index a2dfcf6cde5a..22413d2ccde6 100644 --- a/src/provision.c +++ b/src/provision.c @@ -32,7 +32,8 @@ bool __ofono_provision_get_settings(const char *mcc, if (mcc == NULL || strlen(mcc) == 0 || mnc == NULL || strlen(mnc) == 0) return false; - r = provision_db_lookup(pdb, mcc, mnc, spn, &contexts, &n_contexts); + r = provision_db_lookup(pdb, mcc, mnc, spn, NULL, + &contexts, &n_contexts); if (r < 0) return false; diff --git a/src/provisiondb.c b/src/provisiondb.c index 53305eab0594..3d5b50bd5bd3 100644 --- a/src/provisiondb.c +++ b/src/provisiondb.c @@ -69,6 +69,7 @@ struct context { __le64 password_offset; __le64 mmsproxy_offset; __le64 mmsc_offset; + __le64 tags_offset; } __attribute__((packed)); struct provision_db { @@ -218,7 +219,25 @@ static int __get_string(struct provision_db *pdb, uint64_t offset, return 0; } +static bool tags_match(char **tags_filter, const char *tags) +{ + _auto_(l_strv_free) char **split_tags = 0; + unsigned int i; + + if (!tags_filter || !tags) + return true; + + split_tags = l_strsplit(tags, ','); + + for (i = 0; tags_filter[i]; i++) + if (l_strv_contains(split_tags, tags_filter[i])) + return true; + + return false; +} + static int __get_contexts(struct provision_db *pdb, uint64_t offset, + char **tags_filter, struct provision_db_entry **contexts, size_t *n_contexts) { @@ -227,6 +246,7 @@ static int __get_contexts(struct provision_db *pdb, uint64_t offset, uint64_t i; struct provision_db_entry *ret; int r; + uint64_t n_matched = 0; if (offset + sizeof(__le64) >= pdb->contexts_size) return -EPROTO; @@ -242,43 +262,57 @@ static int __get_contexts(struct provision_db *pdb, uint64_t offset, for (i = 0; i < num; i++, offset += sizeof(struct context)) { struct context *context = start + offset; - ret[i].type = L_LE32_TO_CPU(context->type); - ret[i].proto = L_LE32_TO_CPU(context->protocol); - ret[i].auth_method = L_LE32_TO_CPU(context->authentication); + r = __get_string(pdb, L_LE64_TO_CPU(context->tags_offset), + &ret[n_matched].tags); + if (r < 0) + goto fail; + + if (!tags_match(tags_filter, ret[n_matched].tags)) + continue; + + ret[n_matched].type = L_LE32_TO_CPU(context->type); + ret[n_matched].proto = L_LE32_TO_CPU(context->protocol); + ret[n_matched].auth_method = + L_LE32_TO_CPU(context->authentication); r = __get_string(pdb, L_LE64_TO_CPU(context->name_offset), - &ret[i].name); + &ret[n_matched].name); if (r < 0) goto fail; r = __get_string(pdb, L_LE64_TO_CPU(context->apn_offset), - &ret[i].apn); + &ret[n_matched].apn); if (r < 0) goto fail; r = __get_string(pdb, L_LE64_TO_CPU(context->username_offset), - &ret[i].username); + &ret[n_matched].username); if (r < 0) goto fail; r = __get_string(pdb, L_LE64_TO_CPU(context->password_offset), - &ret[i].password); + &ret[n_matched].password); if (r < 0) goto fail; r = __get_string(pdb, L_LE64_TO_CPU(context->mmsproxy_offset), - &ret[i].message_proxy); + &ret[n_matched].message_proxy); if (r < 0) goto fail; r = __get_string(pdb, L_LE64_TO_CPU(context->mmsc_offset), - &ret[i].message_center); + &ret[n_matched].message_center); if (r < 0) goto fail; + + r = __get_string(pdb, L_LE64_TO_CPU(context->tags_offset), + &ret[n_matched].tags); + + n_matched += 1; } *contexts = ret; - *n_contexts = num; + *n_contexts = n_matched; return 0; fail: @@ -374,6 +408,7 @@ static int key_from_mcc_mnc(const char *mcc, const char *mnc, uint32_t *key) int provision_db_lookup(struct provision_db *pdb, const char *mcc, const char *mnc, const char *match_spn, + char **tags_filter, struct provision_db_entry **items, size_t *n_items) { int r; @@ -436,5 +471,5 @@ int provision_db_lookup(struct provision_db *pdb, return -ENOENT; return __get_contexts(pdb, L_LE64_TO_CPU(found->context_offset), - items, n_items); + tags_filter, items, n_items); } diff --git a/src/provisiondb.h b/src/provisiondb.h index ee203c6154af..2c70bc15cb26 100644 --- a/src/provisiondb.h +++ b/src/provisiondb.h @@ -19,6 +19,7 @@ struct provision_db_entry { enum ofono_gprs_auth_method auth_method; const char *message_proxy; const char *message_center; + const char *tags; }; struct provision_db *provision_db_new(const char *pathname); @@ -27,5 +28,6 @@ void provision_db_free(struct provision_db *pdb); int provision_db_lookup(struct provision_db *pdb, const char *mcc, const char *mnc, const char *spn, + char **tags_filter, struct provision_db_entry **items, size_t *n_items); diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c index 34d689a434cf..abb95f38f470 100644 --- a/tools/lookup-apn.c +++ b/tools/lookup-apn.c @@ -50,7 +50,7 @@ static int lookup_apn(const char *match_mcc, const char *match_mnc, fprintf(stdout, "Searching for info for network: %s%s, spn: %s\n", match_mcc, match_mnc, match_spn ? match_spn : ""); - r = provision_db_lookup(pdb, match_mcc, match_mnc, match_spn, + r = provision_db_lookup(pdb, match_mcc, match_mnc, match_spn, NULL, &contexts, &n_contexts); if (r < 0) { fprintf(stderr, "Unable to lookup: %s\n", strerror(-r)); diff --git a/unit/test-provision.c b/unit/test-provision.c index 9c3dfad43a62..b80f4d80fa0e 100644 --- a/unit/test-provision.c +++ b/unit/test-provision.c @@ -27,7 +27,8 @@ static void null_provision_db(const void *data) size_t n_items; int r; - r = provision_db_lookup(NULL, "123", "345", NULL, &items, &n_items); + r = provision_db_lookup(NULL, "123", "345", NULL, NULL, + &items, &n_items); assert(r == -EBADF); } @@ -37,16 +38,18 @@ static void invalid_mcc_mnc(const void *data) size_t n_items; int r; - r = provision_db_lookup(pdb, "3444", "33", NULL, &items, &n_items); + r = provision_db_lookup(pdb, "3444", "33", NULL, NULL, + &items, &n_items); assert(r == -EINVAL); - r = provision_db_lookup(pdb, "3ab", "33", NULL, &items, &n_items); + r = provision_db_lookup(pdb, "3ab", "33", NULL, NULL, &items, &n_items); assert(r == -EINVAL); - r = provision_db_lookup(pdb, "333", "3", NULL, &items, &n_items); + r = provision_db_lookup(pdb, "333", "3", NULL, NULL, &items, &n_items); assert(r == -EINVAL); - r = provision_db_lookup(pdb, "333", "3334", NULL, &items, &n_items); + r = provision_db_lookup(pdb, "333", "3334", NULL, NULL, + &items, &n_items); assert(r == -EINVAL); } @@ -225,7 +228,7 @@ static void provision_lookup(const void *data) size_t i; int r; - r = provision_db_lookup(pdb, test->mcc, test->mnc, test->spn, + r = provision_db_lookup(pdb, test->mcc, test->mnc, test->spn, NULL, &items, &n_items); assert(r == test->result); From patchwork Tue Apr 2 22:30:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614685 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0B4D14A83 for ; Tue, 2 Apr 2024 22:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097065; cv=none; b=qeMvykbtH46RgX9mnbrNx+bj5xkxwyetXG8zSCffzBliAS1iAueag19GczR8vIScELogc5XInLbphlO2UIdZS5ctVvpJuTRHHkZGAJzqD0t6W/w73GvV/5HVhyHrs+AJP3zF5kUVdepneRKaaRhxvYVqAFUz7ELlaNUM3+gNe+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097065; c=relaxed/simple; bh=puDK51IZNmptQzOyxED4XtoZxV2LzQQk/y+n2KNzKKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cIMnRojM4ZKcJoJMwlAhgi2YXOavRAr53wZZ3A7WM292rAWqVWNt+m8ileYU2Flyg8lNdQzHrl23c9SsAmJDcfev0bxJba4x95od1Dy7c6bOENLj7cHobTyKXCRckcJWASUP4qshYl5T0ei1uNUigYjK1EBCsSVuBv8Fy+p8Hzw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SET+VGbX; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SET+VGbX" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5a7a4119d02so1952042eaf.1 for ; Tue, 02 Apr 2024 15:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097063; x=1712701863; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XA+Vkqwk5ZmbSNd3gdnkiwrGaLPpFx9rEooKDQQTGCM=; b=SET+VGbXhcBXGeE6/aFmacW3Hi8wH3ZlrCc97oCRduzKuCxb5Q7Cve6LFxyEs/vl3F hXSVup4A0knJPBpaLXrxDkpYhK82IXPNE6vzRtaz6fHg8Ho9s4KwbNS5cPv3pAWIH9gh 3+u7KVJK/oRfs9UnqyiAhfkzhFY7o3yjLjIHYjUgeltRM0+FTitgu0OdWsJJCVJWSoXQ AcXYE/pJ0cm24PZhrPgG1OSiDla/NqarNCY1rFiETCkMWzJbAl7GFaEbMztuPz1XIdOs ze7VnkqXOp9JR9hgruIDGwXlzK256TIhV4MACFYXVb+V3nNP73HaKtwlYrwvBi0qAQxC O75w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097063; x=1712701863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XA+Vkqwk5ZmbSNd3gdnkiwrGaLPpFx9rEooKDQQTGCM=; b=mdGnX9QCp1mJOYuJaFEun68sjtdGFUD1g8gQ65dL/aL06Wa5NW3qNChmCSBfO01GzF 5pfR8KZR93VwJiRZ94vbXyEKaaNCPq+DEufk4yjIQv7cB+9iJXFmop3P2naOkxgbrUuS orcnOIQasA+3N/hK+AcTmFZIMOIoO+HDf5ZQSeQ+DR9cIPBHEfLvtagNL1RH5C2qRxrV iVNjkzAin0TdSyqTJWE1pq0JazwGtV1gCeX+RX6ldD/MhyW5jMt7HK3qz04eEQ/I7wCu o1vs2dRXNSvSlPGltwjh1OP2DtiZn6kXwYIkfFmLiJ9IhzjEDR2Xpg7PMtpbZkFB9A43 gvzg== X-Gm-Message-State: AOJu0Yx/Qo/CNv93i89CE/IKVwUd825Nz7fQSEO/vHZmI1cTb9tKd63d 2pTyp/JNTgwQAOKqR4W265mESR9SEAn/luDwgiyjJlB3+zkWduBClKte48Ie X-Google-Smtp-Source: AGHT+IFq3GtPbIdWZ5aw6NkkkZ1LFm3PH82rfYDOgtshh3/XQKQ1H0nxS9PJ+oe4bhEf5P0qVlrnog== X-Received: by 2002:a05:6820:2108:b0:5a5:639a:2fa0 with SMTP id cd8-20020a056820210800b005a5639a2fa0mr13406319oob.0.1712097062881; Tue, 02 Apr 2024 15:31:02 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:02 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 09/13] tools: lookup-apn: add support for optional tags filter Date: Tue, 2 Apr 2024 17:30:34 -0500 Message-ID: <20240402223054.2819526-9-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- tools/lookup-apn.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c index abb95f38f470..e4fc79cd7819 100644 --- a/tools/lookup-apn.c +++ b/tools/lookup-apn.c @@ -26,7 +26,7 @@ static const char *option_file; static int lookup_apn(const char *match_mcc, const char *match_mnc, - const char *match_spn) + const char *match_spn, char **tags_filter) { struct provision_db *pdb; struct provision_db_entry *contexts; @@ -50,7 +50,8 @@ static int lookup_apn(const char *match_mcc, const char *match_mnc, fprintf(stdout, "Searching for info for network: %s%s, spn: %s\n", match_mcc, match_mnc, match_spn ? match_spn : ""); - r = provision_db_lookup(pdb, match_mcc, match_mnc, match_spn, NULL, + r = provision_db_lookup(pdb, match_mcc, match_mnc, + match_spn, tags_filter, &contexts, &n_contexts); if (r < 0) { fprintf(stderr, "Unable to lookup: %s\n", strerror(-r)); @@ -78,6 +79,8 @@ static int lookup_apn(const char *match_mcc, const char *match_mnc, fprintf(stdout, "Message Center: %s\n", ap->message_center); } + + fprintf(stdout, "Tags: %s\n", ap->tags); } l_free(contexts); @@ -92,22 +95,26 @@ static void usage(void) printf("lookup-apn\nUsage:\n"); printf("lookup-apn [options] [spn]\n"); printf("Options:\n" - "\t-v, --version Show version\n" - "\t-f, --file Provision DB file to use\n" - "\t-h, --help Show help options\n"); + "\t-v, --version Show version\n" + "\t-f, --file Provision DB file to use\n" + "\t-t, --tags Comma separated tag filter\n" + "\t-h, --help Show help options\n"); } static const struct option options[] = { { "version", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { "file", required_argument, NULL, 'f' }, + { "tags", required_argument, NULL, 't' }, { }, }; int main(int argc, char **argv) { + _auto_(l_strv_free) char **tags_filter = NULL; + for (;;) { - int opt = getopt_long(argc, argv, "f:vh", options, NULL); + int opt = getopt_long(argc, argv, "f:t:vh", options, NULL); if (opt < 0) break; @@ -116,6 +123,9 @@ int main(int argc, char **argv) case 'f': option_file = optarg; break; + case 't': + tags_filter = l_strsplit(optarg, ','); + break; case 'v': printf("%s\n", VERSION); return EXIT_SUCCESS; @@ -138,5 +148,6 @@ int main(int argc, char **argv) } return lookup_apn(argv[optind], argv[optind + 1], - argc - optind == 3 ? argv[optind + 2] : NULL); + argc - optind == 3 ? argv[optind + 2] : NULL, + tags_filter); } From patchwork Tue Apr 2 22:30:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614686 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 862591B95E for ; Tue, 2 Apr 2024 22:31:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097066; cv=none; b=Hszb34V3f4GatDGwqNmoWT0qmmv2FrK2Mw3CtzXlqt4XZmE1F2YGjg6362nwx22g+zGywGs8F3Xeu6GF8t0eJ+r1Auxrqsm16azdNLdT26X+vUmqiAiknWctciFrzi70c0wN+cOvSjbW7rbDvBSOIEzc/G4D1HDKf+b1SRFmhaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097066; c=relaxed/simple; bh=s0Bv3UA2qC7Y73LHPGb39vKsBvBr50BYguKrJo3XPNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jrf7WDlZZnJPnZ9O9+/Quop7/jlZdbMU04bFo+KuXNVOMZzCX9CJ9i8DVsnLh4mawljtvyumoEWu2WqNOChCBs0S/xpqyZCYlNeidUkN+HlhFVpRGRKVCwvCdWHlL+/EFJZ2PUrBig2dQHWGsvI9nztwmomKN20BcSAyASkJQ/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QDdYcCpH; arc=none smtp.client-ip=209.85.161.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QDdYcCpH" Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5a496fde460so3581086eaf.1 for ; Tue, 02 Apr 2024 15:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097063; x=1712701863; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rt4wRsDcMGIHHM1uJUmPeebowvVE+1VhfzJeay2c9Qo=; b=QDdYcCpHDSUhpRrUkmEg8t3Bde23VlVOlkLgwL6RCvYrOAdyhTskKGhEirAgsIACAC p1nhMNYYI0jIYR/j13OS3Pi2uynXIAN6qCyHLXLoUk355DzjR9v9DBWgNt1NhAltQyvQ iNmn02eB+wc3+77hUCe5QH+avvuKHrFQ0uWn0RwUXLEQzRdy7wcoHrQRPpRy8iUyBnmP zR0eQS0YCHdEobXhIZSeJbpPkJ1QG3fLBpOBX0GkQAN9kYWfdOeKeYni2/M6vZRysKd5 DE7q8vq+1wIwLLNJS0L4xnBYwh7GqKFe2HD8w/uwG4X0aIdg3por1WuH41ZkXTypsjMF Qvzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097063; x=1712701863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rt4wRsDcMGIHHM1uJUmPeebowvVE+1VhfzJeay2c9Qo=; b=MtKYFjjsJuXUMJjVm1PQL6lvWTP2jiB1FyCvkhU1SMyQOaA+/sBLAOOYOseGs/kNdr CSYkBGpZ6XK+An/xti5hM3vyPEu4R9b8BuWPEfQXBrxdjZnX2UiqK+MpxwQd4sFB0MbL JVVjHKrdlmc2nvFdhYSGR6qFiK3f9fgQ1zNOfelc3S6ipoQR4mJIZ7+zYzw7+CO53WvP 5gRDtPGLpDqlBCyHPE5dfn6aSEQ0FwKJnEHw7r/fK+VnzduM3x85HRZVv4sx0hpeWyMh 8GT8VBhKP+Y99+uwS99kHPklswSQ7E6P6hvqN6SP1cGMN2GrNbcRn0jvDQoZwLThAT+E bbsw== X-Gm-Message-State: AOJu0YzC6dsXQEon8crqQN5KXuPLp4f8fcKX92Hl2al6dTWg8zbijJnp qXXT5weYw3wOkUabYUmax4bESvQnCj4xmDCowYOz4Sz4m4ngQ6LLg8vX1Hlf X-Google-Smtp-Source: AGHT+IGKLcVO+zKfWxPVxcviHnY9dYj33oaytcM5CmkGLYqwMS/Nj/J6K6NLan2Rj7Q61fdfnfue1A== X-Received: by 2002:a05:6820:2607:b0:5a5:27ab:189d with SMTP id cy7-20020a056820260700b005a527ab189dmr11289171oob.6.1712097063494; Tue, 02 Apr 2024 15:31:03 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:03 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 10/13] data: Add tags for AT&T and T-Mobile contexts Date: Tue, 2 Apr 2024 17:30:35 -0500 Message-ID: <20240402223054.2819526-10-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 AT&T uses several APNs, one for lte/4g devices, one for 5G capable devices and one for M2M. Use the newly introduced tags field to tag them appropriately. Similarly, for T-mobile, add "iot" tag to the iot specific APN configuration. --- data/provision.json | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/data/provision.json b/data/provision.json index cef6e34e1ae3..434bfd8d8f7b 100644 --- a/data/provision.json +++ b/data/provision.json @@ -14169,7 +14169,8 @@ "mms" ], "mmsc": "http://mmsc.mobile.att.net", - "mmsproxy": "proxy.mobile.att.net:80" + "mmsproxy": "proxy.mobile.att.net:80", + "tags": "lte" }, { "name": "ENHANCEDPHONE", @@ -14179,7 +14180,8 @@ "mms" ], "mmsc": "http://mmsc.mobile.att.net", - "mmsproxy": "proxy.mobile.att.net:80" + "mmsproxy": "proxy.mobile.att.net:80", + "tags": "5g" }, { "name": "AT&T M2M", @@ -14187,7 +14189,8 @@ "type": [ "internet", "ia" - ] + ], + "tags": "m2m" } ] }, @@ -14216,8 +14219,10 @@ "name": "T-Mobile LTE", "apn": "fast.t-mobile.com", "type": [ - "internet" - ] + "internet", + "ia" + ], + "tags": "lte,5g" }, { "name": "IoT", @@ -14225,7 +14230,8 @@ "type": [ "internet", "ia" - ] + ], + "tags": "iot" } ] }, From patchwork Tue Apr 2 22:30:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614687 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1419C1D6AE for ; Tue, 2 Apr 2024 22:31:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097066; cv=none; b=FRZs99PYbYRxiAoA808ehrHPRYifcyv8yOFV5YjGCzXsULgY+YknvqnY42ZzluPUVKd1xOzI5A2tFnO9dHuYDyKivjXP8evgoIsifZI75sKtfDj5LrYnfy20/MzlOsNQUvnUlktUdb27mAVT2ipa0Xw1Nr3R5Go/nuYT1xsdbjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097066; c=relaxed/simple; bh=fpkxOhYghJN9PKJW/r3LKfNzRX/7z7hBEeZ2vLRX6c4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AzFAaW1LoSKtlLFGcGCETn5s4roFbN5sV/Vub1bzSX97+Z97TZTIuSTF21r5O3SrTOo2Jk6aEw0tzRjTpe5bEBlGpDppWv2rQtzI2uDbz5UioUT48xIcU/LJfT1HXBWlE2i1wUThqrSiU6xeFooGg8YackYYJ729lHmfBatzErY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ee/nASzq; arc=none smtp.client-ip=209.85.161.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ee/nASzq" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5a496fde460so3581091eaf.1 for ; Tue, 02 Apr 2024 15:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097064; x=1712701864; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9/TWG2+W2RzqALcg9cVNAXCMYJOSOEY4RrtyMmJ23bI=; b=Ee/nASzqA0J5CI8wKoBIAg31O4ka4UZy4EKNpA7Qg0oIIkvI9hpSJ6tn8+tz2ia6Mr NhyuzN+UxEtBDx3LSA3xPFtfbND8xdYF9K2ybNZskZk4BVUs4Unsyk0jUdgqRralwR7h rpyNnfZqicUPy/2v0ZUqKDGLNdXBM4iFFmHdDMITJFdjkIqv+a22sNMDGafNyvgdkcXF mKd+xa/9Sx8qj3BTcKN1B6cNT6hUPrt5wFyOkjMqCuf3jOdjGnIkb2xszDZoPWgP9uhF tpjbaFXob1i6MjS6n1vK6Ren+0tUqmURYVrvTcwj0aCaSPIQ72kWOZdADhTbT+lmsDPv l1Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097064; x=1712701864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9/TWG2+W2RzqALcg9cVNAXCMYJOSOEY4RrtyMmJ23bI=; b=Ui1/V8GSi0dY61ayVehrEz70wURllObu3EPnum9NzONxk/6MnlqVMN+eCM4YWAlbML VIBdQQ2Sliq7GksxKyIFcsCeA6qWe1jv6xU/DIvH3B1UI0dtrpmDEjxv8nERVnkdxWIP xG3uJbb21AH6he7nwwBojPofBMjiqDV4b7Ed3wMUtNdIPz8s7S1VCUdOVgdOO7uPcmdM dZMbj5liJetH9U5jNUVyh1q0T6M4d8QVskmPsJ7zSyhn3ickdejrCD0FTLUSWk6IrdkK RHGv01HrV9hZoG30vG/2QZ7I5l7UaPypUay84EEgEx/afz6asI5w3kNES8PpacHI1zrb ZWkA== X-Gm-Message-State: AOJu0YxW9R/XN3Gnl9wxmjShvauMlgUW3GNqymueJpicRabUIcm95j+u edRo0x9tiPMtKpXeKsAi/wWVN2GxfnjMOV0NE674EbOLnZ+MyI9R0Qr+POqo X-Google-Smtp-Source: AGHT+IHZXf0IvRWpOWcFbqBF9fQQqEP9sS2Bc0CnanRMw/5Fp4JrO3W8anriiVdIvdKuBMzXadipdg== X-Received: by 2002:a4a:a541:0:b0:5a4:f5b6:4eca with SMTP id s1-20020a4aa541000000b005a4f5b64ecamr11247730oom.7.1712097064142; Tue, 02 Apr 2024 15:31:04 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:03 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 11/13] ofono: Add support for ofono main.conf settings Date: Tue, 2 Apr 2024 17:30:36 -0500 Message-ID: <20240402223054.2819526-11-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It would be useful to support some oFono wide configuration settings that can be configured for the system. Introduce a new __ofono_get_config() function that will obtain the parsed settings file as a pointer to l_settings. The settings will be parsed from the configuration directory set using CONFIGURATION_DIRECTORY environment variable, or the default CONFIGDIR variable set during configuration/compilation. --- src/main.c | 30 ++++++++++++++++++++++++++++++ src/ofono.h | 1 + 2 files changed, 31 insertions(+) diff --git a/src/main.c b/src/main.c index 141853eef8ae..489b4cb71b43 100644 --- a/src/main.c +++ b/src/main.c @@ -39,6 +39,12 @@ #define SHUTDOWN_GRACE_SECONDS 10 static GMainLoop *event_loop; +static struct l_settings *ofono_config; + +const struct l_settings *__ofono_get_config(void) +{ + return ofono_config; +} void __ofono_exit(void) { @@ -204,6 +210,9 @@ int main(int argc, char **argv) DBusError error; guint signal; struct ell_event_source *source; + const char *config_dir; + char **config_dirs; + unsigned int i; context = g_option_context_new(NULL); g_option_context_add_main_entries(context, options, NULL); @@ -254,6 +263,27 @@ int main(int argc, char **argv) __ofono_log_init(argv[0], option_debug, option_detach); + config_dir = getenv("CONFIGURATION_DIRECTORY"); + if (!config_dir) + config_dir = CONFIGDIR; + + l_debug("Using configuration directory: %s", config_dir); + config_dirs = l_strsplit(config_dir, ':'); + ofono_config = l_settings_new(); + + for (i = 0; config_dirs[i]; i++) { + _auto_(l_free) char *path = l_strdup_printf("%s/main.conf", + config_dirs[i]); + + if (!l_settings_load_from_file(ofono_config, path)) + continue; + + l_info("Loaded configuration from %s", path); + break; + } + + l_strv_free(config_dirs); + dbus_error_init(&error); conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, OFONO_SERVICE, &error); diff --git a/src/ofono.h b/src/ofono.h index 294e90a37c23..80add8351ee7 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -26,6 +26,7 @@ #include +const struct l_settings *__ofono_get_config(void); void __ofono_exit(void); int __ofono_handsfree_audio_manager_init(void); From patchwork Tue Apr 2 22:30:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614688 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBBD21E531 for ; Tue, 2 Apr 2024 22:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097067; cv=none; b=ZdMG6shCnw3d7pwBsINUVLIeAshu/66A3yb1EvYLdlGaQW3dckmpyRI+f/vfzg5hv7VlP9aV581592jKs7qsP6Fzsc0/Q82AV8chX95gwStqnbKQaVg3isZRpLivBdjQENHwJ8YgA3ZCkYfGD/RElrsvg39MLAYS9WNxSYwdaW0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097067; c=relaxed/simple; bh=VIVvtDsq+G5WYkgS7BSz4Z7jw6G1tAM7WGFCd31MXL4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rmY90NISjrIJjvWfHsN11dlusB5f7Dz+xIv5EnCe4DnYGDGmJNeVSuL0IzPn6b9wMdNyYyaVUPRplJ3perrYgHPFMP+62btjE4kHihk9MOX/q14761gkTqAep7XWjeHAOG5Ws2l5Uyh6iXwGVZpkxar+EBqUP3I5F2YLo70cyME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X9958Hn6; arc=none smtp.client-ip=209.85.167.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X9958Hn6" Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3c4e99e7fa9so87776b6e.0 for ; Tue, 02 Apr 2024 15:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097065; x=1712701865; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KUbKF21gV6LrGLntC6qJNUd+XWJqU7cqRFbMu1fiPwo=; b=X9958Hn6JNGYnLX5vmBuUDMPnRKCc/ZSyHUJqBIWeE3PFi/U+WiwmM3L/sHs49bV0q WXEJigZW6UK8Xp+/zkSghHTQS6g9TKDkR6Bn/9VIzx2rhxRlmWajLLEvh6k3JsQbAbPr H5edAW5WCL9yhoIfwL9ejTWofpT83joAc2IiNn+OevwU2tD7bfyQceWh3MhVeqVAwCou LDHLeVWWCGgiQt5aK3gnqz1qXExfea9EDZiY4uqko3Ux1Z5Ej6bqWLuIAoi56tvsNV0O hOqouoSdzyXuC1KQh821XntJ4iFu9oJ8Wk13VGxDas3zSn8luyZMQbrylqbobmj6VTzC l7TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097065; x=1712701865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KUbKF21gV6LrGLntC6qJNUd+XWJqU7cqRFbMu1fiPwo=; b=wSl5EFngJuOZemIGADHBjlhoNTDS0vA2k7OAc151QmA0fvNNX66sT87W9Iz3u6CTg5 mgQAGgjZ11B94H5syFIje1NvjFZEL/4OoEiHweDMpmQ13n9JXYgwPQL3ptzbuJ7CA49r 2ZrEwNSLk50XOYXVlBH2gox6ZyT0S7AbdOabqwtXe1SHqodw36kbrTwX01rZNftIV1dI IcAeu8WF1o1+TNxvodFtrZX1MuwRDfyFaHeiOaiBsTU4iPtdNl27tJU1RTzsUfPbMuL2 bUryqR8PDFAW92ULQRlodD19JuG2gBLPdOG/7Apl0aeioKoS060MBwXVbLUJ6YfgnodO dSJg== X-Gm-Message-State: AOJu0Yz9VfBrcYYq96ROOc6tg2V5jgWm3zOV2zztGuZfMUvUPZaylB5J hTMWI2GKsWiPAPMTQFXWHoGEEm8IBGgfpskPu2PYuBZb8tNLeNdIADheNTBi X-Google-Smtp-Source: AGHT+IEPpPT91R2JuQDCGeAvwQJVpiCLFO8WR31Nw6CMzLAwpoUSEb8jp7XkwnKiSuSYCN+JwY3CeQ== X-Received: by 2002:a05:6808:b3b:b0:3c3:b10c:efa0 with SMTP id t27-20020a0568080b3b00b003c3b10cefa0mr318485oij.18.1712097064815; Tue, 02 Apr 2024 15:31:04 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:04 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 12/13] provision: Add support for provision filter tags Date: Tue, 2 Apr 2024 17:30:37 -0500 Message-ID: <20240402223054.2819526-12-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 oFono main.conf configuration file can now contain an entry with group 'Provision' and key 'TagsFilter'. This entry is treated as a comma separated list of all tags that are accepted during context auto-provisioning. This can help to filter duplicate context entries from the provisioning database such that context auto-provisioning is successful without user intervention. --- src/provision.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/provision.c b/src/provision.c index 22413d2ccde6..0530386f61c1 100644 --- a/src/provision.c +++ b/src/provision.c @@ -28,12 +28,17 @@ bool __ofono_provision_get_settings(const char *mcc, int r; size_t i; uint32_t type; + _auto_(l_strv_free) char **tags_filter = NULL; if (mcc == NULL || strlen(mcc) == 0 || mnc == NULL || strlen(mnc) == 0) return false; - r = provision_db_lookup(pdb, mcc, mnc, spn, NULL, - &contexts, &n_contexts); + tags_filter = l_settings_get_string_list(__ofono_get_config(), + "Provision", + "TagsFilter", ','); + + r = provision_db_lookup(pdb, mcc, mnc, spn, tags_filter, + &contexts, &n_contexts); if (r < 0) return false; From patchwork Tue Apr 2 22:30:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13614689 Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB7FE1D6AE for ; Tue, 2 Apr 2024 22:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097068; cv=none; b=rOpHc1ZeR/DQqsNbWVJxmHamfoPPfecY+QvP/iIodecaR+p3cbSuijW38MmtGjLHInp1WDNgXPN7L6Vs3zenRjX1m+muNluNy4H+D9T1h2Z38JMiUPFLP4vES3WQSLbHX0DW72+RCDOIq31BPpebkBOYNsuxFkw++4KZq90hT3E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712097068; c=relaxed/simple; bh=MkfkVZSWEBmQ2nREg/cLfaKsLACZ1XgFoqNqqRD6lN0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PWA5ZhHnz5knyWwwxEEzLXVeR4SshrUymZzItAbbjUjbi5NJGFoAZT/rhr3yEbcM64bDvlfZLQRb/RxcZCcd7lVFrSgiFf2qSN5uPk9hY3gEljZYSahoteWGFZ8MwJCpD7PloTHnbQ9TjTMsv9KYBjr6cDw5PrkgCw9BMchunwQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZVTt9DZ1; arc=none smtp.client-ip=209.85.161.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZVTt9DZ1" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5a492093073so178847eaf.0 for ; Tue, 02 Apr 2024 15:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712097065; x=1712701865; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vol3mTWKS+Qu0Kx+jxxrbOYp82878IwpfnUQzmwos6Q=; b=ZVTt9DZ14wgS1ZJ7KfXY47UKBU53q81jU1gRq7eLvj1rAgdt2dnIZGA1tuqcPB1mWt st8QIlP6PL9NHhozCcYGtFou8W0LFBfZv1EFAgx5p0Te9EvjZGT0XadKwmciv4rqMl4Z EPTdbHnpL5vDkh8lVL3+m/G/gaWjRR0FEjrdUzt0iWSlgdFdplu+qTLjIIF1ga5IkvhR GgHKLxebseoCMO+uRKh7w8CySIyWsLYm9yYhbxReHgPMe5jEFfGrV/ZIAoQKFmB9fXiG yZx9mWXQ8eA3l/3p4Le6Q4DGIOZ1GuyL8y8MsNG8OInY2pyCL5gYur0b4Vw0+CD7EWl2 jcQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712097065; x=1712701865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vol3mTWKS+Qu0Kx+jxxrbOYp82878IwpfnUQzmwos6Q=; b=WE2U6GfNpXMhcBM1RJlBSQrwhv5L7kqyEYN05D+7uNCMEzk/++tilBM0hKlwt3Ce5V hM+HUWk8DuIdu4NyTmA6iM83Intwp9ohwiNgp6Xns4GnjO9eWXkveLXnuOaTKpU7OqkX Ag5/VOrW80W1tzj/ErAGoBLO91aGPo8G19jPEI6tG9GmUOisk//iJqbHl5sYmXfzXkOZ lp4/BWi7OGBE28DqBQcD1A2TQHfaCMg98K8XhDX76j6V4wJpixs5QzE2YtLEwUb96eaD YpGZHeNLYVuQ9JHwo9rNEW5zZYIq+kGoqZaggZ5D6nppLOMUwRG6yRnqrFrd+8BjOR6b cWNQ== X-Gm-Message-State: AOJu0YyV76tdbjWK0UDV8K96c7fPLKV30VeaWcRt7/ypWb+RyXbrwc8K 0WcHVZgGvlSzgsupU9cobRkVrOiadX/aK06YVCWaYOt9JaY8JWxq7PvAXu7n X-Google-Smtp-Source: AGHT+IF60rQgKJ3cLxza4YQZ7RLwda8EAANoekGNt801OM1vp8BGqgJ6Q1YNwChmu3tcMVrn8JAxTQ== X-Received: by 2002:a05:6820:2993:b0:5a4:9b0f:3652 with SMTP id dq19-20020a056820299300b005a49b0f3652mr298749oob.3.1712097065445; Tue, 02 Apr 2024 15:31:05 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id eo8-20020a0568200f0800b005a58b8e4b1csm2956204oob.7.2024.04.02.15.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:31:05 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 13/13] examples: Fix use after free and resource leaks Date: Tue, 2 Apr 2024 17:30:38 -0500 Message-ID: <20240402223054.2819526-13-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402223054.2819526-1-denkenz@gmail.com> References: <20240402223054.2819526-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The emulator example plugin does not track modem powered watches, and thus leaks them. Additionally, the plugin opens ports for both HFP and DUN emulators. However, only a single server watch is tracked, leading to the other watch being leaked. Since the modem powered watches are not tracked, they are never unregistered. This can lead to situations where emulator plugin is destroyed (and thus all data associated with it is freed) before all modems have been removed. When modems are removed subsequently, registered powered watches will be invoked. This will result in use-after-free errors being reported by valgrind. --- examples/emulator.c | 151 +++++++++++++++++++++++++++++++------------- 1 file changed, 108 insertions(+), 43 deletions(-) diff --git a/examples/emulator.c b/examples/emulator.c index 5c92bd6659c4..972c1acfc0e3 100644 --- a/examples/emulator.c +++ b/examples/emulator.c @@ -44,8 +44,48 @@ #define HFP_PORT 12347 static unsigned int modemwatch_id; -guint server_watch; -static GList *modems; +static guint dun_watch; +static guint hfp_watch; +static struct l_queue *modem_infos; +static unsigned int n_powered; + +struct modem_info { + struct ofono_modem *modem; + unsigned int watch_id; +}; + +static bool modem_matches(const void *data, const void *user_data) +{ + const struct modem_info *info = data; + + return info->modem == user_data; +} + +static void modem_info_free(struct modem_info *info) +{ + if (!info) + return; + + if (info->watch_id) + __ofono_modem_remove_powered_watch(info->modem, info->watch_id); + + l_free(info); +} + +static struct ofono_modem *find_first_powered(void) +{ + const struct l_queue_entry *entry; + + for (entry = l_queue_get_entries(modem_infos); entry; + entry = entry->next) { + struct ofono_modem *modem = entry->data; + + if (ofono_modem_get_powered(modem)) + return modem; + } + + return NULL; +} static gboolean on_socket_connected(GIOChannel *chan, GIOCondition cond, gpointer user) @@ -64,28 +104,35 @@ static gboolean on_socket_connected(GIOChannel *chan, GIOCondition cond, return FALSE; /* Pick the first powered modem */ - modem = modems->data; + modem = find_first_powered(); + if (!modem) + goto error; + DBG("Picked modem %p for emulator", modem); em = ofono_emulator_create(modem, GPOINTER_TO_INT(user)); - if (em == NULL) - close(fd); - else - ofono_emulator_register(em, fd); + if (!em) + goto error; + ofono_emulator_register(em, fd); + return TRUE; + +error: + close(fd); return TRUE; } -static gboolean create_tcp(short port, enum ofono_emulator_type type) +static guint create_tcp(short port, enum ofono_emulator_type type) { struct sockaddr_in addr; int sk; int reuseaddr = 1; GIOChannel *server; + guint server_watch; sk = socket(PF_INET, SOCK_STREAM, 0); if (sk < 0) - return FALSE; + return 0; memset(&addr, 0, sizeof(addr)); @@ -108,62 +155,77 @@ static gboolean create_tcp(short port, enum ofono_emulator_type type) G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, on_socket_connected, GINT_TO_POINTER(type), NULL); - g_io_channel_unref(server); DBG("Created server_watch: %u", server_watch); - - return TRUE; + return server_watch; err: close(sk); - return FALSE; + return 0; +} + +static void powered_watch_destroy(void *user) +{ + struct modem_info *info = user; + + DBG(""); + + info->watch_id = 0; } static void powered_watch(struct ofono_modem *modem, gboolean powered, void *user) { + DBG("powered: %d", powered); + if (powered == FALSE) { - DBG("Removing modem %p from the list", modem); - modems = g_list_remove(modems, modem); - - if (modems == NULL && server_watch > 0) { - DBG("Removing server watch: %u", server_watch); - g_source_remove(server_watch); - server_watch = 0; - } - } else { - DBG("Adding modem %p to the list", modem); - modems = g_list_append(modems, modem); - - if (modems->next == NULL) { - create_tcp(DUN_PORT, OFONO_EMULATOR_TYPE_DUN); - create_tcp(HFP_PORT, OFONO_EMULATOR_TYPE_HFP); - } + n_powered -= 1; + + if (n_powered) + return; + + g_source_remove(dun_watch); + dun_watch = 0; + + g_source_remove(hfp_watch); + hfp_watch = 0; + + return; } + + n_powered += 1; + + if (!dun_watch) + dun_watch = create_tcp(DUN_PORT, OFONO_EMULATOR_TYPE_DUN); + + if (!hfp_watch) + hfp_watch = create_tcp(HFP_PORT, OFONO_EMULATOR_TYPE_HFP); } static void modem_watch(struct ofono_modem *modem, gboolean added, void *user) { + struct modem_info *info; + DBG("modem: %p, added: %d", modem, added); if (added == FALSE) { - DBG("Removing modem %p from the list", modem); - modems = g_list_remove(modems, modem); + info = l_queue_remove_if(modem_infos, modem_matches, modem); + DBG("Removing modem %p, info %p, from the list", modem, info); + modem_info_free(info); return; } - if (ofono_modem_get_powered(modem) == TRUE) { - DBG("Adding modem %p to the list", modem); - modems = g_list_append(modems, modem); + info = l_new(struct modem_info, 1); + info->modem = modem; + info->watch_id = __ofono_modem_add_powered_watch(modem, powered_watch, + info, + powered_watch_destroy); - if (modems->next == NULL) { - create_tcp(DUN_PORT, OFONO_EMULATOR_TYPE_DUN); - create_tcp(HFP_PORT, OFONO_EMULATOR_TYPE_HFP); - } - } + l_queue_push_tail(modem_infos, info); - __ofono_modem_add_powered_watch(modem, powered_watch, NULL, NULL); + if (ofono_modem_get_powered(modem) == TRUE) + powered_watch(modem, TRUE, NULL); } static void call_modemwatch(struct ofono_modem *modem, void *user) @@ -175,6 +237,7 @@ static int example_emulator_init(void) { DBG(""); + modem_infos = l_queue_new(); modemwatch_id = __ofono_modemwatch_add(modem_watch, NULL, NULL); __ofono_modem_foreach(call_modemwatch, NULL); @@ -187,11 +250,13 @@ static void example_emulator_exit(void) DBG(""); __ofono_modemwatch_remove(modemwatch_id); + l_queue_destroy(modem_infos, (l_queue_destroy_func_t) modem_info_free); - g_list_free(modems); + if (dun_watch) + g_source_remove(dun_watch); - if (server_watch) - g_source_remove(server_watch); + if (hfp_watch) + g_source_remove(hfp_watch); } OFONO_PLUGIN_DEFINE(example_emulator, "Example AT Modem Emulator Plugin",