]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: include route or nexthop flags in the debug logs 21359/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 14 Nov 2021 05:40:41 +0000 (14:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 14 Nov 2021 05:41:37 +0000 (14:41 +0900)
src/network/networkd-nexthop.c
src/network/networkd-route.c

index f043754ea103208771b4c2be54dd75f5bce6c571..b829aaab90ade59b6c2f0e2a6f13153363db09c3 100644 (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) {
index 946c69621fab289aeea903b0df018892bfccc216..1b3bea98f6d5cc0f06ef7324570df85da7d2a75d 100644 (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) {