1 From 24957c135eaacd718f3c788285de33d64316b32e Mon Sep 17 00:00:00 2001
2 From: Felix Janda <felix.janda@posteo.de>
3 Date: Sat, 16 May 2015 10:31:24 +0200
4 Subject: [PATCH 1/2] src: Use stdint types
6 Backport of upstream commit 047f37b1d5d865084a435fd7594b8c5c332ccb8d
8 Please note that the backported patch does not include two changes
9 to arptables.h from the upstream - these modified lines added in commit
10 dbbe9f7de36aa3c7dd61dc89092c03f7902e474e which was committed after
13 Upstream-status: backport
14 Signed-off-by: Felix Janda <felix.janda@posteo.de>
15 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 Signed-off-by: Brendan Heading <brendanheading@gmail.com>
18 arptables.c | 8 ++++----
19 include/arptables.h | 3 ++-
20 include/libarptc/libarptc.h | 7 ++++---
21 libarptc/libarptc.c | 4 ++--
22 libarptc/libarptc_incl.c | 2 +-
23 5 files changed, 13 insertions(+), 11 deletions(-)
25 diff --git a/arptables.c b/arptables.c
26 index 5535ab2..6d1377f 100644
29 @@ -230,7 +230,7 @@ extern void dump_entries(const arptc_handle_t handle);
37 /* Primitive headers... */
38 @@ -925,7 +925,7 @@ mask_to_dotted(const struct in_addr *mask)
42 - u_int32_t maskaddr, bits;
43 + uint32_t maskaddr, bits;
45 maskaddr = ntohl(mask->s_addr);
47 @@ -967,7 +967,7 @@ string_to_number(const char *s, unsigned int min, unsigned int max,
51 -set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
52 +set_option(unsigned int *options, unsigned int option, uint16_t *invflg,
55 if (*options & option)
56 @@ -1107,7 +1107,7 @@ register_target(struct arptables_target *me)
60 -print_num(u_int64_t number, unsigned int format)
61 +print_num(uint64_t number, unsigned int format)
63 if (format & FMT_KILOMEGAGIGA) {
65 diff --git a/include/arptables.h b/include/arptables.h
66 index 820b664..e6a6ba6 100644
67 --- a/include/arptables.h
68 +++ b/include/arptables.h
70 #ifndef _ARPTABLES_USER_H
71 #define _ARPTABLES_USER_H
74 #include "arptables_common.h"
75 #include "libarptc/libarptc.h"
77 @@ -126,7 +127,7 @@ extern char *mask_to_dotted(const struct in_addr *mask);
79 extern void parse_hostnetworkmask(const char *name, struct in_addr **addrpp,
80 struct in_addr *maskp, unsigned int *naddrs);
81 -extern u_int16_t parse_protocol(const char *s);
82 +extern uint16_t parse_protocol(const char *s);
84 extern int do_command(int argc, char *argv[], char **table,
85 arptc_handle_t *handle);
86 diff --git a/include/libarptc/libarptc.h b/include/libarptc/libarptc.h
87 index e4f1175..76fbfab 100644
88 --- a/include/libarptc/libarptc.h
89 +++ b/include/libarptc/libarptc.h
91 #include <linux/netfilter_arp/arp_tables.h>
93 #ifndef ARPT_MIN_ALIGN
94 -/* arpt_entry has pointers and u_int64_t's in it, so if you align to
95 - it, you'll also align to any crazy matches and targets someone
97 +/* arpt_entry has pointers and uint64_t's in it, so if you align to
98 + * it, you'll also align to any crazy matches and targets someone
101 #define ARPT_MIN_ALIGN (__alignof__(struct arpt_entry))
104 diff --git a/libarptc/libarptc.c b/libarptc/libarptc.c
105 index 2dcaaef..701bae0 100644
106 --- a/libarptc/libarptc.c
107 +++ b/libarptc/libarptc.c
108 @@ -256,8 +256,8 @@ unconditional(const struct arpt_arp *arp)
112 - for (i = 0; i < sizeof(*arp)/sizeof(u_int32_t); i++)
113 - if (((u_int32_t *)arp)[i])
114 + for (i = 0; i < sizeof(*arp) / sizeof(uint32_t); i++)
115 + if (((uint32_t *)arp)[i])
119 diff --git a/libarptc/libarptc_incl.c b/libarptc/libarptc_incl.c
120 index 2fa3d43..b41fcb2 100644
121 --- a/libarptc/libarptc_incl.c
122 +++ b/libarptc/libarptc_incl.c
123 @@ -1706,7 +1706,7 @@ TC_COMMIT(TC_HANDLE_T *handle)
124 /* Kernel will think that pointer should be 64-bits, and get
125 padding. So we accomodate here (assumption: alignment of
126 `counters' is on 64-bit boundary). */
127 - u_int64_t *kernptr = (u_int64_t *)&newcounters->counters;
128 + uint64_t *kernptr = (uint64_t *)&newcounters->counters;
129 if ((unsigned long)&newcounters->counters % 8 != 0) {
131 "counters alignment incorrect! Mail rusty!\n");