fix-u_int16_t.patch 5.7 KB

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