network: cleanup header inclusion

This commit is contained in:
Yu Watanabe 2019-10-30 17:02:15 +09:00
parent b7a4129ca9
commit 737f140546
49 changed files with 114 additions and 134 deletions

View File

@ -2704,7 +2704,7 @@ public_programs += exe
if conf.get('ENABLE_NETWORKD') == 1
executable('systemd-networkd',
systemd_networkd_sources,
include_directories : includes,
include_directories : network_include_dir,
link_with : [libnetworkd_core,
libsystemd_network,
libudev_static,

View File

@ -131,7 +131,7 @@ network_generator_sources = files('''
generator/network-generator.h
'''.split())
network_include_dir = include_directories('.')
network_include_dir = [includes, include_directories(['.', 'netdev', 'tc'])]
if conf.get('ENABLE_NETWORKD') == 1
networkd_gperf_c = custom_target(
@ -159,7 +159,7 @@ if conf.get('ENABLE_NETWORKD') == 1
networkd_gperf_c,
networkd_network_gperf_c,
netdev_gperf_c,
include_directories : includes,
include_directories : network_include_dir,
link_with : [libshared])
install_data('org.freedesktop.network1.conf',
@ -187,7 +187,9 @@ if conf.get('ENABLE_NETWORKD') == 1
libudev_static,
libsystemd_network,
libshared],
[threads]],
[threads],
[],
network_include_dir],
[['src/network/fuzz-network-parser.c',
'src/fuzz/fuzz.h'],
@ -195,7 +197,9 @@ if conf.get('ENABLE_NETWORKD') == 1
libudev_static,
libsystemd_network,
libshared],
[threads]]
[threads],
[],
network_include_dir],
]
tests += [
@ -203,20 +207,21 @@ if conf.get('ENABLE_NETWORKD') == 1
[libnetworkd_core,
libsystemd_network,
libudev],
[]],
[], '', '', [], network_include_dir],
[['src/network/test-network.c'],
[libnetworkd_core,
libudev_static,
libsystemd_network,
libshared],
[threads]],
[threads],
'', '', [], network_include_dir],
[['src/network/test-routing-policy-rule.c'],
[libnetworkd_core,
libsystemd_network,
libudev],
[]],
[], '', '', [], network_include_dir],
[['src/network/test-network-tables.c',
test_tables_h],
@ -233,6 +238,6 @@ if conf.get('ENABLE_NETWORKD') == 1
'src/network/generator/network-generator.c',
'src/network/generator/network-generator.h'],
[libshared],
[]],
[], '', '', [], network_include_dir],
]
endif

View File

@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "sd-netlink.h"
#include "alloc-util.h"
#include "bond.h"
#include "conf-parser.h"

View File

