diff mbox series

netfilter: add include guard to xt_connlabel.h

Message ID 20190728155138.29803-1-yamada.masahiro@socionext.com
State Accepted
Commit 91826ba13855f73e252fef68369b3b0e1ed25253
Headers show
Series netfilter: add include guard to xt_connlabel.h | expand

Commit Message

Masahiro Yamada July 28, 2019, 3:51 p.m. UTC
Add a header include guard just in case.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 include/uapi/linux/netfilter/xt_connlabel.h | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.17.1

Comments

Florian Westphal July 29, 2019, 12:08 a.m. UTC | #1
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Add a header include guard just in case.


Acked-by: Florian Westphal <fw@strlen.de>
Pablo Neira Ayuso July 29, 2019, 1:15 p.m. UTC | #2
On Mon, Jul 29, 2019 at 12:51:38AM +0900, Masahiro Yamada wrote:
> Add a header include guard just in case.


Applied to nf.git, thanks.

BTW, is the _UAPI_ prefix really needed? I can see netfilter headers
under include/uapi/ sometimes are prefixed by UAPI and sometimes not.

Thanks.
Masahiro Yamada July 29, 2019, 2:07 p.m. UTC | #3
On Mon, Jul 29, 2019 at 10:15 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>

> On Mon, Jul 29, 2019 at 12:51:38AM +0900, Masahiro Yamada wrote:

> > Add a header include guard just in case.

>

> Applied to nf.git, thanks.

>

> BTW, is the _UAPI_ prefix really needed? I can see netfilter headers

> under include/uapi/ sometimes are prefixed by UAPI and sometimes not.



The _UAPI prefix will be useful when you happen to
add the corresponding kernel-space header
since it is often the case to have the same name headers
for kernel-space and uapi.



For example, compare the include guards of the following.

include/linux/kernel.h
include/uapi/linux/kernel.h


Or, if you want to see an example for netfilter,

include/linux/netfilter/xt_hashlimit.h
include/uapi/linux/netfilter/xt_hashlimit.h



I recommend to add _UAPI prefix to headers
under include/uapi/
to avoid include guard conflict.

The _UAPI prefix is ripped off by
scripts/headers_install.sh
when exported to user-space.



-- 
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/include/uapi/linux/netfilter/xt_connlabel.h b/include/uapi/linux/netfilter/xt_connlabel.h
index 2312f0ec07b2..323f0dfc2a4e 100644
--- a/include/uapi/linux/netfilter/xt_connlabel.h
+++ b/include/uapi/linux/netfilter/xt_connlabel.h
@@ -1,4 +1,8 @@ 
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+
+#ifndef _UAPI_XT_CONNLABEL_H
+#define _UAPI_XT_CONNLABEL_H
+
 #include <linux/types.h>
 
 #define XT_CONNLABEL_MAXBIT 127
@@ -11,3 +15,5 @@  struct xt_connlabel_mtinfo {
 	__u16 bit;
 	__u16 options;
 };
+
+#endif /* _UAPI_XT_CONNLABEL_H */