diff mbox series

[1/6] netfilter: ipset: include linux/nf_inet_addr.h

Message ID 20220629211902.3045703-2-vpai@akamai.com
State Changes Requested
Delegated to: Jozsef Kadlecsik
Headers show
Series netfilter: ipset: Add support for new bitmask parameter | expand

Commit Message

Vishwanath Pai June 29, 2022, 9:18 p.m. UTC
We redefined a few things from nf_inet_addr.h, this will prevent others
from including nf_inet_addr.h and ipset headers in the same file.

Remove the duplicate definitions and include nf_inet_addr.h instead.

Signed-off-by: Vishwanath Pai <vpai@akamai.com>
Signed-off-by: Joshua Hunt <johunt@akamai.com>
---
 include/libipset/nf_inet_addr.h |  9 +--------
 include/libipset/nfproto.h      | 15 +--------------
 2 files changed, 2 insertions(+), 22 deletions(-)

Comments

Jozsef Kadlecsik July 12, 2022, 10:48 p.m. UTC | #1
Hi,

On Wed, 29 Jun 2022, Vishwanath Pai wrote:

> We redefined a few things from nf_inet_addr.h, this will prevent others
> from including nf_inet_addr.h and ipset headers in the same file.
> 
> Remove the duplicate definitions and include nf_inet_addr.h instead.

Please don't do that or add the required compatibility stuff into 
configure.ac and ip_set_compat.h.in in order not to break support for 
older kernels.

Best regards,
Jozsef
 
> Signed-off-by: Vishwanath Pai <vpai@akamai.com>
> Signed-off-by: Joshua Hunt <johunt@akamai.com>
> ---
>  include/libipset/nf_inet_addr.h |  9 +--------
>  include/libipset/nfproto.h      | 15 +--------------
>  2 files changed, 2 insertions(+), 22 deletions(-)
> 
> diff --git a/include/libipset/nf_inet_addr.h b/include/libipset/nf_inet_addr.h
> index f3bdf01..e1e058c 100644
> --- a/include/libipset/nf_inet_addr.h
> +++ b/include/libipset/nf_inet_addr.h
> @@ -10,13 +10,6 @@
>  #include <stdint.h>				/* uint32_t */
>  #include <netinet/in.h>				/* struct in[6]_addr */
>  
> -/* The structure to hold IP addresses, same as in linux/netfilter.h */
> -union nf_inet_addr {
> -	uint32_t	all[4];
> -	uint32_t	ip;
> -	uint32_t	ip6[4];
> -	struct in_addr	in;
> -	struct in6_addr in6;
> -};
> +#include <linux/netfilter.h>
>  
>  #endif /* LIBIPSET_NF_INET_ADDR_H */
> diff --git a/include/libipset/nfproto.h b/include/libipset/nfproto.h
> index 800da11..5265176 100644
> --- a/include/libipset/nfproto.h
> +++ b/include/libipset/nfproto.h
> @@ -1,19 +1,6 @@
>  #ifndef LIBIPSET_NFPROTO_H
>  #define LIBIPSET_NFPROTO_H
>  
> -/*
> - * The constants to select, same as in linux/netfilter.h.
> - * Like nf_inet_addr.h, this is just here so that we need not to rely on
> - * the presence of a recent-enough netfilter.h.
> - */
> -enum {
> -	NFPROTO_UNSPEC =  0,
> -	NFPROTO_IPV4   =  2,
> -	NFPROTO_ARP    =  3,
> -	NFPROTO_BRIDGE =  7,
> -	NFPROTO_IPV6   = 10,
> -	NFPROTO_DECNET = 12,
> -	NFPROTO_NUMPROTO,
> -};
> +#include <linux/netfilter.h>
>  
>  #endif /* LIBIPSET_NFPROTO_H */
> -- 
> 2.25.1
> 
> 

-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.hu
PGP key : https://wigner.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics
          H-1525 Budapest 114, POB. 49, Hungary
