From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: passt.top; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=JnC7/86c; dkim-atps=neutral Received: from mail-yx1-xb14a.google.com (mail-yx1-xb14a.google.com [IPv6:2607:f8b0:4864:20::b14a]) by passt.top (Postfix) with ESMTPS id 707475A004E for ; Mon, 23 Feb 2026 19:11:35 +0100 (CET) Received: by mail-yx1-xb14a.google.com with SMTP id 956f58d0204a3-64c42aa5d66so8023809d50.0 for ; Mon, 23 Feb 2026 10:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771870294; x=1772475094; darn=passt.top; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Tpo33jkqjGVnVmz3Ic/AWjTwbl4tlqYm9phO3X06YwE=; b=JnC7/86c4ccJQdU79y69xcK0IlzUV9zZFAPVmyGclUuk6QaKaRd5Kua5Kgc6e4Z/F0 RsRWAVaDR/e95E05M8a1fDT9EBMDv/DXwLJx6FOJtHsijAQk+HujbPYTIN6E0n316MSV NnuLIklPE5e2ixBLITcWN+iFIffmQ0s130ywCg4SuMvE8Jw0Vtq0mMsFCugU9D8YpYYM rCoiPUNDKkVrxSc+7BBS1bXuYPJQTQLvaBu5h/dbQORVxksQCLYRix7YKNiSTa5FaW31 ipkb+cpjs8RQpntz6n6G7DUyT+CEn+eC9hEv+Qhkazyoa0jdmsCISk8p3LCtKNYAuEMV ywiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771870294; x=1772475094; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Tpo33jkqjGVnVmz3Ic/AWjTwbl4tlqYm9phO3X06YwE=; b=ZIrBp8wegFsvVs5tDSaYpxua/348NJRyLEQlJWNMbf3KF3qhwD54akgB6iYFGsYiej TZGwXF7iYzVKT/g3TzvsXcdk/qhfRVx7wgetaHonL4B+FWSHzTFWjGb4bsO+xRvByEHy JZ84oCjDLddq7OrPWTVIxerA6MeLsmQwlELKQiEOJ/FZIwf8D5ZdtFsjT562lBRsXtd7 6r6SGYJl++W6H9dDy/9EVIqR7RMsH+IJ+mj0eOmWm5Ra8MOsVzlaR4YlaG8QUbGNVFER ayxJzNWY4l05TQghPvVCgbNf2sQhy/LRdrg7Fzm0Mly0i/MYW/XT5+NJpKZUAtn67Oqa RpUw== X-Gm-Message-State: AOJu0YzIQYMpbMxjL2RYI9Z6mYXTTZNImAeZC/tZteXAug9Tk8yGKplv 7gjF6rbN+zz3qg6SIvrtwS/SbwBAczN3xeyFQDmWDhC5ph3EJZNFTYN1zGPWbmU1LcvEV1YP30I S6s9v1Aq+Cw== X-Received: from yxq5.prod.google.com ([2002:a05:690e:d45:b0:64c:9703:a85f]) (user=pefoley job=prod-delivery.src-stubby-dispatcher) by 2002:a05:690e:d59:b0:64a:dcf7:c13d with SMTP id 956f58d0204a3-64c789c78a0mr8507889d50.13.1771870293852; Mon, 23 Feb 2026 10:11:33 -0800 (PST) Date: Mon, 23 Feb 2026 13:11:19 -0500 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.53.0.371.g1d285c8824-goog Message-ID: <20260223181119.179746-1-pefoley@google.com> Subject: [PATCH v2] Add missing includes to headers From: Peter Foley To: sbrivio@redhat.com Content-Type: text/plain; charset="UTF-8" X-MailFrom: 3VZicaQcKCUw3st2zsCu22uzs.q203o667-rs93o667.723@flex--pefoley.bounces.google.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation Message-ID-Hash: LHI37HYDWYRO4TVYUVFBAPZOLAW6XF6L X-Message-ID-Hash: LHI37HYDWYRO4TVYUVFBAPZOLAW6XF6L X-Mailman-Approved-At: Mon, 23 Feb 2026 19:59:25 +0100 CC: passt-dev@passt.top, Peter Foley X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Support build systems like bazel that check that headers are self-contained. Also update includes so that clang-include-cleaner succeeds. Tested with: clang-include-cleaner-19 --extra-arg=-D_GNU_SOURCE --extra-arg=-DPAGE_SIZE=4096 --extra-arg=-DVERSION=\"git\" --extra-arg=-DHAS_GETRANDOM *.h *.c Signed-off-by: Peter Foley --- arp.h | 2 ++ checksum.h | 3 +++ flow.h | 6 ++++++ flow_table.h | 1 + fwd.h | 10 +++++++++- icmp.h | 4 ++++ icmp_flow.h | 2 ++ inany.h | 6 ++++++ iov.h | 3 ++- ip.h | 2 ++ isolation.h | 3 +++ lineread.h | 2 ++ linux_dep.h | 3 +++ log.h | 2 ++ migrate.h | 3 +++ netlink.h | 4 ++++ packet.h | 2 ++ pasta.h | 2 ++ pcap.h | 2 ++ pif.h | 6 ++++++ repair.h | 2 ++ seccomp.sh | 5 +++++ siphash.h | 3 +++ tap.h | 5 +++++ tcp.h | 8 ++++++++ tcp_conn.h | 4 ++++ tcp_internal.h | 5 +++++ tcp_splice.h | 2 ++ udp.h | 5 +++++ udp_flow.h | 6 ++++++ udp_internal.h | 3 +++ udp_vu.h | 2 ++ util.c | 1 + vu_common.h | 6 ++++++ 34 files changed, 123 insertions(+), 2 deletions(-) diff --git a/arp.h b/arp.h index 4862e90..4b1f38b 100644 --- a/arp.h +++ b/arp.h @@ -6,6 +6,8 @@ #ifndef ARP_H #define ARP_H +#include + /** * struct arpmsg - 802.2 ARP IPv4 payload * @sha: Sender hardware address diff --git a/checksum.h b/checksum.h index 683a09b..4e3b098 100644 --- a/checksum.h +++ b/checksum.h @@ -6,6 +6,9 @@ #ifndef CHECKSUM_H #define CHECKSUM_H +#include +#include + struct udphdr; struct icmphdr; struct icmp6hdr; diff --git a/flow.h b/flow.h index d636358..897c9ea 100644 --- a/flow.h +++ b/flow.h @@ -7,6 +7,12 @@ #ifndef FLOW_H #define FLOW_H +#include +#include + +#include "inany.h" +#include "util.h" + #define FLOW_TIMER_INTERVAL 1000 /* ms */ /** diff --git a/flow_table.h b/flow_table.h index 73de13b..8fb7b5c 100644 --- a/flow_table.h +++ b/flow_table.h @@ -7,6 +7,7 @@ #ifndef FLOW_TABLE_H #define FLOW_TABLE_H +#include "pif.h" #include "tcp_conn.h" #include "icmp_flow.h" #include "udp_flow.h" diff --git a/fwd.h b/fwd.h index 1607011..c0b30f3 100644 --- a/fwd.h +++ b/fwd.h @@ -7,7 +7,15 @@ #ifndef FWD_H #define FWD_H -union inany_addr; +#include +#include +#include +#include + +#include + +#include "inany.h" + struct flowside; /* Number of ports for both TCP and UDP */ diff --git a/icmp.h b/icmp.h index 1a0e620..e8b928b 100644 --- a/icmp.h +++ b/icmp.h @@ -6,6 +6,10 @@ #ifndef ICMP_H #define ICMP_H +#include + +#include + struct ctx; struct icmp_ping_flow; diff --git a/icmp_flow.h b/icmp_flow.h index fb93801..3af98be 100644 --- a/icmp_flow.h +++ b/icmp_flow.h @@ -7,6 +7,8 @@ #ifndef ICMP_FLOW_H #define ICMP_FLOW_H +#include "flow.h" + /** * struct icmp_ping_flow - Descriptor for a flow of ping requests/replies * @f: Generic flow information diff --git a/inany.h b/inany.h index b02c289..efbe2e2 100644 --- a/inany.h +++ b/inany.h @@ -9,6 +9,12 @@ #ifndef INANY_H #define INANY_H +#include +#include + +#include "ip.h" +#include "siphash.h" + struct siphash_state; /** union inany_addr - Represents either an IPv4 or IPv6 address diff --git a/iov.h b/iov.h index d2184bf..d1ab91a 100644 --- a/iov.h +++ b/iov.h @@ -15,8 +15,9 @@ #ifndef IOVEC_H #define IOVEC_H -#include +#include #include +#include #define IOV_OF_LVALUE(lval) \ (struct iovec){ .iov_base = &(lval), .iov_len = sizeof(lval) } diff --git a/ip.h b/ip.h index a8043c2..3be2d4e 100644 --- a/ip.h +++ b/ip.h @@ -9,6 +9,8 @@ #include #include +#include "util.h" + #define IN4_IS_ADDR_UNSPECIFIED(a) \ (((struct in_addr *)(a))->s_addr == htonl_constant(INADDR_ANY)) #define IN4_IS_ADDR_BROADCAST(a) \ diff --git a/isolation.h b/isolation.h index 80bb68d..0576168 100644 --- a/isolation.h +++ b/isolation.h @@ -7,6 +7,9 @@ #ifndef ISOLATION_H #define ISOLATION_H +#include +#include + void isolate_initial(int argc, char **argv); void isolate_user(uid_t uid, gid_t gid, bool use_userns, const char *userns, enum passt_modes mode); diff --git a/lineread.h b/lineread.h index 9203e28..ef6a7d4 100644 --- a/lineread.h +++ b/lineread.h @@ -6,6 +6,8 @@ #ifndef LINEREAD_H #define LINEREAD_H +#include + #define LINEREAD_BUFFER_SIZE 8192 /** diff --git a/linux_dep.h b/linux_dep.h index 89e590c..3f8184b 100644 --- a/linux_dep.h +++ b/linux_dep.h @@ -7,6 +7,9 @@ #ifndef LINUX_DEP_H #define LINUX_DEP_H +#include +#include + /* struct tcp_info_linux - Information from Linux TCP_INFO getsockopt() * * Largely derived from include/linux/tcp.h in the Linux kernel diff --git a/log.h b/log.h index b7b2067..6ceb686 100644 --- a/log.h +++ b/log.h @@ -6,7 +6,9 @@ #ifndef LOG_H #define LOG_H +#include #include +#include #include /* This would make more sense in util.h, but because we use it in die(), that diff --git a/migrate.h b/migrate.h index 2c51cd9..844be47 100644 --- a/migrate.h +++ b/migrate.h @@ -6,6 +6,9 @@ #ifndef MIGRATE_H #define MIGRATE_H +#include +#include + /** * struct migrate_header - Migration header from source * @magic: 0xB1BB1D1B0BB1D1B0, network order diff --git a/netlink.h b/netlink.h index 8f1e9b9..b22f485 100644 --- a/netlink.h +++ b/netlink.h @@ -6,6 +6,10 @@ #ifndef NETLINK_H #define NETLINK_H +#include + +#include + extern int nl_sock; extern int nl_sock_ns; diff --git a/packet.h b/packet.h index ba8d5c2..7b7fa71 100644 --- a/packet.h +++ b/packet.h @@ -7,6 +7,8 @@ #define PACKET_H #include +#include + #include "iov.h" #include "virtio.h" diff --git a/pasta.h b/pasta.h index 4b063d1..07e04b3 100644 --- a/pasta.h +++ b/pasta.h @@ -6,6 +6,8 @@ #ifndef PASTA_H #define PASTA_H +#include + extern int pasta_child_pid; void pasta_open_ns(struct ctx *c, const char *netns); diff --git a/pcap.h b/pcap.h index 2aeb53e..dface5d 100644 --- a/pcap.h +++ b/pcap.h @@ -6,6 +6,8 @@ #ifndef PCAP_H #define PCAP_H +#include + extern int pcap_fd; void pcap(const char *pkt, size_t l2len); diff --git a/pif.h b/pif.h index 0f7f667..f4bec1e 100644 --- a/pif.h +++ b/pif.h @@ -7,6 +7,12 @@ #ifndef PIF_H #define PIF_H +#include + +#include + +#include "epoll_type.h" + union inany_addr; union sockaddr_inany; diff --git a/repair.h b/repair.h index ab27e67..f39c237 100644 --- a/repair.h +++ b/repair.h @@ -6,6 +6,8 @@ #ifndef REPAIR_H #define REPAIR_H +#include + void repair_sock_init(const struct ctx *c); int repair_listen_handler(struct ctx *c, uint32_t events); void repair_handler(struct ctx *c, uint32_t events); diff --git a/seccomp.sh b/seccomp.sh index 60ebe84..5347586 100755 --- a/seccomp.sh +++ b/seccomp.sh @@ -34,6 +34,11 @@ AUDIT_ARCH="AUDIT_ARCH_$(echo ${ARCH} | tr '[a-z]' '[A-Z]' \ HEADER="/* This file was automatically generated by $(basename ${0}) */ +#include +#include +#include +#include + #ifndef AUDIT_ARCH_PPC64LE #define AUDIT_ARCH_PPC64LE (AUDIT_ARCH_PPC64 | __AUDIT_ARCH_LE) #endif" diff --git a/siphash.h b/siphash.h index e760236..bbddcac 100644 --- a/siphash.h +++ b/siphash.h @@ -44,6 +44,9 @@ #ifndef SIPHASH_H #define SIPHASH_H +#include +#include + /** * struct siphash_state - Internal state of siphash calculation */ diff --git a/tap.h b/tap.h index cc780d1..07ca096 100644 --- a/tap.h +++ b/tap.h @@ -6,6 +6,11 @@ #ifndef TAP_H #define TAP_H +#include +#include + +#include "passt.h" + /** L2_MAX_LEN_PASTA - Maximum frame length for pasta mode (with L2 header) * * The kernel tuntap device imposes a maximum frame size of 65535 including diff --git a/tcp.h b/tcp.h index 24b9087..bfcadf9 100644 --- a/tcp.h +++ b/tcp.h @@ -6,6 +6,14 @@ #ifndef TCP_H #define TCP_H +#include +#include + +#include +#include + +#include "fwd.h" + #define TCP_TIMER_INTERVAL 1000 /* ms */ struct ctx; diff --git a/tcp_conn.h b/tcp_conn.h index 21cea10..d4d0139 100644 --- a/tcp_conn.h +++ b/tcp_conn.h @@ -9,6 +9,10 @@ #ifndef TCP_CONN_H #define TCP_CONN_H +#include + +#include "flow.h" + /** * struct tcp_tap_conn - Descriptor for a TCP connection (not spliced) * @f: Generic flow information diff --git a/tcp_internal.h b/tcp_internal.h index 518913b..591e58c 100644 --- a/tcp_internal.h +++ b/tcp_internal.h @@ -6,6 +6,11 @@ #ifndef TCP_INTERNAL_H #define TCP_INTERNAL_H +#include +#include + +#include "util.h" + #define MAX_WS 8 #define MAX_WINDOW (1 << (16 + (MAX_WS))) diff --git a/tcp_splice.h b/tcp_splice.h index a20f3e2..dbfd55d 100644 --- a/tcp_splice.h +++ b/tcp_splice.h @@ -6,6 +6,8 @@ #ifndef TCP_SPLICE_H #define TCP_SPLICE_H +#include + struct tcp_splice_conn; union sockaddr_inany; diff --git a/udp.h b/udp.h index da9c2df..0eca1ab 100644 --- a/udp.h +++ b/udp.h @@ -6,6 +6,11 @@ #ifndef UDP_H #define UDP_H +#include +#include + +#include "fwd.h" + void udp_listen_sock_handler(const struct ctx *c, union epoll_ref ref, uint32_t events, const struct timespec *now); void udp_sock_handler(const struct ctx *c, union epoll_ref ref, diff --git a/udp_flow.h b/udp_flow.h index 3ca49c5..62cc9b3 100644 --- a/udp_flow.h +++ b/udp_flow.h @@ -7,6 +7,12 @@ #ifndef UDP_FLOW_H #define UDP_FLOW_H +#include +#include +#include + +#include "flow.h" + /** * struct udp_flow - Descriptor for a flow of UDP packets * @f: Generic flow information diff --git a/udp_internal.h b/udp_internal.h index 0a8fe49..64e4577 100644 --- a/udp_internal.h +++ b/udp_internal.h @@ -6,6 +6,9 @@ #ifndef UDP_INTERNAL_H #define UDP_INTERNAL_H +#include +#include + #include "tap.h" /* needed by udp_meta_t */ /** diff --git a/udp_vu.h b/udp_vu.h index 576b0e7..1e38af3 100644 --- a/udp_vu.h +++ b/udp_vu.h @@ -6,6 +6,8 @@ #ifndef UDP_VU_H #define UDP_VU_H +#include "flow.h" + void udp_vu_listen_sock_data(const struct ctx *c, union epoll_ref ref, const struct timespec *now); void udp_vu_sock_to_tap(const struct ctx *c, int s, int n, flow_sidx_t tosidx); diff --git a/util.c b/util.c index a48f727..db27431 100644 --- a/util.c +++ b/util.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "linux_dep.h" diff --git a/vu_common.h b/vu_common.h index 052aff7..76eee87 100644 --- a/vu_common.h +++ b/vu_common.h @@ -7,8 +7,14 @@ #ifndef VU_COMMON_H #define VU_COMMON_H + +#include + #include +#include "ip.h" +#include "virtio.h" + static inline void *vu_eth(void *base) { return ((char *)base + VNET_HLEN); -- 2.53.0.371.g1d285c8824-goog