mesh: Inclusive language changes
authorArchie Pusaka <apusaka@chromium.org>
Wed, 15 Sep 2021 08:32:07 +0000 (16:32 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:37 +0000 (19:08 +0530)
According to
https://specificationrefs.bluetooth.com/language-mapping/Appropriate_Language_Mapping_Table.pdf
"flooding", "accept list", and "reject list" are the preferred terms.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
mesh/net-keys.c
mesh/net-keys.h
mesh/net.h

index e0060df..ee7bbf0 100644 (file)
@@ -45,7 +45,7 @@ struct net_key {
        uint16_t beacon_enables;
        uint8_t friend_key;
        uint8_t nid;
-       uint8_t master[16];
+       uint8_t flooding[16];
        uint8_t encrypt[16];
        uint8_t privacy[16];
        uint8_t beacon[16];
@@ -53,7 +53,7 @@ struct net_key {
 };
 
 static struct l_queue *keys = NULL;
-static uint32_t last_master_id = 0;
+static uint32_t last_flooding_id = 0;
 
 /* To avoid re-decrypting same packet for multiple nodes, cache and check */
 static uint8_t cache_pkt[29];
@@ -63,11 +63,11 @@ static size_t cache_plainlen;
 static uint32_t cache_id;
 static uint32_t cache_iv_index;
 
-static bool match_master(const void *a, const void *b)
+static bool match_flooding(const void *a, const void *b)
 {
        const struct net_key *key = a;
 
-       return (memcmp(key->master, b, sizeof(key->master)) == 0);
+       return (memcmp(key->flooding, b, sizeof(key->flooding)) == 0);
 }
 
 static bool match_id(const void *a, const void *b)
@@ -87,9 +87,9 @@ static bool match_network(const void *a, const void *b)
 }
 
 /* Key added from Provisioning, NetKey Add or NetKey update */
-uint32_t net_key_add(const uint8_t master[16])
+uint32_t net_key_add(const uint8_t flooding[16])
 {
-       struct net_key *key = l_queue_find(keys, match_master, master);
+       struct net_key *key = l_queue_find(keys, match_flooding, flooding);
        uint8_t p[] = {0};
        bool result;
 
@@ -102,22 +102,22 @@ uint32_t net_key_add(const uint8_t master[16])
                keys = l_queue_new();
 
        key = l_new(struct net_key, 1);
-       memcpy(key->master, master, 16);
+       memcpy(key->flooding, flooding, 16);
        key->ref_cnt++;
-       result = mesh_crypto_k2(master, p, sizeof(p), &key->nid, key->encrypt,
+       result = mesh_crypto_k2(flooding, p, sizeof(p), &key->nid, key->encrypt,
                                                                key->privacy);
        if (!result)
                goto fail;
 
-       result = mesh_crypto_k3(master, key->network);
+       result = mesh_crypto_k3(flooding, key->network);
        if (!result)
                goto fail;
 
-       result = mesh_crypto_nkbk(master, key->beacon);
+       result = mesh_crypto_nkbk(flooding, key->beacon);
        if (!result)
                goto fail;
 
-       key->id = ++last_master_id;
+       key->id = ++last_flooding_id;
        l_queue_push_tail(keys, key);
        return key->id;
 
@@ -126,11 +126,11 @@ fail:
        return 0;
 }
 
-uint32_t net_key_frnd_add(uint32_t master_id, uint16_t lpn, uint16_t frnd,
+uint32_t net_key_frnd_add(uint32_t flooding_id, uint16_t lpn, uint16_t frnd,
                                        uint16_t lp_cnt, uint16_t fn_cnt)
 {
        const struct net_key *key = l_queue_find(keys, match_id,
-                                               L_UINT_TO_PTR(master_id));
+                                               L_UINT_TO_PTR(flooding_id));
        struct net_key *frnd_key;
        uint8_t p[9] = {0x01};
        bool result;
@@ -145,7 +145,7 @@ uint32_t net_key_frnd_add(uint32_t master_id, uint16_t lpn, uint16_t frnd,
        l_put_be16(lp_cnt, p + 5);
        l_put_be16(fn_cnt, p + 7);
 
-       result = mesh_crypto_k2(key->master, p, sizeof(p), &frnd_key->nid,
+       result = mesh_crypto_k2(key->flooding, p, sizeof(p), &frnd_key->nid,
                                frnd_key->encrypt, frnd_key->privacy);
 
        if (!result) {
@@ -155,7 +155,7 @@ uint32_t net_key_frnd_add(uint32_t master_id, uint16_t lpn, uint16_t frnd,
 
        frnd_key->friend_key = true;
        frnd_key->ref_cnt++;
-       frnd_key->id = ++last_master_id;
+       frnd_key->id = ++last_flooding_id;
        l_queue_push_head(keys, frnd_key);
 
        return frnd_key->id;
@@ -174,22 +174,22 @@ void net_key_unref(uint32_t id)
        }
 }
 
-bool net_key_confirm(uint32_t id, const uint8_t master[16])
+bool net_key_confirm(uint32_t id, const uint8_t flooding[16])
 {
        struct net_key *key = l_queue_find(keys, match_id, L_UINT_TO_PTR(id));
 
        if (key)
-               return memcmp(key->master, master, sizeof(key->master)) == 0;
+               return !memcmp(key->flooding, flooding, sizeof(key->flooding));
 
        return false;
 }
 
-bool net_key_retrieve(uint32_t id, uint8_t *master)
+bool net_key_retrieve(uint32_t id, uint8_t *flooding)
 {
        struct net_key *key = l_queue_find(keys, match_id, L_UINT_TO_PTR(id));
 
        if (key) {
-               memcpy(master, key->master, sizeof(key->master));
+               memcpy(flooding, key->flooding, sizeof(key->flooding));
                return true;
        }
 
index 70b3d22..420618f 100644 (file)
 #define IV_INDEX_UPDATE                0x02
 
 void net_key_cleanup(void);
-bool net_key_confirm(uint32_t id, const uint8_t master[16]);
-bool net_key_retrieve(uint32_t id, uint8_t *master);
-uint32_t net_key_add(const uint8_t master[16]);
-uint32_t net_key_frnd_add(uint32_t master_id, uint16_t lpn, uint16_t frnd,
+bool net_key_confirm(uint32_t id, const uint8_t flooding[16]);
+bool net_key_retrieve(uint32_t id, uint8_t *flooding);
+uint32_t net_key_add(const uint8_t flooding[16]);
+uint32_t net_key_frnd_add(uint32_t flooding_id, uint16_t lpn, uint16_t frnd,
                                        uint16_t lp_cnt, uint16_t fn_cnt);
 void net_key_unref(uint32_t id);
 uint32_t net_key_decrypt(uint32_t iv_index, const uint8_t *pkt, size_t len,
index 4dbc94b..465d889 100644 (file)
@@ -86,8 +86,8 @@ struct mesh_node;
 #define PROXY_OP_FILTER_STATUS         0x03
 
 /* Proxy Filter Defines */
-#define PROXY_FILTER_WHITELIST         0x00
-#define PROXY_FILTER_BLACKLIST         0x01
+#define PROXY_FILTER_ACCEPT_LIST       0x00
+#define PROXY_FILTER_REJECT_LIST       0x01
 
 /* Network Tranport Opcodes */
 #define NET_OP_SEG_ACKNOWLEDGE         0x00