Skip to content

Commit 75156cc

Browse files
committed
network: cleanup headers included in networkd-nexthop.h
1 parent b82663d commit 75156cc

File tree

7 files changed

+21
-17
lines changed

7 files changed

+21
-17
lines changed

src/network/networkd-link.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "networkd-manager.h"
3333
#include "networkd-ndisc.h"
3434
#include "networkd-neighbor.h"
35+
#include "networkd-nexthop.h"
3536
#include "networkd-sriov.h"
3637
#include "networkd-radv.h"
3738
#include "networkd-routing-policy-rule.h"

src/network/networkd-manager.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "networkd-manager-bus.h"
3131
#include "networkd-manager.h"
3232
#include "networkd-network-bus.h"
33+
#include "networkd-nexthop.h"
3334
#include "networkd-routing-policy-rule.h"
3435
#include "networkd-speed-meter.h"
3536
#include "ordered-set.h"

src/network/networkd-network-gperf.gperf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
1515
#include "networkd-ipv4ll.h"
1616
#include "networkd-ndisc.h"
1717
#include "networkd-network.h"
18+
#include "networkd-nexthop.h"
1819
#include "networkd-routing-policy-rule.h"
1920
#include "networkd-sriov.h"
2021
#include "qdisc.h"

src/network/networkd-network.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "network-internal.h"
1717
#include "networkd-manager.h"
1818
#include "networkd-network.h"
19+
#include "networkd-nexthop.h"
1920
#include "networkd-routing-policy-rule.h"
2021
#include "networkd-sriov.h"
2122
#include "parse-util.h"

src/network/networkd-network.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "networkd-mdb.h"
2727
#include "networkd-ndisc.h"
2828
#include "networkd-neighbor.h"
29-
#include "networkd-nexthop.h"
3029
#include "networkd-radv.h"
3130
#include "networkd-route.h"
3231
#include "networkd-util.h"

src/network/networkd-nexthop.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
#include <linux/nexthop.h>
66

77
#include "alloc-util.h"
8-
#include "conf-parser.h"
9-
#include "in-addr-util.h"
108
#include "netlink-util.h"
9+
#include "networkd-link.h"
1110
#include "networkd-manager.h"
11+
#include "networkd-network.h"
1212
#include "networkd-nexthop.h"
1313
#include "parse-util.h"
1414
#include "set.h"
1515
#include "string-util.h"
16-
#include "util.h"
1716

18-
void nexthop_free(NextHop *nexthop) {
17+
NextHop *nexthop_free(NextHop *nexthop) {
1918
if (!nexthop)
20-
return;
19+
return NULL;
2120

2221
if (nexthop->network) {
2322
assert(nexthop->section);
@@ -31,7 +30,7 @@ void nexthop_free(NextHop *nexthop) {
3130
set_remove(nexthop->link->nexthops_foreign, nexthop);
3231
}
3332

34-
free(nexthop);
33+
return mfree(nexthop);
3534
}
3635

3736
DEFINE_NETWORK_SECTION_FUNCTIONS(NextHop, nexthop_free);

src/network/networkd-nexthop.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44

55
#pragma once
66

7-
#include "conf-parser.h"
8-
#include "macro.h"
7+
#include <inttypes.h>
98

10-
typedef struct NextHop NextHop;
11-
typedef struct NetworkConfigSection NetworkConfigSection;
9+
#include "sd-netlink.h"
1210

13-
#include "networkd-network.h"
11+
#include "conf-parser.h"
12+
#include "in-addr-util.h"
1413
#include "networkd-util.h"
1514

16-
struct NextHop {
15+
typedef struct Link Link;
16+
typedef struct Manager Manager;
17+
typedef struct Network Network;
18+
19+
typedef struct NextHop {
1720
Network *network;
1821
NetworkConfigSection *section;
1922

@@ -26,15 +29,14 @@ struct NextHop {
2629
uint32_t id;
2730

2831
union in_addr_union gw;
29-
};
32+
} NextHop;
3033

31-
void nexthop_free(NextHop *nexthop);
34+
NextHop *nexthop_free(NextHop *nexthop);
35+
int nexthop_section_verify(NextHop *nexthop);
3236

3337
int link_set_nexthop(Link *link);
3438

3539
int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
3640

37-
int nexthop_section_verify(NextHop *nexthop);
38-
3941
CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id);
4042
CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_gateway);

0 commit comments

Comments
 (0)