From patchwork Wed Apr 3 16:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13616428 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.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 456C414D706 for ; Wed, 3 Apr 2024 16:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160363; cv=none; b=KOW31POvvX2NRtQF5jxNc35RAsPbuj4T969GygvJJlLLpw6Fzto8B5A9TGx+W5mEIApkQGBcZMkVbqZiqRQiRFLu09N19wZ+lwnElYRMd9cZ/nu5AZjyXHySH29czV1gTt37Xwr54vazG0k3v73dDVQ58HWEiGc/ANH6JDR1Uxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160363; c=relaxed/simple; bh=/wymyt5xwpZ+tQHu282+4XSKoEkHISFJ7iCvFHqruTs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DTcnOLrqdQff/qPBdrR0yH+0Gi70iTAZjfG5Qwzg2Q2LdAEqCakhwZiy4+bpmH4575MNyt8fKpXjAXK/oLcsgQP+mejeL36WF6v8oDhgx7hR/dqBiews0DplXoXqEw3tu4gk8akq03AMlFRemWq+8He23UNmlfITWn0wLsA6V0Q= 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=i24nYVlg; arc=none smtp.client-ip=209.85.160.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="i24nYVlg" Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-2220a389390so533479fac.0 for ; Wed, 03 Apr 2024 09:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160360; x=1712765160; 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=8HoeR3bAAJqv5hNIJPwou9IBsNAQQueJ+Kbnp+RCSHI=; b=i24nYVlg9em1p+WXOHYfWpR5+mnniY4B/edsLQrF2ClCiArpW4agWWQkRXY+HLGovm lc5RDb5LQuxH82jNwJUDXvMZL/x696zChPNUnbK5QI+JKypo0X9c+XEZYrAZWj/wixGJ OLNR36TIDI1GJHS3yf2AzDUWkU58Rek8fAkgPXhPu+mN4qCENXFeF3uXQL888rJsVMl6 8YX3hLx4cq/vZz5CKm1pDW32hdGGVo4bA6mYd1aVKb1Gb4jF5Dnh0LA1UoVdDCjJqn1A LDtl/YnKTK/IRI2mvf1tyIi85MBkUihOYTwE+NDdUu6SFrJ8VSvWzgl629mWoLjQ6gZ2 7cGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160360; x=1712765160; 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=8HoeR3bAAJqv5hNIJPwou9IBsNAQQueJ+Kbnp+RCSHI=; b=muscploKezY86kF0FqClIC3EfKLrhEPN80AUg4u345oaSlnymU01Og+Kevo7Q73oM0 BMhJc1Ez92R4NXKZf9K9fla6qpZ5nSSaEJOvQT35HQ2dxeXFyD8QSdmvdMI3N5B4Nem1 YV1XQV5tfLqI8/WDEvSZMdYIyFfrUYZAA6h/r5QFKBg3JyoP/3EJKZFftDO/R0yMLr2c //X1i1jH/7yhILu1P1TrJZ6mBNxl8W7n0j79oy62czGoCLWwbR/PfLz91Sop6W+1mgse mk9GYeYr+dAp7kYsEbBv0Ln64x7vfX6NczUg4pABubWQHl25EF17z3BZBl879NBkwuSu KrLg== X-Gm-Message-State: AOJu0YzAXPi12X2iXKleYFseq78ttWOMuWEv/6MQGChv8cD86a81xEN0 awl0LXuJzWLzjOAOG3LqOFHmwyBsiuk80y0o2hHHMCdS94kchTCabngDB6/4 X-Google-Smtp-Source: AGHT+IH7aRDSuPQp0wj5/47pJYk6UqW9pcC7J6vH1uPhFC9CkIoXxYMqw3fCbu1Am+RRenInHwHksg== X-Received: by 2002:a05:6871:7247:b0:22a:5022:53e0 with SMTP id ml7-20020a056871724700b0022a502253e0mr30288oac.24.1712160359971; Wed, 03 Apr 2024 09:05: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:05:59 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 01/14] simutil: Convert eons APIs to use ell Date: Wed, 3 Apr 2024 11:05:24 -0500 Message-ID: <20240403160557.2828145-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 | 116 +++++++++++++++++++++----------------------- src/simutil.h | 15 +++--- unit/test-simutil.c | 1 - 4 files changed, 63 insertions(+), 71 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..fbecf6db67de 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,52 @@ 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 bool opl_match_mcc_mnc(const char *opl, const char *s, size_t max) +{ + unsigned int i; + + for (i = 0; i < max; i++) + if (s[i] != opl[i] && !(opl[i] == 'b' && s[i])) + return false; + + return true; } static const struct sim_eons_operator_info * @@ -1112,46 +1120,32 @@ 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; - 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) + if (!opl_match_mcc_mnc(opl->mcc, mcc, OFONO_MAX_MCC_LENGTH)) continue; - 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) + if (!opl_match_mcc_mnc(opl->mnc, mnc, OFONO_MAX_MNC_LENGTH)) continue; 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; } - 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 Wed Apr 3 16:05:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13616430 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.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 0469814BFB5 for ; Wed, 3 Apr 2024 16:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160363; cv=none; b=dWnF1u80VSam22WRq1fqf68jtwNsXAcaf5gk7aFLDn51kZrInFauSVFqZq3lYGlxLn74srWHy7bXwdjl/GsUjxU2iQ9al/Hd/fG6Ga/KT9tG1c4oz7U55/eCssNY1U1j453R7LoJWvEiB64+a8CWuglMLv4AjeunRlO91bKpPho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160363; c=relaxed/simple; bh=FyWc1Q0mtKOGVJ/yFXv3XkiWnhZ7+UwTfCoLIL0KW7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pYAmcdlGkf0IHZdGWJYkExCBglPgrBNSHqPkFl7LD+tckcyr28ehzvUAnbqDB8vdbIQ7ldqlOysHg1ucReKb27qqwyyqqnY6i3yxiG+LhJA9KjL9DCFwK7RtmUamhKxr7Wfzm7KdtGm5HrLxQzPtj7mqmN00uKo1vevmMbzSppE= 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=LCYTN5zu; arc=none smtp.client-ip=209.85.210.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="LCYTN5zu" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6e69a9c0eaeso4242658a34.3 for ; Wed, 03 Apr 2024 09:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160361; x=1712765161; 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=LCYTN5zu3OJ5DMqt7bfGubK9KHAixvkrGUOf4/sUmgMywAC99V61j536Twl22ac3rQ 0XU237kLQJTireE+GPxon7uFNmSd83QnWaPQw8cazjlp6e6IBZDighhmig3k832s+a3b U33UBaxnuC+UkRqJtrFIlN4YXuxKvwQrLdUXlqVQ3XwJQqX4XP4ROrdm6kgd+7lYIf3X aIrXj6KNTsGScDJ7t/h5lEh2dm/dXSslcw/biNyMzqaMIqGnR0h84Oq+nAvsmiyLBfbh VTje2dfHGwPpiCy39j7IzCX5tpmRLcuKPpEb/udP/xLYLSnU4wX9gbQ1goJPoXIXGL0F Ewfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160361; x=1712765161; 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=tXgUq0ifZ7ghID5gPl+Pm/VK4V+q/fDP1MS6CCdv8Wz8u2/4KDiUsMKTjcfpyxatJs NJRF2pqiIaNXUUPbxA+z5MgYw0MIX19TJRok3avLyYKB7vespZzDRbXrYAKM5i/7imnz mAl10OCT1QjEFda+nBGs8UWR0aPmrHcxFubEhyeVF2zynDNvdjgoRf3NdGEfV9/qhS8c AouTiLk3Tt56qDS3dHO3MR2tZfCL3kJrTWoRI//qz/RYakG9jNKZZv/bspAff1bBQywI V4j7deX9xEDPgjlqjjSL/Ngv4S1eYlUimavkyIo9+We9jQXzUfKj717IhTQVCpxypUsz CaUA== X-Gm-Message-State: AOJu0YzAfDOtYkVbtI2kXMnHF2N+sx1osR8BaNqe9cytT3Kdgk2UKmn6 1G6ls07NJ/UHNYwxdYZuYTHKJ3y0WfnV/eH0c8fblyR5xoNQTu+zsvN/niht X-Google-Smtp-Source: AGHT+IG+TjcAhLbO5DPmcrCQ3rqL54YqmVBZ61iF1e4LplSz1F9LWzUAiHS7ysj/PcbAjkW3iod0Uw== X-Received: by 2002:a9d:7844:0:b0:6e6:e347:55dc with SMTP id c4-20020a9d7844000000b006e6e34755dcmr16505009otm.4.1712160360838; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:00 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 02/14] sim: Simplify SPN management logic Date: Wed, 3 Apr 2024 11:05:25 -0500 Message-ID: <20240403160557.2828145-2-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616429 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.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 8686414D295 for ; Wed, 3 Apr 2024 16:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160364; cv=none; b=ehxaL5SHOrlTBAJoSVokTalbwcvKXHzH3f5l3k6wAgKkkLHff+BJ6kHcEFmPZRsqCHpNiv3A4nm+2ixP9q5AvAZGQDZnEoLmEqgtTjaDKOgSE1+94/a6VMi0LEXSZ0+s3dVFScq9umStMFb8phKLKwq4mwZ/UK+t0DrdragiiXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160364; c=relaxed/simple; bh=2jtwPV/0aXzMV9GYqTuankIWt+V0Hg7TZhCy2NTuGTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S492A5sBTN6Z98tBzQ3Ds1AbaO1j+T9ecxEQ1j2xwUOuzUY//x83DWamt6y2snYaeEiPtX2Kb0Mlx5pvLEB1JLdK7ImH7DT/x2WH0obIqXCPB7YAdtadnMoIuj3+PBHp9pSC49DuRenbsAEMLs3bqJCRacJqTcD5ryfN+fgngq0= 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=DdpzlRqP; arc=none smtp.client-ip=209.85.160.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="DdpzlRqP" Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-22ea805f3edso3020fac.1 for ; Wed, 03 Apr 2024 09:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160361; x=1712765161; 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=DdpzlRqP7BXtoClW1RsE+1MWP2RvtKYPDubDsyNkBC+MOqt9ri/lGgMOYdAHhgykJY nn4JkYL+isb6qtyKfxlO7fO5G/ADhB6tAts/9/BkrQi3JxHAt9V56rMr/jeFugoZ0gAL uotSNCSR/w21CsUT9jl2PwVmmLzQKrqx8r4+WFjE4U46B8rhwp3g1GtBeukDWSgRYbhB ovw0/LZ8luxxgjwfJGq06jHf7BSVVbt2Ix0lCK5nl/YZEwyPVIBO9KNZjhlnV42Gi3nG jtDowFi6mHhv1U1dftuGQ3XwGrpWw8K1wgT6rEqEGHdzAK1zSisha0T3ihAEs94v1CRm y8HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160361; x=1712765161; 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=fsYCz0qAo5xbL4pPzERiRX+GZnQW1Sq/VVodp5CMkphE4YQAdjOj5nbfOTT7PcXPc/ eWqWMxGQrQuzXHds25dAupR41MNsq9U4DhH3kRwT91+6/ap95r8s/+dTfFJsStozCEJK YCLRXTp/7vY0i6zVtwtbZWMv1VXMpmBmDBKAaSopjuvh1E1o2y1ESv/bgz7tAaQ/n+mo GqOzOFbFquKmcbBqnPoRTSLhRMOgVEcoRhNb2vgoQLxXH3mHinSfTH+Yp0M8nGasFidk QzF56mmShaON1GkGMHj2dWABDV/sdArG7Xp+3VbpIVGfnADYLE6+ikpREQsHFjKwIMZ3 QY8w== X-Gm-Message-State: AOJu0YzbWpOdzHWmmcfb39kGfFwZ1vwntdpC/4/Qep4Zd1Wa2qWLldfh 3Mnr1dQHGvSGUkH6QRpOHGrufSH4rDSYH3XC9T5VkK8jS/M623bW50Xf9U12 X-Google-Smtp-Source: AGHT+IGg0mpTucwGNVSb/jQnoVOO9xzsW7gLhOWC1N+ehpkhDQsviEUGYK4ZAn50u6srl5R/EKmVUg== X-Received: by 2002:a05:6870:808c:b0:22e:98df:9a2 with SMTP id q12-20020a056870808c00b0022e98df09a2mr2151687oab.8.1712160361499; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:01 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 03/14] data: Remove AweSIM entry Date: Wed, 3 Apr 2024 11:05:26 -0500 Message-ID: <20240403160557.2828145-3-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616431 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.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 0C4E2149C48 for ; Wed, 3 Apr 2024 16:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160364; cv=none; b=nWLDkHkQn387F8jQi0C3HOucCbH7WyXJV6uk7+7ggKq01Gm03ppM1mFEfmrJTba+GKKZAl486u2OnQYRI4OX/wA3y3WhkEbJapMVd43rgSf5SWdHhNxFIn/wAtYPJjupv/rJWVs3meyi1M/bM/Oez6Iw9i5NDxbGNgw9rEQz24s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160364; c=relaxed/simple; bh=HKXA4XdTxGefTIGQ80/Qe1Utjgr/lo1uHDKL0Rd6KzM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E2mbEwqOsDY2sDSMTwZpJAGCyIJRwFLlEtiqINZ1JwHP+WADYl9IiONZSLjqoCVxgsa3L/zdW4W+/kuyLYc0vaSNMz6b+pbeTpwnoUeusQCpcYVoON6YdhRanLpLUV/k+AOY0hbUO7SxtcPwwvfiZVQxVXLiaGzSBC2xlktu6Os= 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=Tk7slDTL; arc=none smtp.client-ip=209.85.210.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="Tk7slDTL" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6e696ee8fa3so604136a34.1 for ; Wed, 03 Apr 2024 09:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160362; x=1712765162; 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=Tk7slDTLx7rh80I7i5xdqTEa/q6xbv+fi9328kGAf0TRTnParocVszmZEOtvmY5Ibx ea9dRSTLlPv1ssdQb/Xf97N5FaXFqU4po888fr4SLfLSn3u39la8ou9A6Q5SByOXwqKn AGqNspSivhRi1l1KDiq8EK/3IelDOvkR4nnbgX9IfRxTTPWKaZ1q6T2mIZwYNpA1Xboc p84ilEYp8ikkQaRubkzKpN5vES4DERJuNJJgo2ldbNqkIteSPrfsrGN5DT3AzZlUogsO 1/Z7PEtQTCt0lULJidSaMaiSAzVt4amSzUNOq92zQOCl60+8rQupVXI9nx6CgBIJq716 Hbdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160362; x=1712765162; 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=UrOfBIhW0bAFsojMQPPgdcd69pHMvo4WYM8kGfVa8mttXZB/0+ab2jeJOOd08RXu0V /cHOC6+qjqmSaqp2xlGMjs7w8IM+C/ERcwRJZHgZxJEjKhv+5OarsHglIx+nEbNUsMhQ h141xO6eGzBRcaSx0CLsxS8x6dZuUgclunXZHUwOOYJMRoci2Mvy+Rf2thUWucNhtR0f PWIBg/X53RMK8Kl7abzVA3SuzO6xQ0/xzovNoU+WdwOrumyqVDFBZtcq1ID8de5ME4rK alEJjJJZJodRIOx0GQbAGVS1GfxLbsEXPkWQK1mMH6b2tpUaM9SQ/NrWZrSSTxq4r88d Pf9A== X-Gm-Message-State: AOJu0YyCZnmXojlI7dONJ8T5wCYZ+uLcNtE7hRf8o5x4LyOFc4k1olcw hWlJJ6vCAsFjCGjfdZLaIcBfoI6c5Uo6sk+Ty+ig8LTJkbNqPhMjLBW06t1i X-Google-Smtp-Source: AGHT+IG3aVwOdHCEN6MNJvF1fyg33ZyaGReYVOPCCWUshoOLKeLvoV/ORqw0tsTkf+vdJ5m0Piky6A== X-Received: by 2002:a05:6830:18d8:b0:6e6:bc25:1503 with SMTP id v24-20020a05683018d800b006e6bc251503mr1335357ote.12.1712160362060; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:01 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 04/14] data: Mark some MVNOs via the "spn" attribute Date: Wed, 3 Apr 2024 11:05:27 -0500 Message-ID: <20240403160557.2828145-4-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616432 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.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 DED6F14BF97 for ; Wed, 3 Apr 2024 16:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160365; cv=none; b=kwbvKfeFdr4zLNsn7jqh1ZMRwpVRRMupPh8aQ7fDIIIhYQLqNgMofpjdy3mAI67ut9kQscHLotf1kkpL+7kfZHEJaNF/18ND9rnZzuX0hBYLVslauqx1Np6VqO4xadktp8GKsmZh9czLmv8q/26yOIrEogQ18B56A/78Uk8M44s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160365; c=relaxed/simple; bh=IXf7Td7dakoDdaJxiHvJavMN42z6RyPBX+lN1+zJAfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=saeHR5ig1R/8dgvQMSJFWdOqLMkckvfoB361xUjMwaBwnlb4FmNfNigqsfSE12yqhoeK/g2X7r0BYgYkbly9DsSwZrK8m5VeIkalCF8cNeC8oNu1FW+VrQquVmP6qAZet1kCe1JHAniNh6W25LTKDQuOhlMRI3l8FxAxDMYJX2w= 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=UqanDkCb; arc=none smtp.client-ip=209.85.160.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="UqanDkCb" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-220ee7342ddso2603477fac.3 for ; Wed, 03 Apr 2024 09:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160363; x=1712765163; 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=UqanDkCbX693TNalreYoeQUUMU0jfuuLW/hW6W+fK85Lt/8LHU6fbiyXnAZzEbPgZO b/A7r+2ArOs1mq/oKUDgxli7vpDbhXhRc1cwxBwDZGrYl54bXDKUJhwwoOH/FEMRT9QW YllQ9cjvkxTteaQRlOy0STzboRJPKPGbae20uMY6g7qzUeL5pgAS6C+eRQSFPyXuS96I ODZHzWCgCFO4k2nr6vVvrlpuWV9hGd0q4kB78bvHNkizhCy5NxUuwQEWbZn6yGW0lI9X XcTuX4Braw22sOAF9yPmIJxzT60t4AHB5rO/YAx//4XluO9FCdge0/k0fySRVExV7g96 7RLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160363; x=1712765163; 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=RxAf1SoFRv0wEybqIDs2vaSeNYChJSCN/BsO0B6Xxah4JNMNo0G7AAoWu0ZrWZaR5i H5Vu1MRDZxCZMeuNSqC+/2/tcRJOu4Dfe5gqOIevXg/9LRzEBG3kn309gdy5kN+eX+KS EXxPupVPCiTZIPSSct2jXFlC5BPNNLuIbxGMwsoJvVrJD8gMm44GG7N0vC/pYrD6Kbxa jAl7k+9CtpwTQz3o7HDw7wNQuUutvoJQfuLabxOqoTIyf/eldY0XyoYid+WYjhbhXApf dh+502LW9e7/aArJ/YZzw+CmLsFbkPaRrJh7zSqkH1UemB82VM1REABd3r6aIYJ43JjI n96w== X-Gm-Message-State: AOJu0YzJqFRUjwnGXqUA0BNz1KlfGQowPI0MhAPqDOXGHA/hMhqqbKTa TBGl1CsxXRvoyV4ci86vCWPLsTdocAwTU5nlcvLP0mY8ULvlHIrHjEhc/UkM X-Google-Smtp-Source: AGHT+IG+uqezKk2NocjlyYTfZ32EmeDV6/fdq2Trl4r8XHKdrDHb98AFW1VkusOzy6hD2imNdVA4QA== X-Received: by 2002:a05:6870:63a7:b0:22e:a451:57d1 with SMTP id t39-20020a05687063a700b0022ea45157d1mr1044806oap.52.1712160362711; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:02 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 05/14] data: Remove outdated T-mobile settings Date: Wed, 3 Apr 2024 11:05:28 -0500 Message-ID: <20240403160557.2828145-5-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616433 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 C1C4F149C48 for ; Wed, 3 Apr 2024 16:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160366; cv=none; b=aVZvs3IACMv2oH5H9Y+8j1MIfpTPUtK0CTEmYmuNYR+v3+JkMKu12l242zKTZk6YDH7AQeqHVOhz/lj2YZakq+BS49xBN6JNiHiKYaUnG9pWbr/hC5DI2vVqkTndqIy5o3khu0R5O0EmYhZFHebP03fHeeG0lZravxL6e1OEboo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160366; c=relaxed/simple; bh=8A/vRDi5jAwzUJ1AgQLwUt184NvPYujph9PsMG+FPJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pLd423DcluvsUm7NcF0/w96SxeB0J2x17a7xH3vdMCqgjGze0oTRmvCrFTfFfF3UO0tL+rYX8Tn0zr5KAU0et3MbWHoZ1QyfuSdDGtza7rvuqYxEHE32AXNfLFqC3aLuNDKyV194/VdiJ2VKfjmAD2OqcKe4KIzWrdBH+4qaKVI= 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=AmsDvAu9; arc=none smtp.client-ip=209.85.210.49 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="AmsDvAu9" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6e89c87a72eso13579a34.0 for ; Wed, 03 Apr 2024 09:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160364; x=1712765164; 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=AmsDvAu9UfV+M/eS4KQsVMAW/uAo5E2qXji3ocmCOlqgvfQWNU0PRnBuzdBsax+k5/ y8hzY9WE9AR/hyLvgv0AbFPFcQC5Jj7coEIGgHugcHE2o3xT3tQLMMjvhCplw8h5N5Zg RysPrL+gTlYoNLu2b6LH5EYwEB42TPFA1HSjHZZLb6CVRAbbdWRNTF+yNp+JCue0/L9x QHy2K3CHbEF2GiSF3mZP+d63+RhohpuYZbdrkPbEy72gOvbITVuROQGenL657rxaAHIP rXY7bKpzjW4IGlVqIiBTWdNUNUC+e/Dsu5UhiBayBL8aqTJlDZWItNQ2PzhilU/X2IAe J3ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160364; x=1712765164; 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=q0OdRZ06SDyf6EqgOp5z7hMrCJkllOxVBjnikiN2ZYfIcKV/JslxsgaIkgVPP595l3 F+9GTsZlZm12nIdTwZvi8HEEHYsnWZn4XaCUv8ZyYTC9j+onYzY0/O0NlCWxnzIyFxaa xWGGFKPQMQfkzeamhVlLT2mPsoqyX2RY6oIlMv+nyag5Am7K4Ckx+kq/INc+BMZgs6Za scylIATZnJnzTbu4lhyC1fpEONcSxcDPq63Ey8gZI3L/fy39wXnaNhfXOtboesxg3v7u /LNaCZ9dvZvbmkoCfLIa6TauhIwF0yJuPV9f33WGZm/VxPt4BQw8o9MXXI6P3Vd4l3TH GRCw== X-Gm-Message-State: AOJu0Yz+ZKvTNzL3U6TYAcq9Y5fiLmdpCoSKOAEUECpVQhTHFTQpnzBc TY5r3bx39vU1JYbSzWP60HzhkoSyn1s8Ccv71JRhGHFqYgjI6x25ykAu+3cz X-Google-Smtp-Source: AGHT+IHdiXThhm37bYTYTkqHnB8+eh5eQ+UbjwCxCmbOaHxwijz1KKVaojjkrMboliskuXrIzsxy3w== X-Received: by 2002:a9d:638f:0:b0:6e7:39ab:a9df with SMTP id w15-20020a9d638f000000b006e739aba9dfmr14283650otk.36.1712160363612; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:03 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 06/14] data: Remove RESELLER settings from AT&T Date: Wed, 3 Apr 2024 11:05:29 -0500 Message-ID: <20240403160557.2828145-6-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616434 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.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 85C1714D29F for ; Wed, 3 Apr 2024 16:06:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160367; cv=none; b=YNUW79BG6nWX5W7Mhe9x7bk1ET3VuK5AKLQjG2C9Mlsel6YxAQbwKuPkX32CzMTX6YhS8b2GIDSFv/dUxpRQCIYGktPCaAWDejcEOmXS4RmbtGxHd14jMTam/1xPdYyTr7xTubmC/rGr1yBbGTWODxHJT/TmUcRXvFjdL6w/wQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160367; c=relaxed/simple; bh=sTP3HQTlWVgoLKVHjbAHwN55h/yTrk0VgaPXBstLQQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Br3fyOAix4gA70mTxSkGxUrajBZpJjCDmggXCfzvunUb+BYNs7beyx/g0fHP7sdpUh00uCRy8h3qqArBdnw7qk2DnPaa0ob4BKeqEgIptFBKU5Xtod4Up4QFr+e6zmNxrDocRe2knDa3PinMhaQajE0ZpCG0Ee9aliZnmCvBq8c= 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=eu4+7gl5; arc=none smtp.client-ip=209.85.210.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="eu4+7gl5" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6e89e48d2c0so4911a34.1 for ; Wed, 03 Apr 2024 09:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160364; x=1712765164; 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=eu4+7gl5vwpoEO68qZkAiWzhaquOGq9p2ZyVn1G8fmoFUNYEazDd5CAdaId+0KIoye qhKDrULrS+tnXI3G9Ca9ZV9FvxO7AIrDHxbvHlqtHwkw3t9laZ1AvON5lPfjDoquoK/4 uzBbGE2Uz3WK5bBRD3sgOCpI/r9vR7QX6CVTpj83H5jZyd/Y2dHXaVsBLGUGcwmOx34q wb/r2pWNs3xvIDxoiMTbZhK5VgB1hTTwv7oFBgi6s6AXgeuk31wV6Afbe6BEgTnaknid O8/HZo91GbO1qHdv/D8jDfGdksZmlITGHaAB+ozGcmJGqN0cGoYzhzVTL9QXuTxNH0aS qqbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160364; x=1712765164; 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=Jg8xeZYfPwWupwyhiykt2qsfZ9FIpm+e35LaAfkGb8rsp43YC1YmCkBLLL7gABBIhF BCOzgkeM2HAIWoARapSskHuSqN9shuBCYz5KYR4bUyXbclp31NZ+0ZdkYyXf8kcSgM5x yfU6KNOFFeT+nV0yx6tvLTj1LKLYRCbIFPJEKEoPqT2Y1T+4zIzt4i8jSY+vAwc9FMXj k8X6/O0ii372COhyIAnRxC433RGdTQaJC41+7xDsIARofgvDLycFf8xx8PMKvA1GEAsG Fcy+3XE255wrk9ovkglly1Ry6bO4m/jAwrx60uCjdQlF8CuFmqHRmKiCmpfMXvkQUeYL nNsA== X-Gm-Message-State: AOJu0YxFmIZt5vN/0k+5qbjnbdD4yah3z5k5wk5ZqxMyd6TUUcUk0gvW 02V7OUpUutt7does+PRS77yl0YjQONGs1D21ZC6/8xH2p4s85kbqyUO/RclR X-Google-Smtp-Source: AGHT+IEt7MeSU/pUs7/1MhV8nX75qt4efHpwrbrtVFFH+L7NfVbfq7nNZfsFCgpoZ+rD36MhTrUYgQ== X-Received: by 2002:a9d:7693:0:b0:6e6:9738:6b71 with SMTP id j19-20020a9d7693000000b006e697386b71mr15186418otl.1.1712160364358; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:04 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 07/14] provisiontool: Add support for context tags Date: Wed, 3 Apr 2024 11:05:30 -0500 Message-ID: <20240403160557.2828145-7-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616437 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.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 5BD0414D29F for ; Wed, 3 Apr 2024 16:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160369; cv=none; b=GWtdbJS2ql1Bt7xi8nQCF6gjnQxwXHO7fgeBuAN+d7W52nQmYbf04oPQN1ertCsGXaax6VZ2OLkO2miI7k0Mj9+SsyhkXsWxyyVQvfxbuzsSp8Heu77W19ZOprfRjKoefkWs9gGp3hkln3s2aFyaTq1WZNCtUdhxaTS2QtpW0oA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160369; c=relaxed/simple; bh=xXGcPCH/f2i8XpsEDqM5nE3YotYEMbkoSerxoZ3CQsM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=se+NbjxLqGYaUoG7Sn4ctzLi8wZ5yRzn8bIFFaW99VF2pUHm+r8c+6N2cfXP1JOi9iuUS5mXjE7En8g0myi0mIb6Ji04D9/7EbWe7/eHyC4zonVvWmB5w8o6tcaTieP+mw4s7uH77LWcPWttzCPQ7RBGV00wJjgRly00FfkSeOI= 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=M6BbZF1i; arc=none smtp.client-ip=209.85.210.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="M6BbZF1i" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6e6d089f603so4378a34.1 for ; Wed, 03 Apr 2024 09:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160366; x=1712765166; 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=L/WrVMZ2OFN2dz7GiYX41gzqzblVTskW2G6GEXirRpg=; b=M6BbZF1iKBoTCOQBM29cJaTtcBswCUByJbjL7WOO9fZtOPU0lFS+GZQjJQQxXnM3kg fRXewe42tF37cd7ZdCGvgj2RkQqfxakK+pcIHW0EiivEJoKuf4sO7iQ/52kFBRDrU6sm AzlrHiG7r6jOD3S/Q0IxyikuH55bZTR/n0lbul7QQ7OCSklFPiHv0QjpONiq1uOxVpK7 iWUXnLBv+Eff3h6S91SFC2JtU2JBzgcIVXvTQjQ4UPY8igp2sserDp6fnqj34WLaLECR +mJ3Lbl2z3uAN0/OPh9H321iUQ6QogupJuxmyb2RMtXGlCSsMTev5YqqdrlmoBkZpQko DNxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160366; x=1712765166; 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=L/WrVMZ2OFN2dz7GiYX41gzqzblVTskW2G6GEXirRpg=; b=BwDTYD9K6hvq6D7QD6bkznn2FNJR84ofsKCqihbCx8CapNiOJ4PKvAJ4Wp0wflGc/Y vrQxrF6EIrUzNEtYYVCRt+gIZ1pCBIMIEdac1Wv/GmiVLcqsjFo1hPSCKPKCkKyJV7Ah ABTiK7HrYqHwOy69YTncPB1Q/CePyLRo9hMMbwNTaOe/MZoyFzkxuB565ORxmZeUZCXs E/etYf2dTgNWfVyN82nnfY3NQ7iMMjXLe0V/IuGfOhH90u6YxAfwCMvjc79ZWL4+uh+r TXNb6X5hUEJg3EsYoq4K1V7lZUuopYjmsUP6Vi/zO44GkSmjcWdZnbTa4/ubTVy3oKAe E7vA== X-Gm-Message-State: AOJu0Yw2vOGHkCWOpAQtBxSoaKgLEbEdyvjbYC5FGLlNqmPYYG0VZXlC NK1e7eOYtv9tpaNUEo8x5EfAnn1DdGnLWoPlW7oTBWPeKXhGwQJZNjbnL1Mg X-Google-Smtp-Source: AGHT+IGEZNbZPpr3cUwJK7tJv3xEz8TBtlvlSDZZHswIVFOrqPeDh7KPXT78PmfQpsGItipahArUjw== X-Received: by 2002:a9d:6d98:0:b0:6e6:9422:d70c with SMTP id x24-20020a9d6d98000000b006e69422d70cmr16937148otp.17.1712160365014; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:04 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 08/14] provisiondb: Add tags_filter support Date: Wed, 3 Apr 2024 11:05:31 -0500 Message-ID: <20240403160557.2828145-8-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 | 54 ++++++++++++++++++++++++++++++++++--------- src/provisiondb.h | 2 ++ tools/lookup-apn.c | 2 +- unit/test-provision.c | 15 +++++++----- 5 files changed, 57 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..6a913d8d1540 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,54 @@ 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; + + n_matched += 1; } *contexts = ret; - *n_contexts = num; + *n_contexts = n_matched; return 0; fail: @@ -374,6 +405,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 +468,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 Wed Apr 3 16:05: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: 13616435 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.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 AF268149C48 for ; Wed, 3 Apr 2024 16:06:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160368; cv=none; b=ix342dNGpwGD8n8ztGVAvH9a9/Nqhw+EVLim9aG4aIaIJnCAcwSFm/Z5hHBuFvT1uAoS6Da4S8Plz7ozAjpsIA7ZfUPSbpfCJo+ZauzyfQJ7gufj21eXdE2BNTWYnOHQq692YiBoNkSueQhf2fFdWaAYNyZEy4DTRumtD99slZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160368; c=relaxed/simple; bh=puDK51IZNmptQzOyxED4XtoZxV2LzQQk/y+n2KNzKKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W9VXsCGN3TPd0DlUdCnWxv5g2tILJSd20kCB5Iiy1tD0+t5FryRNWDeLO1cViEdmjMDqOs/1WlrrtuFRbENFVz42KF7i8VDB8Shky6O9p2QAKdGDX0G/k+i5Iam5jpYdZa4edpUWW1pwbRchKoq5IWubR0ZcwhgMn/KOLXjvNpM= 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=WIbAr2q6; arc=none smtp.client-ip=209.85.210.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="WIbAr2q6" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6e695b7391dso5003a34.1 for ; Wed, 03 Apr 2024 09:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160365; x=1712765165; 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=WIbAr2q65TBTqbr6Ws2HDJ6ovl12saXqiclSkZ6qEDv1XfMvup5z0MmRI9HbIhw4eY 8gkdxSMPbkjBRklH87mIgVDmi9uK10j8F7o2w6JaXkmfo1tYhXEw6WgNiu9Iz7DF4iaa yXpaS6yjAku7bdyPzIjH5htJvxdkYZ7Lmeo1TfgXelsNa4tXh0ogn4QSsUU4nZCXgh3s RG8cIA00yG3qi0GsoIXDZBr6pPi9hBek63feMeHbqoWaNr+6Un9roN1SN1A2BMGqqTnB tPI49xldyHweroD1nqhYgYBGbj4T0oFtUofnNNU3Obi4hQwSiveHaVH55mGYH/cVfxkA 8MNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160365; x=1712765165; 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=O5XdLoY7oaO91SomZN3ZfqDJYFf+R3YmwuY9l5ONypkjVKmzSXjOI8sPX9y/2zZdNi k/COntSk4uBhYPnw/nmJKlTvi+7sqph3Fo5FdqYqx1upo9Nqe787H+ZBbzsKVE8y/x0J gni9Mw+vDsj9h9EHDXzXlhEXj9RHeTOT+0njGS9dJIK5VzYC/mFcJAHcu5KPEIKbvpZL ue5csWU0pUjBEuzxL+0bBC0utJpsKd3iZSw5nUdzQzFqfqwPPVFbW9vge3Css9hZkN8g 7iV6ekxEpOHYVeAV/vB9XG5nSsCCbkBvmYp6afyyGkMOKeljExFt4rzxV/VTzw4tRLSs 8Y0g== X-Gm-Message-State: AOJu0Yw/8hCrG2GQIBe3BJJyjFeqSGQY0HPME6QWXdgVPDoZKPdzT7JP atmjBD8XA+1A0pxtwB2HxqkSwNkNSiPwTqGG6ybHOcr0Es5MTE+9lNTS/AtV X-Google-Smtp-Source: AGHT+IEeibc2qm+DaltVWf1Mpa5tD17jXmYkoj9+C95bH+CxkxtcM04vZAxIjBgYG9SWzKt+qjedHA== X-Received: by 2002:a9d:7603:0:b0:6e6:6d42:c61 with SMTP id k3-20020a9d7603000000b006e66d420c61mr3347207otl.16.1712160365561; Wed, 03 Apr 2024 09:06: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 a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:05 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 09/14] tools: lookup-apn: add support for optional tags filter Date: Wed, 3 Apr 2024 11:05:32 -0500 Message-ID: <20240403160557.2828145-9-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616436 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 5C63014D2BE for ; Wed, 3 Apr 2024 16:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160368; cv=none; b=BrZ+sSAphV2s7Mucbj7Lwq3JtkXHXxI1DlFZtdbDhTT8hVAb2eTbKGPPPuCiTnxBgo/g+TrVXAn0mej68jf/Jtb8UWHh5/7uMdf4WzuPC6CBnBMXt88zxLyIks62xcoyar0QGykiwg/c3Zu2OrHOOFgHlXiKaVaRM1V51ryXrqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160368; c=relaxed/simple; bh=s0Bv3UA2qC7Y73LHPGb39vKsBvBr50BYguKrJo3XPNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XZma0RgFQ1lAcZtN0brTwpoGtoQhEXSQVkTTPBkQlbEvYH1QDgbLf08D9m0ClKceB1CdQhQTJwuOaBwnMrjaXc290qgaPo+eWhLBvXKH8qHSiUKPwvQJ5KGjd93WC4pClcjiPkdg66Q+MrDc+bf52o8U1oLT+8j2kz6CAhyrhYo= 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=QYMKQkvn; arc=none smtp.client-ip=209.85.210.42 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="QYMKQkvn" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6e89b6daa1fso12972a34.0 for ; Wed, 03 Apr 2024 09:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160366; x=1712765166; 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=QYMKQkvnXCQ6hWi9gssxFhi+NVPeEc0V5vYfcFhw6esMGu1lNBe83WVNEMA9sONC1n GUPHh00ueyXB5agPx9fviMUlnW7us89qbNfqPF/6X1Nqx8IcBbyWDcxd8BJaHXSIG4DN o19v7ddWPep+hXHm8i32EYXSfT637g+Bz5CZSxptx8JJ3PpfLeEaTny/pu8TmE388fvU wXA3k6gPsSVJHTkLNUOKbCEYV7HaGVH/MmS2HypNHXI+zb/5YR5xRfLjwH4t4asronq6 oy5iHlo5kfT+Tt9lwhEqH7eh5bLagGEkxq1EWwAdlwBW0Wylhnmj17Rlkd8rPxYTzt92 Pe4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160366; x=1712765166; 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=aRTCCdD94rSPsmyrIw70Hrzfcl0FtYH0sE7jBphAo6iZgLRKApcU1dBDFisicwj0cJ 4agQJLOZOdyGi6SFPLVOt4/1zT2k0YqVyhUj3deS3MmSuaWqu3RmmpnlhxwKRoqonEdA ThdXL34dZh0P9eEBIZM/PeRDqWa+Z7IYbZyMALa/Hu8kSwh4pLqm9pTNF5TI3eK8aURF JPYYHULJDkggLmwE1eixgbj+dVahyjLkkBYiVq4AYZgXKLaEdj9GXv3yCYbxh+M+eiyn qXei2OvxTiBTR/p+6Lo9FA5VY/Gmydv6av8TJZJSlPfxr+pfxPC/B2Iqmr9siYgnYZa1 E3uw== X-Gm-Message-State: AOJu0Yz2F/NZMbfE/OmVE0rkw29+WCw29gvcGGvvli1ArMx921OXZ3zI RTQQcSi6/2PHiFTTfsB9TI92KVtm0vXz9d1DuS9KmQhUw6QG2hTeq5L9Ftty X-Google-Smtp-Source: AGHT+IEdSqkhuwP6M3/9Rfw/tkdq2BB3+lx+Dca0sEi0FLy7FtNq/A5rbyEXDjBjDKoSFlmLT+iL3w== X-Received: by 2002:a9d:5e88:0:b0:6e6:a1c8:d035 with SMTP id f8-20020a9d5e88000000b006e6a1c8d035mr16925395otl.0.1712160366209; Wed, 03 Apr 2024 09:06:06 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:06 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 10/14] data: Add tags for AT&T and T-Mobile contexts Date: Wed, 3 Apr 2024 11:05:33 -0500 Message-ID: <20240403160557.2828145-10-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616438 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 0A6AA14D6F3 for ; Wed, 3 Apr 2024 16:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160369; cv=none; b=a6z+rWyr+//fi/m3geUDO3qQig88rfw1U/FwqXXZ8lFoYqxQ1S4gBxe3qi/OVPeAiR5IQ1vn7GgxswzlLKtcFJTHOqoCT2WTJp4VnfH1rMij5EpuuRdBotDyFIU/Umc/b1OvoOmLK8WunP9I30DlEhm2y8igDXR6GhlWq+i3AvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160369; c=relaxed/simple; bh=2yTKEfhHkIg/up3+wwOAaK9J2AR5AvDliW+mUFBk/mo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IbXtbhl7k4BWDwwdqKYlVwuRjhuepLCqNCjptdPFj/3b9oVFBNwzXNFAeH46l9znGd8iqnTycD1NWXgbcrL961vSkA6iBZNr9bVKTMzuOyQoqyFF6wV8cJsfdfvIUdEmlPiuqhrlTHqVHiOJpfoG+kyRGdHF2SAsXW7N4pB02nE= 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=XFMih97S; arc=none smtp.client-ip=209.85.210.49 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="XFMih97S" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6e125818649so3692a34.1 for ; Wed, 03 Apr 2024 09:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160367; x=1712765167; 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=mNuhAYPkpRIdVqTtTC2kKgQAxbnzz0Rcmel+VCHhK/A=; b=XFMih97Sah1sLX9IfZKR3C491eJpi1Sk3G8x5bkcygAMm1MzfhPUeuyCm5rgF9rfDy yHyliULJUMcPaicmHA+22D2ox2VLOtfT3v4UdOIYiTtiLFdodlu/ey1FL8D89LQCSAWP RYBGwya+Ndt7t0o7BfUJ2/1hjv4z8JQMm5Y+UMipXihjtjaC/c5vIE3syNPoms3n0PJw 41+/vnUQnrHH9XahGSZ77cD2lu2LO+PFRwM87F0jgk6KOUrJhJTMprzmnt1fRIr9V4gZ IRZoNg2cUeagxQANBTPZip2mV9H4CybMDAQyCNIy/XoOamC3a5LWoAfdy2KA1YXpVT2r DEcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160367; x=1712765167; 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=mNuhAYPkpRIdVqTtTC2kKgQAxbnzz0Rcmel+VCHhK/A=; b=xPoE38nGEhZJnwDjljlR0upTh10b1bWZqjLxpQH2h0jJFb0Wxahsjhcu9/LvkuKezR jEoIfFjBISIXOQrVCnBCoeGEEUH8Xz8vAphn/LSFm9DOE0NlKH5+DeBpVbPXamA/xPXX O4ghQ5RM2AesJv7adZSV9dZYn9SfGs86cXKoli5PaTptbUgHf5NdT3n7ovF1akRyokap Jzc7BdhgGjpd2TslzK0PTwJst9CPIHqKXWS6N5ax0DaMmDl4VONk5zSq4XrgHP9+55kI QzAJMCUTJuXOYgnnsrVdeUHkyHzDwxbDmNt/6LrF67msFIfd+BN3bQQsIRPs7vvMU8mq UXvA== X-Gm-Message-State: AOJu0Yx/CKxbc/6JwABFmFsiq9BaGmT2OL0IghC8I4kd4RsPWj/GDqTv qqg0OwSVVZMITbsELVvBcyvfUSpOBBuRLGasJUn2CufqOJ8QE7LevtRjBG1H X-Google-Smtp-Source: AGHT+IGIZb5VvS1yKqYTfU1r0MHeR+rQBMqsPgac1aBuSYT+xSinYkz7sVT4ZOK0OI0tCRVQzpBrCg== X-Received: by 2002:a9d:68c7:0:b0:6e6:8ec7:85d6 with SMTP id i7-20020a9d68c7000000b006e68ec785d6mr18190005oto.31.1712160367045; Wed, 03 Apr 2024 09:06:07 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:06 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 11/14] ofono: Add support for ofono main.conf settings Date: Wed, 3 Apr 2024 11:05:34 -0500 Message-ID: <20240403160557.2828145-11-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 | 32 ++++++++++++++++++++++++++++++++ src/ofono.h | 1 + 2 files changed, 33 insertions(+) diff --git a/src/main.c b/src/main.c index 141853eef8ae..6dd073b4f31a 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); @@ -291,6 +321,8 @@ fail_module_init: __ofono_dbus_cleanup(); dbus_connection_unref(conn); + l_settings_free(ofono_config); + cleanup: g_source_remove(signal); 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 Wed Apr 3 16:05: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: 13616439 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (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 C033114D295 for ; Wed, 3 Apr 2024 16:06:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160370; cv=none; b=UZanVgKYbgqtXCpIbhS2ZSbdi/+3V+WAPAbeY1fJXwtYx4ZDPvhNHExlIHLQau5URTJRHm4zIwxBu8YzYD3d3X0TkPxcbubdfkF5oOqB/rHsZLqRRrjnyE4CfZQqN+U1Wz+K/Bi9cloYmvT0WLnT7/Nl/nd3/rq7NuGyETVHsEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160370; c=relaxed/simple; bh=VIVvtDsq+G5WYkgS7BSz4Z7jw6G1tAM7WGFCd31MXL4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NjuMgR3JTz/aEoR2PUGGk3ZzK0+Y++IkzpGw47Zw2q6Wa2mOikrviYuMudNoZ8Bn88/VYEcCHfk/8ozcBt4EjiURUDPcKH6sB/y29cqJp7cPmHz7UUzggotaVgBqTiQ0j+2cfqg/SCLcc5rsXrxrQA0k98/FoSMFIk1cjPYWZj4= 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=X/ligH7V; arc=none smtp.client-ip=209.85.210.47 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="X/ligH7V" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6e67d42422aso12676a34.0 for ; Wed, 03 Apr 2024 09:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160367; x=1712765167; 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=X/ligH7VRI80G4GQHuUMBHsog/3Bub5QTA0uN+IVEmjrKPzLZpR4eL3srxENMUNs/6 MH/cFDf6nY8/r6DAd5vKJEiTM4bSl81sEUZO5Yzc87dMnecqg3LXha/TugrYH/BCIyl/ lhNSPtpnccQ9uxKioeeM40sa9puJWrAsgHg9BJ38eY6lXgLgVgkDwqhwFh9//q4q4nNA K8pb/4A12ENJK6SiZ6DDSnekh9FrxwJO8tppet6esb0A2U9stILCCxEOepmyxp8SsaM1 mMAqq40qgLu86fmYvDHMTFEG5wgEJyhjInBqzyoAxqz53M37MQtOnioYs/oOfEGoNd8n rmPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160367; x=1712765167; 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=nSS07XFj0/2VMDunrxw2PkJ/bCoemN6V4rVBWDujIZ9ieD+XYoJDn2WrvfZXBU9s6Q EbG2AhOlolbs4AXT6Nd2EPKv8DOoIfsgRCtrX/wdkkvyRMtla/XSJODT53Q7C8AzIXJa Ke2qItqmI447XwsxgjepCiAcjftLJBOPcSEXG6rITG/lpLrQjG7z1Va7p/KEvRFJLoab yGMztiDg7/V/2/rnMa+svZ3HWcRnaubqLPClwomFB5ay6EWdP+/n93N5GnOX2gWqHXEy SXtZDYO8UaLpvo3JSv/IRAUSg32wNSEz+j7pzTDX0cfwLxPTLpgXHpLlwDIhAZ4s48nw LsnQ== X-Gm-Message-State: AOJu0YxdSITmzrXGZQbZisiXSas1mV+q2PXtQHDgvvKBTZLvDEKBxQfk PSv1Z6kByfh/cWb0ncDajGlqd5AK1gTxEJcLISmPTEBT9KRTzkTQgWQN63n4 X-Google-Smtp-Source: AGHT+IGmTGUwPzVRy8EzOUTCiCCfEF1V7CKF6mAGDAt8jOtlpikybDlRF87Y8IkMfcaiy4/dp4WTUw== X-Received: by 2002:a05:6830:6e93:b0:6e7:39ab:a96b with SMTP id ed19-20020a0568306e9300b006e739aba96bmr5047967otb.24.1712160367585; Wed, 03 Apr 2024 09:06:07 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:07 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 12/14] provision: Add support for provision filter tags Date: Wed, 3 Apr 2024 11:05:35 -0500 Message-ID: <20240403160557.2828145-12-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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 Wed Apr 3 16:05: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: 13616440 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 1823714C58F for ; Wed, 3 Apr 2024 16:06:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160370; cv=none; b=EKEJ2iBXFyle1nIL5rygh/Un1k36X2m9mJszzpfP/i/kAvkDsVuBf/R4LkoFrB/pWdGMPQtmaoG/pObi6PpHttIa8FTKp2nbKo7e50Bzc4dTMYlGiiGM0q1ibHFkSY6YlzAhvs+R2d5994o2982tUU7ufKUaQtapX7pOgzdXwUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160370; c=relaxed/simple; bh=085LurbDsqYJZoVhOWwzdvbDxgGMMCSO99X/YXkJfm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IF2lCbJbLei0EuD0si/AST9KBMrx179AiEIv4UV/66AedqOccJ/r1vSKsVWLVpMs54LP6tezCPC5GQvN3lWh9o95yNZKUT4256xcFPQbKX28TBsia6dCDOIVdgsjyH7je8fncvOf5Dj8tnEQYdVv81PMW3oypD4MROkkRNRIxBI= 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=aN5jIN6P; arc=none smtp.client-ip=209.85.210.46 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="aN5jIN6P" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-6e6db4dfd7aso4742754a34.2 for ; Wed, 03 Apr 2024 09:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160368; x=1712765168; 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=e3W8hK2fzJFap+B9VWDMcag62JPy0hq4rvzBgjbA9Y4=; b=aN5jIN6PH67PkM+BfYRmQxSD3NEBkzBRxRfnvExgbIENYKE2zvRB+CmofWDZORGPFQ HrME5YK6wK89OvovlnwpzqAeWLXnj3spmrxQjMpNeyCzBIlUIxuXGZQvXw3EXixTIDiI flXGPhzCxLQac2bM0UUNVq0fShyv2KBkG1kJ72dSs5cxFJjNN0Spys6v/Oyb5PSIYMEB S99CNNVaZgX2AFGXwgURSfkz2GeCh2ERn+p4fq2/VNrZgYzZg1zknfFifY5BB6vhMCPx R1zrzSrKb8Vm/eqXciSBER/CtV6NbDbbGgIFBiR9ilVCI8XgXFXKhP7Du3VuE9JnWPnF LRLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160368; x=1712765168; 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=e3W8hK2fzJFap+B9VWDMcag62JPy0hq4rvzBgjbA9Y4=; b=f2cTMfQWRHtbfjc5pDZRevXZQWoOjeT39bXfGo+lXkRPueqGS/OxrtirfDnDC6FDCE N50V7o/e6+rKCeaIUClwxG/W6ZohzEUjUsBhEnGX6ntsT5Auj+IpBEptX4EBY0m9pzZB KWd6h4uR/TS9Wzpziaoz97kseEMcozDWEPRfAjLrkgV8q8KyZAE4cJWL9sB3CHnFjDnV rAp5CUZRLzuuSv0OCmk56v/T5u703EPOL0EDICiPJmcQ9nvYiGocME/F9nUy3v/d3Zqz LTsUuWJ4t4AAO34N0saHz8g35LK7WMW/Ogce/RL5zpgX5L8TxoTmIEAV1YaFgYYlBvHr 5xYA== X-Gm-Message-State: AOJu0Ywtw1gXzHF60Bj8UymzES+iHmQu8uX4eKbChPbqb3wgmIaZuJuv PBieFMv+aKhCcyq251/1oh0aOTCJIu+cllAUPa9VCOwUUQ+WHfv5IbIT4rf7 X-Google-Smtp-Source: AGHT+IFYmA5jF9o4Tvpjpl5WsaniPD0/XWzlqlm9qStlKT6N5VOZiuSAkCmVcYQF3w+TWNdMAJnKtQ== X-Received: by 2002:a9d:7d92:0:b0:6e6:af64:3581 with SMTP id j18-20020a9d7d92000000b006e6af643581mr17923492otn.12.1712160368189; Wed, 03 Apr 2024 09:06:08 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:07 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 13/14] examples: Fix use after free and resource leaks Date: Wed, 3 Apr 2024 11:05:36 -0500 Message-ID: <20240403160557.2828145-13-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-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..927cf1fa8b0e 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", From patchwork Wed Apr 3 16:05: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: 13616441 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.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 CAD0614D6F3 for ; Wed, 3 Apr 2024 16:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160371; cv=none; b=FKIDEe5GsMejiar67NB7+H9+PcLWXCBwfTZ11oZxEyr+plnEvCZW7rD/4VZZRGFqv5NjODyIcJmGZgkgbFRoO9/B1zr6nj2BZv7O6/EyYkUm98fCOnNXmhjr8wvtSXJfOvfg30D5CaVn//w7CHJQejr2nLmmWY8WRFExOKmOYCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160371; c=relaxed/simple; bh=Ni2eKAPrhadS+t2eupfN/yqehpuQqsHi06brvXa562g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uvkbmKPaO8gfEQp3c4YqzFsLYJe732B/zoxNhz1Qm2PR/hWYYO1S5CaWns1X/Kz/NCTAnW4+KayCsGCZjuG0BMdSonDddU3U/Ma8FJawVNd9ZHD8wCcBWc4WUpUDma8tIFGPY8W0ENJwtmCFcQNJTgAHr7YCGzFO+TJ4waKrpQo= 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=MR9hxlXd; arc=none smtp.client-ip=209.85.210.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="MR9hxlXd" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6e9de355513so3074a34.1 for ; Wed, 03 Apr 2024 09:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712160369; x=1712765169; 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=Cz2HF2DC/Rfz2rRCK3lbTYsSKMT3bB6AMNf8f4S96wE=; b=MR9hxlXdOlx9g29CwhXYv9gKUKvWzaoGzfti0Exh5anIDB9CksltRzx7NjEaGMGi7i XEIjBug2q0p04pt4JB6g9AHVdutxcy0odKgOXCabxRQhFT9PjCfIOu6FBVaTAPqIv4iA GOFGL3HjoPTWjaj0X70SnGkthkvZz8eAO4n1Hn5quoMMwasjpUMZ0oVx8xv8708CZCy/ xhiTStx5LoE0vuwUiZ+kUo1FjC4oaTqUukxOOsfPcx/L3iLqKE3gU63L8UBMiGtCztFN lyhH2+fELDVP5EekbLgeVf5H/qeNS9oP18lqOMd0gasc4jfwl6PjVEYBVRmdGKP/rz2S SEDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712160369; x=1712765169; 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=Cz2HF2DC/Rfz2rRCK3lbTYsSKMT3bB6AMNf8f4S96wE=; b=uHn9WEqVfQ1iVFZ2BZjkAhKKbSbEyRkLCKnpDO98HOSOR6yRn0IXgj6nlse6ZwOnyk J7xImDjaQm7fzDO1aL1niIJDD1PuHAD8SKk+Rz06/wfWU+2bbp3XUKrikGJs2aSwANfq ol5JFPhDJQA8tepwX6kBOkJOtIWVxCVWwx+aOdP9BpldOAVmh3xWzh1zeZcNzaqLmVlj R3F1a6XIgiqhEa8SCEfsqONa27FrqB5GgzgYTEXgwvimOy6cqQA6z9/vcEWG7MybZM/M un7Au6xrirSEd5x5Sj7GYKG8+9upQ2zdCDE4A4ci8ojRefVteWodhzbmbBRYa4bQFw4R j1GA== X-Gm-Message-State: AOJu0YyI1qAKxI4m/5LcEwxnBHbfkcR3xQ7+aNEiQloIYI5/QyekHCAE MstPk4un5fx0OsOJTlSlwvUUsdi5jJc0FTGSeG6x5qVKq5itckysJ6XYBDd/ X-Google-Smtp-Source: AGHT+IFUiVXr9QHyao/oS4CIeRKGblx9CItOoMjmp4sdCYwA6zMnOBmqgj1VxqKGd6ZOXntn+ENKmQ== X-Received: by 2002:a05:6830:32a8:b0:6e7:6ac:2442 with SMTP id m40-20020a05683032a800b006e706ac2442mr16901588ott.24.1712160368728; Wed, 03 Apr 2024 09:06:08 -0700 (PDT) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id a15-20020a056830100f00b006e6b018a703sm2653635otp.79.2024.04.03.09.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:06:08 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 14/14] unit: Add test cases with tags_filter provided Date: Wed, 3 Apr 2024 11:05:37 -0500 Message-ID: <20240403160557.2828145-14-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com> References: <20240403160557.2828145-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace the XYZ operator contexts with a set of two. One tagged as 'lte' and one tagged as '5g'. Add logic to the provision unit test to support filter tags. --- unit/test-provision.c | 37 +++++++++++++++++++++++++++++++------ unit/test-provision.json | 10 +++++++++- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/unit/test-provision.c b/unit/test-provision.c index b80f4d80fa0e..d251f31b148c 100644 --- a/unit/test-provision.c +++ b/unit/test-provision.c @@ -57,6 +57,7 @@ struct provision_test { const char *mcc; const char *mnc; const char *spn; + const char *tags; int result; size_t n_items; const struct provision_db_entry *items; @@ -114,7 +115,7 @@ static const struct provision_db_entry charlie_contexts[] = { }, }; -static const struct provision_db_entry xyz_contexts[] = { +static const struct provision_db_entry xyz_lte_contexts[] = { { .type = OFONO_GPRS_CONTEXT_TYPE_INTERNET | OFONO_GPRS_CONTEXT_TYPE_IA, @@ -124,6 +125,16 @@ static const struct provision_db_entry xyz_contexts[] = { } }; +static const struct provision_db_entry xyz_5g_contexts[] = { + { + .type = OFONO_GPRS_CONTEXT_TYPE_INTERNET | + OFONO_GPRS_CONTEXT_TYPE_IA, + .proto = OFONO_GPRS_PROTO_IPV4V6, + .apn = "xyz.5g", + .auth_method = OFONO_GPRS_AUTH_METHOD_CHAP, + } +}; + /* Make sure mccmnc not in the database isn't found */ static const struct provision_test unknown_mcc_mnc = { .mcc = "994", @@ -204,13 +215,25 @@ static const struct provision_test lookup_charlie = { }; /* Successful lookup of XYZ (MVNO on Charlie) */ -static const struct provision_test lookup_xyz = { +static const struct provision_test lookup_lte_xyz = { + .mcc = "999", + .mnc = "11", + .spn = "XYZ", + .tags = "lte,unused", + .result = 0, + .n_items = L_ARRAY_SIZE(xyz_lte_contexts), + .items = xyz_lte_contexts, +}; + +/* Successful lookup of XYZ (MVNO on Charlie) */ +static const struct provision_test lookup_5g_xyz = { .mcc = "999", .mnc = "11", .spn = "XYZ", + .tags = "5g", .result = 0, - .n_items = L_ARRAY_SIZE(xyz_contexts), - .items = xyz_contexts, + .n_items = L_ARRAY_SIZE(xyz_5g_contexts), + .items = xyz_5g_contexts, }; /* No match with for an MCC/MNC present in the DB, but no wildcard entry */ @@ -224,11 +247,12 @@ static void provision_lookup(const void *data) { const struct provision_test *test = data; struct provision_db_entry *items; + _auto_(l_strv_free) char **tags = l_strsplit(test->tags, ','); size_t n_items; size_t i; int r; - r = provision_db_lookup(pdb, test->mcc, test->mnc, test->spn, NULL, + r = provision_db_lookup(pdb, test->mcc, test->mnc, test->spn, tags, &items, &n_items); assert(r == test->result); @@ -270,7 +294,8 @@ int main(int argc, char **argv) l_test_add("Successful lookup (Alpha)", provision_lookup, &lookup_alpha); l_test_add("Successful lookup (ZYX)", provision_lookup, &lookup_zyx); l_test_add("Exact match (Charlie)", provision_lookup, &lookup_charlie); - l_test_add("Exact match (XYZ)", provision_lookup, &lookup_xyz); + l_test_add("Exact match (XYZ)", provision_lookup, &lookup_lte_xyz); + l_test_add("Exact match (XYZ 5G)", provision_lookup, &lookup_5g_xyz); l_test_add("Exact math (no match)", provision_lookup, &lookup_no_match); pdb = provision_db_new(UNITDIR "test-provision.db"); diff --git a/unit/test-provision.json b/unit/test-provision.json index 61d060ad4def..fcf82a67bb67 100644 --- a/unit/test-provision.json +++ b/unit/test-provision.json @@ -85,7 +85,15 @@ "apn": "xyz", "type": [ "internet", "ia" - ] + ], + "tags": "lte" + }, + { + "apn": "xyz.5g", + "type": [ + "internet", "ia" + ], + "tags": "5g" } ] }