mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
Merge pull request #15224 from ssahani/geneve
networkctl: Display more geneve properties
This commit is contained in:
commit
1ab2033804
@ -29,6 +29,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
#include "format-util.h"
|
||||
#include "geneve-util.h"
|
||||
#include "glob-util.h"
|
||||
#include "hwdb-util.h"
|
||||
#include "local-addresses.h"
|
||||
@ -161,8 +162,14 @@ typedef struct LinkInfo {
|
||||
/* tunnel info */
|
||||
uint8_t ttl;
|
||||
uint8_t tos;
|
||||
uint8_t inherit;
|
||||
uint8_t df;
|
||||
uint8_t csum;
|
||||
uint8_t csum6_tx;
|
||||
uint8_t csum6_rx;
|
||||
uint16_t tunnel_port;
|
||||
uint32_t vni;
|
||||
uint32_t label;
|
||||
union in_addr_union local;
|
||||
union in_addr_union remote;
|
||||
|
||||
@ -286,8 +293,14 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
||||
(void) sd_netlink_message_read_in6_addr(m, IFLA_GENEVE_REMOTE6, &info->remote.in6);
|
||||
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TTL, &info->ttl);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TTL_INHERIT, &info->inherit);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TOS, &info->tos);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_DF, &info->df);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_CSUM, &info->csum);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, &info->csum6_tx);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, &info->csum6_rx);
|
||||
(void) sd_netlink_message_read_u16(m, IFLA_GENEVE_PORT, &info->tunnel_port);
|
||||
(void) sd_netlink_message_read_u32(m, IFLA_GENEVE_LABEL, &info->label);
|
||||
} 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);
|
||||
@ -1660,6 +1673,52 @@ static int link_status_one(
|
||||
TABLE_UINT16, info->tunnel_port);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_EMPTY,
|
||||
TABLE_STRING, "Inherit:",
|
||||
TABLE_STRING, geneve_df_to_string(info->inherit));
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
if (info->df > 0) {
|
||||
r = table_add_many(table,
|
||||
TABLE_EMPTY,
|
||||
TABLE_STRING, "IPDoNotFragment:",
|
||||
TABLE_UINT8, info->df);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_EMPTY,
|
||||
TABLE_STRING, "UDPChecksum:",
|
||||
TABLE_BOOLEAN, info->csum);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_EMPTY,
|
||||
TABLE_STRING, "UDP6ZeroChecksumTx:",
|
||||
TABLE_BOOLEAN, info->csum6_tx);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_EMPTY,
|
||||
TABLE_STRING, "UDP6ZeroChecksumRx:",
|
||||
TABLE_BOOLEAN, info->csum6_rx);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
if (info->label > 0) {
|
||||
r = table_add_many(table,
|
||||
TABLE_EMPTY,
|
||||
TABLE_STRING, "FlowLabel:",
|
||||
TABLE_UINT32, info->label);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (info->has_wlan_link_info) {
|
||||
|
12
src/shared/geneve-util.c
Normal file
12
src/shared/geneve-util.c
Normal file
@ -0,0 +1,12 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include "geneve-util.h"
|
||||
#include "string-table.h"
|
||||
|
||||
static const char* const geneve_df_table[_NETDEV_GENEVE_DF_MAX] = {
|
||||
[NETDEV_GENEVE_DF_UNSET] = "unset",
|
||||
[NETDEV_GENEVE_DF_SET] = "set",
|
||||
[NETDEV_GENEVE_DF_INHERIT] = "inherit",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(geneve_df, GeneveDF);
|
17
src/shared/geneve-util.h
Normal file
17
src/shared/geneve-util.h
Normal file
@ -0,0 +1,17 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <linux/if_link.h>
|
||||
|
||||
#include "conf-parser.h"
|
||||
|
||||
typedef enum GeneveDF {
|
||||
NETDEV_GENEVE_DF_UNSET = GENEVE_DF_UNSET,
|
||||
NETDEV_GENEVE_DF_SET = GENEVE_DF_SET,
|
||||
NETDEV_GENEVE_DF_INHERIT = GENEVE_DF_INHERIT,
|
||||
_NETDEV_GENEVE_DF_MAX,
|
||||
_NETDEV_GENEVE_DF_INVALID = -1,
|
||||
} GeneveDF;
|
||||
|
||||
const char *geneve_df_to_string(GeneveDF d) _const_;
|
||||
GeneveDF geneve_df_from_string(const char *d) _pure_;
|
@ -89,6 +89,8 @@ shared_sources = files('''
|
||||
fstab-util.h
|
||||
generator.c
|
||||
generator.h
|
||||
geneve-util.c
|
||||
geneve-util.h
|
||||
gpt.c
|
||||
gpt.h
|
||||
group-record-nss.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user