diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index dca9b1550c..e5d51f1572 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -32,6 +32,7 @@ #include "networkd-manager.h" #include "networkd-ndisc.h" #include "networkd-neighbor.h" +#include "networkd-nexthop.h" #include "networkd-sriov.h" #include "networkd-radv.h" #include "networkd-routing-policy-rule.h" diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 94b036e81e..0a0fb36f95 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -30,6 +30,7 @@ #include "networkd-manager-bus.h" #include "networkd-manager.h" #include "networkd-network-bus.h" +#include "networkd-nexthop.h" #include "networkd-routing-policy-rule.h" #include "networkd-speed-meter.h" #include "ordered-set.h" diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index b3f3a22d07..25a7b8991a 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -15,6 +15,7 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") #include "networkd-ipv4ll.h" #include "networkd-ndisc.h" #include "networkd-network.h" +#include "networkd-nexthop.h" #include "networkd-routing-policy-rule.h" #include "networkd-sriov.h" #include "qdisc.h" diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index d8831561c4..d04d523c32 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -16,6 +16,7 @@ #include "network-internal.h" #include "networkd-manager.h" #include "networkd-network.h" +#include "networkd-nexthop.h" #include "networkd-routing-policy-rule.h" #include "networkd-sriov.h" #include "parse-util.h" diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index c92b751866..12ec6ef1b2 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -26,7 +26,6 @@ #include "networkd-mdb.h" #include "networkd-ndisc.h" #include "networkd-neighbor.h" -#include "networkd-nexthop.h" #include "networkd-radv.h" #include "networkd-route.h" #include "networkd-util.h" diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 6c9d1c57dd..4f40883e54 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -5,19 +5,18 @@ #include #include "alloc-util.h" -#include "conf-parser.h" -#include "in-addr-util.h" #include "netlink-util.h" +#include "networkd-link.h" #include "networkd-manager.h" +#include "networkd-network.h" #include "networkd-nexthop.h" #include "parse-util.h" #include "set.h" #include "string-util.h" -#include "util.h" -void nexthop_free(NextHop *nexthop) { +NextHop *nexthop_free(NextHop *nexthop) { if (!nexthop) - return; + return NULL; if (nexthop->network) { assert(nexthop->section); @@ -31,7 +30,7 @@ void nexthop_free(NextHop *nexthop) { set_remove(nexthop->link->nexthops_foreign, nexthop); } - free(nexthop); + return mfree(nexthop); } DEFINE_NETWORK_SECTION_FUNCTIONS(NextHop, nexthop_free); diff --git a/src/network/networkd-nexthop.h b/src/network/networkd-nexthop.h index 2ff8b4b81e..7d1705904f 100644 --- a/src/network/networkd-nexthop.h +++ b/src/network/networkd-nexthop.h @@ -4,16 +4,19 @@ #pragma once +#include + +#include "sd-netlink.h" + #include "conf-parser.h" -#include "macro.h" - -typedef struct NextHop NextHop; -typedef struct NetworkConfigSection NetworkConfigSection; - -#include "networkd-network.h" +#include "in-addr-util.h" #include "networkd-util.h" -struct NextHop { +typedef struct Link Link; +typedef struct Manager Manager; +typedef struct Network Network; + +typedef struct NextHop { Network *network; NetworkConfigSection *section; @@ -26,15 +29,14 @@ struct NextHop { uint32_t id; union in_addr_union gw; -}; +} NextHop; -void nexthop_free(NextHop *nexthop); +NextHop *nexthop_free(NextHop *nexthop); +int nexthop_section_verify(NextHop *nexthop); int link_set_nexthop(Link *link); int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, Manager *m); -int nexthop_section_verify(NextHop *nexthop); - CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id); CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_gateway);