Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: relayd: remove unnecessary includes
To:
Rafael Sadowski <rafael@sizeofvoid.org>
Cc:
tech@openbsd.org
Date:
Tue, 19 May 2026 11:51:09 +0200

Download raw body.

Thread
On Tue, May 19, 2026 at 10:56:49AM +0200, Rafael Sadowski wrote:
> OK?

Not sure how you determined these. Generally it's not good to rely on
headers to include other headers since it makes things fragile. Since
relayd.h includes ssl.h, many public headers are "redundant" from there.

The include-what-you-use port helps (but blindly following it also
isn't great).

> diff --git a/usr.sbin/relayd/check_icmp.c b/usr.sbin/relayd/check_icmp.c
> index a8182cd4699..5a737e3795a 100644
> --- a/usr.sbin/relayd/check_icmp.c
> +++ b/usr.sbin/relayd/check_icmp.c
> @@ -32,7 +32,6 @@
>  #include <errno.h>
>  #include <unistd.h>
>  #include <string.h>
> -#include <stdlib.h>

Used for NULL

>  
>  #include "relayd.h"
>  #include "log.h"
> diff --git a/usr.sbin/relayd/check_script.c b/usr.sbin/relayd/check_script.c
> index 6182b071b01..41ef0daf980 100644
> --- a/usr.sbin/relayd/check_script.c
> +++ b/usr.sbin/relayd/check_script.c
> @@ -22,7 +22,6 @@
>  #include <errno.h>
>  #include <unistd.h>
>  #include <string.h>
> -#include <stdlib.h>

ditto

>  #include <signal.h>
>  #include <pwd.h>
>  
> diff --git a/usr.sbin/relayd/config.c b/usr.sbin/relayd/config.c
> index ccf0ef4fa88..b8652d015a3 100644
> --- a/usr.sbin/relayd/config.c
> +++ b/usr.sbin/relayd/config.c
> @@ -24,7 +24,6 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> -#include <limits.h>

IOV_MAX

>  #include <string.h>
>  #include <imsg.h>
>  
> diff --git a/usr.sbin/relayd/pfe_route.c b/usr.sbin/relayd/pfe_route.c
> index 27afb352eef..c6e736ed48c 100644
> --- a/usr.sbin/relayd/pfe_route.c
> +++ b/usr.sbin/relayd/pfe_route.c
> @@ -25,9 +25,7 @@
>  #include <net/route.h>
>  #include <arpa/inet.h>
>  
> -#include <limits.h>

HOSTNAME_MAX

>  #include <stddef.h>
> -#include <stdio.h>

fine

>  #include <unistd.h>
>  #include <string.h>
>  #include <errno.h>
> diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
> index a035f996f0a..d0987121238 100644
> --- a/usr.sbin/relayd/relay.c
> +++ b/usr.sbin/relayd/relay.c
> @@ -26,7 +26,6 @@
>  #include <netinet/tcp.h>
>  #include <arpa/inet.h>
>  
> -#include <limits.h>

fine

>  #include <netdb.h>
>  #include <poll.h>
>  #include <stdio.h>
>