iptables: update to 1.8.8
[openwrt/staging/aparcar.git] / package / network / utils / iptables / patches / 020-treewide-use-uint-instead-of-u_int.patch
1 From f319389525b066b7dc6d389c88f16a0df3b8f189 Mon Sep 17 00:00:00 2001
2 From: Nick Hainke <vincent@systemli.org>
3 Date: Mon, 16 May 2022 18:16:41 +0200
4 Subject: treewide: use uint* instead of u_int*
5
6 Gcc complains about missing types. Some commits introduced u_int* instead
7 of uint*. Use uint treewide.
8
9 Fixes errors in the form of:
10 In file included from xtables-legacy-multi.c:5:
11 xshared.h:83:56: error: unknown type name 'u_int16_t'; did you mean 'uint16_t'?
12 83 | set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
13 | ^~~~~~~~~
14 | uint16_t
15 make[6]: *** [Makefile:712: xtables_legacy_multi-xtables-legacy-multi.o] Error 1
16
17 Avoid libipq API breakage by adjusting libipq.h include accordingly. For
18 arpt_mangle.h kernel uAPI header, apply same change as in kernel commit
19 e91ded8db5747 ("uapi: netfilter_arp: use __u8 instead of u_int8_t").
20
21 Signed-off-by: Nick Hainke <vincent@systemli.org>
22 Signed-off-by: Phil Sutter <phil@nwl.cc>
23 ---
24 extensions/libxt_conntrack.c | 2 +-
25 include/libipq/libipq.h | 8 ++++----
26 include/libiptc/libxtc.h | 2 +-
27 include/linux/netfilter_arp/arpt_mangle.h | 2 +-
28 iptables/xshared.c | 2 +-
29 iptables/xshared.h | 2 +-
30 libipq/ipq_create_handle.3 | 2 +-
31 libipq/ipq_set_mode.3 | 2 +-
32 8 files changed, 11 insertions(+), 11 deletions(-)
33
34 --- a/extensions/libxt_conntrack.c
35 +++ b/extensions/libxt_conntrack.c
36 @@ -778,7 +778,7 @@ matchinfo_print(const void *ip, const st
37
38 static void
39 conntrack_dump_ports(const char *prefix, const char *opt,
40 - u_int16_t port_low, u_int16_t port_high)
41 + uint16_t port_low, uint16_t port_high)
42 {
43 if (port_high == 0 || port_low == port_high)
44 printf(" %s%s %u", prefix, opt, port_low);
45 --- a/include/libipq/libipq.h
46 +++ b/include/libipq/libipq.h
47 @@ -24,7 +24,7 @@
48 #include <errno.h>
49 #include <unistd.h>
50 #include <fcntl.h>
51 -#include <sys/types.h>
52 +#include <stdint.h>
53 #include <sys/socket.h>
54 #include <sys/uio.h>
55 #include <asm/types.h>
56 @@ -48,19 +48,19 @@ typedef unsigned long ipq_id_t;
57 struct ipq_handle
58 {
59 int fd;
60 - u_int8_t blocking;
61 + uint8_t blocking;
62 struct sockaddr_nl local;
63 struct sockaddr_nl peer;
64 };
65
66 -struct ipq_handle *ipq_create_handle(u_int32_t flags, u_int32_t protocol);
67 +struct ipq_handle *ipq_create_handle(uint32_t flags, uint32_t protocol);
68
69 int ipq_destroy_handle(struct ipq_handle *h);
70
71 ssize_t ipq_read(const struct ipq_handle *h,
72 unsigned char *buf, size_t len, int timeout);
73
74 -int ipq_set_mode(const struct ipq_handle *h, u_int8_t mode, size_t len);
75 +int ipq_set_mode(const struct ipq_handle *h, uint8_t mode, size_t len);
76
77 ipq_packet_msg_t *ipq_get_packet(const unsigned char *buf);
78
79 --- a/include/libiptc/libxtc.h
80 +++ b/include/libiptc/libxtc.h
81 @@ -10,7 +10,7 @@ extern "C" {
82 #endif
83
84 #ifndef XT_MIN_ALIGN
85 -/* xt_entry has pointers and u_int64_t's in it, so if you align to
86 +/* xt_entry has pointers and uint64_t's in it, so if you align to
87 it, you'll also align to any crazy matches and targets someone
88 might write */
89 #define XT_MIN_ALIGN (__alignof__(struct xt_entry))
90 --- a/include/linux/netfilter_arp/arpt_mangle.h
91 +++ b/include/linux/netfilter_arp/arpt_mangle.h
92 @@ -13,7 +13,7 @@ struct arpt_mangle
93 union {
94 struct in_addr tgt_ip;
95 } u_t;
96 - u_int8_t flags;
97 + __u8 flags;
98 int target;
99 };
100
101 --- a/iptables/xshared.c
102 +++ b/iptables/xshared.c
103 @@ -1025,7 +1025,7 @@ static const int inverse_for_options[NUM
104 };
105
106 void
107 -set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
108 +set_option(unsigned int *options, unsigned int option, uint16_t *invflg,
109 bool invert)
110 {
111 if (*options & option)
112 --- a/iptables/xshared.h
113 +++ b/iptables/xshared.h
114 @@ -80,7 +80,7 @@ struct xtables_target;
115 #define IPT_INV_ARPHRD 0x0800
116
117 void
118 -set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
119 +set_option(unsigned int *options, unsigned int option, uint16_t *invflg,
120 bool invert);
121
122 /**
123 --- a/libipq/ipq_create_handle.3
124 +++ b/libipq/ipq_create_handle.3
125 @@ -24,7 +24,7 @@ ipq_create_handle, ipq_destroy_handle \(
126 .br
127 .B #include <libipq.h>
128 .sp
129 -.BI "struct ipq_handle *ipq_create_handle(u_int32_t " flags ", u_int32_t " protocol ");"
130 +.BI "struct ipq_handle *ipq_create_handle(uint32_t " flags ", uint32_t " protocol ");"
131 .br
132 .BI "int ipq_destroy_handle(struct ipq_handle *" h );
133 .SH DESCRIPTION
134 --- a/libipq/ipq_set_mode.3
135 +++ b/libipq/ipq_set_mode.3
136 @@ -24,7 +24,7 @@ ipq_set_mode \(em set the ip_queue queui
137 .br
138 .B #include <libipq.h>
139 .sp
140 -.BI "int ipq_set_mode(const struct ipq_handle *" h ", u_int8_t " mode ", size_t " range );
141 +.BI "int ipq_set_mode(const struct ipq_handle *" h ", uint8_t " mode ", size_t " range );
142 .SH DESCRIPTION
143 The
144 .B ipq_set_mode