]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: link - serialize routes
authorTom Gundersen <teg@jklm.no>
Mon, 12 Oct 2015 15:54:41 +0000 (17:54 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 30 Oct 2015 11:32:49 +0000 (12:32 +0100)
src/network/networkd-link.c

index 0f73d2128ccede174d597fac7f43ed292fe2c111..c5be599ecdc93847eb8f429995aa2c626dcb2cac 100644 (file)
@@ -2372,6 +2372,7 @@ int link_save(Link *link) {
         _cleanup_fclose_ FILE *f = NULL;
         const char *admin_state, *oper_state;
         Address *a;
+        Route *route;
         Iterator i;
         int r;
 
@@ -2559,6 +2560,22 @@ int link_save(Link *link) {
                 }
 
                 fputc('\n', f);
+
+                fputs("ROUTES=", f);
+                space = false;
+                SET_FOREACH(route, link->routes, i) {
+                        _cleanup_free_ char *route_str = NULL;
+
+                        r = in_addr_to_string(route->family, &route->dst, &route_str);
+                        if (r < 0)
+                                goto fail;
+
+                        fprintf(f, "%s%s/%hhu/%hhu/%"PRIu32"/%hhu", space ? " " : "", route_str,
+                                route->dst_prefixlen, route->tos, route->priority, route->table);
+                        space = true;
+                }
+
+                fputc('\n', f);
         }
 
         if (!hashmap_isempty(link->bound_to_links)) {