From: Yu Watanabe Date: Sun, 14 Nov 2021 05:40:41 +0000 (+0900) Subject: network: include route or nexthop flags in the debug logs X-Git-Tag: v250-rc1~263^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b07d8145e10d117fe52c1db93034713406dcaa2f;p=thirdparty%2Fsystemd.git network: include route or nexthop flags in the debug logs --- diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index f043754ea10..b829aaab90a 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -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) { diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 946c69621fa..1b3bea98f6d 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -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) {