All of lore.kernel.org
 help / color / mirror / Atom feed
* [ulogd2 PATCH 2/4] Use stdint types everywhere
@ 2015-05-16 13:02 Felix Janda
  2015-06-23 12:37 ` Eric Leblond
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Janda @ 2015-05-16 13:02 UTC (permalink / raw)
  To: netfilter-devel

Signed-off-by: Felix Janda <felix.janda@posteo.de>
---
 filter/raw2packet/ulogd_raw2packet_BASE.c | 42 +++++++++++++++----------------
 filter/ulogd_filter_HWHDR.c               |  6 ++---
 filter/ulogd_filter_IP2HBIN.c             |  4 +--
 filter/ulogd_filter_IP2STR.c              |  2 +-
 filter/ulogd_filter_MARK.c                |  4 +--
 filter/ulogd_filter_PWSNIFF.c             |  4 +--
 include/libipulog/libipulog.h             |  4 +--
 include/ulogd/addr.h                      |  2 +-
 include/ulogd/conffile.h                  |  8 +++---
 include/ulogd/ipfix_protocol.h            | 36 +++++++++++++-------------
 include/ulogd/ulogd.h                     | 42 +++++++++++++++----------------
 input/packet/ulogd_inppkt_NFLOG.c         | 16 ++++++------
 input/packet/ulogd_inppkt_UNIXSOCK.c      | 34 ++++++++++++-------------
 libipulog/libipulog.c                     |  8 +++---
 output/mysql/ulogd_output_MYSQL.c         |  2 +-
 output/ulogd_output_IPFIX.c               | 20 +++++++--------
 src/addr.c                                |  4 +--
 util/db.c                                 |  2 +-
 util/printpkt.c                           |  6 ++---
 19 files changed, 123 insertions(+), 123 deletions(-)

diff --git a/filter/raw2packet/ulogd_raw2packet_BASE.c b/filter/raw2packet/ulogd_raw2packet_BASE.c
index c9d5227..2079c91 100644
--- a/filter/raw2packet/ulogd_raw2packet_BASE.c
+++ b/filter/raw2packet/ulogd_raw2packet_BASE.c
@@ -537,7 +537,7 @@ static struct ulogd_key iphdr_rets[] = {
  ***********************************************************************/
 
 static int _interp_tcp(struct ulogd_pluginstance *pi, struct tcphdr *tcph,
-		       u_int32_t len)
+		       uint32_t len)
 {
 	struct ulogd_key *ret = pi->output.keys;
 
@@ -572,7 +572,7 @@ static int _interp_tcp(struct ulogd_pluginstance *pi, struct tcphdr *tcph,
  ***********************************************************************/
 
 static int _interp_udp(struct ulogd_pluginstance *pi, struct udphdr *udph,
-		       u_int32_t len)
+		       uint32_t len)
 		
 {
 	struct ulogd_key *ret = pi->output.keys;
@@ -594,14 +594,14 @@ static int _interp_udp(struct ulogd_pluginstance *pi, struct udphdr *udph,
 
 /* Section 3.1.  SCTP Common Header Format */
 typedef struct sctphdr {
-	__be16 source;
-	__be16 dest;
-	__be32 vtag;
-	__be32 checksum;
+	uint16_t source;
+	uint16_t dest;
+	uint32_t vtag;
+	uint32_t checksum;
 } __attribute__((packed)) sctp_sctphdr_t;
 
 static int _interp_sctp(struct ulogd_pluginstance *pi, struct sctphdr *sctph,
-		       u_int32_t len)
+		       uint32_t len)
 		
 {
 	struct ulogd_key *ret = pi->output.keys;
@@ -624,7 +624,7 @@ static int _interp_sctp(struct ulogd_pluginstance *pi, struct sctphdr *sctph,
  ***********************************************************************/
 
 static int _interp_icmp(struct ulogd_pluginstance *pi, struct icmphdr *icmph,
-			u_int32_t len)
+			uint32_t len)
 {
 	struct ulogd_key *ret = pi->output.keys;
 
@@ -662,7 +662,7 @@ static int _interp_icmp(struct ulogd_pluginstance *pi, struct icmphdr *icmph,
  ***********************************************************************/
 
 static int _interp_icmpv6(struct ulogd_pluginstance *pi, struct icmp6_hdr *icmph,
-			  u_int32_t len)
+			  uint32_t len)
 {
 	struct ulogd_key *ret = pi->output.keys;
 
@@ -690,7 +690,7 @@ static int _interp_icmpv6(struct ulogd_pluginstance *pi, struct icmp6_hdr *icmph
  * 			IPSEC HEADER 
  ***********************************************************************/
 static int _interp_ahesp(struct ulogd_pluginstance *pi, void *protoh,
-			 u_int32_t len)
+			 uint32_t len)
 {
 #if 0
 	struct ulogd_key *ret = pi->output.keys;
@@ -710,14 +710,14 @@ static int _interp_ahesp(struct ulogd_pluginstance *pi, void *protoh,
  * 			IP HEADER
  ***********************************************************************/
 
-static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_iphdr(struct ulogd_pluginstance *pi, uint32_t len)
 {
 	struct ulogd_key *ret = pi->output.keys;
 	struct iphdr *iph =
 		ikey_get_ptr(&pi->input.keys[INKEY_RAW_PCKT]);
-	void *nexthdr = (u_int32_t *)iph + iph->ihl;
+	void *nexthdr = (uint32_t *)iph + iph->ihl;
 
-	if (len < sizeof(struct iphdr) || len <= (u_int32_t)(iph->ihl * 4))
+	if (len < sizeof(struct iphdr) || len <= (uint32_t)(iph->ihl * 4))
 		return ULOGD_IRET_OK;
 	len -= iph->ihl * 4;
 
@@ -758,7 +758,7 @@ static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
  * 			IPv6 HEADER
  ***********************************************************************/
 
-static int ip6_ext_hdr(u_int8_t nexthdr)
+static int ip6_ext_hdr(uint8_t nexthdr)
 {
 	switch (nexthdr) {
 	case IPPROTO_HOPOPTS:
@@ -773,12 +773,12 @@ static int ip6_ext_hdr(u_int8_t nexthdr)
 	}
 }
 
-static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_ipv6hdr(struct ulogd_pluginstance *pi, uint32_t len)
 {
 	struct ulogd_key *ret = pi->output.keys;
 	struct ip6_hdr *ipv6h = ikey_get_ptr(&pi->input.keys[INKEY_RAW_PCKT]);
 	unsigned int ptr, hdrlen = 0;
-	u_int8_t curhdr;
+	uint8_t curhdr;
 	int fragment = 0;
 
 	if (len < sizeof(struct ip6_hdr))
@@ -888,7 +888,7 @@ out:
 /***********************************************************************
  * 			ARP HEADER
  ***********************************************************************/
-static int _interp_arp(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_arp(struct ulogd_pluginstance *pi, uint32_t len)
 {
 	struct ulogd_key *ret = pi->output.keys;
 	const struct ether_arp *arph =
@@ -913,9 +913,9 @@ static int _interp_arp(struct ulogd_pluginstance *pi, u_int32_t len)
  * 			ETHER HEADER
  ***********************************************************************/
 
-static int _interp_bridge(struct ulogd_pluginstance *pi, u_int32_t len)
+static int _interp_bridge(struct ulogd_pluginstance *pi, uint32_t len)
 {
-	const u_int16_t proto =
+	const uint16_t proto =
 		ikey_get_u16(&pi->input.keys[INKEY_OOB_PROTOCOL]);
 
 	switch (proto) {
@@ -937,8 +937,8 @@ static int _interp_bridge(struct ulogd_pluginstance *pi, u_int32_t len)
 
 static int _interp_pkt(struct ulogd_pluginstance *pi)
 {
-	u_int32_t len = ikey_get_u32(&pi->input.keys[INKEY_RAW_PCKTLEN]);
-	u_int8_t family = ikey_get_u8(&pi->input.keys[INKEY_OOB_FAMILY]);
+	uint32_t len = ikey_get_u32(&pi->input.keys[INKEY_RAW_PCKTLEN]);
+	uint8_t family = ikey_get_u8(&pi->input.keys[INKEY_OOB_FAMILY]);
 	struct ulogd_key *ret = pi->output.keys;
 
 	okey_set_u16(&ret[KEY_OOB_PROTOCOL],
diff --git a/filter/ulogd_filter_HWHDR.c b/filter/ulogd_filter_HWHDR.c
index 3b095c9..10c95c4 100644
--- a/filter/ulogd_filter_HWHDR.c
+++ b/filter/ulogd_filter_HWHDR.c
@@ -143,10 +143,10 @@ static void *hwhdr_get_daddr(struct ulogd_key *inp)
 	return ikey_get_ptr(&inp[KEY_RAW_MAC]);
 }
 
-static u_int16_t hwhdr_get_len(struct ulogd_key *inp)
+static uint16_t hwhdr_get_len(struct ulogd_key *inp)
 {
 	void *len = ikey_get_ptr(&inp[KEY_RAW_MAC]) + 2 * ETH_ALEN;
-	return ntohs(*(u_int16_t *) len);
+	return ntohs(*(uint16_t *) len);
 }
 static int parse_ethernet(struct ulogd_key *ret, struct ulogd_key *inp)
 {
@@ -171,7 +171,7 @@ static int interp_mac2str(struct ulogd_pluginstance *pi)
 {
 	struct ulogd_key *ret = pi->output.keys;
 	struct ulogd_key *inp = pi->input.keys;
-	u_int16_t type = 0;
+	uint16_t type = 0;
 
 	if (pp_is_valid(inp, KEY_OOB_PROTOCOL))
 		okey_set_u16(&ret[KEY_MAC_PROTOCOL],
diff --git a/filter/ulogd_filter_IP2HBIN.c b/filter/ulogd_filter_IP2HBIN.c
index 4fd3ff1..087e824 100644
--- a/filter/ulogd_filter_IP2HBIN.c
+++ b/filter/ulogd_filter_IP2HBIN.c
@@ -116,8 +116,8 @@ static int interp_ip2hbin(struct ulogd_pluginstance *pi)
 {
 	struct ulogd_key *ret = pi->output.keys;
 	struct ulogd_key *inp = pi->input.keys;
-	u_int8_t family = ikey_get_u8(&inp[KEY_OOB_FAMILY]);
-	u_int8_t convfamily = family;
+	uint8_t family = ikey_get_u8(&inp[KEY_OOB_FAMILY]);
+	uint8_t convfamily = family;
 	int i;
 
 	switch (family) {
diff --git a/filter/ulogd_filter_IP2STR.c b/filter/ulogd_filter_IP2STR.c
index 732e1ef..66324b0 100644
--- a/filter/ulogd_filter_IP2STR.c
+++ b/filter/ulogd_filter_IP2STR.c
@@ -168,7 +168,7 @@ static int ip2str(struct ulogd_key *inp, int index, int oindex)
 	}
 
 	switch (convfamily) {
-		u_int32_t ip;
+		uint32_t ip;
 	case AF_INET6:
 		inet_ntop(AF_INET6,
 			  ikey_get_u128(&inp[index]),
diff --git a/filter/ulogd_filter_MARK.c b/filter/ulogd_filter_MARK.c
index 7807f63..149725d 100644
--- a/filter/ulogd_filter_MARK.c
+++ b/filter/ulogd_filter_MARK.c
@@ -73,14 +73,14 @@ static int interp_mark(struct ulogd_pluginstance *pi)
 	if (pp_is_valid(inp, KEY_CT_MARK)) {
 		if ((ikey_get_u32(&inp[KEY_CT_MARK]) &
 			pi->config_kset->ces[MARK_MASK].u.value) !=
-			(u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
+			(uint32_t) pi->config_kset->ces[MARK_MARK].u.value
 		   ) {
 			return ULOGD_IRET_STOP;
 		}
 	} else if (pp_is_valid(inp, KEY_OOB_MARK)) {
 		if ((ikey_get_u32(&inp[KEY_OOB_MARK]) &
 			pi->config_kset->ces[MARK_MASK].u.value) !=
-			(u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
+			(uint32_t) pi->config_kset->ces[MARK_MARK].u.value
 		   ) {
 			return ULOGD_IRET_STOP;
 		}
diff --git a/filter/ulogd_filter_PWSNIFF.c b/filter/ulogd_filter_PWSNIFF.c
index 5169eee..3d965e6 100644
--- a/filter/ulogd_filter_PWSNIFF.c
+++ b/filter/ulogd_filter_PWSNIFF.c
@@ -38,7 +38,7 @@
 #define PORT_POP3	110
 #define PORT_FTP	21
 
-static u_int16_t pwsniff_ports[] = {
+static uint16_t pwsniff_ports[] = {
 	PORT_POP3,
 	PORT_FTP,
 	/* feel free to include any other ports here, provided that their
@@ -71,7 +71,7 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi)
 		return ULOGD_IRET_STOP;
 	
 	iph = (struct iphdr *) pi->input.keys[0].u.value.ptr;
-	protoh = (u_int32_t *)iph + iph->ihl;
+	protoh = (uint32_t *)iph + iph->ihl;
 	tcph = protoh;
 	tcplen = ntohs(iph->tot_len) - iph->ihl * 4;
 
diff --git a/include/libipulog/libipulog.h b/include/libipulog/libipulog.h
index b3c9616..a74d690 100644
--- a/include/libipulog/libipulog.h
+++ b/include/libipulog/libipulog.h
@@ -20,9 +20,9 @@
 struct ipulog_handle;
 extern int ipulog_errno;
 
-u_int32_t ipulog_group2gmask(u_int32_t group);
+uint32_t ipulog_group2gmask(uint32_t group);
 
-struct ipulog_handle *ipulog_create_handle(u_int32_t gmask, u_int32_t rmem);
+struct ipulog_handle *ipulog_create_handle(uint32_t gmask, uint32_t rmem);
 
 void ipulog_destroy_handle(struct ipulog_handle *h);
 
diff --git a/include/ulogd/addr.h b/include/ulogd/addr.h
index b4432e3..b2e9ed6 100644
--- a/include/ulogd/addr.h
+++ b/include/ulogd/addr.h
@@ -8,7 +8,7 @@
 #ifndef _ADDR_H
 #define _ADDR_H
 
-u_int32_t ulogd_bits2netmask(int bits);
+uint32_t ulogd_bits2netmask(int bits);
 void ulogd_ipv6_cidr2mask_host(uint8_t cidr, uint32_t *res);
 void ulogd_ipv6_addr2addr_host(uint32_t *addr, uint32_t *res);
 
diff --git a/include/ulogd/conffile.h b/include/ulogd/conffile.h
index 69a6f70..269ae66 100644
--- a/include/ulogd/conffile.h
+++ b/include/ulogd/conffile.h
@@ -45,10 +45,10 @@ enum {
 
 struct config_entry {
 	char key[CONFIG_KEY_LEN];	/* name of config directive */
-	u_int8_t type;			/* type; see above */
-	u_int8_t options;		/* options; see above  */
-	u_int8_t hit;			/* found? */
-	u_int8_t flag;			/* tune setup of option */
+	uint8_t type;			/* type; see above */
+	uint8_t options;		/* options; see above  */
+	uint8_t hit;			/* found? */
+	uint8_t flag;			/* tune setup of option */
 	union {
 		char string[CONFIG_VAL_STRING_LEN];
 		int value;
diff --git a/include/ulogd/ipfix_protocol.h b/include/ulogd/ipfix_protocol.h
index 5d7e46a..8c9f61c 100644
--- a/include/ulogd/ipfix_protocol.h
+++ b/include/ulogd/ipfix_protocol.h
@@ -11,29 +11,29 @@
 
 /* Section 3.1 */
 struct ipfix_msg_hdr {
-	u_int16_t	version;
-	u_int16_t	length;
-	u_int32_t	export_time;
-	u_int32_t	seq;
-	u_int32_t	source_id;
+	uint16_t	version;
+	uint16_t	length;
+	uint32_t	export_time;
+	uint32_t	seq;
+	uint32_t	source_id;
 };
 
 /* Section 3.4.1 */
 struct ipfix_templ_rec_hdr {
-	u_int16_t	templ_id;
-	u_int16_t	field_count;
+	uint16_t	templ_id;
+	uint16_t	field_count;
 };
 
 /* Section 3.2 */
 struct ipfix_ietf_field {
-	u_int16_t	type;
-	u_int16_t	length;
+	uint16_t	type;
+	uint16_t	length;
 };
 
 struct ipfix_vendor_field {
-	u_int16_t	type;
-	u_int16_t	length;
-	u_int32_t	enterprise_num;
+	uint16_t	type;
+	uint16_t	length;
+	uint32_t	enterprise_num;
 };
 
 /* Information Element Identifiers as of draft-ietf-ipfix-info-11.txt */
@@ -219,13 +219,13 @@ enum {
 /* Information elements of the netfilter vendor id */
 enum {
 	IPFIX_NF_rawpacket		= 1,	/* pointer */
-	IPFIX_NF_rawpacket_length	= 2,	/* u_int32_t */
+	IPFIX_NF_rawpacket_length	= 2,	/* uint32_t */
 	IPFIX_NF_prefix			= 3,	/* string */
-	IPFIX_NF_mark			= 4,	/* u_int32_t */
-	IPFIX_NF_hook			= 5,	/* u_int8_t */
-	IPFIX_NF_conntrack_id		= 6,	/* u_int32_t */
-	IPFIX_NF_seq_local		= 7,	/* u_int32_t */
-	IPFIX_NF_seq_global		= 8,	/* u_int32_t */
+	IPFIX_NF_mark			= 4,	/* uint32_t */
+	IPFIX_NF_hook			= 5,	/* uint8_t */
+	IPFIX_NF_conntrack_id		= 6,	/* uint32_t */
+	IPFIX_NF_seq_local		= 7,	/* uint32_t */
+	IPFIX_NF_seq_global		= 8,	/* uint32_t */
 };
 
 #endif
diff --git a/include/ulogd/ulogd.h b/include/ulogd/ulogd.h
index cf26a15..2e38195 100644
--- a/include/ulogd/ulogd.h
+++ b/include/ulogd/ulogd.h
@@ -85,17 +85,17 @@ enum ulogd_dtype {
 /* structure describing an input  / output parameter of a plugin */
 struct ulogd_key {
 	/* length of the returned value (only for lengthed types */
-	u_int32_t len;
+	uint32_t len;
 	/* type of the returned value (ULOGD_DTYPE_...) */
-	u_int16_t type;
+	uint16_t type;
 	/* flags (i.e. free, ...) */
-	u_int16_t flags;
+	uint16_t flags;
 	/* name of this key */
 	char name[ULOGD_MAX_KEYLEN+1];
 	/* IETF IPFIX attribute ID */
 	struct {
-		u_int32_t	vendor;
-		u_int16_t	field_id;
+		uint32_t	vendor;
+		uint16_t	field_id;
 	} ipfix;
 
 	/* Store field name for Common Information Model */
@@ -104,12 +104,12 @@ struct ulogd_key {
 	union {
 		/* and finally the returned value */
 		union {
-			u_int8_t	b;
-			u_int8_t	ui8;
-			u_int16_t	ui16;
-			u_int32_t	ui32;
-			u_int64_t	ui64;
-			u_int32_t	ui128[4];
+			uint8_t	b;
+			uint8_t	ui8;
+			uint16_t	ui16;
+			uint32_t	ui32;
+			uint64_t	ui64;
+			uint32_t	ui128[4];
 			int8_t		i8;
 			int16_t		i16;
 			int32_t		i32;
@@ -130,31 +130,31 @@ struct ulogd_keyset {
 	unsigned int type;
 };
 
-static inline void okey_set_b(struct ulogd_key *key, u_int8_t value)
+static inline void okey_set_b(struct ulogd_key *key, uint8_t value)
 {
 	key->u.value.b = value;
 	key->flags |= ULOGD_RETF_VALID;
 }
 
-static inline void okey_set_u8(struct ulogd_key *key, u_int8_t value)
+static inline void okey_set_u8(struct ulogd_key *key, uint8_t value)
 {
 	key->u.value.ui8 = value;
 	key->flags |= ULOGD_RETF_VALID;
 }
 
-static inline void okey_set_u16(struct ulogd_key *key, u_int16_t value)
+static inline void okey_set_u16(struct ulogd_key *key, uint16_t value)
 {
 	key->u.value.ui16 = value;
 	key->flags |= ULOGD_RETF_VALID;
 }
 
-static inline void okey_set_u32(struct ulogd_key *key, u_int32_t value)
+static inline void okey_set_u32(struct ulogd_key *key, uint32_t value)
 {
 	key->u.value.ui32 = value;
 	key->flags |= ULOGD_RETF_VALID;
 }
 
-static inline void okey_set_u64(struct ulogd_key *key, u_int64_t value)
+static inline void okey_set_u64(struct ulogd_key *key, uint64_t value)
 {
 	key->u.value.ui64 = value;
 	key->flags |= ULOGD_RETF_VALID;
@@ -172,22 +172,22 @@ static inline void okey_set_ptr(struct ulogd_key *key, void *value)
 	key->flags |= ULOGD_RETF_VALID;
 }
 
-static inline u_int8_t ikey_get_u8(struct ulogd_key *key)
+static inline uint8_t ikey_get_u8(struct ulogd_key *key)
 {
 	return key->u.source->u.value.ui8;
 }
 
-static inline u_int16_t ikey_get_u16(struct ulogd_key *key)
+static inline uint16_t ikey_get_u16(struct ulogd_key *key)
 {
 	return key->u.source->u.value.ui16;
 }
 
-static inline u_int32_t ikey_get_u32(struct ulogd_key *key)
+static inline uint32_t ikey_get_u32(struct ulogd_key *key)
 {
 	return key->u.source->u.value.ui32;
 }
 
-static inline u_int64_t ikey_get_u64(struct ulogd_key *key)
+static inline uint64_t ikey_get_u64(struct ulogd_key *key)
 {
 	return key->u.source->u.value.ui64;
 }
@@ -292,7 +292,7 @@ void ulogd_propagate_results(struct ulogd_pluginstance *pi);
 void ulogd_register_plugin(struct ulogd_plugin *me);
 
 /* allocate a new ulogd_key */
-struct ulogd_key *alloc_ret(const u_int16_t type, const char*);
+struct ulogd_key *alloc_ret(const uint16_t type, const char*);
 
 /* write a message to the daemons' logfile */
 void __ulogd_log(int level, char *file, int line, const char *message, ...);
diff --git a/input/packet/ulogd_inppkt_NFLOG.c b/input/packet/ulogd_inppkt_NFLOG.c
index 6196626..a367959 100644
--- a/input/packet/ulogd_inppkt_NFLOG.c
+++ b/input/packet/ulogd_inppkt_NFLOG.c
@@ -315,7 +315,7 @@ static struct ulogd_key output_keys[] = {
 };
 
 static inline int
-interp_packet(struct ulogd_pluginstance *upi, u_int8_t pf_family,
+interp_packet(struct ulogd_pluginstance *upi, uint8_t pf_family,
 	      struct nflog_data *ldata)
 {
 	struct ulogd_key *ret = upi->output.keys;
@@ -326,12 +326,12 @@ interp_packet(struct ulogd_pluginstance *upi, u_int8_t pf_family,
 	int payload_len = nflog_get_payload(ldata, &payload);
 	char *prefix = nflog_get_prefix(ldata);
 	struct timeval ts;
-	u_int32_t mark = nflog_get_nfmark(ldata);
-	u_int32_t indev = nflog_get_indev(ldata);
-	u_int32_t outdev = nflog_get_outdev(ldata);
-	u_int32_t seq;
-	u_int32_t uid;
-	u_int32_t gid;
+	uint32_t mark = nflog_get_nfmark(ldata);
+	uint32_t indev = nflog_get_indev(ldata);
+	uint32_t outdev = nflog_get_outdev(ldata);
+	uint32_t seq;
+	uint32_t uid;
+	uint32_t gid;
 
 	okey_set_u8(&ret[NFLOG_KEY_OOB_FAMILY], 
 		    pf_family);
@@ -493,7 +493,7 @@ static int configure(struct ulogd_pluginstance *upi,
 	return 0;
 }
 
-static int become_system_logging(struct ulogd_pluginstance *upi, u_int8_t pf)
+static int become_system_logging(struct ulogd_pluginstance *upi, uint8_t pf)
 {
 	struct nflog_input *ui = (struct nflog_input *) upi->private;
 
diff --git a/input/packet/ulogd_inppkt_UNIXSOCK.c b/input/packet/ulogd_inppkt_UNIXSOCK.c
index e4009f3..39944bf 100644
--- a/input/packet/ulogd_inppkt_UNIXSOCK.c
+++ b/input/packet/ulogd_inppkt_UNIXSOCK.c
@@ -336,10 +336,10 @@ enum ulogd2_option_type {
 	ULOGD2_OPT_PREFIX,	/* log prefix (string) */
 	ULOGD2_OPT_OOB_IN,	/* input device (string) */
 	ULOGD2_OPT_OOB_OUT,	/* output device (string) */
-	ULOGD2_OPT_OOB_TIME_SEC,	/* packet arrival time (u_int32_t) */
+	ULOGD2_OPT_OOB_TIME_SEC,	/* packet arrival time (uint32_t) */
 
 	ULOGD2_OPT_USER=200,	/* user name (string) */
-	ULOGD2_OPT_USERID,	/* user id (u_int32_t) */
+	ULOGD2_OPT_USERID,	/* user id (uint32_t) */
 	ULOGD2_OPT_OSNAME,	/* OS name (string) */
 	ULOGD2_OPT_OSREL,	/* OS release (string) */
 	ULOGD2_OPT_OSVERS,	/* OS version (string) */
@@ -367,15 +367,15 @@ struct ulogd_unixsock_option_t  {
 #define USOCK_ALIGNTO 8
 #define USOCK_ALIGN(len) ( ((len)+USOCK_ALIGNTO-1) & ~(USOCK_ALIGNTO-1) )
 
-static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_packet_t *pkt, u_int16_t total_len)
+static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_packet_t *pkt, uint16_t total_len)
 {
 	char *data = NULL;
 	struct iphdr *ip;
 	struct ulogd_key *ret = upi->output.keys;
-	u_int8_t oob_family;
-	u_int16_t payload_len;
-	u_int32_t option_number;
-	u_int32_t option_length;
+	uint8_t oob_family;
+	uint16_t payload_len;
+	uint32_t option_number;
+	uint32_t option_length;
 	char *buf;
 	struct ulogd_unixsock_option_t *option;
 	int new_offset;
@@ -398,7 +398,7 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
 	okey_set_u32(&ret[UNIXSOCK_KEY_RAW_PCKTLEN], payload_len);
 
 	/* options */
-	if (total_len > payload_len + sizeof(u_int16_t)) {
+	if (total_len > payload_len + sizeof(uint16_t)) {
 		/* option starts at the next aligned address after the payload */
 		new_offset = USOCK_ALIGN(payload_len);
 		options_start = (void*)ip + new_offset;
@@ -431,13 +431,13 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
 				okey_set_ptr(&ret[UNIXSOCK_KEY_OOB_OUT], buf);
 				break;
 			case ULOGD2_OPT_OOB_TIME_SEC:
-				okey_set_u32(&ret[UNIXSOCK_KEY_OOB_TIME_SEC], *(u_int32_t*)buf);
+				okey_set_u32(&ret[UNIXSOCK_KEY_OOB_TIME_SEC], *(uint32_t*)buf);
 				break;
 			case ULOGD2_OPT_USER:
 				okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_USER_NAME], buf);
 				break;
 			case ULOGD2_OPT_USERID:
-				okey_set_u32(&ret[UNIXSOCK_KEY_NUFW_USER_ID], *(u_int32_t*)buf);
+				okey_set_u32(&ret[UNIXSOCK_KEY_NUFW_USER_ID], *(uint32_t*)buf);
 				break;
 			case ULOGD2_OPT_OSNAME:
 				okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_OS_NAME], buf);
@@ -452,7 +452,7 @@ static int handle_packet(struct ulogd_pluginstance *upi, struct ulogd_unixsock_p
 				okey_set_ptr(&ret[UNIXSOCK_KEY_NUFW_APP_NAME], buf);
 				break;
 			case ULOGD2_OPT_STATE:
-				okey_set_u8(&ret[UNIXSOCK_KEY_RAW_LABEL], *(u_int8_t*)buf);
+				okey_set_u8(&ret[UNIXSOCK_KEY_RAW_LABEL], *(uint8_t*)buf);
 				break;
 			default:
 				ulogd_log(ULOGD_NOTICE,
@@ -595,8 +595,8 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
 	struct ulogd_pluginstance *upi = param;
 	struct unixsock_input *ui = (struct unixsock_input*)upi->private;
 	int len;
-	u_int16_t needed_len;
-	u_int32_t packet_sig;
+	uint16_t needed_len;
+	uint32_t packet_sig;
 	struct ulogd_unixsock_packet_t *unixsock_packet;
 
 	char buf[4096];
@@ -642,7 +642,7 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
 
 		needed_len = ntohs(unixsock_packet->total_size);
 
-		if (ui->unixsock_buf_avail >= needed_len + sizeof(u_int32_t)) {
+		if (ui->unixsock_buf_avail >= needed_len + sizeof(uint32_t)) {
 			ulogd_log(ULOGD_DEBUG,
 			"  We have enough data (%d bytes required), handling packet\n",
 					needed_len);
@@ -651,11 +651,11 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
 				return -1;
 			}
 			/* consume data */
-			ui->unixsock_buf_avail -= (sizeof(u_int32_t) + needed_len);
+			ui->unixsock_buf_avail -= (sizeof(uint32_t) + needed_len);
 			if (ui->unixsock_buf_avail > 0) {
 				/* we need to shift data .. */
 				memmove(ui->unixsock_buf,
-						ui->unixsock_buf + (sizeof(u_int32_t) + needed_len) ,
+						ui->unixsock_buf + (sizeof(uint32_t) + needed_len) ,
 						ui->unixsock_buf_avail);
 			} else {
 				/* input buffer is empty, do not loop */
@@ -664,7 +664,7 @@ static int unixsock_instance_read_cb(int fd, unsigned int what, void *param)
 
 		} else {
 			ulogd_log(ULOGD_DEBUG, "  We have %d bytes, but need %d. Requesting more\n",
-					ui->unixsock_buf_avail, needed_len + sizeof(u_int32_t));
+					ui->unixsock_buf_avail, needed_len + sizeof(uint32_t));
 			return 0;
 		}
 
diff --git a/libipulog/libipulog.c b/libipulog/libipulog.c
index ab28bb4..b49f7f2 100644
--- a/libipulog/libipulog.c
+++ b/libipulog/libipulog.c
@@ -33,7 +33,7 @@
 struct ipulog_handle
 {
 	int fd;
-	u_int8_t blocking;
+	uint8_t blocking;
 	struct sockaddr_nl local;
 	struct sockaddr_nl peer;
 	struct nlmsghdr* last_nlhdr;
@@ -112,7 +112,7 @@ char *ipulog_strerror(int errcode)
 }
 
 /* convert a netlink group (1-32) to a group_mask suitable for create_handle */
-u_int32_t ipulog_group2gmask(u_int32_t group)
+uint32_t ipulog_group2gmask(uint32_t group)
 {
 	if (group < 1 || group > 32)
 	{
@@ -123,8 +123,8 @@ u_int32_t ipulog_group2gmask(u_int32_t group)
 }
 
 /* create a ipulog handle for the reception of packets sent to gmask */
-struct ipulog_handle *ipulog_create_handle(u_int32_t gmask, 
-					   u_int32_t rcvbufsize)
+struct ipulog_handle *ipulog_create_handle(uint32_t gmask,
+					   uint32_t rcvbufsize)
 {
 	struct ipulog_handle *h;
 	int status;
diff --git a/output/mysql/ulogd_output_MYSQL.c b/output/mysql/ulogd_output_MYSQL.c
index 0a1ebfc..643320c 100644
--- a/output/mysql/ulogd_output_MYSQL.c
+++ b/output/mysql/ulogd_output_MYSQL.c
@@ -174,7 +174,7 @@ static int open_db_mysql(struct ulogd_pluginstance *upi)
 	struct mysql_instance *mi = (struct mysql_instance *) upi->private;
 	unsigned int connect_timeout = timeout_ce(upi->config_kset).u.value;
 	char *server = host_ce(upi->config_kset).u.string;
-	u_int16_t port = port_ce(upi->config_kset).u.value;
+	uint16_t port = port_ce(upi->config_kset).u.value;
 	char *user = user_ce(upi->config_kset).u.string;
 	char *pass = pass_ce(upi->config_kset).u.string;
 	char *db = db_ce(upi->config_kset).u.string;
diff --git a/output/ulogd_output_IPFIX.c b/output/ulogd_output_IPFIX.c
index 761d272..62f1d60 100644
--- a/output/ulogd_output_IPFIX.c
+++ b/output/ulogd_output_IPFIX.c
@@ -44,19 +44,19 @@
 #endif
 
 #ifdef IPPROTO_SCTP
-typedef u_int32_t sctp_assoc_t;
+typedef uint32_t sctp_assoc_t;
 
 /* glibc doesn't yet have this, as defined by
  * draft-ietf-tsvwg-sctpsocket-11.txt */
 struct sctp_sndrcvinfo {
-	u_int16_t	sinfo_stream;
-	u_int16_t	sinfo_ssn;
-	u_int16_t	sinfo_flags;
-	u_int32_t	sinfo_ppid;
-	u_int32_t	sinfo_context;
-	u_int32_t	sinfo_timetolive;
-	u_int32_t	sinfo_tsn;
-	u_int32_t	sinfo_cumtsn;
+	uint16_t	sinfo_stream;
+	uint16_t	sinfo_ssn;
+	uint16_t	sinfo_flags;
+	uint32_t	sinfo_ppid;
+	uint32_t	sinfo_context;
+	uint32_t	sinfo_timetolive;
+	uint32_t	sinfo_tsn;
+	uint32_t	sinfo_cumtsn;
 	sctp_assoc_t	sinfo_assoc_id;
 };
 #endif
@@ -207,7 +207,7 @@ struct ipfix_instance {
 };
 
 #define ULOGD_IPFIX_TEMPL_BASE 1024
-static u_int16_t next_template_id = ULOGD_IPFIX_TEMPL_BASE;
+static uint16_t next_template_id = ULOGD_IPFIX_TEMPL_BASE;
 
 /* Build the IPFIX template from the input keys */
 struct ulogd_ipfix_template *
diff --git a/src/addr.c b/src/addr.c
index 2672fab..41435dc 100644
--- a/src/addr.c
+++ b/src/addr.c
@@ -22,9 +22,9 @@
 #include <ulogd/ulogd.h>
 #include <ulogd/addr.h>
 
-u_int32_t ulogd_bits2netmask(int bits)
+uint32_t ulogd_bits2netmask(int bits)
 {
-	u_int32_t netmask, bm;
+	uint32_t netmask, bm;
 
 	if (bits >= 32 || bits < 0)
 		return(~0);
diff --git a/util/db.c b/util/db.c
index 24966a5..c9aec41 100644
--- a/util/db.c
+++ b/util/db.c
@@ -362,7 +362,7 @@ static void __format_query_db(struct ulogd_pluginstance *upi, char *start)
 			sprintf(stmt_ins, "%u,", res->u.value.ui16);
 			break;
 		case ULOGD_RET_IPADDR:
-			/* fallthrough when logging IP as u_int32_t */
+			/* fallthrough when logging IP as uint32_t */
 		case ULOGD_RET_UINT32:
 			sprintf(stmt_ins, "%u,", res->u.value.ui32);
 			break;
diff --git a/util/printpkt.c b/util/printpkt.c
index eb6cfbf..69a47ca 100644
--- a/util/printpkt.c
+++ b/util/printpkt.c
@@ -199,7 +199,7 @@ static int printpkt_ipv4(struct ulogd_key *res, char *buf)
 {
 	char *buf_cur = buf;
 	char tmp[INET_ADDRSTRLEN];
-	u_int32_t paddr;
+	uint32_t paddr;
 
 	if (pp_is_valid(res, KEY_IP_SADDR))
 		buf_cur += sprintf(buf_cur, "SRC=%s ",
@@ -363,8 +363,8 @@ static int printpkt_ipv6(struct ulogd_key *res, char *buf)
 int printpkt_arp(struct ulogd_key *res, char *buf)
 {
 	char *buf_cur = buf;
-	u_int16_t code = 0;
-	u_int8_t *mac;
+	uint16_t code = 0;
+	uint8_t *mac;
 
 	if (pp_is_valid(res, KEY_ARP_SPA))
 		buf_cur += sprintf(buf_cur, "SRC=%s ",
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [ulogd2 PATCH 2/4] Use stdint types everywhere
  2015-05-16 13:02 [ulogd2 PATCH 2/4] Use stdint types everywhere Felix Janda
@ 2015-06-23 12:37 ` Eric Leblond
  2015-06-23 17:26   ` Felix Janda
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Leblond @ 2015-06-23 12:37 UTC (permalink / raw)
  To: Felix Janda, netfilter-devel

> Hello Felix,

Sorry for the delay in the answer.

Other patches of the series are ok, comments on this one inline.

On Sat, 2015-05-16 at 15:02 +0200, Felix Janda wrote:
> Signed-off-by: Felix Janda <felix.janda@posteo.de>
> ---
>  filter/raw2packet/ulogd_raw2packet_BASE.c | 42 +++++++++++++++------
> ----------
>  filter/ulogd_filter_HWHDR.c               |  6 ++---
>  filter/ulogd_filter_IP2HBIN.c             |  4 +--
>  filter/ulogd_filter_IP2STR.c              |  2 +-
>  filter/ulogd_filter_MARK.c                |  4 +--
>  filter/ulogd_filter_PWSNIFF.c             |  4 +--
>  include/libipulog/libipulog.h             |  4 +--
>  include/ulogd/addr.h                      |  2 +-
>  include/ulogd/conffile.h                  |  8 +++---
>  include/ulogd/ipfix_protocol.h            | 36 +++++++++++++--------
> -----
>  include/ulogd/ulogd.h                     | 42 +++++++++++++++------
> ----------
>  input/packet/ulogd_inppkt_NFLOG.c         | 16 ++++++------
>  input/packet/ulogd_inppkt_UNIXSOCK.c      | 34 ++++++++++++---------
> ----
>  libipulog/libipulog.c                     |  8 +++---
>  output/mysql/ulogd_output_MYSQL.c         |  2 +-
>  output/ulogd_output_IPFIX.c               | 20 +++++++--------
>  src/addr.c                                |  4 +--
>  util/db.c                                 |  2 +-
>  util/printpkt.c                           |  6 ++---
>  19 files changed, 123 insertions(+), 123 deletions(-)


I'm ok with the idea of the patch but this is not building anymore on
my Debian.

|| make[2]: Entering directory
'/home/eric/git/netfilter/ulogd2/libipulog'
||   CC       libipulog.lo
include/libipulog/libipulog.h|23 col 1| error: unknown type name
'uint32_t'
||  uint32_t ipulog_group2gmask(uint32_t group);
||  ^
include/libipulog/libipulog.h|23 col 29| error: unknown type name
'uint32_t'
||  uint32_t ipulog_group2gmask(uint32_t group);
||                              ^
int32_t group);
||                              ^


I've got plenty of similar error.

Could you fix this an resubmit ?

BR,
-- 
Eric Leblond <eric@regit.org>
Blog: https://home.regit.org/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ulogd2 PATCH 2/4] Use stdint types everywhere
  2015-06-23 12:37 ` Eric Leblond
@ 2015-06-23 17:26   ` Felix Janda
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Janda @ 2015-06-23 17:26 UTC (permalink / raw)
  To: Eric Leblond; +Cc: netfilter-devel

Hi Eric,

sorry for the bad patch. A new patch will follow in a minute.

Thanks,
Felix

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-23 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-16 13:02 [ulogd2 PATCH 2/4] Use stdint types everywhere Felix Janda
2015-06-23 12:37 ` Eric Leblond
2015-06-23 17:26   ` Felix Janda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.