mesh: Replace BeaconFlags with just IvUpdate
authorMichał Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com>
Wed, 17 Jun 2020 20:26:57 +0000 (22:26 +0200)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 28 Dec 2020 06:20:04 +0000 (11:50 +0530)
To import nodes, applications need just IvIndex and IvUpdate. KeyRefresh
phase in under provisioner's control, so we don't need to expose it.

Moreover, BeaconFlags property dealt just with the primary net key, and
each subnet key is refreshed separately.

Change-Id: Ia0f878b4531932fc32ddd490eb4684fcff1c1b93
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
doc/mesh-api.txt
mesh/node.c

index e99bacb..4cf72dc 100644 (file)
@@ -433,11 +433,11 @@ Properties:
                This property indicates whether the periodic beaconing is
                enabled (true) or disabled (false).
 
-       uint8 BeaconFlags [read-only]
+       boolean IvUpdate [read-only]
 
-               This property may be read at any time to determine the flag
-               field setting on sent and received beacons of the primary
-               network key.
+               When true, indicates that the network is in the middle of IV
+               Index Update procedure. This information is only useful for
+               provisioning.
 
        uint32 IvIndex [read-only]
 
index 130bd94..bbdc1d9 100644 (file)
@@ -32,6 +32,7 @@
 #include "mesh/mesh-defs.h"
 #include "mesh/mesh.h"
 #include "mesh/net.h"
+#include "mesh/net-keys.h"
 #include "mesh/appkey.h"
 #include "mesh/mesh-config.h"
 #include "mesh/provision.h"
@@ -2174,7 +2175,7 @@ static bool beacon_getter(struct l_dbus *dbus, struct l_dbus_message *msg,
        return true;
 }
 
-static bool beaconflags_getter(struct l_dbus *dbus, struct l_dbus_message *msg,
+static bool ivupdate_getter(struct l_dbus *dbus, struct l_dbus_message *msg,
                                        struct l_dbus_message_builder *builder,
                                        void *user_data)
 {
@@ -2182,10 +2183,13 @@ static bool beaconflags_getter(struct l_dbus *dbus, struct l_dbus_message *msg,
        struct mesh_net *net = node_get_net(node);
        uint8_t flags;
        uint32_t iv_index;
+       bool ivu;
 
        mesh_net_get_snb_state(net, &flags, &iv_index);
 
-       l_dbus_message_builder_append_basic(builder, 'y', &flags);
+       ivu = flags & IV_INDEX_UPDATE;
+
+       l_dbus_message_builder_append_basic(builder, 'b', &ivu);
 
        return true;
 }
@@ -2284,8 +2288,8 @@ static void setup_node_interface(struct l_dbus_interface *iface)
        l_dbus_interface_property(iface, "Features", 0, "a{sv}", features_getter,
                                                                        NULL);
        l_dbus_interface_property(iface, "Beacon", 0, "b", beacon_getter, NULL);
-       l_dbus_interface_property(iface, "BeaconFlags", 0, "y",
-                                               beaconflags_getter, NULL);
+       l_dbus_interface_property(iface, "IvUpdate", 0, "b", ivupdate_getter,
+                                                                       NULL);
        l_dbus_interface_property(iface, "IvIndex", 0, "u", ivindex_getter,
                                                                        NULL);
        l_dbus_interface_property(iface, "SequenceNumber", 0, "u",