d8a888d
From 43423fdfe9cfc69d5759ef04b9d91e3cf60a8142 Mon Sep 17 00:00:00 2001
d8a888d
From: Felix Janda <felix.janda@posteo.de>
d8a888d
Date: Sat, 16 May 2015 10:31:24 +0200
d8a888d
Subject: [PATCH] src: Use stdint types
d8a888d
d8a888d
Signed-off-by: Felix Janda <felix.janda@posteo.de>
d8a888d
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
d8a888d
(cherry picked from commit 047f37b1d5d865084a435fd7594b8c5c332ccb8d)
d8a888d
Signed-off-by: Phil Sutter <psutter@redhat.com>
d8a888d
---
d8a888d
 arptables.c                 | 8 ++++----
d8a888d
 include/arptables.h         | 7 ++++---
d8a888d
 include/libarptc/libarptc.h | 7 ++++---
d8a888d
 libarptc/libarptc.c         | 4 ++--
d8a888d
 libarptc/libarptc_incl.c    | 2 +-
d8a888d
 5 files changed, 15 insertions(+), 13 deletions(-)
d8a888d
d8a888d
diff --git a/arptables.c b/arptables.c
d8a888d
index fbe7350be3f32..4e9af67f92042 100644
d8a888d
--- a/arptables.c
d8a888d
+++ b/arptables.c
d8a888d
@@ -230,7 +230,7 @@ extern void dump_entries(const arptc_handle_t handle);
d8a888d
    /etc/protocols */
d8a888d
 struct pprot {
d8a888d
 	char *name;
d8a888d
-	u_int8_t num;
d8a888d
+	uint8_t num;
d8a888d
 };
d8a888d
 
d8a888d
 /* Primitive headers... */
