Migrate to libyang2

Also update buildroot to latest master:
- the sdbus-cpp version bump patch has been removed, because upstream
  now bumped it to an even newer version

- Fix RAUC not able to start a service
(https://github.com/buildroot/buildroot/commit/72308ab9a32de6e8b4b23e42f115ed5ee87e5f33)

Depends-on: https://cesnet-gerrit-czechlight/c/CzechLight/netconf-cli/+/4539
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/netconf-cli/+/4539
Depends-on: https://cesnet-gerrit-czechlight/c/CzechLight/rousette/+/5391
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/rousette/+/5391
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/cla-sysrepo/+/5292
Depends-on: https://cesnet-gerrit-czechlight/c/CzechLight/velia/+/5237
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/velia/+/5237
Change-Id: I6edc19f35accfd41a4b32f7b396981d470e0c07b
diff --git a/.zuul.yaml b/.zuul.yaml
index af1a45e..4f65f1e 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -14,6 +14,8 @@
       - CzechLight/netconf-cli
       - CzechLight/velia
       - CzechLight/rousette
+      - CzechLight/libyang-cpp
+      - CzechLight/sysrepo-cpp
       - github/CESNET/libyang
       - github/sysrepo/sysrepo
       - github/CESNET/libnetconf2
diff --git a/board/czechlight/common/patches/systemd/0001-network-Serialize-LLDP-neighbor-to-JSON-format.patch b/board/czechlight/common/patches/systemd/0001-network-Serialize-LLDP-neighbor-to-JSON-format.patch
index 8f85d59..dc8666c 100644
--- a/board/czechlight/common/patches/systemd/0001-network-Serialize-LLDP-neighbor-to-JSON-format.patch
+++ b/board/czechlight/common/patches/systemd/0001-network-Serialize-LLDP-neighbor-to-JSON-format.patch
@@ -1,4 +1,4 @@
-From 64d19ae11c2a3014fa58a0c05620b6ee95352125 Mon Sep 17 00:00:00 2001
+From a98772047310c422872163a54ddf17a9669929e0 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Thu, 7 Oct 2021 11:16:57 +0200
 Subject: [PATCH 1/9] network: Serialize LLDP neighbor to JSON format
@@ -9,13 +9,13 @@
 neighbor. Also it possibly contains an integer coding the enabled system
 capabilities and port description.
 ---
- src/libsystemd-network/lldp-neighbor.c | 22 +++++++++++++++
- src/libsystemd-network/sd-lldp.c       | 37 ++++++++++++++++++++++++++
- src/systemd/sd-lldp.h                  |  4 +++
- 3 files changed, 63 insertions(+)
+ src/libsystemd-network/lldp-neighbor.c | 22 ++++++++++++
+ src/libsystemd-network/sd-lldp-rx.c    | 46 +++++++++++++++++++++++++-
+ src/systemd/sd-lldp-rx.h               |  4 +++
+ 3 files changed, 71 insertions(+), 1 deletion(-)
 
 diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/lldp-neighbor.c
-index 3bd775158e..5c00205110 100644
+index 44847b2b92..cacad8adea 100644
 --- a/src/libsystemd-network/lldp-neighbor.c
 +++ b/src/libsystemd-network/lldp-neighbor.c
 @@ -5,6 +5,7 @@
@@ -23,10 +23,10 @@
  #include "hexdecoct.h"
  #include "in-addr-util.h"
 +#include "json.h"
- #include "lldp-internal.h"
  #include "lldp-neighbor.h"
  #include "memory-util.h"
-@@ -777,3 +778,24 @@ _public_ int sd_lldp_neighbor_get_timestamp(sd_lldp_neighbor *n, clockid_t clock
+ #include "missing_network.h"
+@@ -790,3 +791,24 @@ int sd_lldp_neighbor_get_timestamp(sd_lldp_neighbor *n, clockid_t clock, uint64_
          *ret = triple_timestamp_by_clock(&n->timestamp, clock);
          return 0;
  }
@@ -51,31 +51,32 @@
 +                                                JSON_BUILD_PAIR("portId", JSON_BUILD_STRING(port_id)),
 +                                                JSON_BUILD_PAIR_CONDITION(port_description, "portDescription", JSON_BUILD_STRING(port_description))))));
 +}
-diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
-index 49aa876a53..2d51992237 100644
---- a/src/libsystemd-network/sd-lldp.c
-+++ b/src/libsystemd-network/sd-lldp.c
+diff --git a/src/libsystemd-network/sd-lldp-rx.c b/src/libsystemd-network/sd-lldp-rx.c
+index 34bdcb644b..ae4d2d599c 100644
+--- a/src/libsystemd-network/sd-lldp-rx.c
++++ b/src/libsystemd-network/sd-lldp-rx.c
 @@ -10,6 +10,7 @@
  #include "ether-addr-util.h"
  #include "event-util.h"
  #include "fd-util.h"
 +#include "json.h"
- #include "lldp-internal.h"
  #include "lldp-neighbor.h"
  #include "lldp-network.h"