@ -2,9 +2,9 @@
#include <net/if.h>
#include "bridge.h"
#include "missing.h"
#include "netlink-util.h"
#include "netdev/bridge.h"
#include "network-internal.h"
#include "networkd-manager.h"
#include "string-table.h"

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "netdev/dummy.h"
#include "dummy.h"
const NetDevVTable dummy_vtable = {
.object_size = sizeof(Dummy),

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "netdev/netdev.h"
#include "netdev.h"
typedef struct Dummy {
NetDev meta;

View File

@ -6,14 +6,12 @@
#include <linux/ip.h>
#include "conf-parser.h"
#include "fou-tunnel.h"
#include "ip-protocol-list.h"
#include "missing.h"
#include "netdev/fou-tunnel.h"
#include "netlink-util.h"
#include "networkd-link.h"
#include "networkd-manager.h"
#include "parse-util.h"
#include "sd-netlink.h"
#include "string-table.h"
#include "string-util.h"
#include "util.h"

View File

@ -5,7 +5,7 @@
#include <linux/fou.h>
#include "in-addr-util.h"
#include "netdev/netdev.h"
#include "netdev.h"
typedef enum FooOverUDPEncapType {
NETDEV_FOO_OVER_UDP_ENCAP_UNSPEC = FOU_ENCAP_UNSPEC,

View File

@ -2,19 +2,17 @@
#include <net/if.h>
#include "sd-netlink.h"
#include "alloc-util.h"
#include "conf-parser.h"
#include "extract-word.h"
#include "geneve.h"
#include "missing.h"
#include "netlink-util.h"
#include "networkd-manager.h"
#include "parse-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "missing.h"
#include "networkd-manager.h"
#define GENEVE_FLOW_LABEL_MAX_MASK 0xFFFFFU
#define DEFAULT_GENEVE_DESTINATION_PORT 6081

View File

@ -5,7 +5,6 @@ typedef struct Geneve Geneve;
#include "in-addr-util.h"
#include "netdev.h"
#include "networkd-link.h"
#include "networkd-network.h"
#define GENEVE_VID_MAX (1u << 24) - 1

View File

@ -3,7 +3,7 @@
#include <net/if.h>
#include "conf-parser.h"
#include "netdev/ipvlan.h"
#include "ipvlan.h"
#include "networkd-link.h"
#include "string-table.h"

View File

@ -4,7 +4,7 @@
#include <netinet/in.h>
#include <linux/if_link.h>
#include "netdev/netdev.h"
#include "netdev.h"
typedef enum IPVlanMode {
NETDEV_IPVLAN_MODE_L2 = IPVLAN_MODE_L2,

View File

@ -4,8 +4,6 @@
#include <linux/l2tp.h>
#include <linux/genetlink.h>
#include "sd-netlink.h"
#include "conf-parser.h"
#include "hashmap.h"
#include "l2tp-tunnel.h"

View File

@ -17,7 +17,6 @@
#include "networkd-address.h"
#include "networkd-manager.h"
#include "path-util.h"
#include "sd-netlink.h"
#include "socket-util.h"
#include "string-table.h"
#include "string-util.h"

View File

@ -3,7 +3,7 @@
#include <net/if.h>
#include "conf-parser.h"
#include "netdev/macvlan.h"
#include "macvlan.h"
#include "string-table.h"
static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = {

View File

@ -3,7 +3,7 @@
typedef struct MacVlan MacVlan;
#include "netdev/netdev.h"
#include "netdev.h"
typedef enum MacVlanMode {
NETDEV_MACVLAN_MODE_PRIVATE = MACVLAN_MODE_PRIVATE,

View File

@ -3,27 +3,27 @@
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#endif
#include <stddef.h>
#include "bond.h"
#include "bridge.h"
#include "conf-parser.h"
#include "network-internal.h"
#include "netdev/bond.h"
#include "netdev/bridge.h"
#include "netdev/geneve.h"
#include "netdev/ipvlan.h"
#include "netdev/macsec.h"
#include "netdev/macvlan.h"
#include "netdev/tunnel.h"
#include "netdev/tuntap.h"
#include "netdev/veth.h"
#include "netdev/vlan.h"
#include "netdev/vxlan.h"
#include "netdev/vrf.h"
#include "netdev/netdev.h"
#include "netdev/vxcan.h"
#include "netdev/wireguard.h"
#include "netdev/fou-tunnel.h"
#include "netdev/l2tp-tunnel.h"
#include "netdev/xfrm.h"
#include "geneve.h"
#include "ipvlan.h"
#include "macsec.h"
#include "macvlan.h"
#include "tunnel.h"
#include "tuntap.h"
#include "veth.h"
#include "vlan-util.h"
#include "vlan.h"
#include "vxlan.h"
#include "vrf.h"
#include "netdev.h"
#include "network-internal.h"
#include "vxcan.h"
#include "wireguard.h"
#include "fou-tunnel.h"
#include "l2tp-tunnel.h"
#include "xfrm.h"
%}
struct ConfigPerfItem;
%null_strings

View File

@ -4,41 +4,40 @@
#include <netinet/in.h>
#include "alloc-util.h"
#include "bond.h"
#include "bridge.h"
#include "conf-files.h"
#include "conf-parser.h"
#include "dummy.h"
#include "fd-util.h"
#include "fou-tunnel.h"
#include "geneve.h"
#include "ipvlan.h"
#include "l2tp-tunnel.h"
#include "list.h"
#include "netdev/bond.h"
#include "netdev/bridge.h"
#include "netdev/dummy.h"
#include "netdev/fou-tunnel.h"
#include "netdev/geneve.h"
#include "netdev/ipvlan.h"
#include "netdev/l2tp-tunnel.h"
#include "netdev/macsec.h"
#include "netdev/macvlan.h"
#include "netdev/netdev.h"
#include "netdev/netdevsim.h"
#include "netdev/nlmon.h"
#include "netdev/tunnel.h"
#include "netdev/tuntap.h"
#include "netdev/vcan.h"
#include "netdev/veth.h"
#include "netdev/vlan.h"
#include "netdev/vrf.h"
#include "netdev/vxcan.h"
#include "netdev/vxlan.h"
#include "netdev/wireguard.h"
#include "netdev/xfrm.h"
#include "macsec.h"
#include "macvlan.h"
#include "netdev.h"
#include "netdevsim.h"
#include "netlink-util.h"
#include "network-internal.h"
#include "networkd-link.h"
#include "networkd-manager.h"
#include "nlmon.h"
#include "siphash24.h"
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "tunnel.h"
#include "tuntap.h"
#include "vcan.h"
#include "veth.h"
#include "vlan.h"
#include "vrf.h"
#include "vxcan.h"
#include "vxlan.h"
#include "wireguard.h"
#include "xfrm.h"
const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX] = {
[NETDEV_KIND_BRIDGE] = &bridge_vtable,

View File

@ -5,7 +5,7 @@
#include "conf-parser.h"
#include "list.h"
#include "../networkd-link.h"
#include "networkd-link.h"
#include "time-util.h"
typedef struct netdev_join_callback netdev_join_callback;

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "netdev/netdevsim.h"
#include "missing.h"
#include "netdevsim.h"
const NetDevVTable netdevsim_vtable = {
.object_size = sizeof(NetDevSim),

View File

@ -3,7 +3,7 @@
typedef struct NetDevSim NetDevSim;
#include "netdev/netdev.h"
#include "netdev.h"
struct NetDevSim {
NetDev meta;

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "netdev/nlmon.h"
#include "nlmon.h"
static int netdev_nlmon_verify(NetDev *netdev, const char *filename) {
assert(netdev);

View File

@ -3,7 +3,7 @@
typedef struct NLMon NLMon;
#include "netdev/netdev.h"
#include "netdev.h"
struct NLMon {
NetDev meta;

View File

@ -6,16 +6,13 @@
#include <linux/if_tunnel.h>
#include <linux/ip6_tunnel.h>
#include "sd-netlink.h"
#include "conf-parser.h"
#include "missing.h"
#include "netlink-util.h"
#include "networkd-link.h"
#include "netdev/tunnel.h"
#include "parse-util.h"
#include "string-table.h"
#include "string-util.h"
#include "tunnel.h"
#include "util.h"
#define DEFAULT_TNL_HOP_LIMIT 64

View File

@ -4,8 +4,8 @@
#include "in-addr-util.h"
#include "conf-parser.h"
#include "netdev/netdev.h"
#include "netdev/fou-tunnel.h"
#include "fou-tunnel.h"
#include "netdev.h"
typedef enum Ip6TnlMode {
NETDEV_IP6_TNL_MODE_IP6IP6,

View File

@ -11,7 +11,7 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "netdev/tuntap.h"
#include "tuntap.h"
#include "user-util.h"
#define TUN_DEV "/dev/net/tun"

View File

@ -3,7 +3,7 @@
typedef struct TunTap TunTap;
#include "netdev/netdev.h"
#include "netdev.h"
struct TunTap {
NetDev meta;

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "netdev/vcan.h"
#include "vcan.h"
const NetDevVTable vcan_vtable = {
.object_size = sizeof(VCan),

View File

@ -6,7 +6,7 @@ typedef struct VCan VCan;
#include <netinet/in.h>
#include <linux/can/netlink.h>
#include "netdev/netdev.h"
#include "netdev.h"
struct VCan {
NetDev meta;

View File

@ -4,9 +4,7 @@
#include <net/if.h>
#include <linux/veth.h>
#include "sd-netlink.h"
#include "netdev/veth.h"
#include "veth.h"
static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Veth *v;

View File

@ -3,7 +3,7 @@
typedef struct Veth Veth;
#include "netdev/netdev.h"
#include "netdev.h"
struct Veth {
NetDev meta;

View File

@ -4,8 +4,8 @@
#include <net/if.h>
#include <linux/if_vlan.h>
#include "netdev/vlan.h"
#include "vlan-util.h"
#include "vlan.h"
static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
struct ifla_vlan_flags flags = {};

View File

@ -3,7 +3,7 @@
typedef struct VLan VLan;
#include "netdev/netdev.h"
#include "netdev.h"
struct VLan {
NetDev meta;

View File

@ -2,9 +2,8 @@
#include <net/if.h>
#include "sd-netlink.h"
#include "missing.h"
#include "netdev/vrf.h"
#include "vrf.h"
static int netdev_vrf_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Vrf *v;

View File

@ -3,7 +3,7 @@
typedef struct Vrf Vrf;
#include "netdev/netdev.h"
#include "netdev.h"
struct Vrf {
NetDev meta;

View File

@ -2,7 +2,7 @@
#include <linux/can/vxcan.h>
#include "netdev/vxcan.h"
#include "vxcan.h"
static int netdev_vxcan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
VxCan *v;

View File

@ -3,7 +3,7 @@
typedef struct VxCan VxCan;
#include "netdev/netdev.h"
#include "netdev.h"
struct VxCan {
NetDev meta;

View File

@ -2,8 +2,6 @@
#include <net/if.h>
#include "sd-netlink.h"
#include "conf-parser.h"
#include "alloc-util.h"
#include "extract-word.h"
@ -12,9 +10,7 @@
#include "strv.h"
#include "parse-util.h"
#include "missing.h"
#include "networkd-link.h"
#include "netdev/vxlan.h"
#include "vxlan.h"
static const char* const df_table[_NETDEV_VXLAN_DF_MAX] = {
[NETDEV_VXLAN_DF_NO] = "no",

View File

@ -6,7 +6,7 @@ typedef struct VxLan VxLan;
#include <linux/if_link.h>
#include "in-addr-util.h"
#include "netdev/netdev.h"
#include "netdev.h"
#define VXLAN_VID_MAX (1u << 24) - 1
#define VXLAN_FLOW_LABEL_MAX_MASK 0xFFFFFU

View File

@ -15,7 +15,6 @@
#include "hexdecoct.h"
#include "memory-util.h"
#include "netlink-util.h"
#include "networkd-link.h"
#include "networkd-manager.h"
#include "networkd-util.h"
#include "parse-util.h"

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "missing_network.h"
#include "netdev/xfrm.h"
#include "xfrm.h"
static int xfrm_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *message) {
Xfrm *x;

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "netdev/netdev.h"
#include "netdev.h"
typedef struct Xfrm {
NetDev meta;

View File

@ -7,9 +7,8 @@
#include <net/if.h>
#include "alloc-util.h"
#include "bridge.h"
#include "conf-parser.h"
#include "netdev/bridge.h"
#include "netdev/vxlan.h"
#include "netlink-util.h"
#include "networkd-fdb.h"
#include "networkd-manager.h"
@ -18,6 +17,7 @@
#include "string-table.h"
#include "util.h"
#include "vlan-util.h"
#include "vxlan.h"
#define STATIC_FDB_ENTRIES_PER_NETWORK_MAX 1024U

View File

@ -6,17 +6,16 @@
#include <unistd.h>
#include "alloc-util.h"
#include "bond.h"
#include "bridge.h"
#include "bus-util.h"
#include "dhcp-identifier.h"
#include "dhcp-lease-internal.h"
#include "env-file.h"
#include "fd-util.h"
#include "fileio.h"
#include "ipvlan.h"
#include "missing_network.h"
#include "netdev/bond.h"
#include "netdev/bridge.h"
#include "netdev/ipvlan.h"
#include "netdev/vrf.h"
#include "netlink-util.h"
#include "network-internal.h"
#include "networkd-can.h"
@ -34,6 +33,7 @@
#include "networkd-radv.h"
#include "networkd-routing-policy-rule.h"
#include "networkd-wifi.h"
#include "qdisc.h"
#include "set.h"
#include "socket-util.h"
#include "stdio-util.h"
@ -43,8 +43,8 @@
#include "tmpfile-util.h"
#include "udev-util.h"
#include "util.h"
#include "tc/qdisc.h"
#include "virt.h"
#include "vrf.h"
uint32_t link_get_vrf_table(Link *link) {
return link->network->vrf ? VRF(link->network->vrf)->table : RT_TABLE_MAIN;

View File

@ -4,6 +4,7 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#endif
#include <stddef.h>
#include "conf-parser.h"
#include "netem.h"
#include "network-internal.h"
#include "networkd-conf.h"
#include "networkd-dhcp-common.h"
@ -12,9 +13,8 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#include "networkd-ipv4ll.h"
#include "networkd-ndisc.h"
#include "networkd-network.h"
#include "qdisc.h"
#include "vlan-util.h"
#include "tc/qdisc.h"
#include "tc/netem.h"
%}
struct ConfigPerfItem;
%null_strings

View File

@ -6,11 +6,11 @@
#include "sd-bus.h"
#include "sd-device.h"
#include "bridge.h"
#include "condition.h"
#include "conf-parser.h"
#include "hashmap.h"
#include "netdev/bridge.h"
#include "netdev/netdev.h"
#include "netdev.h"
#include "networkd-address-label.h"
#include "networkd-address.h"
#include "networkd-brvlan.h"
@ -27,8 +27,8 @@
#include "networkd-routing-policy-rule.h"
#include "networkd-util.h"
#include "ordered-set.h"
#include "qdisc.h"
#include "resolve-util.h"
#include "tc/qdisc.h"
typedef enum IPv6PrivacyExtensions {
/* The values map to the kernel's /proc/sys/net/ipv6/conf/xxx/use_tempaddr values */

View File

@ -5,20 +5,18 @@
#include "sd-netlink.h"
#include "conf-parser.h"
#include "macro.h"
#include "../networkd-link.h"
#include "networkd-link.h"
#include "time-util.h"
typedef struct NetworkEmulator NetworkEmulator;
typedef struct QDiscs QDiscs;
struct NetworkEmulator {
typedef struct NetworkEmulator {
usec_t delay;
usec_t jitter;
uint32_t limit;
uint32_t loss;
};
} NetworkEmulator;
int network_emulator_new(NetworkEmulator **ret);
int network_emulator_fill_message(Link *link, QDiscs *qdisc, sd_netlink_message *req);

View File

@ -3,13 +3,12 @@
#pragma once
#include "conf-parser.h"
#include "macro.h"
#include "netem.h"
#include "../networkd-util.h"
#include "networkd-link.h"
#include "networkd-network.h"
#include "networkd-util.h"
typedef struct QDiscs QDiscs;
struct QDiscs {
typedef struct QDiscs {
NetworkConfigSection *section;
Network *network;
@ -23,7 +22,7 @@ struct QDiscs {
bool has_network_emulator:1;
NetworkEmulator ne;
};
} QDiscs;
void qdisc_free(QDiscs *qdisc);
int qdisc_new_static(Network *network, const char *filename, unsigned section_line, QDiscs **ret);

View File

@ -1,17 +1,17 @@
#include "bond.h"
#include "dhcp6-internal.h"
#include "dhcp6-protocol.h"
#include "ethtool-util.h"
#include "ipvlan.h"
#include "lldp-internal.h"
#include "macvlan.h"
#include "ndisc-internal.h"
#include "netdev/bond.h"
#include "netdev/ipvlan.h"
#include "netdev/macvlan.h"
#include "netdev/tunnel.h"
#include "netlink-internal.h"
#include "networkd-link.h"
#include "networkd-network.h"
#include "networkd-util.h"
#include "test-tables.h"
#include "tunnel.h"
int main(int argc, char **argv) {
test_table(bond_ad_select, NETDEV_BOND_AD_SELECT);