d8a888d
@@ -926,7 +926,7 @@ mask_to_dotted(const struct in_addr *mask)
d8a888d
 {
d8a888d
 	int i;
d8a888d
 	static char buf[20];
d8a888d
-	u_int32_t maskaddr, bits;
d8a888d
+	uint32_t maskaddr, bits;
d8a888d
 
d8a888d
 	maskaddr = ntohl(mask->s_addr);
d8a888d
 
d8a888d
@@ -968,7 +968,7 @@ string_to_number(const char *s, unsigned int min, unsigned int max,
d8a888d
 }
d8a888d
 
d8a888d
 static void
d8a888d
-set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
d8a888d
+set_option(unsigned int *options, unsigned int option, uint16_t *invflg,
d8a888d
 	   int invert)
d8a888d
 {
d8a888d
 	if (*options & option)
d8a888d
@@ -1108,7 +1108,7 @@ register_target(struct arptables_target *me)
d8a888d
 }
d8a888d
 
d8a888d
 static void
d8a888d
-print_num(u_int64_t number, unsigned int format)
d8a888d
+print_num(uint64_t number, unsigned int format)
d8a888d
 {
d8a888d
 	if (format & FMT_KILOMEGAGIGA) {
d8a888d
 		if (number > 99999) {
d8a888d
diff --git a/include/arptables.h b/include/arptables.h
d8a888d
index 82e6e9a80445e..34f53c1cadbd8 100644
d8a888d
--- a/include/arptables.h
d8a888d
+++ b/include/arptables.h
d8a888d
@@ -1,6 +1,7 @@
d8a888d
 #ifndef _ARPTABLES_USER_H
d8a888d
 #define _ARPTABLES_USER_H
d8a888d
 
d8a888d
+#include <stdint.h>
d8a888d
 #include "arptables_common.h"
d8a888d
 #include "libarptc/libarptc.h"
d8a888d
 
d8a888d
@@ -33,7 +34,7 @@ struct arptables_match
d8a888d
 	size_t userspacesize;
d8a888d
 
d8a888d
 	/* Revision of target (0 by default). */
d8a888d
-	u_int8_t revision;
d8a888d
+	uint8_t revision;
d8a888d
 
d8a888d
 	/* Function which prints out usage message. */
d8a888d
 	void (*help)(void);
d8a888d
@@ -85,7 +86,7 @@ struct arptables_target
d8a888d
 	size_t userspacesize;
d8a888d
 
d8a888d
 	/* Revision of target (0 by default). */
d8a888d
-	u_int8_t revision;
d8a888d
+	uint8_t revision;
d8a888d
 
d8a888d
 	/* Function which prints out usage message. */
d8a888d
 	void (*help)(void);
d8a888d
@@ -132,7 +133,7 @@ extern char *mask_to_dotted(const struct in_addr *mask);
d8a888d
 
d8a888d
 extern void parse_hostnetworkmask(const char *name, struct in_addr **addrpp,
d8a888d
                       struct in_addr *maskp, unsigned int *naddrs);
d8a888d
-extern u_int16_t parse_protocol(const char *s);
d8a888d
+extern uint16_t parse_protocol(const char *s);
d8a888d
 
d8a888d
 extern int do_command(int argc, char *argv[], char **table,
d8a888d
 		      arptc_handle_t *handle);
d8a888d
diff --git a/include/libarptc/libarptc.h b/include/libarptc/libarptc.h
d8a888d
index ff4606fb9ae16..18e8bb06fee6b 100644
d8a888d
--- a/include/libarptc/libarptc.h
d8a888d
+++ b/include/libarptc/libarptc.h
d8a888d
@@ -7,9 +7,10 @@
d8a888d
 #include <linux/netfilter_arp/arp_tables.h>
d8a888d
 
d8a888d
 #ifndef ARPT_MIN_ALIGN
d8a888d
-/* arpt_entry has pointers and u_int64_t's in it, so if you align to
d8a888d
-   it, you'll also align to any crazy matches and targets someone
d8a888d
-   might write */
d8a888d
+/* arpt_entry has pointers and uint64_t's in it, so if you align to
d8a888d
+ * it, you'll also align to any crazy matches and targets someone
d8a888d
+ * might write.
d8a888d
+ */
d8a888d
 #define ARPT_MIN_ALIGN (__alignof__(struct arpt_entry))
d8a888d
 #endif
d8a888d
 
d8a888d
diff --git a/libarptc/libarptc.c b/libarptc/libarptc.c
d8a888d
index 0025a75efc9ea..6d9773553e679 100644
d8a888d
--- a/libarptc/libarptc.c
d8a888d
+++ b/libarptc/libarptc.c
d8a888d
@@ -256,8 +256,8 @@ unconditional(const struct arpt_arp *arp)
d8a888d
 {
d8a888d
 	unsigned int i;
d8a888d
 
d8a888d
-	for (i = 0; i < sizeof(*arp)/sizeof(u_int32_t); i++)
d8a888d
-		if (((u_int32_t *)arp)[i])
d8a888d
+	for (i = 0; i < sizeof(*arp) / sizeof(uint32_t); i++)
d8a888d
+		if (((uint32_t *)arp)[i])
d8a888d
 			return 0;
d8a888d
 
d8a888d
 	return 1;
d8a888d
diff --git a/libarptc/libarptc_incl.c b/libarptc/libarptc_incl.c
d8a888d
index 87404ce185d77..ca23da6474990 100644
d8a888d
--- a/libarptc/libarptc_incl.c
d8a888d
+++ b/libarptc/libarptc_incl.c
d8a888d
@@ -1688,7 +1688,7 @@ TC_COMMIT(TC_HANDLE_T *handle)
d8a888d
 		/* Kernel will think that pointer should be 64-bits, and get
d8a888d
 		   padding.  So we accomodate here (assumption: alignment of
d8a888d
 		   `counters' is on 64-bit boundary). */
d8a888d
-		u_int64_t *kernptr = (u_int64_t *)&newcounters->counters;
d8a888d
+		uint64_t *kernptr = (uint64_t *)&newcounters->counters;
d8a888d
 		if ((unsigned long)&newcounters->counters % 8 != 0) {
d8a888d
 			fprintf(stderr,
d8a888d
 				"counters alignment incorrect! Mail rusty!\n");
d8a888d
-- 
d8a888d
2.21.0
d8a888d