mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
networkctl: add support to display learned fdb entries
Since Linux commit ddd1ad68826d ("net: bridge: Add netlink knobs for number / max learned FDB entries") [1] it is possible to limit to number of dynamically learned fdb entries per bridge. Add support to the systemd networkctl for the netlink bridge attributes IFLA_BR_FDB_MAX_LEARNED and IFLA_BR_FDB_N_LEARNED. [1] https://lore.kernel.org/all/20231016-fdb_limit-v5-0-32cddff87758@avm.de/ Signed-off-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
This commit is contained in:
parent
f379f36b11
commit
5a3e759bd0
@ -173,6 +173,7 @@ static const NLAPolicy rtnl_link_info_data_bridge_policies[] = {
|
||||
[IFLA_BR_MCAST_MLD_VERSION] = BUILD_POLICY(U8),
|
||||
[IFLA_BR_VLAN_STATS_PER_PORT] = BUILD_POLICY(U8),
|
||||
[IFLA_BR_MULTI_BOOLOPT] = BUILD_POLICY_WITH_SIZE(BINARY, sizeof(struct br_boolopt_multi)),
|
||||
[IFLA_BR_FDB_N_LEARNED] = BUILD_POLICY(U32),
|
||||
[IFLA_BR_FDB_MAX_LEARNED] = BUILD_POLICY(U32),
|
||||
};
|
||||
|
||||
|
@ -415,6 +415,9 @@ typedef struct LinkInfo {
|
||||
uint16_t priority;
|
||||
uint8_t mcast_igmp_version;
|
||||
uint8_t port_state;
|
||||
uint32_t fdb_max_learned;
|
||||
uint32_t fdb_n_learned;
|
||||
bool has_fdb_learned;
|
||||
|
||||
/* vxlan info */
|
||||
VxLanInfo vxlan_info;
|
||||
@ -522,6 +525,9 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
||||
(void) sd_netlink_message_read_u16(m, IFLA_BR_PRIORITY, &info->priority);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_BR_MCAST_IGMP_VERSION, &info->mcast_igmp_version);
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_BRPORT_STATE, &info->port_state);
|
||||
if (sd_netlink_message_read_u32(m, IFLA_BR_FDB_MAX_LEARNED, &info->fdb_max_learned) >= 0 &&
|
||||
sd_netlink_message_read_u32(m, IFLA_BR_FDB_N_LEARNED, &info->fdb_n_learned) >= 0)
|
||||
info->has_fdb_learned = true;
|
||||
} if (streq(info->netdev_kind, "bond")) {
|
||||
(void) sd_netlink_message_read_u8(m, IFLA_BOND_MODE, &info->mode);
|
||||
(void) sd_netlink_message_read_u32(m, IFLA_BOND_MIIMON, &info->miimon);
|
||||
@ -1910,6 +1916,16 @@ static int link_status_one(
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
if (info->has_fdb_learned) {
|
||||
r = table_add_many(table,
|
||||
TABLE_FIELD, "FDB Learned",
|
||||
TABLE_UINT32, info->fdb_n_learned,
|
||||
TABLE_FIELD, "FDB Max Learned",
|
||||
TABLE_UINT32, info->fdb_max_learned);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
||||
if (info->port_state <= BR_STATE_BLOCKING) {
|
||||
r = table_add_many(table,
|
||||
TABLE_FIELD, "Port State",
|
||||
|
Loading…
Reference in New Issue
Block a user