]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp: introduce dhcp-forward.h 42256/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 21 May 2026 22:34:37 +0000 (07:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 22 May 2026 14:06:54 +0000 (23:06 +0900)
Then, rework header inclusions for DHCP related files.

32 files changed:
src/libsystemd-network/dhcp-client-id-internal.h
src/libsystemd-network/dhcp-client-internal.h
src/libsystemd-network/dhcp-client-send.h
src/libsystemd-network/dhcp-duid-internal.h
src/libsystemd-network/dhcp-forward.h [new file with mode: 0644]
src/libsystemd-network/dhcp-lease-internal.h
src/libsystemd-network/dhcp-message-dump.c
src/libsystemd-network/dhcp-message-dump.h
src/libsystemd-network/dhcp-message.c
src/libsystemd-network/dhcp-message.h
src/libsystemd-network/dhcp-protocol.h
src/libsystemd-network/dhcp-relay-downstream.c
src/libsystemd-network/dhcp-relay-internal.h
src/libsystemd-network/dhcp-relay-upstream.c
src/libsystemd-network/dhcp-route.c
src/libsystemd-network/dhcp-route.h
src/libsystemd-network/dhcp-server-internal.h
src/libsystemd-network/dhcp-server-lease-internal.h
src/libsystemd-network/dhcp-server-request.h
src/libsystemd-network/dhcp-server-send.c
src/libsystemd-network/dhcp-server-send.h
src/libsystemd-network/sd-dhcp-client.c
src/libsystemd-network/sd-dhcp-lease.c
src/libsystemd-network/sd-dhcp-relay.c
src/libsystemd-network/sd-dhcp-server-lease.c
src/libsystemd-network/test-dhcp-client.c
src/libsystemd-network/test-dhcp-message.c
src/libsystemd-network/test-dhcp-relay.c
src/libsystemd/sd-common/sd-forward.h
src/network/networkd-dhcp-server-bus.c
src/network/networkd-forward.h
src/network/networkd-json.c

index 8efc007a3d4a80e88539a3f50a72a49ef0e46907..47cc3cf80401287b7460a40057abec82edcc39af 100644 (file)
@@ -1,13 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <linux/if_ether.h>
-
 #include "sd-dhcp-client-id.h"
 
 #include "dhcp-duid-internal.h"
-#include "sd-forward.h"
-#include "sparse-endian.h"
+#include "dhcp-forward.h"
+#include "ether-addr-util.h"
 
 /* RFC 2132 section 9.14: its minimum length is 2.
  * Note, its maximum is not mentioend in the RFC. Hence, 255. */
index 4adaeeec220813c27bbfa40bccf1c5544aa6cec5..53f4287868379b560855d231105482a589a15f8a 100644 (file)
@@ -4,13 +4,11 @@
 #include "sd-dhcp-client.h"
 
 #include "dhcp-client-id-internal.h"
+#include "dhcp-forward.h"
 #include "dhcp-protocol.h"
 #include "ether-addr-util.h"
 #include "iovec-wrapper.h"
 #include "network-common.h"
-#include "sd-forward.h"
-#include "socket-util.h"
-#include "tlv-util.h"
 
 struct sd_dhcp_client {
         unsigned n_ref;
index d5d65a31cce505e7105ff7dec24616dd8af6b1be..758b987727829263080ec2242af35ad9391276ca 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-forward.h"
+#include "dhcp-forward.h"
 
 int dhcp_client_send_message(sd_dhcp_client *client, uint8_t type);
index eca98892791d222ef2ba17e07a89694cbb2b18bd..bcb46c4f355adfd07e5b97f761999117df20aa01 100644 (file)
@@ -4,9 +4,8 @@
 #include "sd-dhcp-duid.h"
 #include "sd-id128.h"
 
+#include "dhcp-forward.h"
 #include "ether-addr-util.h"
-#include "sd-forward.h"
-#include "sparse-endian.h"
 
 #define SYSTEMD_PEN    43793
 
diff --git a/src/libsystemd-network/dhcp-forward.h b/src/libsystemd-network/dhcp-forward.h
new file mode 100644 (file)
index 0000000..f83c58a
--- /dev/null
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "sd-forward.h"
+#include "sparse-endian.h"
+
+struct in_pktinfo;
+struct iphdr;
+struct udphdr;
+
+typedef struct sd_dhcp_client sd_dhcp_client;
+typedef struct sd_dhcp_client_id sd_dhcp_client_id;
+typedef struct sd_dhcp_duid sd_dhcp_duid;
+typedef struct sd_dhcp_lease sd_dhcp_lease;
+typedef struct sd_dhcp_message sd_dhcp_message;
+typedef struct sd_dhcp_relay sd_dhcp_relay;
+typedef struct sd_dhcp_relay_interface sd_dhcp_relay_interface;
+typedef struct sd_dhcp_route sd_dhcp_route;
+typedef struct sd_dhcp_server sd_dhcp_server;
+typedef struct sd_dhcp_server_lease sd_dhcp_server_lease;
+
+typedef struct DHCPMessageHeader DHCPMessageHeader;
+typedef struct DHCPRequest DHCPRequest;
+typedef struct DHCPServerData DHCPServerData;
+
+typedef struct TLV TLV;
index 153ae833b3a9974eaea150ab11254d180d9ef5a8..12711a5846ad3c920fdb78dec8b2f82849693351 100644 (file)
@@ -5,11 +5,13 @@
   Copyright © 2013 Intel Corporation. All rights reserved.
 ***/
 
+#include <netinet/in.h>
+
 #include "sd-dhcp-lease.h"
-#include "sd-forward.h"
 
-#include "dhcp-client-id-internal.h"
+#include "dhcp-forward.h"
 #include "dhcp-message.h"
+#include "time-util.h"
 
 struct sd_dhcp_lease {
         unsigned n_ref;
index 3c9283351a31e88805676d81ff7b8393f2439107..a593c86d451e11304d021543bfb7cf6c1e4335fd 100644 (file)
@@ -3,8 +3,8 @@
 #include "alloc-util.h"
 #include "ansi-color.h"
 #include "arphrd-util.h"
+#include "dhcp-message.h"
 #include "dhcp-message-dump.h"
-#include "dhcp-protocol.h"
 #include "dhcp-route.h"
 #include "dns-resolver-internal.h"
 #include "escape.h"
index 6ebd5a2c4654caab6d810f163d087c3823a1125e..34eb261f1bbbb682d4bd08a930d35e35f9170b0c 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "dhcp-message.h"
+#include "dhcp-forward.h"
 
 typedef enum {
         DUMP_DHCP_MESSAGE_LEGEND = 1 << 0,
index 14671a07508259d6d02d3b17edcdfd3bc7051bb8..732a52c08b5b5f5f0136a6760a36e9d75b571e16 100644 (file)
@@ -5,7 +5,6 @@
 #include "alloc-util.h"
 #include "dhcp-client-id-internal.h"
 #include "dhcp-message.h"
-#include "dhcp-protocol.h"
 #include "dhcp-route.h"
 #include "dns-def.h"
 #include "dns-domain.h"
index 752ad814d4251742de536101a108f9add99aa300..2e3bf7dbac7a3be4afe3588e813f3fe348cf7c69 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-dhcp-client-id.h"
-#include "sd-forward.h"
-
+#include "dhcp-forward.h"
 #include "dhcp-protocol.h"
 #include "tlv-util.h"
 
index de84671d0d8943044c8220956316d0e427db0d7f..c366cf2202a98c9c94c500cfeab1991047695d8a 100644 (file)
@@ -7,8 +7,7 @@
 
 #include "sd-dhcp-protocol.h"  /* IWYU pragma: export */
 
-#include "sd-forward.h"
-#include "sparse-endian.h"
+#include "dhcp-forward.h"
 #include "time-util.h"
 
 /* RFC 8925 - IPv6-Only Preferred Option for DHCPv4 3.4.
index dd825d02a21fba04fab74ae7738720188c2dd5fc..5c3311d979aa05709d3a6c0aabc114e3a745d811 100644 (file)
@@ -5,7 +5,6 @@
 #include "sd-event.h"
 
 #include "dhcp-message.h"
-#include "dhcp-protocol.h"
 #include "dhcp-relay-internal.h"
 #include "errno-util.h"
 #include "ether-addr-util.h"
index feb08a606cfdfcfdb91744c072472959a97be185..baa6ecab06cae91276602af2e36da92479a2c171 100644 (file)
@@ -1,13 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include <netinet/in.h>
+#include <sys/uio.h>
+
 #include "sd-dhcp-relay.h"
 
-#include "dhcp-message.h"
-#include "ether-addr-util.h"
+#include "dhcp-forward.h"
 #include "network-common.h"
-#include "sd-forward.h"
-#include "tlv-util.h"
 
 #define DHCP_RELAY_IFINDEX_UNBOUND (-100)
 
index f1b4189153b39b0cb9b34050b3aba59c9c31d9fd..fa3dbc02573e49589144351829879119b8224e36 100644 (file)
@@ -5,7 +5,6 @@
 #include "sd-event.h"
 
 #include "dhcp-message.h"
-#include "dhcp-protocol.h"
 #include "dhcp-relay-internal.h"
 #include "hashmap.h"
 #include "in-addr-util.h"
index 33828276ace433b9fdca1e855ad317aef16ddcda..6a7f9d7da9ad1d79dfa02896d4d7177544214dde 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "sd-dhcp-lease.h"
 
-#include "dhcp-route.h"  /* IWYU pragma: keep */
+#include "dhcp-route.h"
 
 int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *ret) {
         assert_return(route, -EINVAL);
index e313c08a586ba5b6fde8a3313ff9c30b3610a04b..9d2b0b4a00346fa2e828cfeb904bf701df086de3 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-forward.h"
+#include <netinet/in.h>
 
-#include "in-addr-util.h"  /* IWYU pragma: keep */
+#include "dhcp-forward.h"   /* IWYU pragma: export */
 
 struct sd_dhcp_route {
         struct in_addr dst_addr;
index f55223ba22a7fe4041fc99f32286d8e6c1dc150a..f2d85b6e6c0ee798da4f2c30cf4b1598e3ddf5ea 100644 (file)
@@ -5,13 +5,13 @@
   Copyright © 2013 Intel Corporation. All rights reserved.
 ***/
 
+#include <netinet/in.h>
+
 #include "sd-dhcp-server.h"
 
+#include "dhcp-forward.h"
 #include "dhcp-message.h"
 #include "network-common.h"
-#include "sd-forward.h"
-#include "sparse-endian.h"
-#include "tlv-util.h"
 
 typedef struct sd_dhcp_server {
         unsigned n_ref;
index f347837bd847e7432052f97c261c0b2d3468409d..76b92c6339f8af532cd9e23ed133ffb77f762a53 100644 (file)
@@ -4,10 +4,8 @@
 #include "sd-dhcp-server-lease.h"
 
 #include "dhcp-client-id-internal.h"
-#include "dhcp-server-internal.h"
-#include "dhcp-server-request.h"
+#include "dhcp-forward.h"
 #include "ether-addr-util.h"
-#include "sd-forward.h"
 
 typedef struct sd_dhcp_server_lease {
         unsigned n_ref;
index ea7596d0731e1f586db71d72000d3ed174b1ba48..ad77a0250ca9b744a1fceae60c5b6d3630612b7e 100644 (file)
@@ -1,13 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-dhcp-server-lease.h"
-
 #include "dhcp-client-id-internal.h"
-#include "dhcp-message.h"
+#include "dhcp-forward.h"
 #include "ether-addr-util.h"
-#include "sd-forward.h"
-#include "sparse-endian.h"
 #include "time-util.h"
 
 typedef struct DHCPRequest {
index cc0f9d667b010e38aeaa2df30a7f0a5f3d8a7a00..6e00bafd098a8e7e9edda6bd187375a98464b2db 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "dhcp-server-internal.h"
 #include "dhcp-server-lease-internal.h"
+#include "dhcp-server-request.h"
 #include "dhcp-server-send.h"
 #include "errno-util.h"
 #include "fd-util.h"
index 2dde23b2c2c315db1a353f10bb48ddffb199c124..92f63bcc869fdf85fff62f02e3998609f6ea79dc 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-forward.h"
-
-#include "dhcp-server-request.h"
+#include "dhcp-forward.h"
 
 int dhcp_server_send_reply(
                 sd_dhcp_server *server,
index 5675c7d78755be91724ad8b2dc71f7840ab14d5e..8154aef00d4d55edde0f20f8ddff759c743e99dc 100644 (file)
@@ -26,6 +26,7 @@
 #include "socket-util.h"
 #include "string-util.h"
 #include "time-util.h"
+#include "tlv-util.h"
 #include "web-util.h"
 
 #define MAX_MAC_ADDR_LEN CONST_MAX(INFINIBAND_ALEN, ETH_ALEN)
index e661ac4fa815cc6475272d874e85d87340ccf1f7..2799275d3052f79107e6bc8137a7d76f726b4195 100644 (file)
@@ -10,7 +10,7 @@
 #include "alloc-util.h"
 #include "dhcp-client-internal.h"
 #include "dhcp-lease-internal.h"
-#include "dhcp-route.h"  /* IWYU pragma: keep */
+#include "dhcp-route.h"
 #include "dns-resolver-internal.h"
 #include "in-addr-util.h"
 #include "ip-util.h"
index 1442a43fda7d2ef6532195dfa4eaf42a4c53d3a1..9188fd5958afea47919fbf3ef2691cd1b046b6dd 100644 (file)
@@ -9,6 +9,7 @@
 #include "in-addr-util.h"
 #include "iovec-util.h"
 #include "prioq.h"
+#include "tlv-util.h"
 
 static sd_dhcp_relay* dhcp_relay_free(sd_dhcp_relay *relay) {
         if (!relay)
index ce7d4f93a1c7dbac671aedfc05f0aca06aca4a01..f170056046edaeac71c9067a292cbc8f7685e646 100644 (file)
@@ -6,7 +6,9 @@
 #include "sd-event.h"
 
 #include "alloc-util.h"
+#include "dhcp-server-internal.h"
 #include "dhcp-server-lease-internal.h"
+#include "dhcp-server-request.h"
 #include "dns-domain.h"
 #include "errno-util.h"
 #include "fd-util.h"
index 2098470becbcd247b2a952f6388f1f75b7796a95..9eeb102b64a231bf0e3a291ea155fedfa72680d9 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "dhcp-client-internal.h"
 #include "dhcp-message.h"
-#include "dhcp-protocol.h"
 #include "ether-addr-util.h"
 #include "fd-util.h"
 #include "hashmap.h"
@@ -24,6 +23,7 @@
 #include "ip-util.h"
 #include "log.h"
 #include "set.h"
+#include "socket-util.h"
 #include "strv.h"
 #include "tests.h"
 
index 69e1201b695126c32b0368838dfbb890cfbee03d..9975a4820a8f9812adcb65198f72cf5fe4e5e0f1 100644 (file)
@@ -8,7 +8,6 @@
 #include "dhcp-client-id-internal.h"
 #include "dhcp-message.h"
 #include "dhcp-message-dump.h"
-#include "dhcp-protocol.h"
 #include "dhcp-route.h"
 #include "dns-packet.h"
 #include "dns-resolver-internal.h"
index dd4e7652d9f06b096f78243a47bd4f0f5764f080..2a7131e59b5a2504fc38f7f43a241fb41c2ae548 100644 (file)
@@ -5,8 +5,8 @@
 
 #include "sd-event.h"
 
-#include "dhcp-protocol.h"
-#include "dhcp-relay-internal.h"  /* IWYU pragma: keep */
+#include "dhcp-message.h"
+#include "dhcp-relay-internal.h"
 #include "ether-addr-util.h"
 #include "fd-util.h"
 #include "hashmap.h"
index 0a1d673e140737944bf93434470065b32aa4c6a9..aca0ed32095f744c5eebdb9740765f3df45895f2 100644 (file)
@@ -76,12 +76,6 @@ typedef enum sd_lldp_multicast_mode_t sd_lldp_multicast_mode_t;
 typedef enum sd_ndisc_event_t sd_ndisc_event_t;
 
 typedef struct sd_ipv4ll sd_ipv4ll;
-typedef struct sd_dhcp_client sd_dhcp_client;
-typedef struct sd_dhcp_lease sd_dhcp_lease;
-typedef struct sd_dhcp_route sd_dhcp_route;
-typedef struct sd_dhcp_relay sd_dhcp_relay;
-typedef struct sd_dhcp_relay_interface sd_dhcp_relay_interface;
-typedef struct sd_dhcp_server sd_dhcp_server;
 typedef struct sd_dns_resolver sd_dns_resolver;
 typedef struct sd_ndisc sd_ndisc;
 typedef struct sd_radv sd_radv;
index d5829b6dfbb3f84f07bc50c2bc92cbc05b011f25..40679c288bfb25461e75250b165384efa849d8a5 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "alloc-util.h"
 #include "bus-object.h"
+#include "dhcp-server-internal.h"
 #include "dhcp-server-lease-internal.h"
 #include "hashmap.h"
 #include "networkd-dhcp-server-bus.h"
index 95bd46801e320cb9b14cb6e3b304d17297a64303..40e6380b915635b422353d2cdc9cd67ef65c91b5 100644 (file)
@@ -4,6 +4,7 @@
 /* IWYU pragma: always_keep */
 
 #include "conf-parser-forward.h"    /* IWYU pragma: export */
+#include "dhcp-forward.h"           /* IWYU pragma: export */
 #include "shared-forward.h"         /* IWYU pragma: export */
 
 typedef enum NetDevLocalAddressType NetDevLocalAddressType;
index dcf74d4b8b0a09e77be1284ff5373173f81005de..137653bd66754c6aed3337dcce9e420cc355e1be 100644 (file)
@@ -7,6 +7,7 @@
 #include "sd-dhcp6-client.h"
 
 #include "dhcp-lease-internal.h"         /* IWYU pragma: keep */
+#include "dhcp-server-internal.h"
 #include "dhcp-server-lease-internal.h"
 #include "dhcp6-lease-internal.h"
 #include "extract-word.h"