Re: [PATCH net-next] net: add UAPI to the header guard in various network headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 17, 2025 at 4:09 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> fib_rule, ip6_tunnel, and a whole lot of if_* headers lack the customary
> _UAPI in the header guard. Without it YNL build can't protect from in tree
> and system headers both getting included. YNL doesn't need most of these
> but it's annoying to have to fix them one by one.
>
> Note that header installation strips this _UAPI prefix so this should
> result in no change to the end user.
>
> Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>

Reviewed-by: Jason Xing <kerneljasonxing@xxxxxxxxx>

Thanks,
Jason

> ---
> CC: m.grzeschik@xxxxxxxxxxxxxx
> CC: jv@xxxxxxxxxxxxx
> CC: willemdebruijn.kernel@xxxxxxxxx
> CC: magnus.karlsson@xxxxxxxxx
> CC: maciej.fijalkowski@xxxxxxxxx
> CC: nhorman@xxxxxxxxxxxxx
> CC: kernelxing@xxxxxxxxxxx
> CC: jhs@xxxxxxxxxxxx
> CC: xiyou.wangcong@xxxxxxxxx
> CC: jiri@xxxxxxxxxxx
> CC: idosch@xxxxxxxxxx
> CC: gnault@xxxxxxxxxx
> CC: petrm@xxxxxxxxxx
> CC: bpf@xxxxxxxxxxxxxxx
> ---
>  include/uapi/linux/fib_rules.h    | 4 ++--
>  include/uapi/linux/if_addr.h      | 4 ++--
>  include/uapi/linux/if_addrlabel.h | 4 ++--
>  include/uapi/linux/if_alg.h       | 6 +++---
>  include/uapi/linux/if_arcnet.h    | 6 +++---
>  include/uapi/linux/if_bonding.h   | 6 +++---
>  include/uapi/linux/if_fc.h        | 6 +++---
>  include/uapi/linux/if_hippi.h     | 6 +++---
>  include/uapi/linux/if_packet.h    | 4 ++--
>  include/uapi/linux/if_plip.h      | 4 ++--
>  include/uapi/linux/if_slip.h      | 4 ++--
>  include/uapi/linux/if_x25.h       | 6 +++---
>  include/uapi/linux/if_xdp.h       | 6 +++---
>  include/uapi/linux/ip6_tunnel.h   | 4 ++--
>  include/uapi/linux/net_dropmon.h  | 4 ++--
>  include/uapi/linux/net_tstamp.h   | 6 +++---
>  include/uapi/linux/netlink_diag.h | 4 ++--
>  include/uapi/linux/pkt_cls.h      | 4 ++--
>  include/uapi/linux/pkt_sched.h    | 4 ++--
>  19 files changed, 46 insertions(+), 46 deletions(-)
>
> diff --git a/include/uapi/linux/fib_rules.h b/include/uapi/linux/fib_rules.h
> index 2df6e4035d50..418c4be697ad 100644
> --- a/include/uapi/linux/fib_rules.h
> +++ b/include/uapi/linux/fib_rules.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef __LINUX_FIB_RULES_H
> -#define __LINUX_FIB_RULES_H
> +#ifndef _UAPI__LINUX_FIB_RULES_H
> +#define _UAPI__LINUX_FIB_RULES_H
>
>  #include <linux/types.h>
>  #include <linux/rtnetlink.h>
> diff --git a/include/uapi/linux/if_addr.h b/include/uapi/linux/if_addr.h
> index 1c392dd95a5e..aa7958b4e41d 100644
> --- a/include/uapi/linux/if_addr.h
> +++ b/include/uapi/linux/if_addr.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef __LINUX_IF_ADDR_H
> -#define __LINUX_IF_ADDR_H
> +#ifndef _UAPI__LINUX_IF_ADDR_H
> +#define _UAPI__LINUX_IF_ADDR_H
>
>  #include <linux/types.h>
>  #include <linux/netlink.h>
> diff --git a/include/uapi/linux/if_addrlabel.h b/include/uapi/linux/if_addrlabel.h
> index d1f5974c76e1..e69db764fbba 100644
> --- a/include/uapi/linux/if_addrlabel.h
> +++ b/include/uapi/linux/if_addrlabel.h
> @@ -8,8 +8,8 @@
>   *     YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@xxxxxxxxxxxxxx>
>   */
>
> -#ifndef __LINUX_IF_ADDRLABEL_H
> -#define __LINUX_IF_ADDRLABEL_H
> +#ifndef _UAPI__LINUX_IF_ADDRLABEL_H
> +#define _UAPI__LINUX_IF_ADDRLABEL_H
>
>  #include <linux/types.h>
>
> diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h
> index 0824fbc026a1..b35871cbeed7 100644
> --- a/include/uapi/linux/if_alg.h
> +++ b/include/uapi/linux/if_alg.h
> @@ -11,8 +11,8 @@
>   *
>   */
>
> -#ifndef _LINUX_IF_ALG_H
> -#define _LINUX_IF_ALG_H
> +#ifndef _UAPI_LINUX_IF_ALG_H
> +#define _UAPI_LINUX_IF_ALG_H
>
>  #include <linux/types.h>
>
> @@ -58,4 +58,4 @@ struct af_alg_iv {
>  #define ALG_OP_DECRYPT                 0
>  #define ALG_OP_ENCRYPT                 1
>
> -#endif /* _LINUX_IF_ALG_H */
> +#endif /* _UAPI_LINUX_IF_ALG_H */
> diff --git a/include/uapi/linux/if_arcnet.h b/include/uapi/linux/if_arcnet.h
> index b122cfac7128..473569eaf692 100644
> --- a/include/uapi/linux/if_arcnet.h
> +++ b/include/uapi/linux/if_arcnet.h
> @@ -14,8 +14,8 @@
>   *              2 of the License, or (at your option) any later version.
>   */
>
> -#ifndef _LINUX_IF_ARCNET_H
> -#define _LINUX_IF_ARCNET_H
> +#ifndef _UAPI_LINUX_IF_ARCNET_H
> +#define _UAPI_LINUX_IF_ARCNET_H
>
>  #include <linux/types.h>
>  #include <linux/if_ether.h>
> @@ -127,4 +127,4 @@ struct archdr {
>         } soft;
>  };
>
> -#endif                         /* _LINUX_IF_ARCNET_H */
> +#endif                         /* _UAPI_LINUX_IF_ARCNET_H */
> diff --git a/include/uapi/linux/if_bonding.h b/include/uapi/linux/if_bonding.h
> index d174914a837d..3bcc03f3aa4f 100644
> --- a/include/uapi/linux/if_bonding.h
> +++ b/include/uapi/linux/if_bonding.h
> @@ -41,8 +41,8 @@
>   *      - added definitions for various XOR hashing policies
>   */
>
> -#ifndef _LINUX_IF_BONDING_H
> -#define _LINUX_IF_BONDING_H
> +#ifndef _UAPI_LINUX_IF_BONDING_H
> +#define _UAPI_LINUX_IF_BONDING_H
>
>  #include <linux/if.h>
>  #include <linux/types.h>
> @@ -152,4 +152,4 @@ enum {
>  };
>  #define BOND_3AD_STAT_MAX (__BOND_3AD_STAT_MAX - 1)
>
> -#endif /* _LINUX_IF_BONDING_H */
> +#endif /* _UAPI_LINUX_IF_BONDING_H */
> diff --git a/include/uapi/linux/if_fc.h b/include/uapi/linux/if_fc.h
> index 3e3173282cc3..ff5ab92d16c2 100644
> --- a/include/uapi/linux/if_fc.h
> +++ b/include/uapi/linux/if_fc.h
> @@ -18,8 +18,8 @@
>   *             as published by the Free Software Foundation; either version
>   *             2 of the License, or (at your option) any later version.
>   */
> -#ifndef _LINUX_IF_FC_H
> -#define _LINUX_IF_FC_H
> +#ifndef _UAPI_LINUX_IF_FC_H
> +#define _UAPI_LINUX_IF_FC_H
>
>  #include <linux/types.h>
>
> @@ -49,4 +49,4 @@ struct fcllc {
>         __be16 ethertype;               /* ether type field */
>  };
>
> -#endif /* _LINUX_IF_FC_H */
> +#endif /* _UAPI_LINUX_IF_FC_H */
> diff --git a/include/uapi/linux/if_hippi.h b/include/uapi/linux/if_hippi.h
> index 785a1452a66c..42c4ffd11dae 100644
> --- a/include/uapi/linux/if_hippi.h
> +++ b/include/uapi/linux/if_hippi.h
> @@ -20,8 +20,8 @@
>   *             2 of the License, or (at your option) any later version.
>   */
>
> -#ifndef _LINUX_IF_HIPPI_H
> -#define _LINUX_IF_HIPPI_H
> +#ifndef _UAPI_LINUX_IF_HIPPI_H
> +#define _UAPI_LINUX_IF_HIPPI_H
>
>  #include <linux/types.h>
>  #include <asm/byteorder.h>
> @@ -151,4 +151,4 @@ struct hippi_hdr {
>         struct hippi_snap_hdr   snap;
>  } __attribute__((packed));
>
> -#endif /* _LINUX_IF_HIPPI_H */
> +#endif /* _UAPI_LINUX_IF_HIPPI_H */
> diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
> index 1d2718dd9647..6cd1d7a41dfb 100644
> --- a/include/uapi/linux/if_packet.h
> +++ b/include/uapi/linux/if_packet.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef __LINUX_IF_PACKET_H
> -#define __LINUX_IF_PACKET_H
> +#ifndef _UAPI__LINUX_IF_PACKET_H
> +#define _UAPI__LINUX_IF_PACKET_H
>
>  #include <asm/byteorder.h>
>  #include <linux/types.h>
> diff --git a/include/uapi/linux/if_plip.h b/include/uapi/linux/if_plip.h
> index 495a366112f2..054d86a9c6e6 100644
> --- a/include/uapi/linux/if_plip.h
> +++ b/include/uapi/linux/if_plip.h
> @@ -9,8 +9,8 @@
>   *
>   */
>
> -#ifndef _LINUX_IF_PLIP_H
> -#define _LINUX_IF_PLIP_H
> +#ifndef _UAPI_LINUX_IF_PLIP_H
> +#define _UAPI_LINUX_IF_PLIP_H
>
>  #include <linux/sockios.h>
>
> diff --git a/include/uapi/linux/if_slip.h b/include/uapi/linux/if_slip.h
> index 65937be53103..299bf7adc862 100644
> --- a/include/uapi/linux/if_slip.h
> +++ b/include/uapi/linux/if_slip.h
> @@ -6,8 +6,8 @@
>   *     KISS TNC driver.
>   */
>
> -#ifndef __LINUX_SLIP_H
> -#define __LINUX_SLIP_H
> +#ifndef _UAPI__LINUX_SLIP_H
> +#define _UAPI__LINUX_SLIP_H
>
>  #define                SL_MODE_SLIP            0
>  #define                SL_MODE_CSLIP           1
> diff --git a/include/uapi/linux/if_x25.h b/include/uapi/linux/if_x25.h
> index 3a5938e38370..861cfa983db4 100644
> --- a/include/uapi/linux/if_x25.h
> +++ b/include/uapi/linux/if_x25.h
> @@ -13,8 +13,8 @@
>   *  GNU General Public License for more details.
>   */
>
> -#ifndef _IF_X25_H
> -#define _IF_X25_H
> +#ifndef _UAPI_IF_X25_H
> +#define _UAPI_IF_X25_H
>
>  #include <linux/types.h>
>
> @@ -24,4 +24,4 @@
>  #define X25_IFACE_DISCONNECT   0x02
>  #define X25_IFACE_PARAMS       0x03
>
> -#endif /* _IF_X25_H */
> +#endif /* _UAPI_IF_X25_H */
> diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h
> index 42869770776e..44f2bb93e7e6 100644
> --- a/include/uapi/linux/if_xdp.h
> +++ b/include/uapi/linux/if_xdp.h
> @@ -7,8 +7,8 @@
>   *           Magnus Karlsson <magnus.karlsson@xxxxxxxxx>
>   */
>
> -#ifndef _LINUX_IF_XDP_H
> -#define _LINUX_IF_XDP_H
> +#ifndef _UAPI_LINUX_IF_XDP_H
> +#define _UAPI_LINUX_IF_XDP_H
>
>  #include <linux/types.h>
>
> @@ -180,4 +180,4 @@ struct xdp_desc {
>  /* TX packet carries valid metadata. */
>  #define XDP_TX_METADATA (1 << 1)
>
> -#endif /* _LINUX_IF_XDP_H */
> +#endif /* _UAPI_LINUX_IF_XDP_H */
> diff --git a/include/uapi/linux/ip6_tunnel.h b/include/uapi/linux/ip6_tunnel.h
> index 0245269b037c..85182a839d42 100644
> --- a/include/uapi/linux/ip6_tunnel.h
> +++ b/include/uapi/linux/ip6_tunnel.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef _IP6_TUNNEL_H
> -#define _IP6_TUNNEL_H
> +#ifndef _UAPI_IP6_TUNNEL_H
> +#define _UAPI_IP6_TUNNEL_H
>
>  #include <linux/types.h>
>  #include <linux/if.h>          /* For IFNAMSIZ. */
> diff --git a/include/uapi/linux/net_dropmon.h b/include/uapi/linux/net_dropmon.h
> index 84f622a66a7a..9dd41c2f58a6 100644
> --- a/include/uapi/linux/net_dropmon.h
> +++ b/include/uapi/linux/net_dropmon.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef __NET_DROPMON_H
> -#define __NET_DROPMON_H
> +#ifndef _UAPI__NET_DROPMON_H
> +#define _UAPI__NET_DROPMON_H
>
>  #include <linux/types.h>
>  #include <linux/netlink.h>
> diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
> index 383213de612a..a93e6ea37fb3 100644
> --- a/include/uapi/linux/net_tstamp.h
> +++ b/include/uapi/linux/net_tstamp.h
> @@ -7,8 +7,8 @@
>   *
>   */
>
> -#ifndef _NET_TIMESTAMPING_H
> -#define _NET_TIMESTAMPING_H
> +#ifndef _UAPI_NET_TIMESTAMPING_H
> +#define _UAPI_NET_TIMESTAMPING_H
>
>  #include <linux/types.h>
>  #include <linux/socket.h>   /* for SO_TIMESTAMPING */
> @@ -216,4 +216,4 @@ struct sock_txtime {
>         __u32                   flags;  /* as defined by enum txtime_flags */
>  };
>
> -#endif /* _NET_TIMESTAMPING_H */
> +#endif /* _UAPI_NET_TIMESTAMPING_H */
> diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h
> index dfa61be43d2f..ff28200204bb 100644
> --- a/include/uapi/linux/netlink_diag.h
> +++ b/include/uapi/linux/netlink_diag.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef __NETLINK_DIAG_H__
> -#define __NETLINK_DIAG_H__
> +#ifndef _UAPI__NETLINK_DIAG_H__
> +#define _UAPI__NETLINK_DIAG_H__
>
>  #include <linux/types.h>
>
> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
> index 2c32080416b5..490821364165 100644
> --- a/include/uapi/linux/pkt_cls.h
> +++ b/include/uapi/linux/pkt_cls.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef __LINUX_PKT_CLS_H
> -#define __LINUX_PKT_CLS_H
> +#ifndef _UAPI__LINUX_PKT_CLS_H
> +#define _UAPI__LINUX_PKT_CLS_H
>
>  #include <linux/types.h>
>  #include <linux/pkt_sched.h>
> diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
> index 25a9a47001cd..9ea874395717 100644
> --- a/include/uapi/linux/pkt_sched.h
> +++ b/include/uapi/linux/pkt_sched.h
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> -#ifndef __LINUX_PKT_SCHED_H
> -#define __LINUX_PKT_SCHED_H
> +#ifndef _UAPI__LINUX_PKT_SCHED_H
> +#define _UAPI__LINUX_PKT_SCHED_H
>
>  #include <linux/const.h>
>  #include <linux/types.h>
> --
> 2.49.0
>
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux