summaryrefslogtreecommitdiff
path: root/src/network/networkd-nexthop.h
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2019-10-04 21:40:51 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-10-14 21:32:48 +0900
commitc16c780804714551ac2a777096865de5228fe6ff (patch)
treed3911a517681a05379561af3a7da3a263b9d6e20 /src/network/networkd-nexthop.h
parent55d3fdcf5e9f6ceb9fc1a5f93120305f20abf690 (diff)
downloadsystemd-c16c780804714551ac2a777096865de5228fe6ff.tar.gz
network: introduce ip nexthop routing
Used to manipulate entries in the kernel's nexthop tables. Example: ``` [NextHop] Id=3 Gateway=192.168.5.1 ```
Diffstat (limited to 'src/network/networkd-nexthop.h')
-rw-r--r--src/network/networkd-nexthop.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/network/networkd-nexthop.h b/src/network/networkd-nexthop.h
new file mode 100644
index 0000000000..28cbdad738
--- /dev/null
+++ b/src/network/networkd-nexthop.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: LGPL-2.1+
+ * Copyright © 2019 VMware, Inc.
+ */
+
+#pragma once
+
+#include "conf-parser.h"
+#include "macro.h"
+
+typedef struct NextHop NextHop;
+typedef struct NetworkConfigSection NetworkConfigSection;
+
+#include "networkd-network.h"
+#include "networkd-util.h"
+
+struct NextHop {
+ Network *network;
+ NetworkConfigSection *section;
+
+ Link *link;
+
+ unsigned char protocol;
+
+ int family;
+ uint32_t oif;
+ uint32_t id;
+
+ union in_addr_union gw;
+
+ LIST_FIELDS(NextHop, nexthops);
+};
+
+extern const struct hash_ops nexthop_hash_ops;
+
+int nexthop_new(NextHop **ret);
+void nexthop_free(NextHop *nexthop);
+int nexthop_configure(NextHop *nexthop, Link *link, link_netlink_message_handler_t callback);
+int nexthop_remove(NextHop *nexthop, Link *link, link_netlink_message_handler_t callback);
+
+int nexthop_get(Link *link, NextHop *in, NextHop **ret);
+int nexthop_add(Link *link, NextHop *in, NextHop **ret);
+int nexthop_add_foreign(Link *link, NextHop *in, NextHop **ret);
+bool nexthop_equal(NextHop *r1, NextHop *r2);
+
+int nexthop_section_verify(NextHop *nexthop);
+
+DEFINE_NETWORK_SECTION_FUNCTIONS(NextHop, nexthop_free);
+
+CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id);
+CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_gateway);