summaryrefslogtreecommitdiff
path: root/src/network/networkd-route.h
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-11-03 15:03:50 +0100
committerDaniel Mack <github@zonque.org>2015-11-03 15:03:50 +0100
commit4084052911be74c992f74b0a693115128f2a24a7 (patch)
treedf613da8a04b49f781f4265dd5569ddf25978cb0 /src/network/networkd-route.h
parent8889cbd4dcf7ee42c0a0b08f46372044cc041ff6 (diff)
parentc598ac76266572529b8959145651d18546010869 (diff)
Merge pull request #1726 from teg/networkd-2
networkd: (de)serialize more state and support expiring routes
Diffstat (limited to 'src/network/networkd-route.h')
-rw-r--r--src/network/networkd-route.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h
index c9972e4933..d0a51838ed 100644
--- a/src/network/networkd-route.h
+++ b/src/network/networkd-route.h
@@ -30,20 +30,24 @@ struct Route {
Network *network;
unsigned section;
+ Link *link;
+
int family;
unsigned char dst_prefixlen;
unsigned char src_prefixlen;
unsigned char scope;
- uint32_t metrics;
unsigned char protocol; /* RTPROT_* */
unsigned char tos;
- unsigned char priority;
+ uint32_t priority; /* note that ip(8) calls this 'metric' */
unsigned char table;
- union in_addr_union in_addr;
- union in_addr_union dst_addr;
- union in_addr_union src_addr;
- union in_addr_union prefsrc_addr;
+ union in_addr_union gw;
+ union in_addr_union dst;
+ union in_addr_union src;
+ union in_addr_union prefsrc;
+
+ usec_t lifetime;
+ sd_event_source *expire;
LIST_FIELDS(Route, routes);
};
@@ -54,6 +58,14 @@ void route_free(Route *route);
int route_configure(Route *route, Link *link, sd_netlink_message_handler_t callback);
int route_remove(Route *route, Link *link, sd_netlink_message_handler_t callback);
+int route_get(Link *link, int family, union in_addr_union *dst, unsigned char dst_prefixlen, unsigned char tos, uint32_t priority, unsigned char table, Route **ret);
+int route_add(Link *link, int family, union in_addr_union *dst, unsigned char dst_prefixlen, unsigned char tos, uint32_t priority, unsigned char table, Route **ret);
+int route_add_foreign(Link *link, int family, union in_addr_union *dst, unsigned char dst_prefixlen, unsigned char tos, uint32_t priority, unsigned char table, Route **ret);
+int route_update(Route *route, union in_addr_union *src, unsigned char src_prefixlen, union in_addr_union *gw, union in_addr_union *prefsrc, unsigned char scope, unsigned char protocol);
+void route_drop(Route *route);
+
+int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata);
+
DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
#define _cleanup_route_free_ _cleanup_(route_freep)