summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-10-12 17:54:41 +0200
committerTom Gundersen <teg@jklm.no>2015-10-30 12:32:49 +0100
commitc1eb9872f6d21e04c361a44987f36451e80ac126 (patch)
tree426a99d85ba57223ccfbd09eeb060a39a88ddce5 /src/network
parent1c8e710c2b479129c3ad06a0e8e2d21ae4aefd38 (diff)
networkd: link - serialize routes
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-link.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 0f73d2128c..c5be599ecd 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -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)) {