diff options
Diffstat (limited to 'src/libsystemd-network')
l--------- | src/libsystemd-network/GNUmakefile | 1 | ||||
-rw-r--r--[l---------] | src/libsystemd-network/Makefile | 30 | ||||
l--------- | src/libsystemd-network/include/systemd-network/_sd-common.h | 1 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/arp-util.h (renamed from src/libsystemd-network/arp-util.h) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-identifier.h (renamed from src/libsystemd-network/dhcp-identifier.h) | 8 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-internal.h (renamed from src/libsystemd-network/dhcp-internal.h) | 7 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-lease-internal.h (renamed from src/libsystemd-network/dhcp-lease-internal.h) | 7 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-protocol.h (renamed from src/libsystemd-network/dhcp-protocol.h) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-server-internal.h (renamed from src/libsystemd-network/dhcp-server-internal.h) | 11 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp6-internal.h (renamed from src/libsystemd-network/dhcp6-internal.h) | 8 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp6-lease-internal.h (renamed from src/libsystemd-network/dhcp6-lease-internal.h) | 3 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp6-protocol.h (renamed from src/libsystemd-network/dhcp6-protocol.h) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/icmp6-util.h (renamed from src/libsystemd-network/icmp6-util.h) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/lldp-internal.h (renamed from src/libsystemd-network/lldp-internal.h) | 11 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/lldp-neighbor.h (renamed from src/libsystemd-network/lldp-neighbor.h) | 6 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/lldp-network.h (renamed from src/libsystemd-network/lldp-network.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/ndisc-internal.h (renamed from src/libsystemd-network/ndisc-internal.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/ndisc-router.h (renamed from src/libsystemd-network/ndisc-router.h) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/network-internal.h (renamed from src/libsystemd-network/network-internal.h) | 6 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp-client.h | 157 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h | 67 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp-server.h | 65 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h | 134 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h | 52 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-ipv4acd.h | 60 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-ipv4ll.h | 60 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-lldp.h | 182 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-ndisc.h | 130 | ||||
l--------- | src/libsystemd-network/src/GNUmakefile | 1 | ||||
-rw-r--r-- | src/libsystemd-network/src/Makefile | 83 | ||||
-rw-r--r-- | src/libsystemd-network/src/arp-util.c (renamed from src/libsystemd-network/arp-util.c) | 9 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-identifier.c (renamed from src/libsystemd-network/dhcp-identifier.c) | 20 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-network.c (renamed from src/libsystemd-network/dhcp-network.c) | 7 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-option.c (renamed from src/libsystemd-network/dhcp-option.c) | 7 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-packet.c (renamed from src/libsystemd-network/dhcp-packet.c) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp6-network.c (renamed from src/libsystemd-network/dhcp6-network.c) | 9 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp6-option.c (renamed from src/libsystemd-network/dhcp6-option.c) | 19 | ||||
-rw-r--r-- | src/libsystemd-network/src/icmp6-util.c (renamed from src/libsystemd-network/icmp6-util.c) | 9 | ||||
-rw-r--r-- | src/libsystemd-network/src/lldp-neighbor.c (renamed from src/libsystemd-network/lldp-neighbor.c) | 16 | ||||
-rw-r--r-- | src/libsystemd-network/src/lldp-network.c (renamed from src/libsystemd-network/lldp-network.c) | 9 | ||||
-rw-r--r-- | src/libsystemd-network/src/ndisc-router.c (renamed from src/libsystemd-network/ndisc-router.c) | 17 | ||||
-rw-r--r-- | src/libsystemd-network/src/network-internal.c (renamed from src/libsystemd-network/network-internal.c) | 36 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp-client.c (renamed from src/libsystemd-network/sd-dhcp-client.c) | 26 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp-lease.c (renamed from src/libsystemd-network/sd-dhcp-lease.c) | 31 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp-server.c (renamed from src/libsystemd-network/sd-dhcp-server.c) | 19 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp6-client.c (renamed from src/libsystemd-network/sd-dhcp6-client.c) | 28 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp6-lease.c (renamed from src/libsystemd-network/sd-dhcp6-lease.c) | 10 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-ipv4acd.c (renamed from src/libsystemd-network/sd-ipv4acd.c) | 23 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-ipv4ll.c (renamed from src/libsystemd-network/sd-ipv4ll.c) | 23 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-lldp.c (renamed from src/libsystemd-network/sd-lldp.c) | 17 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-ndisc.c (renamed from src/libsystemd-network/sd-ndisc.c) | 21 | ||||
l--------- | src/libsystemd-network/test/GNUmakefile | 1 | ||||
-rw-r--r-- | src/libsystemd-network/test/Makefile | 118 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-acd.c (renamed from src/libsystemd-network/test-acd.c) | 14 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp-client.c (renamed from src/libsystemd-network/test-dhcp-client.c) | 18 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp-option.c (renamed from src/libsystemd-network/test-dhcp-option.c) | 10 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp-server.c (renamed from src/libsystemd-network/test-dhcp-server.c) | 6 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp6-client.c (renamed from src/libsystemd-network/test-dhcp6-client.c) | 20 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-ipv4ll-manual.c (renamed from src/libsystemd-network/test-ipv4ll-manual.c) | 19 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-ipv4ll.c (renamed from src/libsystemd-network/test-ipv4ll.c) | 11 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-lldp.c (renamed from src/libsystemd-network/test-lldp.c) | 16 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-ndisc-rs.c (renamed from src/libsystemd-network/test-ndisc-rs.c) | 15 |
62 files changed, 1428 insertions, 290 deletions
diff --git a/src/libsystemd-network/GNUmakefile b/src/libsystemd-network/GNUmakefile new file mode 120000 index 0000000000..0f24a727ed --- /dev/null +++ b/src/libsystemd-network/GNUmakefile @@ -0,0 +1 @@ +GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd-network/Makefile b/src/libsystemd-network/Makefile index d0b0e8e008..8ba25db413 120000..100644 --- a/src/libsystemd-network/Makefile +++ b/src/libsystemd-network/Makefile @@ -1 +1,29 @@ -../Makefile
\ No newline at end of file +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. +include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +nested.subdirs += src +nested.subdirs += test + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd-network/include/systemd-network/_sd-common.h b/src/libsystemd-network/include/systemd-network/_sd-common.h new file mode 120000 index 0000000000..653327c267 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/_sd-common.h @@ -0,0 +1 @@ +../../../libsystemd/include/systemd/_sd-common.h
\ No newline at end of file diff --git a/src/libsystemd-network/arp-util.h b/src/libsystemd-network/include/systemd-network/arp-util.h index 3ef56b002a..790085a05b 100644 --- a/src/libsystemd-network/arp-util.h +++ b/src/libsystemd-network/include/systemd-network/arp-util.h @@ -21,8 +21,8 @@ #include <netinet/if_ether.h> -#include "socket-util.h" -#include "sparse-endian.h" +#include "systemd-basic/socket-util.h" +#include "systemd-basic/sparse-endian.h" int arp_network_bind_raw_socket(int index, be32_t address, const struct ether_addr *eth_mac); diff --git a/src/libsystemd-network/dhcp-identifier.h b/src/libsystemd-network/include/systemd-network/dhcp-identifier.h index 1cc0f9fb71..187780e7b0 100644 --- a/src/libsystemd-network/dhcp-identifier.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-identifier.h @@ -19,11 +19,11 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-id128.h" +#include <systemd/sd-id128.h> -#include "macro.h" -#include "sparse-endian.h" -#include "unaligned.h" +#include "systemd-basic/macro.h" +#include "systemd-basic/sparse-endian.h" +#include "systemd-basic/unaligned.h" typedef enum DUIDType { DUID_TYPE_LLT = 1, diff --git a/src/libsystemd-network/dhcp-internal.h b/src/libsystemd-network/include/systemd-network/dhcp-internal.h index 99f690897d..f2f44918cb 100644 --- a/src/libsystemd-network/dhcp-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-internal.h @@ -20,15 +20,16 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <linux/if_packet.h> #include <net/ethernet.h> #include <net/if_arp.h> #include <stdint.h> -#include "sd-dhcp-client.h" +#include <linux/if_packet.h> + +#include "systemd-basic/socket-util.h" #include "dhcp-protocol.h" -#include "socket-util.h" +#include "sd-dhcp-client.h" int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link, uint32_t xid, const uint8_t *mac_addr, diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/include/systemd-network/dhcp-lease-internal.h index 82cae2300a..92dd668876 100644 --- a/src/libsystemd-network/dhcp-lease-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-lease-internal.h @@ -21,13 +21,14 @@ ***/ #include <stdint.h> + #include <linux/if_packet.h> -#include "sd-dhcp-client.h" +#include "systemd-basic/list.h" +#include "systemd-basic/util.h" #include "dhcp-protocol.h" -#include "list.h" -#include "util.h" +#include "sd-dhcp-client.h" struct sd_dhcp_route { struct in_addr dst_addr; diff --git a/src/libsystemd-network/dhcp-protocol.h b/src/libsystemd-network/include/systemd-network/dhcp-protocol.h index 5cf7abbff9..7b083afa8b 100644 --- a/src/libsystemd-network/dhcp-protocol.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-protocol.h @@ -23,8 +23,8 @@ #include <netinet/udp.h> #include <stdint.h> -#include "macro.h" -#include "sparse-endian.h" +#include "systemd-basic/macro.h" +#include "systemd-basic/sparse-endian.h" struct DHCPMessage { uint8_t op; diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/include/systemd-network/dhcp-server-internal.h index 0c76956fad..bdbe63c450 100644 --- a/src/libsystemd-network/dhcp-server-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-server-internal.h @@ -20,13 +20,14 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-dhcp-server.h" -#include "sd-event.h" +#include <systemd/sd-event.h> + +#include "systemd-basic/hashmap.h" +#include "systemd-basic/log.h" +#include "systemd-basic/util.h" #include "dhcp-internal.h" -#include "hashmap.h" -#include "log.h" -#include "util.h" +#include "sd-dhcp-server.h" typedef struct DHCPClientId { size_t length; diff --git a/src/libsystemd-network/dhcp6-internal.h b/src/libsystemd-network/include/systemd-network/dhcp6-internal.h index 945c3b9721..6d3178e2d6 100644 --- a/src/libsystemd-network/dhcp6-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp6-internal.h @@ -22,11 +22,11 @@ #include <net/ethernet.h> #include <netinet/in.h> -#include "sd-event.h" +#include <systemd/sd-event.h> -#include "list.h" -#include "macro.h" -#include "sparse-endian.h" +#include "systemd-basic/list.h" +#include "systemd-basic/macro.h" +#include "systemd-basic/sparse-endian.h" typedef struct DHCP6Address DHCP6Address; diff --git a/src/libsystemd-network/dhcp6-lease-internal.h b/src/libsystemd-network/include/systemd-network/dhcp6-lease-internal.h index 14e708ef63..9da270e9a9 100644 --- a/src/libsystemd-network/dhcp6-lease-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp6-lease-internal.h @@ -22,9 +22,8 @@ #include <stdint.h> -#include "sd-dhcp6-lease.h" - #include "dhcp6-internal.h" +#include "sd-dhcp6-lease.h" struct sd_dhcp6_lease { unsigned n_ref; diff --git a/src/libsystemd-network/dhcp6-protocol.h b/src/libsystemd-network/include/systemd-network/dhcp6-protocol.h index 2487c470ab..7449b2b20d 100644 --- a/src/libsystemd-network/dhcp6-protocol.h +++ b/src/libsystemd-network/include/systemd-network/dhcp6-protocol.h @@ -22,8 +22,8 @@ #include <netinet/ip6.h> #include <netinet/udp.h> -#include "macro.h" -#include "sparse-endian.h" +#include "systemd-basic/macro.h" +#include "systemd-basic/sparse-endian.h" struct DHCP6Message { union { diff --git a/src/libsystemd-network/icmp6-util.h b/src/libsystemd-network/include/systemd-network/icmp6-util.h index 2b4dbc76ce..2b4dbc76ce 100644 --- a/src/libsystemd-network/icmp6-util.h +++ b/src/libsystemd-network/include/systemd-network/icmp6-util.h diff --git a/src/libsystemd-network/lldp-internal.h b/src/libsystemd-network/include/systemd-network/lldp-internal.h index becc162fab..e28b9702a0 100644 --- a/src/libsystemd-network/lldp-internal.h +++ b/src/libsystemd-network/include/systemd-network/lldp-internal.h @@ -20,12 +20,13 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-event.h" -#include "sd-lldp.h" +#include <systemd/sd-event.h> + +#include "systemd-basic/hashmap.h" +#include "systemd-basic/log.h" +#include "systemd-basic/prioq.h" -#include "hashmap.h" -#include "log.h" -#include "prioq.h" +#include "sd-lldp.h" struct sd_lldp { unsigned n_ref; diff --git a/src/libsystemd-network/lldp-neighbor.h b/src/libsystemd-network/include/systemd-network/lldp-neighbor.h index c1a7606d06..392a0a268b 100644 --- a/src/libsystemd-network/lldp-neighbor.h +++ b/src/libsystemd-network/include/systemd-network/lldp-neighbor.h @@ -23,11 +23,11 @@ #include <stdbool.h> #include <sys/types.h> -#include "sd-lldp.h" +#include "systemd-basic/hash-funcs.h" +#include "systemd-basic/time-util.h" -#include "hash-funcs.h" #include "lldp-internal.h" -#include "time-util.h" +#include "sd-lldp.h" typedef struct LLDPNeighborID { /* The spec calls this an "MSAP identifier" */ diff --git a/src/libsystemd-network/lldp-network.h b/src/libsystemd-network/include/systemd-network/lldp-network.h index c4cf8c79f1..43ed54b3b2 100644 --- a/src/libsystemd-network/lldp-network.h +++ b/src/libsystemd-network/include/systemd-network/lldp-network.h @@ -20,6 +20,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-event.h" +#include <systemd/sd-event.h> int lldp_network_bind_raw_socket(int ifindex); diff --git a/src/libsystemd-network/ndisc-internal.h b/src/libsystemd-network/include/systemd-network/ndisc-internal.h index 60e183ff8c..0f7f69a33d 100644 --- a/src/libsystemd-network/ndisc-internal.h +++ b/src/libsystemd-network/include/systemd-network/ndisc-internal.h @@ -19,7 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "log.h" +#include "systemd-basic/log.h" #include "sd-ndisc.h" diff --git a/src/libsystemd-network/ndisc-router.h b/src/libsystemd-network/include/systemd-network/ndisc-router.h index 1fe703da63..2f1df49198 100644 --- a/src/libsystemd-network/ndisc-router.h +++ b/src/libsystemd-network/include/systemd-network/ndisc-router.h @@ -19,9 +19,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-ndisc.h" +#include "systemd-basic/time-util.h" -#include "time-util.h" +#include "sd-ndisc.h" struct sd_ndisc_router { unsigned n_ref; diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/include/systemd-network/network-internal.h index 5bcd577167..3d0554f12c 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/include/systemd-network/network-internal.h @@ -21,11 +21,11 @@ #include <stdbool.h> -#include "sd-dhcp-lease.h" - -#include "condition.h" +#include "systemd-shared/condition.h" #include "udev.h" +#include "sd-dhcp-lease.h" + bool net_match_config(const struct ether_addr *match_mac, char * const *match_path, char * const *match_driver, diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp-client.h b/src/libsystemd-network/include/systemd-network/sd-dhcp-client.h new file mode 100644 index 0000000000..ce1145a575 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp-client.h @@ -0,0 +1,157 @@ +#ifndef foosddhcpclienthfoo +#define foosddhcpclienthfoo + +/*** + This file is part of systemd. + + Copyright (C) 2013 Intel Corporation. All rights reserved. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <netinet/in.h> +#include <sys/types.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" +#include "sd-dhcp-lease.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_DHCP_CLIENT_EVENT_STOP = 0, + SD_DHCP_CLIENT_EVENT_IP_ACQUIRE = 1, + SD_DHCP_CLIENT_EVENT_IP_CHANGE = 2, + SD_DHCP_CLIENT_EVENT_EXPIRED = 3, + SD_DHCP_CLIENT_EVENT_RENEW = 4, +}; + +enum { + SD_DHCP_OPTION_PAD = 0, + SD_DHCP_OPTION_SUBNET_MASK = 1, + SD_DHCP_OPTION_TIME_OFFSET = 2, + SD_DHCP_OPTION_ROUTER = 3, + SD_DHCP_OPTION_DOMAIN_NAME_SERVER = 6, + SD_DHCP_OPTION_HOST_NAME = 12, + SD_DHCP_OPTION_BOOT_FILE_SIZE = 13, + SD_DHCP_OPTION_DOMAIN_NAME = 15, + SD_DHCP_OPTION_ROOT_PATH = 17, + SD_DHCP_OPTION_ENABLE_IP_FORWARDING = 19, + SD_DHCP_OPTION_ENABLE_IP_FORWARDING_NL = 20, + SD_DHCP_OPTION_POLICY_FILTER = 21, + SD_DHCP_OPTION_INTERFACE_MDR = 22, + SD_DHCP_OPTION_INTERFACE_TTL = 23, + SD_DHCP_OPTION_INTERFACE_MTU_AGING_TIMEOUT = 24, + SD_DHCP_OPTION_INTERFACE_MTU = 26, + SD_DHCP_OPTION_BROADCAST = 28, + SD_DHCP_OPTION_STATIC_ROUTE = 33, + SD_DHCP_OPTION_NTP_SERVER = 42, + SD_DHCP_OPTION_VENDOR_SPECIFIC = 43, + SD_DHCP_OPTION_REQUESTED_IP_ADDRESS = 50, + SD_DHCP_OPTION_IP_ADDRESS_LEASE_TIME = 51, + SD_DHCP_OPTION_OVERLOAD = 52, + SD_DHCP_OPTION_MESSAGE_TYPE = 53, + SD_DHCP_OPTION_SERVER_IDENTIFIER = 54, + SD_DHCP_OPTION_PARAMETER_REQUEST_LIST = 55, + SD_DHCP_OPTION_ERROR_MESSAGE = 56, + SD_DHCP_OPTION_MAXIMUM_MESSAGE_SIZE = 57, + SD_DHCP_OPTION_RENEWAL_T1_TIME = 58, + SD_DHCP_OPTION_REBINDING_T2_TIME = 59, + SD_DHCP_OPTION_VENDOR_CLASS_IDENTIFIER = 60, + SD_DHCP_OPTION_CLIENT_IDENTIFIER = 61, + SD_DHCP_OPTION_FQDN = 81, + SD_DHCP_OPTION_NEW_POSIX_TIMEZONE = 100, + SD_DHCP_OPTION_NEW_TZDB_TIMEZONE = 101, + SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE = 121, + SD_DHCP_OPTION_PRIVATE_BASE = 224, + SD_DHCP_OPTION_PRIVATE_LAST = 254, + SD_DHCP_OPTION_END = 255, +}; + +typedef struct sd_dhcp_client sd_dhcp_client; +typedef void (*sd_dhcp_client_callback_t)(sd_dhcp_client *client, int event, void *userdata); +int sd_dhcp_client_set_callback( + sd_dhcp_client *client, + sd_dhcp_client_callback_t cb, + void *userdata); + +int sd_dhcp_client_set_request_option( + sd_dhcp_client *client, + uint8_t option); +int sd_dhcp_client_set_request_address( + sd_dhcp_client *client, + const struct in_addr *last_address); +int sd_dhcp_client_set_request_broadcast( + sd_dhcp_client *client, + int broadcast); +int sd_dhcp_client_set_ifindex( + sd_dhcp_client *client, + int interface_index); +int sd_dhcp_client_set_mac( + sd_dhcp_client *client, + const uint8_t *addr, + size_t addr_len, + uint16_t arp_type); +int sd_dhcp_client_set_client_id( + sd_dhcp_client *client, + uint8_t type, + const uint8_t *data, + size_t data_len); +int sd_dhcp_client_set_iaid_duid( + sd_dhcp_client *client, + uint32_t iaid, + uint16_t duid_type, + const void *duid, + size_t duid_len); +int sd_dhcp_client_get_client_id( + sd_dhcp_client *client, + uint8_t *type, + const uint8_t **data, + size_t *data_len); +int sd_dhcp_client_set_mtu( + sd_dhcp_client *client, + uint32_t mtu); +int sd_dhcp_client_set_hostname( + sd_dhcp_client *client, + const char *hostname); +int sd_dhcp_client_set_vendor_class_identifier( + sd_dhcp_client *client, + const char *vci); +int sd_dhcp_client_get_lease( + sd_dhcp_client *client, + sd_dhcp_lease **ret); + +int sd_dhcp_client_stop(sd_dhcp_client *client); +int sd_dhcp_client_start(sd_dhcp_client *client); + +sd_dhcp_client *sd_dhcp_client_ref(sd_dhcp_client *client); +sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client); + +int sd_dhcp_client_new(sd_dhcp_client **ret); + +int sd_dhcp_client_attach_event( + sd_dhcp_client *client, + sd_event *event, + int64_t priority); +int sd_dhcp_client_detach_event(sd_dhcp_client *client); +sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client, sd_dhcp_client_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h b/src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h new file mode 100644 index 0000000000..2f565ca825 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h @@ -0,0 +1,67 @@ +#ifndef foosddhcpleasehfoo +#define foosddhcpleasehfoo + +/*** + This file is part of systemd. + + Copyright (C) 2013 Intel Corporation. All rights reserved. + Copyright (C) 2014 Tom Gundersen + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <netinet/in.h> +#include <sys/types.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +typedef struct sd_dhcp_lease sd_dhcp_lease; +typedef struct sd_dhcp_route sd_dhcp_route; + +sd_dhcp_lease *sd_dhcp_lease_ref(sd_dhcp_lease *lease); +sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease); + +int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime); +int sd_dhcp_lease_get_t1(sd_dhcp_lease *lease, uint32_t *t1); +int sd_dhcp_lease_get_t2(sd_dhcp_lease *lease, uint32_t *t2); +int sd_dhcp_lease_get_broadcast(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr); +int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr); +int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu); +int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname); +int sd_dhcp_lease_get_hostname(sd_dhcp_lease *lease, const char **hostname); +int sd_dhcp_lease_get_root_path(sd_dhcp_lease *lease, const char **root_path); +int sd_dhcp_lease_get_routes(sd_dhcp_lease *lease, sd_dhcp_route ***routes); +int sd_dhcp_lease_get_vendor_specific(sd_dhcp_lease *lease, const void **data, size_t *data_len); +int sd_dhcp_lease_get_client_id(sd_dhcp_lease *lease, const void **client_id, size_t *client_id_len); +int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **timezone); + +int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination); +int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length); +int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp-server.h b/src/libsystemd-network/include/systemd-network/sd-dhcp-server.h new file mode 100644 index 0000000000..bbb2bb203c --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp-server.h @@ -0,0 +1,65 @@ +#ifndef foosddhcpserverhfoo +#define foosddhcpserverhfoo + +/*** + This file is part of systemd. + + Copyright (C) 2013 Intel Corporation. All rights reserved. + Copyright (C) 2014 Tom Gundersen + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <netinet/in.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +typedef struct sd_dhcp_server sd_dhcp_server; + +int sd_dhcp_server_new(sd_dhcp_server **ret, int ifindex); + +sd_dhcp_server *sd_dhcp_server_ref(sd_dhcp_server *server); +sd_dhcp_server *sd_dhcp_server_unref(sd_dhcp_server *server); + +int sd_dhcp_server_attach_event(sd_dhcp_server *client, sd_event *event, int64_t priority); +int sd_dhcp_server_detach_event(sd_dhcp_server *client); +sd_event *sd_dhcp_server_get_event(sd_dhcp_server *client); + +int sd_dhcp_server_is_running(sd_dhcp_server *server); + +int sd_dhcp_server_start(sd_dhcp_server *server); +int sd_dhcp_server_stop(sd_dhcp_server *server); + +int sd_dhcp_server_configure_pool(sd_dhcp_server *server, struct in_addr *address, unsigned char prefixlen, uint32_t offset, uint32_t size); + +int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *timezone); +int sd_dhcp_server_set_dns(sd_dhcp_server *server, const struct in_addr ntp[], unsigned n); +int sd_dhcp_server_set_ntp(sd_dhcp_server *server, const struct in_addr dns[], unsigned n); +int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled); + +int sd_dhcp_server_set_max_lease_time(sd_dhcp_server *server, uint32_t t); +int sd_dhcp_server_set_default_lease_time(sd_dhcp_server *server, uint32_t t); + +int sd_dhcp_server_forcerenew(sd_dhcp_server *server); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_server, sd_dhcp_server_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h b/src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h new file mode 100644 index 0000000000..cfd5f35135 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h @@ -0,0 +1,134 @@ +#ifndef foosddhcp6clienthfoo +#define foosddhcp6clienthfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Intel Corporation. All rights reserved. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <sys/types.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" +#include "sd-dhcp6-lease.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_DHCP6_CLIENT_EVENT_STOP = 0, + SD_DHCP6_CLIENT_EVENT_RESEND_EXPIRE = 10, + SD_DHCP6_CLIENT_EVENT_RETRANS_MAX = 11, + SD_DHCP6_CLIENT_EVENT_IP_ACQUIRE = 12, + SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST = 13, +}; + +enum { + SD_DHCP6_OPTION_CLIENTID = 1, + SD_DHCP6_OPTION_SERVERID = 2, + SD_DHCP6_OPTION_IA_NA = 3, + SD_DHCP6_OPTION_IA_TA = 4, + SD_DHCP6_OPTION_IAADDR = 5, + SD_DHCP6_OPTION_ORO = 6, + SD_DHCP6_OPTION_PREFERENCE = 7, + SD_DHCP6_OPTION_ELAPSED_TIME = 8, + SD_DHCP6_OPTION_RELAY_MSG = 9, + /* option code 10 is unassigned */ + SD_DHCP6_OPTION_AUTH = 11, + SD_DHCP6_OPTION_UNICAST = 12, + SD_DHCP6_OPTION_STATUS_CODE = 13, + SD_DHCP6_OPTION_RAPID_COMMIT = 14, + SD_DHCP6_OPTION_USER_CLASS = 15, + SD_DHCP6_OPTION_VENDOR_CLASS = 16, + SD_DHCP6_OPTION_VENDOR_OPTS = 17, + SD_DHCP6_OPTION_INTERFACE_ID = 18, + SD_DHCP6_OPTION_RECONF_MSG = 19, + SD_DHCP6_OPTION_RECONF_ACCEPT = 20, + + SD_DHCP6_OPTION_DNS_SERVERS = 23, /* RFC 3646 */ + SD_DHCP6_OPTION_DOMAIN_LIST = 24, /* RFC 3646 */ + + SD_DHCP6_OPTION_SNTP_SERVERS = 31, /* RFC 4075, deprecated */ + + /* option code 35 is unassigned */ + + SD_DHCP6_OPTION_NTP_SERVER = 56, /* RFC 5908 */ + + /* option codes 89-142 are unassigned */ + /* option codes 144-65535 are unassigned */ +}; + +typedef struct sd_dhcp6_client sd_dhcp6_client; +typedef void (*sd_dhcp6_client_callback_t)(sd_dhcp6_client *client, int event, void *userdata); +int sd_dhcp6_client_set_callback( + sd_dhcp6_client *client, + sd_dhcp6_client_callback_t cb, + void *userdata); + +int sd_dhcp6_client_set_ifindex( + sd_dhcp6_client *client, + int interface_index); +int sd_dhcp6_client_set_local_address( + sd_dhcp6_client *client, + const struct in6_addr *local_address); +int sd_dhcp6_client_set_mac( + sd_dhcp6_client *client, + const uint8_t *addr, + size_t addr_len, + uint16_t arp_type); +int sd_dhcp6_client_set_duid( + sd_dhcp6_client *client, + uint16_t duid_type, + const void *duid, + size_t duid_len); +int sd_dhcp6_client_set_iaid( + sd_dhcp6_client *client, + uint32_t iaid); +int sd_dhcp6_client_set_information_request( + sd_dhcp6_client *client, + int enabled); +int sd_dhcp6_client_get_information_request( + sd_dhcp6_client *client, + int *enabled); +int sd_dhcp6_client_set_request_option( + sd_dhcp6_client *client, + uint16_t option); + +int sd_dhcp6_client_get_lease( + sd_dhcp6_client *client, + sd_dhcp6_lease **ret); + +int sd_dhcp6_client_stop(sd_dhcp6_client *client); +int sd_dhcp6_client_start(sd_dhcp6_client *client); +int sd_dhcp6_client_is_running(sd_dhcp6_client *client); +int sd_dhcp6_client_attach_event( + sd_dhcp6_client *client, + sd_event *event, + int64_t priority); +int sd_dhcp6_client_detach_event(sd_dhcp6_client *client); +sd_event *sd_dhcp6_client_get_event(sd_dhcp6_client *client); +sd_dhcp6_client *sd_dhcp6_client_ref(sd_dhcp6_client *client); +sd_dhcp6_client *sd_dhcp6_client_unref(sd_dhcp6_client *client); +int sd_dhcp6_client_new(sd_dhcp6_client **ret); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp6_client, sd_dhcp6_client_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h b/src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h new file mode 100644 index 0000000000..184fbb8e0d --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h @@ -0,0 +1,52 @@ +#ifndef foosddhcp6leasehfoo +#define foosddhcp6leasehfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Tom Gundersen + Copyright (C) 2014-2015 Intel Corporation. All rights reserved. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <netinet/in.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +typedef struct sd_dhcp6_lease sd_dhcp6_lease; + +void sd_dhcp6_lease_reset_address_iter(sd_dhcp6_lease *lease); +int sd_dhcp6_lease_get_address(sd_dhcp6_lease *lease, + struct in6_addr *addr, + uint32_t *lifetime_preferred, + uint32_t *lifetime_valid); + +int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, struct in6_addr **addrs); +int sd_dhcp6_lease_get_domains(sd_dhcp6_lease *lease, char ***domains); +int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease, + struct in6_addr **addrs); +int sd_dhcp6_lease_get_ntp_fqdn(sd_dhcp6_lease *lease, char ***ntp_fqdn); + +sd_dhcp6_lease *sd_dhcp6_lease_ref(sd_dhcp6_lease *lease); +sd_dhcp6_lease *sd_dhcp6_lease_unref(sd_dhcp6_lease *lease); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp6_lease, sd_dhcp6_lease_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-ipv4acd.h b/src/libsystemd-network/include/systemd-network/sd-ipv4acd.h new file mode 100644 index 0000000000..e5ccb4b971 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-ipv4acd.h @@ -0,0 +1,60 @@ +#ifndef foosdipv4acdfoo +#define foosdipv4acdfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Axis Communications AB. All rights reserved. + Copyright (C) 2015 Tom Gundersen + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <net/ethernet.h> +#include <netinet/in.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_IPV4ACD_EVENT_STOP = 0, + SD_IPV4ACD_EVENT_BIND = 1, + SD_IPV4ACD_EVENT_CONFLICT = 2, +}; + +typedef struct sd_ipv4acd sd_ipv4acd; +typedef void (*sd_ipv4acd_callback_t)(sd_ipv4acd *acd, int event, void *userdata); + +int sd_ipv4acd_detach_event(sd_ipv4acd *acd); +int sd_ipv4acd_attach_event(sd_ipv4acd *acd, sd_event *event, int64_t priority); +int sd_ipv4acd_get_address(sd_ipv4acd *acd, struct in_addr *address); +int sd_ipv4acd_set_callback(sd_ipv4acd *acd, sd_ipv4acd_callback_t cb, void *userdata); +int sd_ipv4acd_set_mac(sd_ipv4acd *acd, const struct ether_addr *addr); +int sd_ipv4acd_set_ifindex(sd_ipv4acd *acd, int interface_index); +int sd_ipv4acd_set_address(sd_ipv4acd *acd, const struct in_addr *address); +int sd_ipv4acd_is_running(sd_ipv4acd *acd); +int sd_ipv4acd_start(sd_ipv4acd *acd); +int sd_ipv4acd_stop(sd_ipv4acd *acd); +sd_ipv4acd *sd_ipv4acd_ref(sd_ipv4acd *acd); +sd_ipv4acd *sd_ipv4acd_unref(sd_ipv4acd *acd); +int sd_ipv4acd_new(sd_ipv4acd **ret); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ipv4acd, sd_ipv4acd_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-ipv4ll.h b/src/libsystemd-network/include/systemd-network/sd-ipv4ll.h new file mode 100644 index 0000000000..cff1865d05 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-ipv4ll.h @@ -0,0 +1,60 @@ +#ifndef foosdipv4llfoo +#define foosdipv4llfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Axis Communications AB. All rights reserved. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <net/ethernet.h> +#include <netinet/in.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_IPV4LL_EVENT_STOP = 0, + SD_IPV4LL_EVENT_BIND = 1, + SD_IPV4LL_EVENT_CONFLICT = 2, +}; + +typedef struct sd_ipv4ll sd_ipv4ll; +typedef void (*sd_ipv4ll_callback_t)(sd_ipv4ll *ll, int event, void *userdata); + +int sd_ipv4ll_detach_event(sd_ipv4ll *ll); +int sd_ipv4ll_attach_event(sd_ipv4ll *ll, sd_event *event, int64_t priority); +int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address); +int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdata); +int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr); +int sd_ipv4ll_set_ifindex(sd_ipv4ll *ll, int interface_index); +int sd_ipv4ll_set_address(sd_ipv4ll *ll, const struct in_addr *address); +int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, uint64_t seed); +int sd_ipv4ll_is_running(sd_ipv4ll *ll); +int sd_ipv4ll_start(sd_ipv4ll *ll); +int sd_ipv4ll_stop(sd_ipv4ll *ll); +sd_ipv4ll *sd_ipv4ll_ref(sd_ipv4ll *ll); +sd_ipv4ll *sd_ipv4ll_unref(sd_ipv4ll *ll); +int sd_ipv4ll_new(sd_ipv4ll **ret); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ipv4ll, sd_ipv4ll_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-lldp.h b/src/libsystemd-network/include/systemd-network/sd-lldp.h new file mode 100644 index 0000000000..928f77f0ab --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-lldp.h @@ -0,0 +1,182 @@ +#ifndef foosdlldphfoo +#define foosdlldphfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Tom Gundersen + Copyright (C) 2014 Susant Sahani + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <sys/types.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +/* IEEE 802.3AB Clause 9: TLV Types */ +enum { + SD_LLDP_TYPE_END = 0, + SD_LLDP_TYPE_CHASSIS_ID = 1, + SD_LLDP_TYPE_PORT_ID = 2, + SD_LLDP_TYPE_TTL = 3, + SD_LLDP_TYPE_PORT_DESCRIPTION = 4, + SD_LLDP_TYPE_SYSTEM_NAME = 5, + SD_LLDP_TYPE_SYSTEM_DESCRIPTION = 6, + SD_LLDP_TYPE_SYSTEM_CAPABILITIES = 7, + SD_LLDP_TYPE_MGMT_ADDRESS = 8, + SD_LLDP_TYPE_PRIVATE = 127, +}; + +/* IEEE 802.3AB Clause 9.5.2: Chassis subtypes */ +enum { + SD_LLDP_CHASSIS_SUBTYPE_RESERVED = 0, + SD_LLDP_CHASSIS_SUBTYPE_CHASSIS_COMPONENT = 1, + SD_LLDP_CHASSIS_SUBTYPE_INTERFACE_ALIAS = 2, + SD_LLDP_CHASSIS_SUBTYPE_PORT_COMPONENT = 3, + SD_LLDP_CHASSIS_SUBTYPE_MAC_ADDRESS = 4, + SD_LLDP_CHASSIS_SUBTYPE_NETWORK_ADDRESS = 5, + SD_LLDP_CHASSIS_SUBTYPE_INTERFACE_NAME = 6, + SD_LLDP_CHASSIS_SUBTYPE_LOCALLY_ASSIGNED = 7, +}; + +/* IEEE 802.3AB Clause 9.5.3: Port subtype */ +enum { + SD_LLDP_PORT_SUBTYPE_RESERVED = 0, + SD_LLDP_PORT_SUBTYPE_INTERFACE_ALIAS = 1, + SD_LLDP_PORT_SUBTYPE_PORT_COMPONENT = 2, + SD_LLDP_PORT_SUBTYPE_MAC_ADDRESS = 3, + SD_LLDP_PORT_SUBTYPE_NETWORK_ADDRESS = 4, + SD_LLDP_PORT_SUBTYPE_INTERFACE_NAME = 5, + SD_LLDP_PORT_SUBTYPE_AGENT_CIRCUIT_ID = 6, + SD_LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED = 7, +}; + +enum { + SD_LLDP_SYSTEM_CAPABILITIES_OTHER = 1 << 0, + SD_LLDP_SYSTEM_CAPABILITIES_REPEATER = 1 << 1, + SD_LLDP_SYSTEM_CAPABILITIES_BRIDGE = 1 << 2, + SD_LLDP_SYSTEM_CAPABILITIES_WLAN_AP = 1 << 3, + SD_LLDP_SYSTEM_CAPABILITIES_ROUTER = 1 << 4, + SD_LLDP_SYSTEM_CAPABILITIES_PHONE = 1 << 5, + SD_LLDP_SYSTEM_CAPABILITIES_DOCSIS = 1 << 6, + SD_LLDP_SYSTEM_CAPABILITIES_STATION = 1 << 7, + SD_LLDP_SYSTEM_CAPABILITIES_CVLAN = 1 << 8, + SD_LLDP_SYSTEM_CAPABILITIES_SVLAN = 1 << 9, + SD_LLDP_SYSTEM_CAPABILITIES_TPMR = 1 << 10, +}; + +#define SD_LLDP_SYSTEM_CAPABILITIES_ALL ((uint16_t) -1) + +#define SD_LLDP_SYSTEM_CAPABILITIES_ALL_ROUTERS \ + ((uint16_t) \ + (SD_LLDP_SYSTEM_CAPABILITIES_REPEATER| \ + SD_LLDP_SYSTEM_CAPABILITIES_BRIDGE| \ + SD_LLDP_SYSTEM_CAPABILITIES_WLAN_AP| \ + SD_LLDP_SYSTEM_CAPABILITIES_ROUTER| \ + SD_LLDP_SYSTEM_CAPABILITIES_DOCSIS| \ + SD_LLDP_SYSTEM_CAPABILITIES_CVLAN| \ + SD_LLDP_SYSTEM_CAPABILITIES_SVLAN| \ + SD_LLDP_SYSTEM_CAPABILITIES_TPMR)) + +#define SD_LLDP_OUI_802_1 (uint8_t[]) { 0x00, 0x80, 0xc2 } +#define SD_LLDP_OUI_802_3 (uint8_t[]) { 0x00, 0x12, 0x0f } + +enum { + SD_LLDP_OUI_802_1_SUBTYPE_PORT_VLAN_ID = 1, + SD_LLDP_OUI_802_1_SUBTYPE_PORT_PROTOCOL_VLAN_ID = 2, + SD_LLDP_OUI_802_1_SUBTYPE_VLAN_NAME = 3, + SD_LLDP_OUI_802_1_SUBTYPE_PROTOCOL_IDENTITY = 4, + SD_LLDP_OUI_802_1_SUBTYPE_VID_USAGE_DIGEST = 5, + SD_LLDP_OUI_802_1_SUBTYPE_MANAGEMENT_VID = 6, + SD_LLDP_OUI_802_1_SUBTYPE_LINK_AGGREGATION = 7, +}; + +typedef struct sd_lldp sd_lldp; +typedef struct sd_lldp_neighbor sd_lldp_neighbor; + +typedef enum sd_lldp_event { + SD_LLDP_EVENT_ADDED = 'a', + SD_LLDP_EVENT_REMOVED = 'r', + SD_LLDP_EVENT_UPDATED = 'u', + SD_LLDP_EVENT_REFRESHED = 'f', +} sd_lldp_event; + +typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata); + +int sd_lldp_new(sd_lldp **ret); +sd_lldp* sd_lldp_ref(sd_lldp *lldp); +sd_lldp* sd_lldp_unref(sd_lldp *lldp); + +int sd_lldp_start(sd_lldp *lldp); +int sd_lldp_stop(sd_lldp *lldp); + +int sd_lldp_attach_event(sd_lldp *lldp, sd_event *event, int64_t priority); +int sd_lldp_detach_event(sd_lldp *lldp); +sd_event *sd_lldp_get_event(sd_lldp *lldp); + +int sd_lldp_set_callback(sd_lldp *lldp, sd_lldp_callback_t cb, void *userdata); +int sd_lldp_set_ifindex(sd_lldp *lldp, int ifindex); + +/* Controls how much and what to store in the neighbors database */ +int sd_lldp_set_neighbors_max(sd_lldp *lldp, uint64_t n); +int sd_lldp_match_capabilities(sd_lldp *lldp, uint16_t mask); +int sd_lldp_set_filter_address(sd_lldp *lldp, const struct ether_addr *address); + +int sd_lldp_get_neighbors(sd_lldp *lldp, sd_lldp_neighbor ***neighbors); + +int sd_lldp_neighbor_from_raw(sd_lldp_neighbor **ret, const void *raw, size_t raw_size); +sd_lldp_neighbor *sd_lldp_neighbor_ref(sd_lldp_neighbor *n); +sd_lldp_neighbor *sd_lldp_neighbor_unref(sd_lldp_neighbor *n); + +/* Access to LLDP frame metadata */ +int sd_lldp_neighbor_get_source_address(sd_lldp_neighbor *n, struct ether_addr* address); +int sd_lldp_neighbor_get_destination_address(sd_lldp_neighbor *n, struct ether_addr* address); +int sd_lldp_neighbor_get_timestamp(sd_lldp_neighbor *n, clockid_t clock, uint64_t *ret); +int sd_lldp_neighbor_get_raw(sd_lldp_neighbor *n, const void **ret, size_t *size); + +/* High-level, direct, parsed out field access. These fields exist at most once, hence may be queried directly. */ +int sd_lldp_neighbor_get_chassis_id(sd_lldp_neighbor *n, uint8_t *type, const void **ret, size_t *size); +int sd_lldp_neighbor_get_chassis_id_as_string(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_port_id(sd_lldp_neighbor *n, uint8_t *type, const void **ret, size_t *size); +int sd_lldp_neighbor_get_port_id_as_string(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_ttl(sd_lldp_neighbor *n, uint16_t *ret_sec); +int sd_lldp_neighbor_get_system_name(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_system_description(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_port_description(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_system_capabilities(sd_lldp_neighbor *n, uint16_t *ret); +int sd_lldp_neighbor_get_enabled_capabilities(sd_lldp_neighbor *n, uint16_t *ret); + +/* Low-level, iterative TLV access. This is for evertyhing else, it iteratively goes through all available TLVs + * (including the ones covered with the calls above), and allows multiple TLVs for the same fields. */ +int sd_lldp_neighbor_tlv_rewind(sd_lldp_neighbor *n); +int sd_lldp_neighbor_tlv_next(sd_lldp_neighbor *n); +int sd_lldp_neighbor_tlv_get_type(sd_lldp_neighbor *n, uint8_t *type); +int sd_lldp_neighbor_tlv_is_type(sd_lldp_neighbor *n, uint8_t type); +int sd_lldp_neighbor_tlv_get_oui(sd_lldp_neighbor *n, uint8_t oui[3], uint8_t *subtype); +int sd_lldp_neighbor_tlv_is_oui(sd_lldp_neighbor *n, const uint8_t oui[3], uint8_t subtype); +int sd_lldp_neighbor_tlv_get_raw(sd_lldp_neighbor *n, const void **ret, size_t *size); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp, sd_lldp_unref); +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp_neighbor, sd_lldp_neighbor_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-ndisc.h b/src/libsystemd-network/include/systemd-network/sd-ndisc.h new file mode 100644 index 0000000000..de2329458a --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-ndisc.h @@ -0,0 +1,130 @@ +#ifndef foosdndiscfoo +#define foosdndiscfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Intel Corporation. All rights reserved. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <netinet/in.h> +#include <sys/types.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +/* Neightbor Discovery Options, RFC 4861, Section 4.6 and + * https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5 */ +enum { + SD_NDISC_OPTION_SOURCE_LL_ADDRESS = 1, + SD_NDISC_OPTION_TARGET_LL_ADDRESS = 2, + SD_NDISC_OPTION_PREFIX_INFORMATION = 3, + SD_NDISC_OPTION_MTU = 5, + SD_NDISC_OPTION_ROUTE_INFORMATION = 24, + SD_NDISC_OPTION_RDNSS = 25, + SD_NDISC_OPTION_FLAGS_EXTENSION = 26, + SD_NDISC_OPTION_DNSSL = 31, + SD_NDISC_OPTION_CAPTIVE_PORTAL = 37, +}; + +/* Route preference, RFC 4191, Section 2.1 */ +enum { + SD_NDISC_PREFERENCE_LOW = 3U, + SD_NDISC_PREFERENCE_MEDIUM = 0U, + SD_NDISC_PREFERENCE_HIGH = 1U, +}; + +typedef struct sd_ndisc sd_ndisc; +typedef struct sd_ndisc_router sd_ndisc_router; + +typedef enum sd_ndisc_event { + SD_NDISC_EVENT_TIMEOUT = 't', + SD_NDISC_EVENT_ROUTER = 'r', +} sd_ndisc_event; + +typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata); + +int sd_ndisc_new(sd_ndisc **ret); +sd_ndisc *sd_ndisc_ref(sd_ndisc *nd); +sd_ndisc *sd_ndisc_unref(sd_ndisc *nd); + +int sd_ndisc_start(sd_ndisc *nd); +int sd_ndisc_stop(sd_ndisc *nd); + +int sd_ndisc_attach_event(sd_ndisc *nd, sd_event *event, int64_t priority); +int sd_ndisc_detach_event(sd_ndisc *nd); +sd_event *sd_ndisc_get_event(sd_ndisc *nd); + +int sd_ndisc_set_callback(sd_ndisc *nd, sd_ndisc_callback_t cb, void *userdata); +int sd_ndisc_set_ifindex(sd_ndisc *nd, int interface_index); +int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr); + +int sd_ndisc_get_mtu(sd_ndisc *nd, uint32_t *ret); +int sd_ndisc_get_hop_limit(sd_ndisc *nd, uint8_t *ret); + +int sd_ndisc_router_from_raw(sd_ndisc_router **ret, const void *raw, size_t raw_size); +sd_ndisc_router *sd_ndisc_router_ref(sd_ndisc_router *rt); +sd_ndisc_router *sd_ndisc_router_unref(sd_ndisc_router *rt); + +int sd_ndisc_router_get_address(sd_ndisc_router *rt, struct in6_addr *ret_addr); +int sd_ndisc_router_get_timestamp(sd_ndisc_router *rt, clockid_t clock, uint64_t *ret); +int sd_ndisc_router_get_raw(sd_ndisc_router *rt, const void **ret, size_t *size); + +int sd_ndisc_router_get_hop_limit(sd_ndisc_router *rt, uint8_t *ret); +int sd_ndisc_router_get_flags(sd_ndisc_router *rt, uint64_t *ret_flags); +int sd_ndisc_router_get_preference(sd_ndisc_router *rt, unsigned *ret); +int sd_ndisc_router_get_lifetime(sd_ndisc_router *rt, uint16_t *ret_lifetime); +int sd_ndisc_router_get_mtu(sd_ndisc_router *rt, uint32_t *ret); + +/* Generic option access */ +int sd_ndisc_router_option_rewind(sd_ndisc_router *rt); +int sd_ndisc_router_option_next(sd_ndisc_router *rt); +int sd_ndisc_router_option_get_type(sd_ndisc_router *rt, uint8_t *ret); +int sd_ndisc_router_option_is_type(sd_ndisc_router *rt, uint8_t type); +int sd_ndisc_router_option_get_raw(sd_ndisc_router *rt, const void **ret, size_t *size); + +/* Specific option access: SD_NDISC_OPTION_PREFIX_INFORMATION */ +int sd_ndisc_router_prefix_get_valid_lifetime(sd_ndisc_router *rt, uint32_t *ret); +int sd_ndisc_router_prefix_get_preferred_lifetime(sd_ndisc_router *rt, uint32_t *ret); +int sd_ndisc_router_prefix_get_flags(sd_ndisc_router *rt, uint8_t *ret); +int sd_ndisc_router_prefix_get_address(sd_ndisc_router *rt, struct in6_addr *ret_addr); +int sd_ndisc_router_prefix_get_prefixlen(sd_ndisc_router *rt, unsigned *prefixlen); + +/* Specific option access: SD_NDISC_OPTION_ROUTE_INFORMATION */ +int sd_ndisc_router_route_get_lifetime(sd_ndisc_router *rt, uint32_t *ret); +int sd_ndisc_router_route_get_address(sd_ndisc_router *rt, struct in6_addr *ret_addr); +int sd_ndisc_router_route_get_prefixlen(sd_ndisc_router *rt, unsigned *prefixlen); +int sd_ndisc_router_route_get_preference(sd_ndisc_router *rt, unsigned *ret); + +/* Specific option access: SD_NDISC_OPTION_RDNSS */ +int sd_ndisc_router_rdnss_get_addresses(sd_ndisc_router *rt, const struct in6_addr **ret); +int sd_ndisc_router_rdnss_get_lifetime(sd_ndisc_router *rt, uint32_t *ret); + +/* Specific option access: SD_NDISC_OPTION_DNSSL */ +int sd_ndisc_router_dnssl_get_domains(sd_ndisc_router *rt, char ***ret); +int sd_ndisc_router_dnssl_get_lifetime(sd_ndisc_router *rt, uint32_t *ret); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc, sd_ndisc_unref); +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc_router, sd_ndisc_router_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/src/GNUmakefile b/src/libsystemd-network/src/GNUmakefile new file mode 120000 index 0000000000..0f24a727ed --- /dev/null +++ b/src/libsystemd-network/src/GNUmakefile @@ -0,0 +1 @@ +GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd-network/src/Makefile b/src/libsystemd-network/src/Makefile new file mode 100644 index 0000000000..c636e3cab1 --- /dev/null +++ b/src/libsystemd-network/src/Makefile @@ -0,0 +1,83 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. +include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +noinst_LTLIBRARIES += \ + libsystemd-network.la + +libsystemd_network_la_CFLAGS = \ + $(KMOD_CFLAGS) + +libsystemd_network_la_SOURCES = \ + src/systemd/sd-dhcp-client.h \ + src/systemd/sd-dhcp-server.h \ + src/systemd/sd-dhcp-lease.h \ + src/systemd/sd-ipv4ll.h \ + src/systemd/sd-ipv4acd.h \ + src/systemd/sd-ndisc.h \ + src/systemd/sd-dhcp6-client.h \ + src/systemd/sd-dhcp6-lease.h \ + src/systemd/sd-lldp.h \ + src/libsystemd-network/sd-dhcp-client.c \ + src/libsystemd-network/sd-dhcp-server.c \ + src/libsystemd-network/dhcp-network.c \ + src/libsystemd-network/dhcp-option.c \ + src/libsystemd-network/dhcp-packet.c \ + src/libsystemd-network/dhcp-internal.h \ + src/libsystemd-network/dhcp-server-internal.h \ + src/libsystemd-network/dhcp-protocol.h \ + src/libsystemd-network/dhcp-lease-internal.h \ + src/libsystemd-network/sd-dhcp-lease.c \ + src/libsystemd-network/sd-ipv4ll.c \ + src/libsystemd-network/sd-ipv4acd.c \ + src/libsystemd-network/arp-util.h \ + src/libsystemd-network/arp-util.c \ + src/libsystemd-network/network-internal.c \ + src/libsystemd-network/network-internal.h \ + src/libsystemd-network/sd-ndisc.c \ + src/libsystemd-network/ndisc-internal.h \ + src/libsystemd-network/ndisc-router.h \ + src/libsystemd-network/ndisc-router.c \ + src/libsystemd-network/icmp6-util.h \ + src/libsystemd-network/icmp6-util.c \ + src/libsystemd-network/sd-dhcp6-client.c \ + src/libsystemd-network/dhcp6-internal.h \ + src/libsystemd-network/dhcp6-protocol.h \ + src/libsystemd-network/dhcp6-network.c \ + src/libsystemd-network/dhcp6-option.c \ + src/libsystemd-network/dhcp6-lease-internal.h \ + src/libsystemd-network/sd-dhcp6-lease.c \ + src/libsystemd-network/dhcp-identifier.h \ + src/libsystemd-network/dhcp-identifier.c \ + src/libsystemd-network/lldp-internal.h \ + src/libsystemd-network/lldp-network.h \ + src/libsystemd-network/lldp-network.c \ + src/libsystemd-network/lldp-neighbor.h \ + src/libsystemd-network/lldp-neighbor.c \ + src/libsystemd-network/sd-lldp.c + +libsystemd_network_la_LIBADD = \ + $(KMOD_LIBS) + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/src/arp-util.c index 02028bf28a..2edb97be32 100644 --- a/src/libsystemd-network/arp-util.c +++ b/src/libsystemd-network/src/arp-util.c @@ -18,12 +18,13 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <linux/filter.h> #include <arpa/inet.h> -#include "arp-util.h" -#include "fd-util.h" -#include "util.h" +#include <linux/filter.h> + +#include "systemd-basic/fd-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/arp-util.h" int arp_network_bind_raw_socket(int ifindex, be32_t address, const struct ether_addr *eth_mac) { struct sock_filter filter[] = { diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/src/dhcp-identifier.c index a21efc4d06..afe0b9a404 100644 --- a/src/libsystemd-network/dhcp-identifier.c +++ b/src/libsystemd-network/src/dhcp-identifier.c @@ -17,16 +17,16 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "libudev.h" -#include "sd-id128.h" - -#include "dhcp-identifier.h" -#include "dhcp6-protocol.h" -#include "network-internal.h" -#include "siphash24.h" -#include "sparse-endian.h" -#include "udev-util.h" -#include "virt.h" +#include <libudev.h> +#include <systemd/sd-id128.h> + +#include "systemd-basic/siphash24.h" +#include "systemd-basic/sparse-endian.h" +#include "systemd-basic/virt.h" +#include "systemd-network/dhcp-identifier.h" +#include "systemd-network/dhcp6-protocol.h" +#include "systemd-network/network-internal.h" +#include "systemd-shared/udev-util.h" #define SYSTEMD_PEN 43793 #define HASH_KEY SD_ID128_MAKE(80,11,8c,c2,fe,4a,03,ee,3e,d6,0c,6f,36,39,14,09) diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/src/dhcp-network.c index a9f5a0a5de..2cdadee730 100644 --- a/src/libsystemd-network/dhcp-network.c +++ b/src/libsystemd-network/src/dhcp-network.c @@ -23,13 +23,14 @@ #include <stdio.h> #include <string.h> #include <sys/socket.h> + #include <linux/filter.h> #include <linux/if_infiniband.h> #include <linux/if_packet.h> -#include "dhcp-internal.h" -#include "fd-util.h" -#include "socket-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-network/dhcp-internal.h" static int _bind_raw_socket(int ifindex, union sockaddr_union *link, uint32_t xid, const uint8_t *mac_addr, diff --git a/src/libsystemd-network/dhcp-option.c b/src/libsystemd-network/src/dhcp-option.c index c105196334..a848ed2841 100644 --- a/src/libsystemd-network/dhcp-option.c +++ b/src/libsystemd-network/src/dhcp-option.c @@ -22,10 +22,9 @@ #include <stdio.h> #include <string.h> -#include "alloc-util.h" -#include "utf8.h" - -#include "dhcp-internal.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/utf8.h" +#include "systemd-network/dhcp-internal.h" static int option_append(uint8_t options[], size_t size, size_t *offset, uint8_t code, size_t optlen, const void *optval) { diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/src/dhcp-packet.c index 8be774061d..cdb54caedc 100644 --- a/src/libsystemd-network/dhcp-packet.c +++ b/src/libsystemd-network/src/dhcp-packet.c @@ -23,8 +23,8 @@ #include <net/if_arp.h> #include <string.h> -#include "dhcp-internal.h" -#include "dhcp-protocol.h" +#include "systemd-network/dhcp-internal.h" +#include "systemd-network/dhcp-protocol.h" #define DHCP_CLIENT_MIN_OPTIONS_SIZE 312 diff --git a/src/libsystemd-network/dhcp6-network.c b/src/libsystemd-network/src/dhcp6-network.c index fd2d60c9d5..469e3ddfdf 100644 --- a/src/libsystemd-network/dhcp6-network.c +++ b/src/libsystemd-network/src/dhcp6-network.c @@ -25,12 +25,13 @@ #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> + #include <linux/if_packet.h> -#include "dhcp6-internal.h" -#include "dhcp6-protocol.h" -#include "fd-util.h" -#include "socket-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-network/dhcp6-internal.h" +#include "systemd-network/dhcp6-protocol.h" int dhcp6_network_bind_udp_socket(int index, struct in6_addr *local_address) { union sockaddr_union src = { diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/src/dhcp6-option.c index 5462e03476..ecbf201661 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/src/dhcp6-option.c @@ -21,16 +21,15 @@ #include <netinet/in.h> #include <string.h> -#include "sd-dhcp6-client.h" - -#include "alloc-util.h" -#include "dhcp6-internal.h" -#include "dhcp6-protocol.h" -#include "dns-domain.h" -#include "sparse-endian.h" -#include "strv.h" -#include "unaligned.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/sparse-endian.h" +#include "systemd-basic/strv.h" +#include "systemd-basic/unaligned.h" +#include "systemd-basic/util.h" +#include "systemd-network/dhcp6-internal.h" +#include "systemd-network/dhcp6-protocol.h" +#include "systemd-network/sd-dhcp6-client.h" +#include "systemd-shared/dns-domain.h" #define DHCP6_OPTION_IA_NA_LEN 12 #define DHCP6_OPTION_IA_TA_LEN 4 diff --git a/src/libsystemd-network/icmp6-util.c b/src/libsystemd-network/src/icmp6-util.c index c2e4b0e9e3..4280d32e3d 100644 --- a/src/libsystemd-network/icmp6-util.c +++ b/src/libsystemd-network/src/icmp6-util.c @@ -18,6 +18,7 @@ ***/ #include <errno.h> +#include <net/if.h> #include <netinet/icmp6.h> #include <netinet/in.h> #include <netinet/ip6.h> @@ -26,12 +27,12 @@ #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> -#include <net/if.h> + #include <linux/if_packet.h> -#include "fd-util.h" -#include "icmp6-util.h" -#include "socket-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-network/icmp6-util.h" #define IN6ADDR_ALL_ROUTERS_MULTICAST_INIT \ { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/src/lldp-neighbor.c index 53e29377b3..6509b1479d 100644 --- a/src/libsystemd-network/lldp-neighbor.c +++ b/src/libsystemd-network/src/lldp-neighbor.c @@ -17,14 +17,14 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "alloc-util.h" -#include "escape.h" -#include "ether-addr-util.h" -#include "hexdecoct.h" -#include "in-addr-util.h" -#include "lldp-internal.h" -#include "lldp-neighbor.h" -#include "unaligned.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/escape.h" +#include "systemd-basic/ether-addr-util.h" +#include "systemd-basic/hexdecoct.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/unaligned.h" +#include "systemd-network/lldp-internal.h" +#include "systemd-network/lldp-neighbor.h" static void lldp_neighbor_id_hash_func(const void *p, struct siphash *state) { const LLDPNeighborID *id = p; diff --git a/src/libsystemd-network/lldp-network.c b/src/libsystemd-network/src/lldp-network.c index 59c25598e9..6c9ed81e69 100644 --- a/src/libsystemd-network/lldp-network.c +++ b/src/libsystemd-network/src/lldp-network.c @@ -18,12 +18,13 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <linux/filter.h> #include <netinet/if_ether.h> -#include "fd-util.h" -#include "lldp-network.h" -#include "socket-util.h" +#include <linux/filter.h> + +#include "systemd-basic/fd-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-network/lldp-network.h" int lldp_network_bind_raw_socket(int ifindex) { diff --git a/src/libsystemd-network/ndisc-router.c b/src/libsystemd-network/src/ndisc-router.c index 41ff2b353a..a1051dadc5 100644 --- a/src/libsystemd-network/ndisc-router.c +++ b/src/libsystemd-network/src/ndisc-router.c @@ -19,15 +19,14 @@ #include <netinet/icmp6.h> -#include "sd-ndisc.h" - -#include "alloc-util.h" -#include "dns-domain.h" -#include "hostname-util.h" -#include "missing.h" -#include "ndisc-internal.h" -#include "ndisc-router.h" -#include "strv.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/hostname-util.h" +#include "systemd-basic/missing.h" +#include "systemd-basic/strv.h" +#include "systemd-network/ndisc-internal.h" +#include "systemd-network/ndisc-router.h" +#include "systemd-network/sd-ndisc.h" +#include "systemd-shared/dns-domain.h" _public_ sd_ndisc_router* sd_ndisc_router_ref(sd_ndisc_router *rt) { if (!rt) diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/src/network-internal.c index 9d78b953fc..13b3bad81b 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/src/network-internal.c @@ -18,26 +18,26 @@ ***/ #include <arpa/inet.h> -#include <linux/if.h> #include <netinet/ether.h> -#include "sd-ndisc.h" - -#include "alloc-util.h" -#include "condition.h" -#include "conf-parser.h" -#include "dhcp-lease-internal.h" -#include "ether-addr-util.h" -#include "hexdecoct.h" -#include "log.h" -#include "network-internal.h" -#include "parse-util.h" -#include "siphash24.h" -#include "socket-util.h" -#include "string-util.h" -#include "strv.h" -#include "utf8.h" -#include "util.h" +#include <linux/if.h> + +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/ether-addr-util.h" +#include "systemd-basic/hexdecoct.h" +#include "systemd-basic/log.h" +#include "systemd-basic/parse-util.h" +#include "systemd-basic/siphash24.h" +#include "systemd-basic/socket-util.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/strv.h" +#include "systemd-basic/utf8.h" +#include "systemd-basic/util.h" +#include "systemd-network/dhcp-lease-internal.h" +#include "systemd-network/network-internal.h" +#include "systemd-network/sd-ndisc.h" +#include "systemd-shared/condition.h" +#include "systemd-shared/conf-parser.h" const char *net_get_name(struct udev_device *device) { const char *name, *field; diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/src/sd-dhcp-client.c index 5ccb23922c..fa6393a2e2 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/src/sd-dhcp-client.c @@ -24,21 +24,21 @@ #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> + #include <linux/if_infiniband.h> -#include "sd-dhcp-client.h" - -#include "alloc-util.h" -#include "async.h" -#include "dhcp-identifier.h" -#include "dhcp-internal.h" -#include "dhcp-lease-internal.h" -#include "dhcp-protocol.h" -#include "dns-domain.h" -#include "hostname-util.h" -#include "random-util.h" -#include "string-util.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/async.h" +#include "systemd-basic/hostname-util.h" +#include "systemd-basic/random-util.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/dhcp-identifier.h" +#include "systemd-network/dhcp-internal.h" +#include "systemd-network/dhcp-lease-internal.h" +#include "systemd-network/dhcp-protocol.h" +#include "systemd-network/sd-dhcp-client.h" +#include "systemd-shared/dns-domain.h" #define MAX_CLIENT_ID_LEN (sizeof(uint32_t) + MAX_DUID_LEN) /* Arbitrary limit */ #define MAX_MAC_ADDR_LEN CONST_MAX(INFINIBAND_ALEN, ETH_ALEN) diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/src/sd-dhcp-lease.c index 8387b185c0..26f8a61cab 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/src/sd-dhcp-lease.c @@ -24,22 +24,21 @@ #include <stdlib.h> #include <string.h> -#include "sd-dhcp-lease.h" - -#include "alloc-util.h" -#include "dhcp-lease-internal.h" -#include "dhcp-protocol.h" -#include "dns-domain.h" -#include "fd-util.h" -#include "fileio.h" -#include "hexdecoct.h" -#include "hostname-util.h" -#include "in-addr-util.h" -#include "network-internal.h" -#include "parse-util.h" -#include "stdio-util.h" -#include "string-util.h" -#include "unaligned.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/fileio.h" +#include "systemd-basic/hexdecoct.h" +#include "systemd-basic/hostname-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/parse-util.h" +#include "systemd-basic/stdio-util.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/unaligned.h" +#include "systemd-network/dhcp-lease-internal.h" +#include "systemd-network/dhcp-protocol.h" +#include "systemd-network/network-internal.h" +#include "systemd-network/sd-dhcp-lease.h" +#include "systemd-shared/dns-domain.h" int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr) { assert_return(lease, -EINVAL); diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/src/sd-dhcp-server.c index f16314a37f..b92093ab05 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/src/sd-dhcp-server.c @@ -20,16 +20,15 @@ #include <sys/ioctl.h> -#include "sd-dhcp-server.h" - -#include "alloc-util.h" -#include "dhcp-internal.h" -#include "dhcp-server-internal.h" -#include "fd-util.h" -#include "in-addr-util.h" -#include "siphash24.h" -#include "string-util.h" -#include "unaligned.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/siphash24.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/unaligned.h" +#include "systemd-network/dhcp-internal.h" +#include "systemd-network/dhcp-server-internal.h" +#include "systemd-network/sd-dhcp-server.h" #define DHCP_DEFAULT_LEASE_TIME_USEC USEC_PER_HOUR #define DHCP_MAX_LEASE_TIME_USEC (USEC_PER_HOUR*12) diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/src/sd-dhcp6-client.c index e81215f7d7..d2c83e4043 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/src/sd-dhcp6-client.c @@ -20,22 +20,22 @@ #include <errno.h> #include <string.h> #include <sys/ioctl.h> + #include <linux/if_infiniband.h> -#include "sd-dhcp6-client.h" - -#include "alloc-util.h" -#include "dhcp-identifier.h" -#include "dhcp6-internal.h" -#include "dhcp6-lease-internal.h" -#include "dhcp6-protocol.h" -#include "fd-util.h" -#include "in-addr-util.h" -#include "network-internal.h" -#include "random-util.h" -#include "socket-util.h" -#include "string-table.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/random-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-basic/string-table.h" +#include "systemd-basic/util.h" +#include "systemd-network/dhcp-identifier.h" +#include "systemd-network/dhcp6-internal.h" +#include "systemd-network/dhcp6-lease-internal.h" +#include "systemd-network/dhcp6-protocol.h" +#include "systemd-network/network-internal.h" +#include "systemd-network/sd-dhcp6-client.h" #define MAX_MAC_ADDR_LEN INFINIBAND_ALEN diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/src/sd-dhcp6-lease.c index ab59977a3f..bd1d4026f5 100644 --- a/src/libsystemd-network/sd-dhcp6-lease.c +++ b/src/libsystemd-network/src/sd-dhcp6-lease.c @@ -20,11 +20,11 @@ #include <errno.h> -#include "alloc-util.h" -#include "dhcp6-lease-internal.h" -#include "dhcp6-protocol.h" -#include "strv.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/strv.h" +#include "systemd-basic/util.h" +#include "systemd-network/dhcp6-lease-internal.h" +#include "systemd-network/dhcp6-protocol.h" int dhcp6_lease_clear_timers(DHCP6IA *ia) { assert_return(ia, -EINVAL); diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/src/sd-ipv4acd.c index 4dd343c101..90ffc8ccea 100644 --- a/src/libsystemd-network/sd-ipv4acd.c +++ b/src/libsystemd-network/src/sd-ipv4acd.c @@ -24,18 +24,17 @@ #include <stdlib.h> #include <string.h> -#include "sd-ipv4acd.h" - -#include "alloc-util.h" -#include "arp-util.h" -#include "ether-addr-util.h" -#include "fd-util.h" -#include "in-addr-util.h" -#include "list.h" -#include "random-util.h" -#include "siphash24.h" -#include "string-util.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/ether-addr-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/list.h" +#include "systemd-basic/random-util.h" +#include "systemd-basic/siphash24.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/arp-util.h" +#include "systemd-network/sd-ipv4acd.h" /* Constants from the RFC */ #define PROBE_WAIT_USEC (1U * USEC_PER_SEC) diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/src/sd-ipv4ll.c index 13209261f9..35d3a972b2 100644 --- a/src/libsystemd-network/sd-ipv4ll.c +++ b/src/libsystemd-network/src/sd-ipv4ll.c @@ -24,18 +24,17 @@ #include <stdlib.h> #include <string.h> -#include "sd-ipv4acd.h" -#include "sd-ipv4ll.h" - -#include "alloc-util.h" -#include "ether-addr-util.h" -#include "in-addr-util.h" -#include "list.h" -#include "random-util.h" -#include "siphash24.h" -#include "sparse-endian.h" -#include "string-util.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/ether-addr-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/list.h" +#include "systemd-basic/random-util.h" +#include "systemd-basic/siphash24.h" +#include "systemd-basic/sparse-endian.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/sd-ipv4acd.h" +#include "systemd-network/sd-ipv4ll.h" #define IPV4LL_NETWORK UINT32_C(0xA9FE0000) #define IPV4LL_NETMASK UINT32_C(0xFFFF0000) diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/src/sd-lldp.c index 0702241506..b271c88786 100644 --- a/src/libsystemd-network/sd-lldp.c +++ b/src/libsystemd-network/src/sd-lldp.c @@ -20,15 +20,14 @@ #include <arpa/inet.h> -#include "sd-lldp.h" - -#include "alloc-util.h" -#include "fd-util.h" -#include "lldp-internal.h" -#include "lldp-neighbor.h" -#include "lldp-network.h" -#include "socket-util.h" -#include "ether-addr-util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/ether-addr-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-network/lldp-internal.h" +#include "systemd-network/lldp-neighbor.h" +#include "systemd-network/lldp-network.h" +#include "systemd-network/sd-lldp.h" #define LLDP_DEFAULT_NEIGHBORS_MAX 128U diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/src/sd-ndisc.c index 1d3be9b862..7f3bcbd7e2 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/src/sd-ndisc.c @@ -20,17 +20,16 @@ #include <netinet/icmp6.h> #include <netinet/in.h> -#include "sd-ndisc.h" - -#include "alloc-util.h" -#include "fd-util.h" -#include "icmp6-util.h" -#include "in-addr-util.h" -#include "ndisc-internal.h" -#include "ndisc-router.h" -#include "socket-util.h" -#include "string-util.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/icmp6-util.h" +#include "systemd-network/ndisc-internal.h" +#include "systemd-network/ndisc-router.h" +#include "systemd-network/sd-ndisc.h" #define NDISC_ROUTER_SOLICITATION_INTERVAL (4U * USEC_PER_SEC) #define NDISC_MAX_ROUTER_SOLICITATIONS 3U diff --git a/src/libsystemd-network/test/GNUmakefile b/src/libsystemd-network/test/GNUmakefile new file mode 120000 index 0000000000..0f24a727ed --- /dev/null +++ b/src/libsystemd-network/test/GNUmakefile @@ -0,0 +1 @@ +GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd-network/test/Makefile b/src/libsystemd-network/test/Makefile new file mode 100644 index 0000000000..8cc38bb547 --- /dev/null +++ b/src/libsystemd-network/test/Makefile @@ -0,0 +1,118 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. +include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +test_dhcp_option_SOURCES = \ + src/libsystemd-network/dhcp-protocol.h \ + src/libsystemd-network/dhcp-internal.h \ + src/libsystemd-network/test-dhcp-option.c + +test_dhcp_option_LDADD = \ + libsystemd-network.la \ + libsystemd-shared.la + +test_dhcp_client_SOURCES = \ + src/systemd/sd-dhcp-client.h \ + src/libsystemd-network/dhcp-protocol.h \ + src/libsystemd-network/dhcp-internal.h \ + src/libsystemd-network/test-dhcp-client.c + +test_dhcp_client_LDADD = \ + libsystemd-network.la \ + libsystemd-shared.la + +test_dhcp_server_SOURCES = \ + src/libsystemd-network/test-dhcp-server.c + +test_dhcp_server_LDADD = \ + libsystemd-network.la \ + libsystemd-shared.la + +test_ipv4ll_SOURCES = \ + src/systemd/sd-ipv4ll.h \ + src/libsystemd-network/arp-util.h \ + src/libsystemd-network/test-ipv4ll.c + +test_ipv4ll_LDADD = \ + libsystemd-network.la \ + libsystemd-shared.la + +test_ipv4ll_manual_SOURCES = \ + src/systemd/sd-ipv4ll.h \ + src/libsystemd-network/test-ipv4ll-manual.c + +test_ipv4ll_manual_LDADD = \ + libsystemd-network.la \ + libsystemd-shared.la + +test_acd_SOURCES = \ + src/systemd/sd-ipv4acd.h \ + src/libsystemd-network/test-acd.c + +test_acd_LDADD = \ + libsystemd-network.la \ + libsystemd-shared.la + +test_ndisc_rs_SOURCES = \ + src/systemd/sd-dhcp6-client.h \ + src/systemd/sd-ndisc.h \ + src/libsystemd-network/icmp6-util.h \ + src/libsystemd-network/test-ndisc-rs.c \ + src/libsystemd-network/dhcp-identifier.h \ + src/libsystemd-network/dhcp-identifier.c + +test_ndisc_rs_LDADD = \ + libsystemd-network.la \ + libudev.la \ + libsystemd-shared.la + +test_dhcp6_client_SOURCES = \ + src/systemd/sd-dhcp6-client.h \ + src/libsystemd-network/dhcp6-internal.h \ + src/libsystemd-network/test-dhcp6-client.c \ + src/libsystemd-network/dhcp-identifier.h \ + src/libsystemd-network/dhcp-identifier.c + +test_dhcp6_client_LDADD = \ + libsystemd-network.la \ + libudev.la \ + libsystemd-shared.la + +test_lldp_SOURCES = \ + src/libsystemd-network/test-lldp.c + +test_lldp_LDADD = \ + libsystemd-network.la \ + libsystemd-shared.la + +tests += \ + test-dhcp-option \ + test-dhcp-client \ + test-dhcp-server \ + test-ipv4ll \ + test-ndisc-rs \ + test-dhcp6-client \ + test-lldp + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd-network/test-acd.c b/src/libsystemd-network/test/test-acd.c index 27fcc332a3..26480a2012 100644 --- a/src/libsystemd-network/test-acd.c +++ b/src/libsystemd-network/test/test-acd.c @@ -18,19 +18,19 @@ ***/ #include <errno.h> +#include <net/if.h> #include <stdlib.h> #include <unistd.h> #include <linux/veth.h> -#include <net/if.h> -#include "sd-event.h" -#include "sd-ipv4acd.h" -#include "sd-netlink.h" +#include <systemd/sd-event.h> -#include "in-addr-util.h" -#include "netlink-util.h" -#include "util.h" +#include "sd-netlink/netlink-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/sd-ipv4acd.h" +#include "systemd-staging/sd-netlink.h" static void acd_handler(sd_ipv4acd *acd, int event, void *userdata) { assert_se(acd); diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test/test-dhcp-client.c index 2a101cb1fe..e58491293c 100644 --- a/src/libsystemd-network/test-dhcp-client.c +++ b/src/libsystemd-network/test/test-dhcp-client.c @@ -22,15 +22,15 @@ #include <sys/socket.h> #include <unistd.h> -#include "sd-dhcp-client.h" -#include "sd-event.h" - -#include "alloc-util.h" -#include "dhcp-identifier.h" -#include "dhcp-internal.h" -#include "dhcp-protocol.h" -#include "fd-util.h" -#include "util.h" +#include <systemd/sd-event.h> + +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/dhcp-identifier.h" +#include "systemd-network/dhcp-internal.h" +#include "systemd-network/dhcp-protocol.h" +#include "systemd-network/sd-dhcp-client.h" static uint8_t mac_addr[] = {'A', 'B', 'C', '1', '2', '3'}; diff --git a/src/libsystemd-network/test-dhcp-option.c b/src/libsystemd-network/test/test-dhcp-option.c index d84859c053..2dfbb557c0 100644 --- a/src/libsystemd-network/test-dhcp-option.c +++ b/src/libsystemd-network/test/test-dhcp-option.c @@ -3,11 +3,11 @@ #include <stdio.h> #include <string.h> -#include "alloc-util.h" -#include "dhcp-internal.h" -#include "dhcp-protocol.h" -#include "macro.h" -#include "util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/macro.h" +#include "systemd-basic/util.h" +#include "systemd-network/dhcp-internal.h" +#include "systemd-network/dhcp-protocol.h" struct option_desc { uint8_t sname[64]; diff --git a/src/libsystemd-network/test-dhcp-server.c b/src/libsystemd-network/test/test-dhcp-server.c index e81c508c7f..0796a98707 100644 --- a/src/libsystemd-network/test-dhcp-server.c +++ b/src/libsystemd-network/test/test-dhcp-server.c @@ -20,10 +20,10 @@ #include <errno.h> -#include "sd-dhcp-server.h" -#include "sd-event.h" +#include <systemd/sd-event.h> -#include "dhcp-server-internal.h" +#include "systemd-network/dhcp-server-internal.h" +#include "systemd-network/sd-dhcp-server.h" static void test_pool(struct in_addr *address, unsigned size, int ret) { _cleanup_(sd_dhcp_server_unrefp) sd_dhcp_server *server = NULL; diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test/test-dhcp6-client.c index bd289fa802..84bb9f9013 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test/test-dhcp6-client.c @@ -24,16 +24,16 @@ #include <sys/types.h> #include <unistd.h> -#include "sd-dhcp6-client.h" -#include "sd-event.h" - -#include "dhcp6-internal.h" -#include "dhcp6-lease-internal.h" -#include "dhcp6-protocol.h" -#include "fd-util.h" -#include "macro.h" -#include "socket-util.h" -#include "virt.h" +#include <systemd/sd-event.h> + +#include "systemd-basic/fd-util.h" +#include "systemd-basic/macro.h" +#include "systemd-basic/socket-util.h" +#include "systemd-basic/virt.h" +#include "systemd-network/dhcp6-internal.h" +#include "systemd-network/dhcp6-lease-internal.h" +#include "systemd-network/dhcp6-protocol.h" +#include "systemd-network/sd-dhcp6-client.h" static struct ether_addr mac_addr = { .ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'} diff --git a/src/libsystemd-network/test-ipv4ll-manual.c b/src/libsystemd-network/test/test-ipv4ll-manual.c index 2b1387fa91..f67a8fe16c 100644 --- a/src/libsystemd-network/test-ipv4ll-manual.c +++ b/src/libsystemd-network/test/test-ipv4ll-manual.c @@ -21,18 +21,19 @@ #include <net/if.h> #include <stdlib.h> #include <unistd.h> + #include <linux/veth.h> -#include "sd-event.h" -#include "sd-ipv4ll.h" -#include "sd-netlink.h" +#include <systemd/sd-event.h> -#include "alloc-util.h" -#include "in-addr-util.h" -#include "netlink-util.h" -#include "parse-util.h" -#include "string-util.h" -#include "util.h" +#include "sd-netlink/netlink-util.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/in-addr-util.h" +#include "systemd-basic/parse-util.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/sd-ipv4ll.h" +#include "systemd-staging/sd-netlink.h" static void ll_handler(sd_ipv4ll *ll, int event, void *userdata) { _cleanup_free_ char *address = NULL; diff --git a/src/libsystemd-network/test-ipv4ll.c b/src/libsystemd-network/test/test-ipv4ll.c index fe70697075..58912a1bf5 100644 --- a/src/libsystemd-network/test-ipv4ll.c +++ b/src/libsystemd-network/test/test-ipv4ll.c @@ -25,12 +25,11 @@ #include <sys/types.h> #include <unistd.h> -#include "sd-ipv4ll.h" - -#include "arp-util.h" -#include "fd-util.h" -#include "socket-util.h" -#include "util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/socket-util.h" +#include "systemd-basic/util.h" +#include "systemd-network/arp-util.h" +#include "systemd-network/sd-ipv4ll.h" static bool verbose = false; static bool extended = false; diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test/test-lldp.c index 6bcd65de0a..27b6711916 100644 --- a/src/libsystemd-network/test-lldp.c +++ b/src/libsystemd-network/test/test-lldp.c @@ -24,14 +24,14 @@ #include <string.h> #include <unistd.h> -#include "sd-event.h" -#include "sd-lldp.h" - -#include "alloc-util.h" -#include "fd-util.h" -#include "lldp-network.h" -#include "macro.h" -#include "string-util.h" +#include <systemd/sd-event.h> + +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/fd-util.h" +#include "systemd-basic/macro.h" +#include "systemd-basic/string-util.h" +#include "systemd-network/lldp-network.h" +#include "systemd-network/sd-lldp.h" #define TEST_LLDP_PORT "em1" #define TEST_LLDP_TYPE_SYSTEM_NAME "systemd-lldp" diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test/test-ndisc-rs.c index d9669488be..eb2dad5ab8 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test/test-ndisc-rs.c @@ -17,16 +17,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <netinet/icmp6.h> #include <arpa/inet.h> +#include <netinet/icmp6.h> -#include "sd-ndisc.h" - -#include "alloc-util.h" -#include "hexdecoct.h" -#include "icmp6-util.h" -#include "socket-util.h" -#include "strv.h" +#include "systemd-basic/alloc-util.h" +#include "systemd-basic/hexdecoct.h" +#include "systemd-basic/socket-util.h" +#include "systemd-basic/strv.h" +#include "systemd-network/icmp6-util.h" +#include "systemd-network/sd-ndisc.h" static struct ether_addr mac_addr = { .ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'} |