network: include route or nexthop flags in the debug logs

This commit is contained in:
Yu Watanabe
2021-11-14 14:40:41 +09:00
parent 18b23bd493
commit b07d8145e1
2 changed files with 8 additions and 6 deletions

View File

@@ -346,7 +346,7 @@ static int nexthop_acquire_id(Manager *manager, NextHop *nexthop) {
}
static void log_nexthop_debug(const NextHop *nexthop, const char *str, const Link *link) {
_cleanup_free_ char *state = NULL, *gw = NULL, *group = NULL;
_cleanup_free_ char *state = NULL, *gw = NULL, *group = NULL, *flags = NULL;
struct nexthop_grp *nhg;
assert(nexthop);
@@ -359,13 +359,14 @@ static void log_nexthop_debug(const NextHop *nexthop, const char *str, const Lin
(void) network_config_state_to_string_alloc(nexthop->state, &state);
(void) in_addr_to_string(nexthop->family, &nexthop->gw, &gw);
(void) route_flags_to_string_alloc(nexthop->flags, &flags);
HASHMAP_FOREACH(nhg, nexthop->group)
(void) strextendf_with_separator(&group, ",", "%"PRIu32":%"PRIu32, nhg->id, nhg->weight+1);
log_link_debug(link, "%s %s nexthop (%s): id: %"PRIu32", gw: %s, blackhole: %s, group: %s",
log_link_debug(link, "%s %s nexthop (%s): id: %"PRIu32", gw: %s, blackhole: %s, group: %s, flags: %s",
str, strna(network_config_source_to_string(nexthop->source)), strna(state),
nexthop->id, strna(gw), yes_no(nexthop->blackhole), strna(group));
nexthop->id, strna(gw), yes_no(nexthop->blackhole), strna(group), strna(flags));
}
static int nexthop_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {

View File

@@ -544,7 +544,7 @@ void link_mark_routes(Link *link, NetworkConfigSource source, const struct in6_a
static void log_route_debug(const Route *route, const char *str, const Link *link, const Manager *manager) {
_cleanup_free_ char *state = NULL, *dst = NULL, *src = NULL, *gw_alloc = NULL, *prefsrc = NULL,
*table = NULL, *scope = NULL, *proto = NULL;
*table = NULL, *scope = NULL, *proto = NULL, *flags = NULL;
const char *gw = NULL;
assert(route);
@@ -592,15 +592,16 @@ static void log_route_debug(const Route *route, const char *str, const Link *lin
(void) route_scope_to_string_alloc(route->scope, &scope);
(void) manager_get_route_table_to_string(manager, route->table, &table);
(void) route_protocol_full_to_string_alloc(route->protocol, &proto);
(void) route_flags_to_string_alloc(route->flags, &flags);
log_link_debug(link,
"%s %s route (%s): dst: %s, src: %s, gw: %s, prefsrc: %s, scope: %s, table: %s, "
"proto: %s, type: %s, nexthop: %"PRIu32", priority: %"PRIu32,
"proto: %s, type: %s, nexthop: %"PRIu32", priority: %"PRIu32", flags: %s",
str, strna(network_config_source_to_string(route->source)), strna(state),
strna(dst), strna(src), strna(gw), strna(prefsrc),
strna(scope), strna(table), strna(proto),
strna(route_type_to_string(route->type)),
route->nexthop_id, route->priority);
route->nexthop_id, route->priority, strna(flags));
}
static int route_set_netlink_message(const Route *route, sd_netlink_message *req, Link *link) {