]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkctl: add support to display ip6gre, ip6gretap, ip6erspan
authorSusant Sahani <ssahani@vmware.com>
Wed, 18 Mar 2020 03:27:09 +0000 (04:27 +0100)
committerSusant Sahani <ssahani@vmware.com>
Wed, 18 Mar 2020 03:27:09 +0000 (04:27 +0100)
src/network/networkctl.c

index ff280e9c16289f80a60c4561390e3e87888bf7f1..c4aecc51b9e13a5a90e3bac2b9ba64551109c1ca 100644 (file)
@@ -273,9 +273,11 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
         } else if (STR_IN_SET(received_kind, "gre", "gretap", "erspan")) {
                 (void) sd_netlink_message_read_in_addr(m, IFLA_GRE_LOCAL, &info->local.in);
                 (void) sd_netlink_message_read_in_addr(m, IFLA_GRE_REMOTE, &info->remote.in);
+        } else if (STR_IN_SET(received_kind, "ip6gre", "ip6gretap", "ip6erspan")) {
+                (void) sd_netlink_message_read_in6_addr(m, IFLA_GRE_LOCAL, &info->local.in6);
+                (void) sd_netlink_message_read_in6_addr(m, IFLA_GRE_REMOTE, &info->remote.in6);
         }
 
-
         strncpy(info->netdev_kind, received_kind, IFNAMSIZ);
 
         (void) sd_netlink_message_exit_container(m);
@@ -1498,6 +1500,24 @@ static int link_status_one(
                         if (r < 0)
                                 return table_log_add_error(r);
                 }
+        } else if (STRPTR_IN_SET(info->netdev_kind, "ip6gre", "ip6gretap", "ip6erspan")) {
+                if (!in_addr_is_null(AF_INET6, &info->local)) {
+                        r = table_add_many(table,
+                                           TABLE_EMPTY,
+                                           TABLE_STRING, "Local:",
+                                           TABLE_IN6_ADDR, &info->local);
+                        if (r < 0)
+                                return table_log_add_error(r);
+                }
+
+                if (!in_addr_is_null(AF_INET6, &info->remote)) {
+                        r = table_add_many(table,
+                                           TABLE_EMPTY,
+                                           TABLE_STRING, "Remote:",
+                                           TABLE_IN6_ADDR, &info->remote);
+                        if (r < 0)
+                                return table_log_add_error(r);
+                }
         } else if (streq_ptr(info->netdev_kind, "geneve")) {
                 r = table_add_many(table,
                                    TABLE_EMPTY,