From: Susant Sahani Date: Wed, 18 Mar 2020 03:27:09 +0000 (+0100) Subject: networkctl: add support to display ip6gre, ip6gretap, ip6erspan X-Git-Tag: v246-rc1~734^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad760bc1e71c469c475667034a158acb88d30aa1;p=thirdparty%2Fsystemd.git networkctl: add support to display ip6gre, ip6gretap, ip6erspan --- diff --git a/src/network/networkctl.c b/src/network/networkctl.c index ff280e9c162..c4aecc51b9e 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -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,