Vishwanath Pai July 13, 2022, 8:52 p.m. UTC | #2
On 7/12/22 18:48, Jozsef Kadlecsik wrote:
> Hi,
> 
> On Wed, 29 Jun 2022, Vishwanath Pai wrote:
> 
>> We redefined a few things from nf_inet_addr.h, this will prevent others
>> from including nf_inet_addr.h and ipset headers in the same file.
>>
>> Remove the duplicate definitions and include nf_inet_addr.h instead.
> 
> Please don't do that or add the required compatibility stuff into 
> configure.ac and ip_set_compat.h.in in order not to break support for 
> older kernels.
> 
> Best regards,
> Jozsef
>  
>> Signed-off-by: Vishwanath Pai <vpai@akamai.com>
>> Signed-off-by: Joshua Hunt <johunt@akamai.com>
>> ---
>>  include/libipset/nf_inet_addr.h |  9 +--------
>>  include/libipset/nfproto.h      | 15 +--------------
>>  2 files changed, 2 insertions(+), 22 deletions(-)
>>
>> diff --git a/include/libipset/nf_inet_addr.h b/include/libipset/nf_inet_addr.h
>> index f3bdf01..e1e058c 100644
>> --- a/include/libipset/nf_inet_addr.h
>> +++ b/include/libipset/nf_inet_addr.h
>> @@ -10,13 +10,6 @@
>>  #include <stdint.h>				/* uint32_t */
>>  #include <netinet/in.h>				/* struct in[6]_addr */
>>  
>> -/* The structure to hold IP addresses, same as in linux/netfilter.h */
>> -union nf_inet_addr {
>> -	uint32_t	all[4];
>> -	uint32_t	ip;
>> -	uint32_t	ip6[4];
>> -	struct in_addr	in;
>> -	struct in6_addr in6;
>> -};
>> +#include <linux/netfilter.h>
>>  
>>  #endif /* LIBIPSET_NF_INET_ADDR_H */
>> diff --git a/include/libipset/nfproto.h b/include/libipset/nfproto.h
>> index 800da11..5265176 100644
>> --- a/include/libipset/nfproto.h
>> +++ b/include/libipset/nfproto.h
>> @@ -1,19 +1,6 @@
>>  #ifndef LIBIPSET_NFPROTO_H
>>  #define LIBIPSET_NFPROTO_H
>>  
>> -/*
>> - * The constants to select, same as in linux/netfilter.h.
>> - * Like nf_inet_addr.h, this is just here so that we need not to rely on
>> - * the presence of a recent-enough netfilter.h.
>> - */
>> -enum {
>> -	NFPROTO_UNSPEC =  0,
>> -	NFPROTO_IPV4   =  2,
>> -	NFPROTO_ARP    =  3,
>> -	NFPROTO_BRIDGE =  7,
>> -	NFPROTO_IPV6   = 10,
>> -	NFPROTO_DECNET = 12,
>> -	NFPROTO_NUMPROTO,
>> -};
>> +#include <linux/netfilter.h>
>>  
>>  #endif /* LIBIPSET_NFPROTO_H */
>> -- 
>> 2.25.1
>>
>>
> 
> -
> E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.hu
> PGP key : https://urldefense.com/v3/__https://wigner.hu/*kadlec/pgp_public_key.txt__;fg!!GjvTz_vk!RpoeCRFI0PWc4oBxSqKNzLH0ay8yDHYgfzLW5sGYtJy4bMW0G8Vd73lAZEOwigOZXdQAS8906hLTeg$ 
> Address : Wigner Research Centre for Physics
>           H-1525 Budapest 114, POB. 49, Hungary

Ah, thanks for pointing that out. I'll take care of this in V2.

Thanks,
Vishwanath
diff mbox series

Patch

diff --git a/include/libipset/nf_inet_addr.h b/include/libipset/nf_inet_addr.h
index f3bdf01..e1e058c 100644
--- a/include/libipset/nf_inet_addr.h
+++ b/include/libipset/nf_inet_addr.h
@@ -10,13 +10,6 @@ 
 #include <stdint.h>				/* uint32_t */
 #include <netinet/in.h>				/* struct in[6]_addr */
 
-/* The structure to hold IP addresses, same as in linux/netfilter.h */
-union nf_inet_addr {
-	uint32_t	all[4];
-	uint32_t	ip;
-	uint32_t	ip6[4];
-	struct in_addr	in;
-	struct in6_addr in6;
-};
+#include <linux/netfilter.h>
 
 #endif /* LIBIPSET_NF_INET_ADDR_H */
diff --git a/include/libipset/nfproto.h b/include/libipset/nfproto.h
index 800da11..5265176 100644
--- a/include/libipset/nfproto.h
+++ b/include/libipset/nfproto.h
@@ -1,19 +1,6 @@ 
 #ifndef LIBIPSET_NFPROTO_H
 #define LIBIPSET_NFPROTO_H
 
-/*
- * The constants to select, same as in linux/netfilter.h.
- * Like nf_inet_addr.h, this is just here so that we need not to rely on
- * the presence of a recent-enough netfilter.h.
- */
-enum {
-	NFPROTO_UNSPEC =  0,
-	NFPROTO_IPV4   =  2,
-	NFPROTO_ARP    =  3,
-	NFPROTO_BRIDGE =  7,
-	NFPROTO_IPV6   = 10,
-	NFPROTO_DECNET = 12,
-	NFPROTO_NUMPROTO,
-};
+#include <linux/netfilter.h>
 
 #endif /* LIBIPSET_NFPROTO_H */