-@@ -488,6 +489,42 @@ _public_ int sd_lldp_get_neighbors(sd_lldp *lldp, sd_lldp_neighbor ***ret) {
+ #include "lldp-rx-internal.h"
+@@ -492,7 +493,50 @@ int sd_lldp_rx_get_neighbors(sd_lldp_rx *lldp_rx, sd_lldp_neighbor ***ret) {
          return k;
  }
  
-+_public_ int sd_lldp_get_neighbors_json(sd_lldp *lldp, JsonVariant ***ret) {
+-int sd_lldp_rx_set_neighbors_max(sd_lldp_rx *lldp_rx, uint64_t m) {
++_public_ int sd_lldp_rx_get_neighbors_json(sd_lldp_rx *lldp, JsonVariant ***ret) {
 +        int i, j, r, n = 0;
-+        sd_lldp_neighbor **l = NULL;
++        _cleanup_free_ sd_lldp_neighbor **l = NULL;
 +        JsonVariant **v = NULL;
 +
 +        assert_return(lldp, -EINVAL);
 +        assert_return(ret, -EINVAL);
 +
-+        r = sd_lldp_get_neighbors(lldp, &l);
++        r = sd_lldp_rx_get_neighbors(lldp, &l);
 +        if (r < 0)
 +                return r;
 +
@@ -89,13 +90,20 @@
 +                r = sd_lldp_neighbor_build_json(l[i], v + i);
 +                if (r < 0)
 +                        goto clear;
++                else
++                        sd_lldp_neighbor_unref(l[i]);
 +        }
 +
 +        *ret = v;
 +
++        for (i = 0; i < n; j++)
++
 +        return n;
 +
 +clear:
++        for (j = i; j < n; j++)
++                sd_lldp_neighbor_unref(l[j]);
++
 +        for (j = 0; j < i; j++)
 +                json_variant_unrefp(v + j);
 +
@@ -103,27 +111,28 @@
 +        return r;
 +}
 +
- _public_ int sd_lldp_set_neighbors_max(sd_lldp *lldp, uint64_t m) {
-         assert_return(lldp, -EINVAL);
++_public_ int sd_lldp_rx_set_neighbors_max(sd_lldp_rx *lldp_rx, uint64_t m) {
+         assert_return(lldp_rx, -EINVAL);
          assert_return(m > 0, -EINVAL);
-diff --git a/src/systemd/sd-lldp.h b/src/systemd/sd-lldp.h
-index 64047ee817..7594502802 100644
---- a/src/systemd/sd-lldp.h
-+++ b/src/systemd/sd-lldp.h
-@@ -28,6 +28,8 @@
  
- _SD_BEGIN_DECLARATIONS;
+diff --git a/src/systemd/sd-lldp-rx.h b/src/systemd/sd-lldp-rx.h
+index bfeac14ce3..8a538b2444 100644
+--- a/src/systemd/sd-lldp-rx.h
++++ b/src/systemd/sd-lldp-rx.h
+@@ -32,6 +32,8 @@ _SD_BEGIN_DECLARATIONS;
+ typedef struct sd_lldp_rx sd_lldp_rx;
+ typedef struct sd_lldp_neighbor sd_lldp_neighbor;
  
 +typedef struct JsonVariant JsonVariant;
 +
- /* IEEE 802.1AB-2009 Clause 8: TLV Types */
- enum {
-         SD_LLDP_TYPE_END                 = 0,
-@@ -156,10 +158,12 @@ int sd_lldp_match_capabilities(sd_lldp *lldp, uint16_t mask);
- int sd_lldp_set_filter_address(sd_lldp *lldp, const struct ether_addr *address);
+ typedef enum sd_lldp_rx_event_t {
+         SD_LLDP_RX_EVENT_ADDED,
+         SD_LLDP_RX_EVENT_REMOVED,
+@@ -67,10 +69,12 @@ int sd_lldp_rx_match_capabilities(sd_lldp_rx *lldp_rx, uint16_t mask);
+ int sd_lldp_rx_set_filter_address(sd_lldp_rx *lldp_rx, const struct ether_addr *address);
  
- int sd_lldp_get_neighbors(sd_lldp *lldp, sd_lldp_neighbor ***neighbors);
-+int sd_lldp_get_neighbors_json(sd_lldp *lldp, JsonVariant ***neighbors);
+ int sd_lldp_rx_get_neighbors(sd_lldp_rx *lldp_rx, sd_lldp_neighbor ***neighbors);
++int sd_lldp_rx_get_neighbors_json(sd_lldp_rx *lldp, JsonVariant ***neighbors);
  
  int sd_lldp_neighbor_from_raw(sd_lldp_neighbor **ret, const void *raw, size_t raw_size);
  sd_lldp_neighbor *sd_lldp_neighbor_ref(sd_lldp_neighbor *n);
@@ -133,5 +142,5 @@
  /* Access to LLDP frame metadata */
  int sd_lldp_neighbor_get_source_address(sd_lldp_neighbor *n, struct ether_addr* address);
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0002-network-Add-varlink-server.patch b/board/czechlight/common/patches/systemd/0002-network-Add-varlink-server.patch
index 2567d7f..de6b7db 100644
--- a/board/czechlight/common/patches/systemd/0002-network-Add-varlink-server.patch
+++ b/board/czechlight/common/patches/systemd/0002-network-Add-varlink-server.patch
@@ -1,4 +1,4 @@
-From 36f46b1f60453bdbb8841bd86724ff868149594b Mon Sep 17 00:00:00 2001
+From a99f62ee2c89b3631a23426eedfa477aa9d8dbd9 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Tue, 24 Aug 2021 14:59:40 +0200
 Subject: [PATCH 2/9] network: Add varlink server
@@ -16,10 +16,10 @@
  create mode 100644 src/network/networkd-varlink.h
 
 diff --git a/src/network/meson.build b/src/network/meson.build
-index 4e137d7b9e..2c97da60d3 100644
+index 5857439c5a..430dadbf05 100644
 --- a/src/network/meson.build
 +++ b/src/network/meson.build
-@@ -129,6 +129,8 @@ sources = files('''
+@@ -137,6 +137,8 @@ sources = files('''
          networkd-sysctl.h
          networkd-util.c
          networkd-util.h
@@ -29,18 +29,18 @@
          networkd-wifi.h
          tc/cake.c
 diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
-index 374d27bef3..5e53498711 100644
+index 7e89366ae8..9f6a2553f6 100644
 --- a/src/network/networkd-manager.c
 +++ b/src/network/networkd-manager.c
-@@ -38,6 +38,7 @@
+@@ -41,6 +41,7 @@
  #include "networkd-routing-policy-rule.h"
  #include "networkd-speed-meter.h"
  #include "networkd-state-file.h"
 +#include "networkd-varlink.h"
+ #include "networkd-wifi.h"
  #include "ordered-set.h"
  #include "path-lookup.h"
- #include "path-util.h"
-@@ -509,6 +510,8 @@ Manager* manager_free(Manager *m) {
+@@ -543,6 +544,8 @@ Manager* manager_free(Manager *m) {
  
          m->fw_ctx = fw_ctx_free(m->fw_ctx);
  
@@ -49,7 +49,7 @@
          return mfree(m);
  }
  
-@@ -518,6 +521,10 @@ int manager_start(Manager *m) {
+@@ -552,6 +555,10 @@ int manager_start(Manager *m) {
  
          assert(m);
  
@@ -61,7 +61,7 @@
          if (r < 0)
                  return log_error_errno(r, "Failed to initialize speed meter: %m");
 diff --git a/src/network/networkd-manager.h b/src/network/networkd-manager.h
-index 4ee48f3468..f8d4d00db2 100644
+index 36313589a3..a0c0336ce5 100644
 --- a/src/network/networkd-manager.h
 +++ b/src/network/networkd-manager.h
 @@ -16,6 +16,7 @@
@@ -72,7 +72,7 @@
  
  struct Manager {
          sd_netlink *rtnl;
-@@ -99,6 +100,8 @@ struct Manager {
+@@ -95,6 +96,8 @@ struct Manager {
          FirewallContext *fw_ctx;
  
          OrderedSet *request_queue;
@@ -80,7 +80,7 @@
 +        VarlinkServer *varlink_server;
  };
  
- int manager_new(Manager **ret);
+ int manager_new(Manager **ret, bool test_mode);
 diff --git a/src/network/networkd-varlink.c b/src/network/networkd-varlink.c
 new file mode 100644
 index 0000000000..57d8acb967
@@ -135,5 +135,5 @@
 +int manager_varlink_init(Manager *m);
 +void manager_varlink_done(Manager *m);
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0003-network-Add-LLDP-neighbors-method-to-varlink-server.patch b/board/czechlight/common/patches/systemd/0003-network-Add-LLDP-neighbors-method-to-varlink-server.patch
index 630b389..2d4bd3f 100644
--- a/board/czechlight/common/patches/systemd/0003-network-Add-LLDP-neighbors-method-to-varlink-server.patch
+++ b/board/czechlight/common/patches/systemd/0003-network-Add-LLDP-neighbors-method-to-varlink-server.patch
@@ -1,4 +1,4 @@
-From 3ee0693ac819543610120542f8e60fb95fe6f0d4 Mon Sep 17 00:00:00 2001
+From 04fa6f4d5d019900b084787b9ca2d4439f26d302 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Wed, 1 Sep 2021 08:30:20 +0200
 Subject: [PATCH 3/9] network: Add LLDP neighbors method to varlink server
@@ -12,7 +12,7 @@
  1 file changed, 77 insertions(+)
 
 diff --git a/src/network/networkd-varlink.c b/src/network/networkd-varlink.c
-index 57d8acb967..f86be4e903 100644
+index 57d8acb967..5bc65c39b7 100644
 --- a/src/network/networkd-varlink.c
 +++ b/src/network/networkd-varlink.c
 @@ -1,6 +1,76 @@
@@ -63,7 +63,7 @@
 +        if (r < 0)
 +                return varlink_error_invalid_parameter(link, JSON_VARIANT_STRING_CONST("ifindex"));
 +
-+        r = sd_lldp_get_neighbors_json(l->lldp, &neighbors);
++        r = sd_lldp_rx_get_neighbors_json(l->lldp_rx, &neighbors);
 +        if (r < 0)
 +                return r;
 +        if (r == 0)
@@ -114,5 +114,5 @@
  }
  
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0004-varlink-Implement-varlink_observe_complete.patch b/board/czechlight/common/patches/systemd/0004-varlink-Implement-varlink_observe_complete.patch
index 579dd9f..ca5c9f0 100644
--- a/board/czechlight/common/patches/systemd/0004-varlink-Implement-varlink_observe_complete.patch
+++ b/board/czechlight/common/patches/systemd/0004-varlink-Implement-varlink_observe_complete.patch
@@ -1,4 +1,4 @@
-From 657ce718099d6d82d2a6757909496d285221b22f Mon Sep 17 00:00:00 2001
+From 4e7bdd09a12d9ed1695980d8edf94841a5c11cd8 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Thu, 9 Sep 2021 09:19:05 +0200
 Subject: [PATCH 4/9] varlink: Implement varlink_observe_complete
@@ -16,7 +16,7 @@
  2 files changed, 32 insertions(+)
 
 diff --git a/src/shared/varlink.c b/src/shared/varlink.c
-index 8da568e208..23a72516fb 100644
+index e0038dfd28..7e5c9657f8 100644
 --- a/src/shared/varlink.c
 +++ b/src/shared/varlink.c
 @@ -1440,6 +1440,37 @@ int varlink_observeb(Varlink *v, const char *method, ...) {
@@ -50,7 +50,7 @@
 +                return varlink_log_errno(v, SYNTHETIC_ERRNO(ETIME), "Connection timed out.");
 +
 +        default:
-+                assert_not_reached("Unexpected state");
++                assert_not_reached();
 +        }
 +}
 +
@@ -70,5 +70,5 @@
  /* Enqueue a final reply */
  int varlink_reply(Varlink *v, JsonVariant *parameters);
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0005-networkctl-lldp-uses-table_empty_string-instead-of-s.patch b/board/czechlight/common/patches/systemd/0005-networkctl-lldp-uses-table_empty_string-instead-of-s.patch
index b1c97bc..141e5af 100644
--- a/board/czechlight/common/patches/systemd/0005-networkctl-lldp-uses-table_empty_string-instead-of-s.patch
+++ b/board/czechlight/common/patches/systemd/0005-networkctl-lldp-uses-table_empty_string-instead-of-s.patch
@@ -1,4 +1,4 @@
-From 876c47e0743031e352a126000c87b0b51209408d Mon Sep 17 00:00:00 2001
+From 3f997c34cdaef7a66fdb1d0bc10a1bafd4f7e656 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Thu, 7 Oct 2021 14:11:45 +0200
 Subject: [PATCH 5/9] networkctl: lldp uses table_empty_string instead of strna
@@ -8,10 +8,10 @@
  1 file changed, 8 insertions(+), 5 deletions(-)
 
 diff --git a/src/network/networkctl.c b/src/network/networkctl.c
-index 9bbfe177b1..235731079d 100644
+index 68dd4b185c..30cd75eec0 100644
 --- a/src/network/networkctl.c
 +++ b/src/network/networkctl.c
-@@ -2531,6 +2531,9 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+@@ -2529,6 +2529,9 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
          assert_se(cell = table_get_cell(table, 0, 5));
          table_set_minimum_width(table, cell, 16);
  
@@ -21,7 +21,7 @@
          for (int i = 0; i < c; i++) {
                  _cleanup_fclose_ FILE *f = NULL;
  
-@@ -2592,11 +2595,11 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+@@ -2590,11 +2593,11 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
  
                          r = table_add_many(table,
                                             TABLE_STRING, links[i].name,
@@ -39,5 +39,5 @@
                                  return table_log_add_error(r);
  
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0006-networkctl-lldp-table-now-ellpsizes-via-table-functi.patch b/board/czechlight/common/patches/systemd/0006-networkctl-lldp-table-now-ellpsizes-via-table-functi.patch
index add9432..ef0c2e4 100644
--- a/board/czechlight/common/patches/systemd/0006-networkctl-lldp-table-now-ellpsizes-via-table-functi.patch
+++ b/board/czechlight/common/patches/systemd/0006-networkctl-lldp-table-now-ellpsizes-via-table-functi.patch
@@ -1,4 +1,4 @@
-From 03305bb0f181446ae4f1698c14e72470ae642bbb Mon Sep 17 00:00:00 2001
+From 90271bd69a7488714a51173dcec3f349459761c9 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Thu, 7 Oct 2021 14:16:53 +0200
 Subject: [PATCH 6/9] networkctl: lldp table now ellpsizes via table functions
@@ -14,10 +14,10 @@
  1 file changed, 7 insertions(+), 25 deletions(-)
 
 diff --git a/src/network/networkctl.c b/src/network/networkctl.c
-index 235731079d..a1d42cbe92 100644
+index 30cd75eec0..46c08b5549 100644
 --- a/src/network/networkctl.c
 +++ b/src/network/networkctl.c
-@@ -2515,21 +2515,27 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+@@ -2513,21 +2513,27 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
  
          assert_se(cell = table_get_cell(table, 0, 0));
          table_set_minimum_width(table, cell, 16);
@@ -45,7 +45,7 @@
  
          if (table_set_empty_string(table, "n/a") < 0)
                  return log_oom();
-@@ -2546,7 +2552,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+@@ -2544,7 +2550,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                  }
  
                  for (;;) {
@@ -54,7 +54,7 @@
                          const char *chassis_id = NULL, *port_id = NULL, *system_name = NULL, *port_description = NULL;
                          _cleanup_(sd_lldp_neighbor_unrefp) sd_lldp_neighbor *n = NULL;
                          uint16_t cc;
-@@ -2564,30 +2570,6 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+@@ -2562,30 +2568,6 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                          (void) sd_lldp_neighbor_get_system_name(n, &system_name);
                          (void) sd_lldp_neighbor_get_port_description(n, &port_description);
  
@@ -86,5 +86,5 @@
                                  capabilities = lldp_capabilities_to_string(cc);
                                  all |= cc;
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0007-networkctl-lldp-now-uses-varlink-call.patch b/board/czechlight/common/patches/systemd/0007-networkctl-lldp-now-uses-varlink-call.patch
index fc8b007..d898278 100644
--- a/board/czechlight/common/patches/systemd/0007-networkctl-lldp-now-uses-varlink-call.patch
+++ b/board/czechlight/common/patches/systemd/0007-networkctl-lldp-now-uses-varlink-call.patch
@@ -1,4 +1,4 @@
-From e5b7f28a216ee1986c417f83132e3daf39ef5fd2 Mon Sep 17 00:00:00 2001
+From ffcce15c1f130f8a52ab050d009946a50472dfbc Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Wed, 15 Sep 2021 14:42:34 +0200
 Subject: [PATCH 7/9] networkctl: lldp now uses varlink call
@@ -6,11 +6,11 @@
 `networkctl lldp` now uses varlink call to the networkd to query LLDP
 neighbor data.
 ---
- src/network/networkctl.c | 157 ++++++++++++++++++++++++++++-----------
- 1 file changed, 113 insertions(+), 44 deletions(-)
+ src/network/networkctl.c | 215 +++++++++++++++++++++++++--------------
+ 1 file changed, 139 insertions(+), 76 deletions(-)
 
 diff --git a/src/network/networkctl.c b/src/network/networkctl.c
-index a1d42cbe92..f98779da7e 100644
+index 46c08b5549..a10f3f3fc7 100644
 --- a/src/network/networkctl.c
 +++ b/src/network/networkctl.c
 @@ -36,6 +36,7 @@
@@ -21,7 +21,7 @@
  #include "local-addresses.h"
  #include "locale-util.h"
  #include "logs-show.h"
-@@ -61,6 +62,7 @@
+@@ -62,6 +63,7 @@
  #include "strxcpyx.h"
  #include "terminal-util.h"
  #include "unit-def.h"
@@ -29,7 +29,7 @@
  #include "verbs.h"
  #include "wifi-util.h"
  
-@@ -2481,14 +2483,104 @@ static void lldp_capabilities_legend(uint16_t x) {
+@@ -2479,14 +2481,103 @@ static void lldp_capabilities_legend(uint16_t x) {
          puts("");
  }
  
@@ -52,14 +52,19 @@
 +}
 +
 +typedef struct LLDPUserdata {
-+        int *neighbors_count;
-+        uint16_t *capabilities_all;
++        int neighbors_count;
++        uint16_t capabilities_all;
++
++        Table *table;
 +
 +        char *link_name;
-+        Table *table;
 +} LLDPUserdata;
 +
-+static int lldp_neighbours_varlink_reply(Varlink *link, JsonVariant *parameters, const char *error_id, VarlinkReplyFlags flags, void *userdata) {
++static void lldp_userdata_freep(LLDPUserdata* p) {
++        table_unref(p->table);
++}
++
++static int lldp_neighbors_varlink_reply(Varlink *link, JsonVariant *parameters, const char *error_id, VarlinkReplyFlags flags, void *userdata) {
 +        int r;
 +        _cleanup_free_ char *capabilities = NULL;
 +        LLDPUserdata *udata;
@@ -97,11 +102,8 @@
 +                        return table_log_add_error(r);
 +        }
 +
-+        if (udata->neighbors_count)
-+                *(udata->neighbors_count) += 1;
-+
-+        if (udata->capabilities_all)
-+                *(udata->capabilities_all) |= entry.capabilities;
++        udata->neighbors_count += 1;
++        udata->capabilities_all |= entry.capabilities;
 +
 +        return 0;
 +}
@@ -114,12 +116,10 @@
 +        _cleanup_(varlink_flush_close_unrefp) Varlink *link = NULL;
          _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
          _cleanup_(link_info_array_freep) LinkInfo *links = NULL;
-         _cleanup_(table_unrefp) Table *table = NULL;
+-        _cleanup_(table_unrefp) Table *table = NULL;
 -        int r, c, m = 0;
 -        uint16_t all = 0;
-+        int neighbors_count = 0;
-+        uint16_t capabilities_all = 0;
-+        LLDPUserdata udata = {};
++        _cleanup_(lldp_userdata_freep) LLDPUserdata udata = {};
          TableCell *cell;
  
 +        r = varlink_connect_address(&link, address);
@@ -129,20 +129,91 @@
 +        (void) varlink_set_description(link, "network");
 +        (void) varlink_set_relative_timeout(link, USEC_INFINITY);
 +
-+        r = varlink_bind_reply(link, lldp_neighbours_varlink_reply);
++        r = varlink_bind_reply(link, lldp_neighbors_varlink_reply);
 +        if (r < 0)
 +                return log_error_errno(r, "Failed to bind reply callback: %m");
 +
          r = sd_netlink_open(&rtnl);
          if (r < 0)
                  return log_error_errno(r, "Failed to connect to netlink: %m");
-@@ -2540,53 +2632,30 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
-         if (table_set_empty_string(table, "n/a") < 0)
+@@ -2497,103 +2588,75 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+ 
+         pager_open(arg_pager_flags);
+ 
+-        table = table_new("link",
+-                          "chassis id",
+-                          "system name",
+-                          "caps",
+-                          "port id",
+-                          "port description");
+-        if (!table)
++        udata.table = table_new("link",
++                                "chassis id",
++                                "system name",
++                                "caps",
++                                "port id",
++                                "port description");
++        if (!udata.table)
                  return log_oom();
  
--        for (int i = 0; i < c; i++) {
+         if (arg_full)
+-                table_set_width(table, 0);
++                table_set_width(udata.table, 0);
+ 
+-        table_set_header(table, arg_legend);
++        table_set_header(udata.table, arg_legend);
+ 
+-        assert_se(cell = table_get_cell(table, 0, 0));
+-        table_set_minimum_width(table, cell, 16);
+-        table_set_maximum_width(table, cell, 16);
++        assert_se(cell = table_get_cell(udata.table, 0, 0));
++        table_set_minimum_width(udata.table, cell, 16);
++        table_set_maximum_width(udata.table, cell, 16);
+ 
+-        assert_se(cell = table_get_cell(table, 0, 1));
+-        table_set_minimum_width(table, cell, 17);
+-        table_set_maximum_width(table, cell, 17);
++        assert_se(cell = table_get_cell(udata.table, 0, 1));
++        table_set_minimum_width(udata.table, cell, 17);
++        table_set_maximum_width(udata.table, cell, 17);
+ 
+-        assert_se(cell = table_get_cell(table, 0, 2));
+-        table_set_minimum_width(table, cell, 16);
+-        table_set_maximum_width(table, cell, 16);
++        assert_se(cell = table_get_cell(udata.table, 0, 2));
++        table_set_minimum_width(udata.table, cell, 16);
++        table_set_maximum_width(udata.table, cell, 16);
+ 
+-        assert_se(cell = table_get_cell(table, 0, 3));
+-        table_set_minimum_width(table, cell, 11);
+-        table_set_maximum_width(table, cell, 11);
++        assert_se(cell = table_get_cell(udata.table, 0, 3));
++        table_set_minimum_width(udata.table, cell, 11);
++        table_set_maximum_width(udata.table, cell, 11);
+ 
+-        assert_se(cell = table_get_cell(table, 0, 4));
+-        table_set_minimum_width(table, cell, 17);
+-        table_set_maximum_width(table, cell, 17);
++        assert_se(cell = table_get_cell(udata.table, 0, 4));
++        table_set_minimum_width(udata.table, cell, 17);
++        table_set_maximum_width(udata.table, cell, 17);
+ 
+-        assert_se(cell = table_get_cell(table, 0, 5));
+-        table_set_minimum_width(table, cell, 16);
+-        table_set_maximum_width(table, cell, 16);
++        assert_se(cell = table_get_cell(udata.table, 0, 5));
++        table_set_minimum_width(udata.table, cell, 16);
++        table_set_maximum_width(udata.table, cell, 16);
+ 
+-        if (table_set_empty_string(table, "n/a") < 0)
++        if (table_set_empty_string(udata.table, "n/a") < 0)
+                 return log_oom();
+ 
++        varlink_set_userdata(link, &udata);
++
+         for (int i = 0; i < c; i++) {
 -                _cleanup_fclose_ FILE *f = NULL;
-+        udata.table = table;
++                _cleanup_(json_variant_unrefp) JsonVariant *cparams = NULL;
  
 -                r = open_lldp_neighbors(links[i].ifindex, &f);
 -                if (r == -ENOENT)
@@ -151,15 +222,17 @@
 -                        log_warning_errno(r, "Failed to open LLDP data for %i, ignoring: %m", links[i].ifindex);
 -                        continue;
 -                }
-+        udata.neighbors_count = &neighbors_count;
-+        udata.capabilities_all = &capabilities_all;
++                udata.link_name = links[i].name;
  
 -                for (;;) {
 -                        _cleanup_free_ char *capabilities = NULL;
 -                        const char *chassis_id = NULL, *port_id = NULL, *system_name = NULL, *port_description = NULL;
 -                        _cleanup_(sd_lldp_neighbor_unrefp) sd_lldp_neighbor *n = NULL;
 -                        uint16_t cc;
-+        varlink_set_userdata(link, &udata);
++                r = json_build(&cparams, JSON_BUILD_OBJECT(
++                                        JSON_BUILD_PAIR("ifindex", JSON_BUILD_UNSIGNED(links[i].ifindex))));
++                if (r < 0)
++                        return r;
  
 -                        r = next_lldp_neighbor(f, &n);
 -                        if (r < 0) {
@@ -168,24 +241,20 @@
 -                        }
 -                        if (r == 0)
 -                                break;
-+        for (int i = 0; i < c; i++) {
-+                _cleanup_(json_variant_unrefp) JsonVariant *cparams = NULL;
++                r = varlink_observe(link, method, cparams);
++                if (r < 0)
++                        return log_error_errno(r, "Failed to execute varlink call: %m");
  
 -                        (void) sd_lldp_neighbor_get_chassis_id_as_string(n, &chassis_id);
 -                        (void) sd_lldp_neighbor_get_port_id_as_string(n, &port_id);
 -                        (void) sd_lldp_neighbor_get_system_name(n, &system_name);
 -                        (void) sd_lldp_neighbor_get_port_description(n, &port_description);
-+                udata.link_name = links[i].name;
- 
+-
 -                        if (sd_lldp_neighbor_get_enabled_capabilities(n, &cc) >= 0) {
 -                                capabilities = lldp_capabilities_to_string(cc);
 -                                all |= cc;
 -                        }
-+                r = json_build(&cparams, JSON_BUILD_OBJECT(
-+                                        JSON_BUILD_PAIR("ifindex", JSON_BUILD_UNSIGNED(links[i].ifindex))));
-+                if (r < 0)
-+                        return r;
- 
+-
 -                        r = table_add_many(table,
 -                                           TABLE_STRING, links[i].name,
 -                                           TABLE_STRING, chassis_id,
@@ -195,10 +264,7 @@
 -                                           TABLE_STRING, port_description);
 -                        if (r < 0)
 -                                return table_log_add_error(r);
-+                r = varlink_observe(link, method, cparams);
-+                if (r < 0)
-+                        return log_error_errno(r, "Failed to execute varlink call: %m");
- 
+-
 -                        m++;
 -                }
 +                r = varlink_observe_complete(link);
@@ -206,18 +272,19 @@
 +                        return r;
          }
  
-         r = table_print(table, NULL);
-@@ -2594,8 +2663,8 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+-        r = table_print(table, NULL);
++        r = table_print(udata.table, NULL);
+         if (r < 0)
                  return table_log_print_error(r);
  
          if (arg_legend) {
 -                lldp_capabilities_legend(all);
 -                printf("\n%i neighbors listed.\n", m);
-+                lldp_capabilities_legend(capabilities_all);
-+                printf("\n%i neighbors listed.\n", neighbors_count);
++                lldp_capabilities_legend(udata.capabilities_all);
++                printf("\n%i neighbors listed.\n", udata.neighbors_count);
          }
  
          return 0;
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0008-networkctl-allow-format-LLDP-capabilities-string-wit.patch b/board/czechlight/common/patches/systemd/0008-networkctl-allow-format-LLDP-capabilities-string-wit.patch
index 72f855d..6b2c299 100644
--- a/board/czechlight/common/patches/systemd/0008-networkctl-allow-format-LLDP-capabilities-string-wit.patch
+++ b/board/czechlight/common/patches/systemd/0008-networkctl-allow-format-LLDP-capabilities-string-wit.patch
@@ -1,4 +1,4 @@
-From 658e0a69a353e2559ab04c3caa7ea1eaf0ef6dda Mon Sep 17 00:00:00 2001
+From b6b2ad094aba092aadda307c4d786a541d878211 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Wed, 15 Sep 2021 14:30:19 +0200
 Subject: [PATCH 8/9] networkctl: allow format LLDP capabilities string without
@@ -11,10 +11,10 @@
  1 file changed, 9 insertions(+), 6 deletions(-)
 
 diff --git a/src/network/networkctl.c b/src/network/networkctl.c
-index f98779da7e..89abaf26da 100644
+index a10f3f3fc7..9fbeed6908 100644
 --- a/src/network/networkctl.c
 +++ b/src/network/networkctl.c
-@@ -2433,21 +2433,24 @@ static int link_status(int argc, char *argv[], void *userdata) {
+@@ -2431,21 +2431,24 @@ static int link_status(int argc, char *argv[], void *userdata) {
          return 0;
  }
  
@@ -44,7 +44,7 @@
          return ret;
  }
  
-@@ -2534,7 +2537,7 @@ static int lldp_neighbours_varlink_reply(Varlink *link, JsonVariant *parameters,
+@@ -2537,7 +2540,7 @@ static int lldp_neighbors_varlink_reply(Varlink *link, JsonVariant *parameters,
                  return r;
  
          if (udata->table) {
@@ -54,5 +54,5 @@
                  r = table_add_many(udata->table,
                                  TABLE_STRING, udata->link_name,
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/0009-networkctl-JSON-output-in-networkctl-lldp.patch b/board/czechlight/common/patches/systemd/0009-networkctl-JSON-output-in-networkctl-lldp.patch
index 5d43f1d..f85c6c3 100644
--- a/board/czechlight/common/patches/systemd/0009-networkctl-JSON-output-in-networkctl-lldp.patch
+++ b/board/czechlight/common/patches/systemd/0009-networkctl-JSON-output-in-networkctl-lldp.patch
@@ -1,4 +1,4 @@
-From 7479e9e720909a2d2360f684e85821195301dce2 Mon Sep 17 00:00:00 2001
+From f681abcf74f1a03f64fbcec15c33aae026dcdf51 Mon Sep 17 00:00:00 2001
 From: Tomas Pecka <peckato1@users.noreply.github.com>
 Date: Wed, 6 Oct 2021 10:11:31 +0200
 Subject: [PATCH 9/9] networkctl: JSON output in networkctl lldp
@@ -6,27 +6,35 @@
 `networkctl lldp` now outputs also in JSON format when `--json=*`
 argument passed. The LLDP neighbors are listed in per interface lists.
 ---
- src/network/networkctl.c | 123 ++++++++++++++++++++++++++-------------
- 1 file changed, 82 insertions(+), 41 deletions(-)
+ src/network/networkctl.c | 136 +++++++++++++++++++++++++--------------
+ 1 file changed, 88 insertions(+), 48 deletions(-)
 
 diff --git a/src/network/networkctl.c b/src/network/networkctl.c
-index 89abaf26da..124ee8f0c7 100644
+index 9fbeed6908..0f48aa4bf7 100644
 --- a/src/network/networkctl.c
 +++ b/src/network/networkctl.c
-@@ -2510,6 +2510,7 @@ typedef struct LLDPUserdata {
+@@ -2507,12 +2507,14 @@ typedef struct LLDPUserdata {
+         uint16_t capabilities_all;
+ 
+         Table *table;
++        JsonVariant *json;
  
          char *link_name;
-         Table *table;
-+        JsonVariant **json_list;
  } LLDPUserdata;
  
- static int lldp_neighbours_varlink_reply(Varlink *link, JsonVariant *parameters, const char *error_id, VarlinkReplyFlags flags, void *userdata) {
-@@ -2556,6 +2557,26 @@ static int lldp_neighbours_varlink_reply(Varlink *link, JsonVariant *parameters,
-         if (udata->capabilities_all)
-                 *(udata->capabilities_all) |= entry.capabilities;
+ static void lldp_userdata_freep(LLDPUserdata* p) {
+         table_unref(p->table);
++        json_variant_unref(p->json);
+ }
  
-+        if (udata->json_list) {
+ static int lldp_neighbors_varlink_reply(Varlink *link, JsonVariant *parameters, const char *error_id, VarlinkReplyFlags flags, void *userdata) {
+@@ -2556,6 +2558,34 @@ static int lldp_neighbors_varlink_reply(Varlink *link, JsonVariant *parameters,
+         udata->neighbors_count += 1;
+         udata->capabilities_all |= entry.capabilities;
+ 
++        if (udata->json) {
 +                _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
++                _cleanup_(json_variant_unrefp) JsonVariant *neighbors = NULL;
 +
 +                capabilities = lldp_capabilities_to_string(entry.capabilities, false);
 +
@@ -40,7 +48,14 @@
 +                if (r < 0)
 +                        return r;
 +
-+                r = json_variant_append_array(udata->json_list, v);
++
++                neighbors = json_variant_ref(json_variant_by_key(udata->json, udata->link_name));
++
++                r = json_variant_append_array(&neighbors, v);
++                if (r < 0)
++                        return r;
++
++                r = json_variant_set_field(&udata->json, udata->link_name, neighbors);
 +                if (r < 0)
 +                        return r;
 +        }
@@ -48,156 +63,134 @@
          return 0;
  }
  
-@@ -2568,10 +2589,10 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
+@@ -2568,7 +2598,6 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
          _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
          _cleanup_(link_info_array_freep) LinkInfo *links = NULL;
-         _cleanup_(table_unrefp) Table *table = NULL;
-+        _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
-         int neighbors_count = 0;
-         uint16_t capabilities_all = 0;
-         LLDPUserdata udata = {};
+         _cleanup_(lldp_userdata_freep) LLDPUserdata udata = {};
 -        TableCell *cell;
  
          r = varlink_connect_address(&link, address);
          if (r < 0)
-@@ -2592,50 +2613,58 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
-         if (c < 0)
+@@ -2590,47 +2619,54 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                  return c;
  
--        (void) pager_open(arg_pager_flags);
+         pager_open(arg_pager_flags);
+-
+-        udata.table = table_new("link",
+-                                "chassis id",
+-                                "system name",
+-                                "caps",
+-                                "port id",
+-                                "port description");
+-        if (!udata.table)
+-                return log_oom();
+-
+-        if (arg_full)
+-                table_set_width(udata.table, 0);
+-
+-        table_set_header(udata.table, arg_legend);
+-
+-        assert_se(cell = table_get_cell(udata.table, 0, 0));
+-        table_set_minimum_width(udata.table, cell, 16);
+-        table_set_maximum_width(udata.table, cell, 16);
+-
+-        assert_se(cell = table_get_cell(udata.table, 0, 1));
+-        table_set_minimum_width(udata.table, cell, 17);
+-        table_set_maximum_width(udata.table, cell, 17);
+-
+-        assert_se(cell = table_get_cell(udata.table, 0, 2));
+-        table_set_minimum_width(udata.table, cell, 16);
+-        table_set_maximum_width(udata.table, cell, 16);
+-
+-        assert_se(cell = table_get_cell(udata.table, 0, 3));
+-        table_set_minimum_width(udata.table, cell, 11);
+-        table_set_maximum_width(udata.table, cell, 11);
+-
+-        assert_se(cell = table_get_cell(udata.table, 0, 4));
+-        table_set_minimum_width(udata.table, cell, 17);
+-        table_set_maximum_width(udata.table, cell, 17);
+-
+-        assert_se(cell = table_get_cell(udata.table, 0, 5));
+-        table_set_minimum_width(udata.table, cell, 16);
+-        table_set_maximum_width(udata.table, cell, 16);
+-
+-        if (table_set_empty_string(udata.table, "n/a") < 0)
+-                return log_oom();
 +        if (arg_json_format_flags == JSON_FORMAT_OFF) {
 +                TableCell *cell;
- 
--        table = table_new("link",
--                          "chassis id",
--                          "system name",
--                          "caps",
--                          "port id",
--                          "port description");
--        if (!table)
--                return log_oom();
-+                (void) pager_open(arg_pager_flags);
- 
--        if (arg_full)
--                table_set_width(table, 0);
-+                table = table_new("link",
-+                                  "chassis id",
-+                                  "system name",
-+                                  "caps",
-+                                  "port id",
-+                                  "port description");
-+                if (!table)
-+                        return log_oom();
- 
--        table_set_header(table, arg_legend);
-+                if (arg_full)
-+                        table_set_width(table, 0);
- 
--        assert_se(cell = table_get_cell(table, 0, 0));
--        table_set_minimum_width(table, cell, 16);
--        table_set_maximum_width(table, cell, 16);
-+                table_set_header(table, arg_legend);
- 
--        assert_se(cell = table_get_cell(table, 0, 1));
--        table_set_minimum_width(table, cell, 17);
--        table_set_maximum_width(table, cell, 17);
-+                assert_se(cell = table_get_cell(table, 0, 0));
-+                table_set_minimum_width(table, cell, 16);
-+                table_set_maximum_width(table, cell, 16);
- 
--        assert_se(cell = table_get_cell(table, 0, 2));
--        table_set_minimum_width(table, cell, 16);
--        table_set_maximum_width(table, cell, 16);
-+                assert_se(cell = table_get_cell(table, 0, 1));
-+                table_set_minimum_width(table, cell, 17);
-+                table_set_maximum_width(table, cell, 17);
- 
--        assert_se(cell = table_get_cell(table, 0, 3));
--        table_set_minimum_width(table, cell, 11);
--        table_set_maximum_width(table, cell, 11);
-+                assert_se(cell = table_get_cell(table, 0, 2));
-+                table_set_minimum_width(table, cell, 16);
-+                table_set_maximum_width(table, cell, 16);
- 
--        assert_se(cell = table_get_cell(table, 0, 4));
--        table_set_minimum_width(table, cell, 17);
--        table_set_maximum_width(table, cell, 17);
-+                assert_se(cell = table_get_cell(table, 0, 3));
-+                table_set_minimum_width(table, cell, 11);
-+                table_set_maximum_width(table, cell, 11);
- 
--        assert_se(cell = table_get_cell(table, 0, 5));
--        table_set_minimum_width(table, cell, 16);
--        table_set_maximum_width(table, cell, 16);
-+                assert_se(cell = table_get_cell(table, 0, 4));
-+                table_set_minimum_width(table, cell, 17);
-+                table_set_maximum_width(table, cell, 17);
- 
--        if (table_set_empty_string(table, "n/a") < 0)
--                return log_oom();
-+                assert_se(cell = table_get_cell(table, 0, 5));
-+                table_set_minimum_width(table, cell, 16);
-+                table_set_maximum_width(table, cell, 16);
 +
-+                if (table_set_empty_string(table, "n/a") < 0)
++                udata.table = table_new("link",
++                                        "chassis id",
++                                        "system name",
++                                        "caps",
++                                        "port id",
++                                        "port description");
++                if (!udata.table)
 +                        return log_oom();
- 
--        udata.table = table;
-+                udata.table = table;
++
++                if (arg_full)
++                        table_set_width(udata.table, 0);
++
++                table_set_header(udata.table, arg_legend);
++
++                assert_se(cell = table_get_cell(udata.table, 0, 0));
++                table_set_minimum_width(udata.table, cell, 16);
++                table_set_maximum_width(udata.table, cell, 16);
++
++                assert_se(cell = table_get_cell(udata.table, 0, 1));
++                table_set_minimum_width(udata.table, cell, 17);
++                table_set_maximum_width(udata.table, cell, 17);
++
++                assert_se(cell = table_get_cell(udata.table, 0, 2));
++                table_set_minimum_width(udata.table, cell, 16);
++                table_set_maximum_width(udata.table, cell, 16);
++
++                assert_se(cell = table_get_cell(udata.table, 0, 3));
++                table_set_minimum_width(udata.table, cell, 11);
++                table_set_maximum_width(udata.table, cell, 11);
++
++                assert_se(cell = table_get_cell(udata.table, 0, 4));
++                table_set_minimum_width(udata.table, cell, 17);
++                table_set_maximum_width(udata.table, cell, 17);
++
++                assert_se(cell = table_get_cell(udata.table, 0, 5));
++                table_set_minimum_width(udata.table, cell, 16);
++                table_set_maximum_width(udata.table, cell, 16);
++
++                if (table_set_empty_string(udata.table, "n/a") < 0)
++                        return log_oom();
 +        } else {
-+                r = json_build(&v, JSON_BUILD_EMPTY_OBJECT);
++                r = json_build(&udata.json, JSON_BUILD_EMPTY_OBJECT);
 +                if (r < 0)
 +                        return r;
 +        }
  
-         udata.neighbors_count = &neighbors_count;
-         udata.capabilities_all = &capabilities_all;
-@@ -2643,10 +2672,14 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
          varlink_set_userdata(link, &udata);
  
-         for (int i = 0; i < c; i++) {
--                _cleanup_(json_variant_unrefp) JsonVariant *cparams = NULL;
-+                _cleanup_(json_variant_unrefp) JsonVariant *cparams = NULL, *neighbors = NULL;
- 
-                 udata.link_name = links[i].name;
- 
-+                if (arg_json_format_flags != JSON_FORMAT_OFF) {
-+                        udata.json_list = &neighbors;
-+                }
-+
-                 r = json_build(&cparams, JSON_BUILD_OBJECT(
-                                         JSON_BUILD_PAIR("ifindex", JSON_BUILD_UNSIGNED(links[i].ifindex))));
-                 if (r < 0)
-@@ -2659,15 +2692,23 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
-                 r = varlink_observe_complete(link);
-                 if (r < 0)
+@@ -2653,13 +2689,17 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                          return r;
-+
-+                if (!json_variant_is_blank_array(neighbors)) {
-+                        json_variant_set_field(&v, links[i].name, neighbors);
-+                }
          }
  
--        r = table_print(table, NULL);
+-        r = table_print(udata.table, NULL);
 -        if (r < 0)
 -                return table_log_print_error(r);
 +        if (arg_json_format_flags == JSON_FORMAT_OFF) {
-+                r = table_print(table, NULL);
++                r = table_print(udata.table, NULL);
 +                if (r < 0)
 +                        return table_log_print_error(r);
  
 -        if (arg_legend) {
--                lldp_capabilities_legend(capabilities_all);
--                printf("\n%i neighbors listed.\n", neighbors_count);
+-                lldp_capabilities_legend(udata.capabilities_all);
+-                printf("\n%i neighbors listed.\n", udata.neighbors_count);
 +                if (arg_legend) {
-+                        lldp_capabilities_legend(capabilities_all);
-+                        printf("\n%i neighbors listed.\n", neighbors_count);
++                        lldp_capabilities_legend(udata.capabilities_all);
++                        printf("\n%i neighbors listed.\n", udata.neighbors_count);
 +                }
 +        } else {
-+                json_variant_dump(v, arg_json_format_flags, NULL, NULL);
++                json_variant_dump(udata.json, arg_json_format_flags, NULL, NULL);
          }
  
          return 0;
 -- 
-2.33.0
+2.34.1
 
diff --git a/board/czechlight/common/patches/systemd/random-seed.patch b/board/czechlight/common/patches/systemd/random-seed.patch
index e79c9af..dac46cf 100644
--- a/board/czechlight/common/patches/systemd/random-seed.patch
+++ b/board/czechlight/common/patches/systemd/random-seed.patch
@@ -24,13 +24,13 @@
 --- a/meson.build
 +++ b/meson.build
 @@ -155,7 +155,7 @@ bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
- testsdir = join_paths(prefixdir, 'lib/systemd/tests')
- systemdstatedir = join_paths(localstatedir, 'lib/systemd')
- catalogstatedir = join_paths(systemdstatedir, 'catalog')
--randomseeddir = join_paths(localstatedir, 'lib/systemd')
+ testsdir = prefixdir / 'lib/systemd/tests'
+ systemdstatedir = localstatedir / 'lib/systemd'
+ catalogstatedir = systemdstatedir / 'catalog'
+-randomseeddir = localstatedir / 'lib/systemd'
 +randomseeddir = '/cfg/random-seed'
- profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
- ntpservicelistdir = join_paths(rootprefixdir, 'lib/systemd/ntp-units.d')
+ profiledir = rootlibexecdir / 'portable' / 'profile'
+ ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
  
 -- 
 2.21.0
diff --git a/configs/czechlight_clearfog_defconfig b/configs/czechlight_clearfog_defconfig
index e4b4bd4..152f0b6 100644
--- a/configs/czechlight_clearfog_defconfig
+++ b/configs/czechlight_clearfog_defconfig
@@ -67,6 +67,7 @@
 BR2_PACKAGE_AUDIT=y
 BR2_PACKAGE_DDRESCUE=y
 BR2_PACKAGE_RAUC=y
+BR2_PACKAGE_RAUC_DBUS=y
 BR2_PACKAGE_RAUC_NETWORK=y
 BR2_PACKAGE_SYSTEMD_JOURNAL_REMOTE=y
 BR2_PACKAGE_SYSTEMD_COREDUMP=y
diff --git a/dev-setup-git.sh b/dev-setup-git.sh
index caffcea..4f4316b 100755
--- a/dev-setup-git.sh
+++ b/dev-setup-git.sh
@@ -14,7 +14,9 @@
 SDBUS_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/sdbus-cpp
 
 LIBYANG_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/libyang
+LIBYANG_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/libyang-cpp
 SYSREPO_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/sysrepo
+SYSREPO_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/sysrepo-cpp
 HOST_SYSREPO_POST_RSYNC_HOOKS += HOST_SYSREPO_PATCH_USE_FAKE_DEV_SHM
 LIBNETCONF2_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/libnetconf2
 NETOPEER2_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/Netopeer2
diff --git a/package/cla-sysrepo/Config.in b/package/cla-sysrepo/Config.in
index c1c7723..e9804e6 100644
--- a/package/cla-sysrepo/Config.in
+++ b/package/cla-sysrepo/Config.in
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_CLA_SYSREPO
 	bool "cla-sysrepo"
-	select BR2_PACKAGE_SYSREPO
 	select BR2_PACKAGE_SYSREPO_CPP
 	select BR2_PACKAGE_LIBYANG_CPP
 	select BR2_PACKAGE_DOCOPT_CPP
diff --git a/package/cla-sysrepo/cla-sysrepo.mk b/package/cla-sysrepo/cla-sysrepo.mk
index a19367c..a54755c 100644
--- a/package/cla-sysrepo/cla-sysrepo.mk
+++ b/package/cla-sysrepo/cla-sysrepo.mk
@@ -2,7 +2,7 @@
 CLA_SYSREPO_SITE = ssh://kundrat@cesnet.cz@gerrit.cesnet.cz:29418/CzechLight/cla-sysrepo
 CLA_SYSREPO_SITE_METHOD = git
 CLA_SYSREPO_INSTALL_STAGING = NO
-CLA_SYSREPO_DEPENDENCIES = sysrepo docopt-cpp spdlog systemd libgpiod boost cppcodec libev
+CLA_SYSREPO_DEPENDENCIES = sysrepo-cpp docopt-cpp spdlog systemd libgpiod boost cppcodec libev
 CLA_SYSREPO_CONF_OPTS = -DTHREADS_PTHREAD_ARG:STRING=-pthread
 CLA_SYSREPO_LICENSE_FILES = LICENSE.md
 
diff --git a/package/cla-sysrepo/czechlight-install-yang.sh b/package/cla-sysrepo/czechlight-install-yang.sh
index ccd0e3d..008d337 100755
--- a/package/cla-sysrepo/czechlight-install-yang.sh
+++ b/package/cla-sysrepo/czechlight-install-yang.sh
@@ -48,63 +48,64 @@
 
 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/iana-hardware@2018-03-13.yang
 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/ietf-hardware@2018-03-13.yang
-sysrepoctl --change ietf-hardware --permissions 0664 --enable-feature hardware-sensor --apply
+sysrepoctl --change ietf-hardware --permissions 0664 --enable-feature hardware-sensor
 
 if [[ ${YANG_ROADM} == 1 ]]; then
-    sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-roadm-device@2021-03-05.yang
-    sysrepoctl --change czechlight-roadm-device --group optics --permissions 0664 --apply
+    FEATURE_ARGS=""
     if [[ ${WITH_FEATURE} ]]; then
         for FEATURE in ${WITH_FEATURE}; do
-            sysrepoctl --change czechlight-roadm-device --enable-feature ${FEATURE}
+            FEATURE_ARGS="${FEATURE_ARGS} --enable-feature ${FEATURE}"
         done
     fi
+    sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-roadm-device@2021-03-05.yang ${FEATURE_ARGS}
+    sysrepoctl --change czechlight-roadm-device --group optics --permissions 0664
     sysrepocfg --datastore=startup --format=json --module=czechlight-roadm-device --import="${CLA_YANG}/${INITIAL_DATA}.json"
 fi
 
 if [[ ${YANG_COHERENT} == 1 ]]; then
     sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-coherent-add-drop@2021-03-05.yang
     sysrepocfg --datastore=startup --format=json --module=czechlight-coherent-add-drop --new-data="${CLA_YANG}/${INITIAL_DATA}.json"
-    sysrepoctl --change czechlight-coherent-add-drop --group optics --permissions 0664 --apply
+    sysrepoctl --change czechlight-coherent-add-drop --group optics --permissions 0664
 fi
 
 if [[ ${YANG_INLINE} == 1 ]]; then
     sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-inline-amp@2021-03-05.yang
     sysrepocfg --datastore=startup --format=json --module=czechlight-inline-amp --import="${CLA_YANG}/${INITIAL_DATA}.json"
-    sysrepoctl --change czechlight-inline-amp --group optics --permissions 0664 --apply
+    sysrepoctl --change czechlight-inline-amp --group optics --permissions 0664
 fi
 
 if [[ ${YANG_CALIBRATION} == 1 ]]; then
     sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-calibration-device@2019-06-25.yang
     sysrepocfg --datastore=startup --format=json --module=czechlight-calibration-device --import="${CLA_YANG}/${INITIAL_DATA}.json"
-    sysrepoctl --change czechlight-calibration-device --group optics --permissions 0664 --apply
+    sysrepoctl --change czechlight-calibration-device --group optics --permissions 0664
 fi
 
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-system@2014-08-06.yang
-sysrepoctl --change ietf-system --permissions 0664 --apply
+sysrepoctl --change ietf-system --permissions 0664
 
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-lldp@2020-11-04.yang
-sysrepoctl --change czechlight-lldp --permissions 0664 --apply
+sysrepoctl --change czechlight-lldp --permissions 0664
 
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-system@2021-01-13.yang
-sysrepoctl --change czechlight-system --permissions 0664 --apply
+sysrepoctl --change czechlight-system --permissions 0664
 
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-firewall@2021-01-25.yang
-sysrepoctl --change czechlight-firewall --permissions 0600 --apply
-sysrepoctl --change ietf-access-control-list --enable-feature eth --enable-feature match-on-eth --enable-feature match-on-ipv4 --enable-feature ipv4 --enable-feature match-on-ipv6 --enable-feature ipv6 --enable-feature mixed-eth-ipv4-ipv6
+sysrepoctl --change czechlight-firewall --permissions 0600
+sysrepoctl --change ietf-access-control-list --enable-feature match-on-eth --enable-feature eth --enable-feature match-on-ipv4 --enable-feature ipv4 --enable-feature match-on-ipv6 --enable-feature ipv6 --enable-feature mixed-eth-ipv4-ipv6
 
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/iana-if-type@2017-01-19.yang
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-interfaces@2018-02-20.yang
-sysrepoctl --change ietf-interfaces --permissions 0664 --apply
+sysrepoctl --change ietf-interfaces --permissions 0664
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ip@2018-02-22.yang
-sysrepoctl --change ietf-ip --permissions 0664 --apply
+sysrepoctl --change ietf-ip --permissions 0664
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-routing@2018-03-13.yang
-sysrepoctl --change ietf-routing --permissions 0664 --apply
+sysrepoctl --change ietf-routing --permissions 0664
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ipv4-unicast-routing@2018-03-13.yang
-sysrepoctl --change ietf-ipv4-unicast-routing --permissions 0664 --apply
+sysrepoctl --change ietf-ipv4-unicast-routing --permissions 0664
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ipv6-unicast-routing@2018-03-13.yang
-sysrepoctl --change ietf-ipv6-unicast-routing --permissions 0664 --apply
+sysrepoctl --change ietf-ipv6-unicast-routing --permissions 0664
 sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-network@2021-02-22.yang
-sysrepoctl --change czechlight-network --permissions 0664 --apply
+sysrepoctl --change czechlight-network --permissions 0664
 
 # If not do not copy here from startup -> running, running might be stale.
 sysrepocfg -C startup
diff --git a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
index 60f4785..bf000bd 100644
--- a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
+++ b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
@@ -15,7 +15,7 @@
 define CZECHLIGHT_CFG_FS_BUILD_CMDS
 	$(TARGET_CC) $(CZECHLIGHT_CFG_FS_PKGDIR)/czechlight-random-seed.c -o $(@D)/czechlight-random-seed
 
-	$(HOST_DIR)/usr/bin/yanglint -t config --strict \
+	$(HOST_DIR)/usr/bin/yanglint -t config \
 		$(TARGET_DIR)/usr/share/yang/modules/netopeer2/ietf-netconf-acm@2018-02-14.yang \
 		$(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/nacm.json
 endef
diff --git a/package/reset-sysrepo/reset-sysrepo.mk b/package/reset-sysrepo/reset-sysrepo.mk
index 773806c..cfca98d 100644
--- a/package/reset-sysrepo/reset-sysrepo.mk
+++ b/package/reset-sysrepo/reset-sysrepo.mk
@@ -3,7 +3,7 @@
 define RESET_SYSREPO_PATCH_DEV_SHM
         sed -i \
                 's|^#define SR_SHM_DIR .*|#define SR_SHM_DIR "/run/sysrepo"|' \
-                $(@D)/src/common.h.in
+                $(@D)/src/config.h.in
 endef
 
 SYSREPO_PRE_PATCH_HOOKS += RESET_SYSREPO_PATCH_DEV_SHM
diff --git a/package/rousette/Config.in b/package/rousette/Config.in
index 423709f..aa4040e 100644
--- a/package/rousette/Config.in
+++ b/package/rousette/Config.in
@@ -2,13 +2,11 @@
 	bool "rousette"
 	select BR2_PACKAGE_BOOST
 	select BR2_PACKAGE_DOCOPT_CPP
-	select BR2_PACKAGE_LIBYANG
 	select BR2_PACKAGE_LIBYANG_CPP
 	select BR2_PACKAGE_NGHTTP2
 	select BR2_PACKAGE_NGHTTP2_CXX
 	select BR2_PACKAGE_SPDLOG
 	select BR2_PACKAGE_SYSTEMD
-	select BR2_PACKAGE_SYSREPO
 	select BR2_PACKAGE_SYSREPO_CPP
 	help
 	  RESTCONF-ish server on top of sysrepo
diff --git a/package/rousette/rousette.mk b/package/rousette/rousette.mk
index 38d26d2..c5391da 100644
--- a/package/rousette/rousette.mk
+++ b/package/rousette/rousette.mk
@@ -2,7 +2,7 @@
 ROUSETTE_SITE = https://gerrit.cesnet.cz/CzechLight/rousette
 ROUSETTE_SITE_METHOD = git
 ROUSETTE_INSTALL_STAGING = NO
-ROUSETTE_DEPENDENCIES = boost docopt-cpp nghttp2 spdlog systemd sysrepo
+ROUSETTE_DEPENDENCIES = boost docopt-cpp nghttp2 spdlog systemd sysrepo-cpp
 ROUSETTE_LICENSE = Apache-2.0
 ROUSETTE_LICENSE_FILES = LICENSE.md
 
diff --git a/package/velia/velia.mk b/package/velia/velia.mk
index ec09817..885143e 100644
--- a/package/velia/velia.mk
+++ b/package/velia/velia.mk
@@ -2,7 +2,7 @@
 VELIA_SITE = https://gerrit.cesnet.cz/CzechLight/velia
 VELIA_SITE_METHOD = git
 VELIA_INSTALL_STAGING = NO
-VELIA_DEPENDENCIES = docopt-cpp spdlog boost sdbus-cpp systemd sysrepo libnl json-for-modern-cpp
+VELIA_DEPENDENCIES = docopt-cpp spdlog boost sdbus-cpp systemd sysrepo-cpp libnl json-for-modern-cpp
 VELIA_LICENSE = Apache-2.0
 VELIA_LICENSE_FILES = LICENSE.md
 
diff --git a/submodules/buildroot b/submodules/buildroot
index 83b5ba3..402ee09 160000
--- a/submodules/buildroot
+++ b/submodules/buildroot
@@ -1 +1 @@
-Subproject commit 83b5ba3c200b87da3623c20065ee89938938bfdd
+Subproject commit 402ee098bb7c8ba624c6cad00a035e3a3ef33839
diff --git a/submodules/cla-sysrepo b/submodules/cla-sysrepo
index e54f3e5..d994028 160000
--- a/submodules/cla-sysrepo
+++ b/submodules/cla-sysrepo
@@ -1 +1 @@
-Subproject commit e54f3e53d14326a2061c86ce6b2654543d32a86c
+Subproject commit d9940284e52e3c729f45064272f364c41d311820
diff --git a/submodules/netconf-cli b/submodules/netconf-cli
index ba3415a..cfdb922 160000
--- a/submodules/netconf-cli
+++ b/submodules/netconf-cli
@@ -1 +1 @@
-Subproject commit ba3415a209d76a6d7ab3a7887cb2a926ee4d8cac
+Subproject commit cfdb922dc40bec8b01e631f7629d3c88125bc6e6
diff --git a/submodules/rousette b/submodules/rousette
index 50e79a6..64e2ac3 160000
--- a/submodules/rousette
+++ b/submodules/rousette
@@ -1 +1 @@
-Subproject commit 50e79a61540693309f0ced12dfb085fbc06c61fa
+Subproject commit 64e2ac33b15abef1de8521c5b7ef1b7666bcfa96
diff --git a/submodules/velia b/submodules/velia
index d2e4bdf..7efd6d5 160000
--- a/submodules/velia
+++ b/submodules/velia
@@ -1 +1 @@
-Subproject commit d2e4bdfbf261763568f7c29d60440230f7267f37
+Subproject commit 7efd6d57ae5509927747895c49105a7804b5fe22