board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / ulogd / 0003-Use-stdint-types-everywhere.patch
blob66408d6d0fc65aa4a65a8f68dc3592d6402c5dc9
1 From c9337b31f756cae85299c8275b21088ce02885e2 Mon Sep 17 00:00:00 2001
2 From: Felix Janda <felix.janda@posteo.de>
3 Date: Wed, 24 Jun 2015 19:53:34 +0200
4 Subject: [PATCH] Use stdint types everywhere
6 Signed-off-by: Felix Janda <felix.janda@posteo.de>
7 [Rahul Bedarkar:
8 - backported from https://git.netfilter.org/ulogd2/commit/?id=c9337b31f756cae85299c8275b21088ce02885e2
9 - remove hunk for output/ulogd_output_IPFIX.c as file doesn't exist in version we use]
10 Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
11 ---
12 filter/raw2packet/ulogd_raw2packet_BASE.c | 35 +++++++++++++-------------
13 filter/ulogd_filter_HWHDR.c | 6 ++---
14 filter/ulogd_filter_IP2HBIN.c | 4 +--
15 filter/ulogd_filter_IP2STR.c | 2 +-
16 filter/ulogd_filter_MARK.c | 4 +--
17 filter/ulogd_filter_PWSNIFF.c | 4 +--
18 include/libipulog/libipulog.h | 7 +++---
19 include/ulogd/addr.h | 4 ++-
20 include/ulogd/conffile.h | 10 ++++----
21 include/ulogd/ipfix_protocol.h | 38 +++++++++++++++-------------
22 include/ulogd/ulogd.h | 42 +++++++++++++++----------------
23 input/packet/ulogd_inppkt_NFLOG.c | 16 ++++++------
24 input/packet/ulogd_inppkt_UNIXSOCK.c | 34 ++++++++++++-------------
25 libipulog/libipulog.c | 8 +++---
26 output/mysql/ulogd_output_MYSQL.c | 2 +-
27 output/ulogd_output_IPFIX.c | 20 +++++++--------
28 src/addr.c | 4 +--
29 util/db.c | 2 +-
30 util/printpkt.c | 6 ++---
31 19 files changed, 126 insertions(+), 122 deletions(-)
33 diff --git a/filter/raw2packet/ulogd_raw2packet_BASE.c b/filter/raw2packet/ulogd_raw2packet_BASE.c
34 index ad894fc..8a6180c 100644
35 --- a/filter/raw2packet/ulogd_raw2packet_BASE.c
36 +++ b/filter/raw2packet/ulogd_raw2packet_BASE.c
37 @@ -44,6 +44,7 @@
38 #include <ulogd/ipfix_protocol.h>
39 #include <netinet/if_ether.h>
40 #include <string.h>
41 +#include <linux/types.h>
43 enum input_keys {
44 INKEY_RAW_PCKT,
45 @@ -538,7 +539,7 @@ static struct ulogd_key iphdr_rets[] = {
46 ***********************************************************************/
48 static int _interp_tcp(struct ulogd_pluginstance *pi, struct tcphdr *tcph,
49 - u_int32_t len)
50 + uint32_t len)
52 struct ulogd_key *ret = pi->output.keys;
54 @@ -573,7 +574,7 @@ static int _interp_tcp(struct ulogd_pluginstance *pi, struct tcphdr *tcph,
55 ***********************************************************************/
57 static int _interp_udp(struct ulogd_pluginstance *pi, struct udphdr *udph,
58 - u_int32_t len)
59 + uint32_t len)
62 struct ulogd_key *ret = pi->output.keys;
63 @@ -602,7 +603,7 @@ typedef struct sctphdr {
64 } __attribute__((packed)) sctp_sctphdr_t;
66 static int _interp_sctp(struct ulogd_pluginstance *pi, struct sctphdr *sctph,
67 - u_int32_t len)
68 + uint32_t len)
71 struct ulogd_key *ret = pi->output.keys;
72 @@ -625,7 +626,7 @@ static int _interp_sctp(struct ulogd_pluginstance *pi, struct sctphdr *sctph,
73 ***********************************************************************/
75 static int _interp_icmp(struct ulogd_pluginstance *pi, struct icmphdr *icmph,
76 - u_int32_t len)
77 + uint32_t len)
79 struct ulogd_key *ret = pi->output.keys;
81 @@ -663,7 +664,7 @@ static int _interp_icmp(struct ulogd_pluginstance *pi, struct icmphdr *icmph,
82 ***********************************************************************/
84 static int _interp_icmpv6(struct ulogd_pluginstance *pi, struct icmp6_hdr *icmph,
85 - u_int32_t len)
86 + uint32_t len)
88 struct ulogd_key *ret = pi->output.keys;
90 @@ -691,7 +692,7 @@ static int _interp_icmpv6(struct ulogd_pluginstance *pi, struct icmp6_hdr *icmph
91 * IPSEC HEADER
92 ***********************************************************************/
93 static int _interp_ahesp(struct ulogd_pluginstance *pi, void *protoh,
94 - u_int32_t len)
95 + uint32_t len)
97 #if 0
98 struct ulogd_key *ret = pi->output.keys;
99 @@ -711,14 +712,14 @@ static int _interp_ahesp(struct ulogd_pluginstance *pi, void *protoh,
100 * IP HEADER
101 ***********************************************************************/
103 -static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
104 +static int _interp_iphdr(struct ulogd_pluginstance *pi, uint32_t len)
106 struct ulogd_key *ret = pi->output.keys;
107 struct iphdr *iph =
108 ikey_get_ptr(&pi->input.keys[INKEY_RAW_PCKT]);
109 - void *nexthdr = (u_int32_t *)iph + iph->ihl;
110 + void *nexthdr = (uint32_t *)iph + iph->ihl;
112 - if (len < sizeof(struct iphdr) || len <= (u_int32_t)(iph->ihl * 4))
113 + if (len < sizeof(struct iphdr) || len <= (uint32_t)(iph->ihl * 4))
114 return ULOGD_IRET_OK;
115 len -= iph->ihl * 4;
117 @@ -759,7 +760,7 @@ static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
118 * IPv6 HEADER
119 ***********************************************************************/
121 -static int ip6_ext_hdr(u_int8_t nexthdr)
122 +static int ip6_ext_hdr(uint8_t nexthdr)
124 switch (nexthdr) {
125 case IPPROTO_HOPOPTS:
126 @@ -774,12 +775,12 @@ static int ip6_ext_hdr(u_int8_t nexthdr)
130 -static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, u_int32_t len)
131 +static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, uint32_t len)
133 struct ulogd_key *ret = pi->output.keys;
134 struct ip6_hdr *ipv6h = ikey_get_ptr(&pi->input.keys[INKEY_RAW_PCKT]);
135 unsigned int ptr, hdrlen = 0;
136 - u_int8_t curhdr;
137 + uint8_t curhdr;
138 int fragment = 0;
140 if (len < sizeof(struct ip6_hdr))
141 @@ -889,7 +890,7 @@ out:
142 /***********************************************************************
143 * ARP HEADER
144 ***********************************************************************/
145 -static int _interp_arp(struct ulogd_pluginstance *pi, u_int32_t len)
146 +static int _interp_arp(struct ulogd_pluginstance *pi, uint32_t len)
148 struct ulogd_key *ret = pi->output.keys;
149 const struct ether_arp *arph =
150 @@ -914,9 +915,9 @@ static int _interp_arp(struct ulogd_pluginstance *pi, u_int32_t len)
151 * ETHER HEADER
152 ***********************************************************************/
154 -static int _interp_bridge(struct ulogd_pluginstance *pi, u_int32_t len)
155 +static int _interp_bridge(struct ulogd_pluginstance *pi, uint32_t len)
157 - const u_int16_t proto =
158 + const uint16_t proto =
159 ikey_get_u16(&pi->input.keys[INKEY_OOB_PROTOCOL]);
161 switch (proto) {
162 @@ -938,8 +939,8 @@ static int _interp_bridge(struct ulogd_pluginstance *pi, u_int32_t len)
164 static int _interp_pkt(struct ulogd_pluginstance *pi)
166 - u_int32_t len = ikey_get_u32(&pi->input.keys[INKEY_RAW_PCKTLEN]);
167 - u_int8_t family = ikey_get_u8(&pi->input.keys[INKEY_OOB_FAMILY]);
168 + uint32_t len = ikey_get_u32(&pi->input.keys[INKEY_RAW_PCKTLEN]);
169 + uint8_t family = ikey_get_u8(&pi->input.keys[INKEY_OOB_FAMILY]);
170 struct ulogd_key *ret = pi->output.keys;
172 okey_set_u16(&ret[KEY_OOB_PROTOCOL],
173 diff --git a/filter/ulogd_filter_HWHDR.c b/filter/ulogd_filter_HWHDR.c
174 index 3b095c9..10c95c4 100644
175 --- a/filter/ulogd_filter_HWHDR.c
176 +++ b/filter/ulogd_filter_HWHDR.c
177 @@ -143,10 +143,10 @@ static void *hwhdr_get_daddr(struct ulogd_key *inp)
178 return ikey_get_ptr(&inp[KEY_RAW_MAC]);
181 -static u_int16_t hwhdr_get_len(struct ulogd_key *inp)
182 +static uint16_t hwhdr_get_len(struct ulogd_key *inp)
184 void *len = ikey_get_ptr(&inp[KEY_RAW_MAC]) + 2 * ETH_ALEN;
185 - return ntohs(*(u_int16_t *) len);
186 + return ntohs(*(uint16_t *) len);
188 static int parse_ethernet(struct ulogd_key *ret, struct ulogd_key *inp)
190 @@ -171,7 +171,7 @@ static int interp_mac2str(struct ulogd_pluginstance *pi)
192 struct ulogd_key *ret = pi->output.keys;
193 struct ulogd_key *inp = pi->input.keys;
194 - u_int16_t type = 0;
195 + uint16_t type = 0;
197 if (pp_is_valid(inp, KEY_OOB_PROTOCOL))
198 okey_set_u16(&ret[KEY_MAC_PROTOCOL],
199 diff --git a/filter/ulogd_filter_IP2HBIN.c b/filter/ulogd_filter_IP2HBIN.c
200 index 4fd3ff1..087e824 100644
201 --- a/filter/ulogd_filter_IP2HBIN.c
202 +++ b/filter/ulogd_filter_IP2HBIN.c
203 @@ -116,8 +116,8 @@ static int interp_ip2hbin(struct ulogd_pluginstance *pi)
205 struct ulogd_key *ret = pi->output.keys;
206 struct ulogd_key *inp = pi->input.keys;
207 - u_int8_t family = ikey_get_u8(&inp[KEY_OOB_FAMILY]);
208 - u_int8_t convfamily = family;
209 + uint8_t family = ikey_get_u8(&inp[KEY_OOB_FAMILY]);
210 + uint8_t convfamily = family;
211 int i;
213 switch (family) {
214 diff --git a/filter/ulogd_filter_IP2STR.c b/filter/ulogd_filter_IP2STR.c
215 index 732e1ef..66324b0 100644
216 --- a/filter/ulogd_filter_IP2STR.c
217 +++ b/filter/ulogd_filter_IP2STR.c
218 @@ -168,7 +168,7 @@ static int ip2str(struct ulogd_key *inp, int index, int oindex)
221 switch (convfamily) {
222 - u_int32_t ip;
223 + uint32_t ip;
224 case AF_INET6:
225 inet_ntop(AF_INET6,
226 ikey_get_u128(&inp[index]),
227 diff --git a/filter/ulogd_filter_MARK.c b/filter/ulogd_filter_MARK.c
228 index 7807f63..149725d 100644
229 --- a/filter/ulogd_filter_MARK.c
230 +++ b/filter/ulogd_filter_MARK.c
231 @@ -73,14 +73,14 @@ static int interp_mark(struct ulogd_pluginstance *pi)
232 if (pp_is_valid(inp, KEY_CT_MARK)) {
233 if ((ikey_get_u32(&inp[KEY_CT_MARK]) &
234 pi->config_kset->ces[MARK_MASK].u.value) !=
235 - (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
236 + (uint32_t) pi->config_kset->ces[MARK_MARK].u.value
238 return ULOGD_IRET_STOP;
240 } else if (pp_is_valid(inp, KEY_OOB_MARK)) {
241 if ((ikey_get_u32(&inp[KEY_OOB_MARK]) &
242 pi->config_kset->ces[MARK_MASK].u.value) !=
243 - (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
244 + (uint32_t) pi->config_kset->ces[MARK_MARK].u.value
246 return ULOGD_IRET_STOP;
248 diff --git a/filter/ulogd_filter_PWSNIFF.c b/filter/ulogd_filter_PWSNIFF.c
249 index a3e2b42..934ff0e 100644
250 --- a/filter/ulogd_filter_PWSNIFF.c
251 +++ b/filter/ulogd_filter_PWSNIFF.c
252 @@ -39,7 +39,7 @@
253 #define PORT_POP3 110
254 #define PORT_FTP 21
256 -static u_int16_t pwsniff_ports[] = {
257 +static uint16_t pwsniff_ports[] = {
258 PORT_POP3,
259 PORT_FTP,
260 /* feel free to include any other ports here, provided that their
261 @@ -72,7 +72,7 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi)
262 return ULOGD_IRET_STOP;
264 iph = (struct iphdr *) pi->input.keys[0].u.value.ptr;
265 - protoh = (u_int32_t *)iph + iph->ihl;
266 + protoh = (uint32_t *)iph + iph->ihl;
267 tcph = protoh;
268 tcplen = ntohs(iph->tot_len) - iph->ihl * 4;
270 diff --git a/include/libipulog/libipulog.h b/include/libipulog/libipulog.h
271 index b3c9616..21b4315 100644
272 --- a/include/libipulog/libipulog.h
273 +++ b/include/libipulog/libipulog.h
274 @@ -4,10 +4,9 @@
275 #include <errno.h>
276 #include <unistd.h>
277 #include <fcntl.h>
278 -#include <sys/types.h>
279 #include <sys/socket.h>
280 #include <sys/uio.h>
281 -#include <asm/types.h>
282 +#include <stdint.h>
283 #include <linux/netlink.h>
284 #include <net/if.h>
285 #include <linux/netfilter_ipv4/ipt_ULOG.h>
286 @@ -20,9 +19,9 @@
287 struct ipulog_handle;
288 extern int ipulog_errno;
290 -u_int32_t ipulog_group2gmask(u_int32_t group);
291 +uint32_t ipulog_group2gmask(uint32_t group);
293 -struct ipulog_handle *ipulog_create_handle(u_int32_t gmask, u_int32_t rmem);
294 +struct ipulog_handle *ipulog_create_handle(uint32_t gmask, uint32_t rmem);
296 void ipulog_destroy_handle(struct ipulog_handle *h);
298 diff --git a/include/ulogd/addr.h b/include/ulogd/addr.h
299 index b4432e3..2259b6c 100644
300 --- a/include/ulogd/addr.h
301 +++ b/include/ulogd/addr.h
302 @@ -8,7 +8,9 @@
303 #ifndef _ADDR_H
304 #define _ADDR_H
306 -u_int32_t ulogd_bits2netmask(int bits);
307 +#include <stdint.h>
309 +uint32_t ulogd_bits2netmask(int bits);
310 void ulogd_ipv6_cidr2mask_host(uint8_t cidr, uint32_t *res);
311 void ulogd_ipv6_addr2addr_host(uint32_t *addr, uint32_t *res);
313 diff --git a/include/ulogd/conffile.h b/include/ulogd/conffile.h
314 index 69a6f70..1f3d563 100644
315 --- a/include/ulogd/conffile.h
316 +++ b/include/ulogd/conffile.h
317 @@ -7,7 +7,7 @@
318 #ifndef _CONFFILE_H
319 #define _CONFFILE_H
321 -#include <sys/types.h>
322 +#include <stdint.h>
324 /* errors returned by config functions */
325 enum {
326 @@ -45,10 +45,10 @@ enum {
328 struct config_entry {
329 char key[CONFIG_KEY_LEN]; /* name of config directive */
330 - u_int8_t type; /* type; see above */
331 - u_int8_t options; /* options; see above */
332 - u_int8_t hit; /* found? */
333 - u_int8_t flag; /* tune setup of option */
334 + uint8_t type; /* type; see above */
335 + uint8_t options; /* options; see above */
336 + uint8_t hit; /* found? */
337 + uint8_t flag; /* tune setup of option */
338 union {
339 char string[CONFIG_VAL_STRING_LEN];
340 int value;
341 diff --git a/include/ulogd/ipfix_protocol.h b/include/ulogd/ipfix_protocol.h
342 index 5d7e46a..aef47f0 100644
343 --- a/include/ulogd/ipfix_protocol.h
344 +++ b/include/ulogd/ipfix_protocol.h
345 @@ -1,6 +1,8 @@
346 #ifndef _IPFIX_PROTOCOL_H
347 #define _IPFIX_PROTOCOL_H
349 +#include <stdint.h>
351 /* This header file defines structures for the IPFIX protocol in accordance with
352 * draft-ietf-ipfix-protocol-19.txt */
354 @@ -11,29 +13,29 @@
356 /* Section 3.1 */
357 struct ipfix_msg_hdr {
358 - u_int16_t version;
359 - u_int16_t length;
360 - u_int32_t export_time;
361 - u_int32_t seq;
362 - u_int32_t source_id;
363 + uint16_t version;
364 + uint16_t length;
365 + uint32_t export_time;
366 + uint32_t seq;
367 + uint32_t source_id;
370 /* Section 3.4.1 */
371 struct ipfix_templ_rec_hdr {
372 - u_int16_t templ_id;
373 - u_int16_t field_count;
374 + uint16_t templ_id;
375 + uint16_t field_count;
378 /* Section 3.2 */
379 struct ipfix_ietf_field {
380 - u_int16_t type;
381 - u_int16_t length;
382 + uint16_t type;
383 + uint16_t length;
386 struct ipfix_vendor_field {
387 - u_int16_t type;
388 - u_int16_t length;
389 - u_int32_t enterprise_num;
390 + uint16_t type;
391 + uint16_t length;
392 + uint32_t enterprise_num;
395 /* Information Element Identifiers as of draft-ietf-ipfix-info-11.txt */
396 @@ -219,13 +221,13 @@ enum {
397 /* Information elements of the netfilter vendor id */
398 enum {
399 IPFIX_NF_rawpacket = 1, /* pointer */
400 - IPFIX_NF_rawpacket_length = 2, /* u_int32_t */
401 + IPFIX_NF_rawpacket_length = 2, /* uint32_t */
402 IPFIX_NF_prefix = 3, /* string */
403 - IPFIX_NF_mark = 4, /* u_int32_t */
404 - IPFIX_NF_hook = 5, /* u_int8_t */
405 - IPFIX_NF_conntrack_id = 6, /* u_int32_t */
406 - IPFIX_NF_seq_local = 7, /* u_int32_t */
407 - IPFIX_NF_seq_global = 8, /* u_int32_t */
408 + IPFIX_NF_mark = 4, /* uint32_t */
409 + IPFIX_NF_hook = 5, /* uint8_t */
410 + IPFIX_NF_conntrack_id = 6, /* uint32_t */
411 + IPFIX_NF_seq_local = 7, /* uint32_t */
412 + IPFIX_NF_seq_global = 8, /* uint32_t */
415 #endif
416 diff --git a/include/ulogd/ulogd.h b/include/ulogd/ulogd.h
417 index cf26a15..2e38195 100644
418 --- a/include/ulogd/ulogd.h
419 +++ b/include/ulogd/ulogd.h
420 @@ -85,17 +85,17 @@ enum ulogd_dtype {
421 /* structure describing an input / output parameter of a plugin */
422 struct ulogd_key {
423 /* length of the returned value (only for lengthed types */
424 - u_int32_t len;
425 + uint32_t len;
426 /* type of the returned value (ULOGD_DTYPE_...) */
427 - u_int16_t type;
428 + uint16_t type;
429 /* flags (i.e. free, ...) */
430 - u_int16_t flags;
431 + uint16_t flags;
432 /* name of this key */
433 char name[ULOGD_MAX_KEYLEN+1];
434 /* IETF IPFIX attribute ID */
435 struct {
436 - u_int32_t vendor;
437 - u_int16_t field_id;
438 + uint32_t vendor;
439 + uint16_t field_id;
440 } ipfix;
442 /* Store field name for Common Information Model */
443 @@ -104,12 +104,12 @@ struct ulogd_key {
444 union {
445 /* and finally the returned value */
446 union {
447 - u_int8_t b;
448 - u_int8_t ui8;
449 - u_int16_t ui16;
450 - u_int32_t ui32;
451 - u_int64_t ui64;
452 - u_int32_t ui128[4];
453 + uint8_t b;
454 + uint8_t ui8;
455 + uint16_t ui16;
456 + uint32_t ui32;
457 + uint64_t ui64;
458 + uint32_t ui128[4];
459 int8_t i8;
460 int16_t i16;
461 int32_t i32;
462 @@ -130,31 +130,31 @@ struct ulogd_keyset {
463 unsigned int type;
466 -static inline void okey_set_b(struct ulogd_key *key, u_int8_t value)
467 +static inline void okey_set_b(struct ulogd_key *key, uint8_t value)
469 key->u.value.b = value;
470 key->flags |= ULOGD_RETF_VALID;
473 -static inline void okey_set_u8(struct ulogd_key *key, u_int8_t value)
474 +static inline void okey_set_u8(struct ulogd_key *key, uint8_t value)
476 key->u.value.ui8 = value;
477 key->flags |= ULOGD_RETF_VALID;
480 -static inline void okey_set_u16(struct ulogd_key *key, u_int16_t value)
481 +static inline void okey_set_u16(struct ulogd_key *key, uint16_t value)
483 key->u.value.ui16 = value;
484 key->flags |= ULOGD_RETF_VALID;
487 -static inline void okey_set_u32(struct ulogd_key *key, u_int32_t value)
488 +static inline void okey_set_u32(struct ulogd_key *key, uint32_t value)
490 key->u.value.ui32 = value;
491 key->flags |= ULOGD_RETF_VALID;
494 -static inline void okey_set_u64(struct ulogd_key *key, u_int64_t value)
495 +static inline void okey_set_u64(struct ulogd_key *key, uint64_t value)
497 key->u.value.ui64 = value;
498 key->flags |= ULOGD_RETF_VALID;
499 @@ -172,22 +172,22 @@ static inline void okey_set_ptr(struct ulogd_key *key, void *value)
500 key->flags |= ULOGD_RETF_VALID;
503 -static inline u_int8_t ikey_get_u8(struct ulogd_key *key)
504 +static inline uint8_t ikey_get_u8(struct ulogd_key *key)
506 return key->u.source->u.value.ui8;
509 -static inline u_int16_t ikey_get_u16(struct ulogd_key *key)
510 +static inline uint16_t ikey_get_u16(struct ulogd_key *key)
512 return key->u.source->u.value.ui16;
515 -static inline u_int32_t ikey_get_u32(struct ulogd_key *key)
516 +static inline uint32_t ikey_get_u32(struct ulogd_key *key)
518 return key->u.source->u.value.ui32;
521 -static inline u_int64_t ikey_get_u64(struct ulogd_key *key)
522 +static inline uint64_t ikey_get_u64(struct ulogd_key *key)
524 return key->u.source->u.value.ui64;
526 @@ -292,7 +292,7 @@ void ulogd_propagate_results(struct ulogd_pluginstance *pi);
527 void ulogd_register_plugin(struct ulogd_plugin *me);
529 /* allocate a new ulogd_key */
530 -struct ulogd_key *alloc_ret(const u_int16_t type, const char*);
531 +struct ulogd_key *alloc_ret(const uint16_t type, const char*);
533 /* write a message to the daemons' logfile */
534 void __ulogd_log(int level, char *file, int line, const char *message, ...);
535 diff --git a/input/packet/ulogd_inppkt_NFLOG.c b/input/packet/ulogd_inppkt_NFLOG.c
536 index 6196626..a367959 100644
537 --- a/input/packet/ulogd_inppkt_NFLOG.c
538 +++ b/input/packet/ulogd_inppkt_NFLOG.c
539 @@ -315,7 +315,7 @@ static struct ulogd_key output_keys[] = {
542 static inline int
543 -interp_packet(struct ulogd_pluginstance *upi, u_int8_t pf_family,
544 +interp_packet(struct ulogd_pluginstance *upi, uint8_t pf_family,
545 struct nflog_data *ldata)
547 struct ulogd_key *ret = upi->output.keys;
548 @@ -326,12 +326,12 @@ interp_packet(struct ulogd_pluginstance *upi, u_int8_t pf_family,
549 int payload_len = nflog_get_payload(ldata, &payload);
550 char *prefix = nflog_get_prefix(ldata);
551 struct timeval ts;
552 - u_int32_t mark = nflog_get_nfmark(ldata);
553 - u_int32_t indev = nflog_get_indev(ldata);
554 - u_int32_t outdev = nflog_get_outdev(ldata);
555 - u_int32_t seq;
556 - u_int32_t uid;
557 - u_int32_t gid;
558 + uint32_t mark = nflog_get_nfmark(ldata);
559 + uint32_t indev = nflog_get_indev(ldata);
560 + uint32_t outdev = nflog_get_outdev(ldata);
561 + uint32_t seq;
562 + uint32_t uid;
563 + uint32_t gid;
565 okey_set_u8(&ret[NFLOG_KEY_OOB_FAMILY],
566 pf_family);
567 @@ -493,7 +493,7 @@ static int configure(struct ulogd_pluginstance *upi,
568 return 0;
571 -static int become_system_logging(struct ulogd_pluginstance *upi, u_int8_t pf)
572 +static int become_system_logging(struct ulogd_pluginstance *upi, uint8_t pf)
574 struct nflog_input *ui = (struct nflog_input *) upi->private;
576 diff --git a/input/packet/ulogd_inppkt_UNIXSOCK.c b/input/packet/ulogd_inppkt_UNIXSOCK.c
577 index e4009f3..39944bf 100644
578 --- a/input/packet/ulogd_inppkt_UNIXSOCK.c
579 +++ b/input/packet/ulogd_inppkt_UNIXSOCK.c
580 @@ -336,10 +336,10 @@ enum ulogd2_option_type {
581 ULOGD2_OPT_PREFIX, /* log prefix (string) */
582 ULOGD2_OPT_OOB_IN, /* input device (string) */
583 ULOGD2_OPT_OOB_OUT, /* output device (string) */
584 - ULOGD2_OPT_OOB_TIME_SEC, /* packet arrival time (u_int32_t) */
585 + ULOGD2_OPT_OOB_TIME_SEC, /* packet arrival time (uint32_t) */
587 ULOGD2_OPT_USER=200, /* user name (string) */
588 - ULOGD2_OPT_USERID, /* user id (u_int32_t) */
589 + ULOGD2_OPT_USERID, /* user id (uint32_t) */
590 ULOGD2_OPT_OSNAME, /* OS name (string) */
591 ULOGD2_OPT_OSREL, /* OS release (string) */
592 ULOGD2_OPT_OSVERS, /* OS version (string) */
593 @@ -367,15 +367,15 @@ struct ulogd_unixsock_option_t {
594 #define USOCK_ALIGNTO 8
595 #define USOCK_ALIGN(len) ( ((len)+USOCK_ALIGNTO-1) & ~(USOCK_ALIGNTO-1) )
597 -static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_packet_t *pkt, u_int16_t total_len)
598 +static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_packet_t *pkt, uint16_t total_len)
600 char *data = NULL;
601 struct iphdr *ip;
602 struct ulogd_key *ret = upi->output.keys;
603 - u_int8_t oob_family;
604 - u_int16_t payload_len;
605 - u_int32_t option_number;
606 - u_int32_t option_length;
607 + uint8_t oob_family;
608 + uint16_t payload_len;
609 + uint32_t option_number;
610 + uint32_t option_length;
611 char *buf;
612 struct ulogd_unixsock_option_t *option;
613 int new_offset;
614 @@ -398,7 +398,7 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
615 okey_set_u32(&ret[UNIXSOCK_KEY_RAW_PCKTLEN], payload_len);
617 /* options */
618 - if (total_len > payload_len + sizeof(u_int16_t)) {
619 + if (total_len > payload_len + sizeof(uint16_t)) {
620 /* option starts at the next aligned address after the payload */
621 new_offset = USOCK_ALIGN(payload_len);
622 options_start = (void*)ip + new_offset;
623 @@ -431,13 +431,13 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
624 okey_set_ptr(&ret[UNIXSOCK_KEY_OOB_OUT], buf);
625 break;
626 case ULOGD2_OPT_OOB_TIME_SEC:
627 - okey_set_u32(&ret[UNIXSOCK_KEY_OOB_TIME_SEC], *(u_int32_t*)buf);
628 + okey_set_u32(&ret[UNIXSOCK_KEY_OOB_TIME_SEC], *(uint32_t*)buf);
629 break;
630 case ULOGD2_OPT_USER:
631 okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_USER_NAME], buf);
632 break;
633 case ULOGD2_OPT_USERID:
634 - okey_set_u32(&ret[UNIXSOCK_KEY_NUFW_USER_ID], *(u_int32_t*)buf);
635 + okey_set_u32(&ret[UNIXSOCK_KEY_NUFW_USER_ID], *(uint32_t*)buf);
636 break;
637 case ULOGD2_OPT_OSNAME:
638 okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_OS_NAME], buf);
639 @@ -452,7 +452,7 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
640 okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_APP_NAME], buf);
641 break;
642 case ULOGD2_OPT_STATE:
643 - okey_set_u8(&ret[UNIXSOCK_KEY_RAW_LABEL], *(u_int8_t*)buf);
644 + okey_set_u8(&ret[UNIXSOCK_KEY_RAW_LABEL], *(uint8_t*)buf);
645 break;
646 default:
647 ulogd_log(ULOGD_NOTICE,
648 @@ -595,8 +595,8 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
649 struct ulogd_pluginstance *upi = param;
650 struct unixsock_input *ui = (struct unixsock_input*)upi->private;
651 int len;
652 - u_int16_t needed_len;
653 - u_int32_t packet_sig;
654 + uint16_t needed_len;
655 + uint32_t packet_sig;
656 struct ulogd_unixsock_packet_t *unixsock_packet;
658 char buf[4096];
659 @@ -642,7 +642,7 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
661 needed_len = ntohs(unixsock_packet->total_size);
663 - if (ui->unixsock_buf_avail >= needed_len + sizeof(u_int32_t)) {
664 + if (ui->unixsock_buf_avail >= needed_len + sizeof(uint32_t)) {
665 ulogd_log(ULOGD_DEBUG,
666 " We have enough data (%d bytes required), handling packet\n",
667 needed_len);
668 @@ -651,11 +651,11 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
669 return -1;
671 /* consume data */
672 - ui->unixsock_buf_avail -= (sizeof(u_int32_t) + needed_len);
673 + ui->unixsock_buf_avail -= (sizeof(uint32_t) + needed_len);
674 if (ui->unixsock_buf_avail > 0) {
675 /* we need to shift data .. */
676 memmove(ui->unixsock_buf,
677 - ui->unixsock_buf + (sizeof(u_int32_t) + needed_len) ,
678 + ui->unixsock_buf + (sizeof(uint32_t) + needed_len) ,
679 ui->unixsock_buf_avail);
680 } else {
681 /* input buffer is empty, do not loop */
682 @@ -664,7 +664,7 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
684 } else {
685 ulogd_log(ULOGD_DEBUG, " We have %d bytes, but need %d. Requesting more\n",
686 - ui->unixsock_buf_avail, needed_len + sizeof(u_int32_t));
687 + ui->unixsock_buf_avail, needed_len + sizeof(uint32_t));
688 return 0;
691 diff --git a/libipulog/libipulog.c b/libipulog/libipulog.c
692 index ab28bb4..b49f7f2 100644
693 --- a/libipulog/libipulog.c
694 +++ b/libipulog/libipulog.c
695 @@ -33,7 +33,7 @@
696 struct ipulog_handle
698 int fd;
699 - u_int8_t blocking;
700 + uint8_t blocking;
701 struct sockaddr_nl local;
702 struct sockaddr_nl peer;
703 struct nlmsghdr* last_nlhdr;
704 @@ -112,7 +112,7 @@ char *ipulog_strerror(int errcode)
707 /* convert a netlink group (1-32) to a group_mask suitable for create_handle */
708 -u_int32_t ipulog_group2gmask(u_int32_t group)
709 +uint32_t ipulog_group2gmask(uint32_t group)
711 if (group < 1 || group > 32)
713 @@ -123,8 +123,8 @@ u_int32_t ipulog_group2gmask(u_int32_t group)
716 /* create a ipulog handle for the reception of packets sent to gmask */
717 -struct ipulog_handle *ipulog_create_handle(u_int32_t gmask,
718 - u_int32_t rcvbufsize)
719 +struct ipulog_handle *ipulog_create_handle(uint32_t gmask,
720 + uint32_t rcvbufsize)
722 struct ipulog_handle *h;
723 int status;
724 diff --git a/output/mysql/ulogd_output_MYSQL.c b/output/mysql/ulogd_output_MYSQL.c
725 index 0a1ebfc..643320c 100644
726 --- a/output/mysql/ulogd_output_MYSQL.c
727 +++ b/output/mysql/ulogd_output_MYSQL.c
728 @@ -174,7 +174,7 @@ static int open_db_mysql(struct ulogd_pluginstance *upi)
729 struct mysql_instance *mi = (struct mysql_instance *) upi->private;
730 unsigned int connect_timeout = timeout_ce(upi->config_kset).u.value;
731 char *server = host_ce(upi->config_kset).u.string;
732 - u_int16_t port = port_ce(upi->config_kset).u.value;
733 + uint16_t port = port_ce(upi->config_kset).u.value;
734 char *user = user_ce(upi->config_kset).u.string;
735 char *pass = pass_ce(upi->config_kset).u.string;
736 char *db = db_ce(upi->config_kset).u.string;
737 diff --git a/src/addr.c b/src/addr.c
738 index 2672fab..41435dc 100644
739 --- a/src/addr.c
740 +++ b/src/addr.c
741 @@ -22,9 +22,9 @@
742 #include <ulogd/ulogd.h>
743 #include <ulogd/addr.h>
745 -u_int32_t ulogd_bits2netmask(int bits)
746 +uint32_t ulogd_bits2netmask(int bits)
748 - u_int32_t netmask, bm;
749 + uint32_t netmask, bm;
751 if (bits >= 32 || bits < 0)
752 return(~0);
753 diff --git a/util/db.c b/util/db.c
754 index 24966a5..c9aec41 100644
755 --- a/util/db.c
756 +++ b/util/db.c
757 @@ -362,7 +362,7 @@ static void __format_query_db(struct ulogd_pluginstance *upi, char *start)
758 sprintf(stmt_ins, "%u,", res->u.value.ui16);
759 break;
760 case ULOGD_RET_IPADDR:
761 - /* fallthrough when logging IP as u_int32_t */
762 + /* fallthrough when logging IP as uint32_t */
763 case ULOGD_RET_UINT32:
764 sprintf(stmt_ins, "%u,", res->u.value.ui32);
765 break;
766 diff --git a/util/printpkt.c b/util/printpkt.c
767 index eb6cfbf..69a47ca 100644
768 --- a/util/printpkt.c
769 +++ b/util/printpkt.c
770 @@ -199,7 +199,7 @@ static int printpkt_ipv4(struct ulogd_key *res, char *buf)
772 char *buf_cur = buf;
773 char tmp[INET_ADDRSTRLEN];
774 - u_int32_t paddr;
775 + uint32_t paddr;
777 if (pp_is_valid(res, KEY_IP_SADDR))
778 buf_cur += sprintf(buf_cur, "SRC=%s ",
779 @@ -363,8 +363,8 @@ static int printpkt_ipv6(struct ulogd_key *res, char *buf)
780 int printpkt_arp(struct ulogd_key *res, char *buf)
782 char *buf_cur = buf;
783 - u_int16_t code = 0;
784 - u_int8_t *mac;
785 + uint16_t code = 0;
786 + uint8_t *mac;
788 if (pp_is_valid(res, KEY_ARP_SPA))
789 buf_cur += sprintf(buf_cur, "SRC=%s ",
791 2.6.2