remote: close file on usteer_init_local_id fread fail
[project/usteer.git] / parse.c
diff --git a/parse.c b/parse.c
index 6f53b039a2e48158537b2ed51937857eeaa662a0..2aa37169e8559750aa26425c351242ed805c9d9f 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -64,6 +64,8 @@ bool parse_apmsg_node(struct apmsg_node *msg, struct blob_attr *data)
                [APMSG_NODE_LOAD] = { .type = BLOB_ATTR_INT32 },
                [APMSG_NODE_RRM_NR] = { .type = BLOB_ATTR_NESTED },
                [APMSG_NODE_NODE_INFO] = { .type = BLOB_ATTR_NESTED },
+               [APMSG_NODE_CHANNEL] = { .type = BLOB_ATTR_INT32 },
+               [APMSG_NODE_OP_CLASS] = { .type = BLOB_ATTR_INT32 },
        };
        struct blob_attr *tb[__APMSG_NODE_MAX];
        struct blob_attr *cur;
@@ -90,6 +92,11 @@ bool parse_apmsg_node(struct apmsg_node *msg, struct blob_attr *data)
        msg->max_assoc = get_int32(tb[APMSG_NODE_MAX_ASSOC]);
        msg->rrm_nr = NULL;
 
+       if (tb[APMSG_NODE_CHANNEL] && tb[APMSG_NODE_OP_CLASS]) {
+               msg->channel = blob_get_int32(tb[APMSG_NODE_CHANNEL]);
+               msg->op_class = blob_get_int32(tb[APMSG_NODE_OP_CLASS]);
+       }
+
        cur = tb[APMSG_NODE_RRM_NR];
        if (cur && blob_len(cur) >= sizeof(struct blob_attr) &&
            blob_len(cur) >= blob_pad_len(blob_data(cur))) {
@@ -124,6 +131,7 @@ bool parse_apmsg_sta(struct apmsg_sta *msg, struct blob_attr *data)
                [APMSG_STA_SEEN] = { .type = BLOB_ATTR_INT32 },
                [APMSG_STA_TIMEOUT] = { .type = BLOB_ATTR_INT32 },
                [APMSG_STA_CONNECTED] = { .type = BLOB_ATTR_INT8 },
+               [APMSG_STA_LAST_CONNECTED] = { .type = BLOB_ATTR_INT32 },
        };
        struct blob_attr *tb[__APMSG_STA_MAX];
 
@@ -132,7 +140,8 @@ bool parse_apmsg_sta(struct apmsg_sta *msg, struct blob_attr *data)
            !tb[APMSG_STA_SIGNAL] ||
            !tb[APMSG_STA_SEEN] ||
            !tb[APMSG_STA_TIMEOUT] ||
-           !tb[APMSG_STA_CONNECTED])
+           !tb[APMSG_STA_CONNECTED] ||
+           !tb[APMSG_STA_LAST_CONNECTED])
                return false;
 
        if (blob_len(tb[APMSG_STA_ADDR]) != sizeof(msg->addr))
@@ -143,6 +152,7 @@ bool parse_apmsg_sta(struct apmsg_sta *msg, struct blob_attr *data)
        msg->seen = blob_get_int32(tb[APMSG_STA_SEEN]);
        msg->timeout = blob_get_int32(tb[APMSG_STA_TIMEOUT]);
        msg->connected = blob_get_int8(tb[APMSG_STA_CONNECTED]);
+       msg->last_connected = blob_get_int32(tb[APMSG_STA_LAST_CONNECTED]);
 
        return true;
 }