Skip to contentSkip to conversation

Use stdint types everywhere

PATCH Applied Felix Janda 1 participant 1 message May 16, 2015 netfilter

v1 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Use stdint types everywhere

---
 include/internal/bitops.h                          |  14 +--
 include/internal/internal.h                        |   4 +-
 include/internal/object.h                          | 126 ++++++++++-----------
 include/internal/prototypes.h                      |  12 +-
 .../libnetfilter_conntrack.h                       |  84 +++++++-------
 qa/ct_echo_event.c                                 |   4 +-
 qa/ct_mark_filter.c                                |   4 +-
 qa/nssocket.c                                      |  14 +--
 qa/nssocket.h                                      |   6 +-
 src/callback.c                                     |   6 +-
 src/conntrack/api.c                                |  44 +++----
 src/conntrack/bsf.c                                |  14 +--
 src/conntrack/build.c                              |  50 ++++----
 src/conntrack/filter.c                             |   8 +-
 src/conntrack/filter_dump.c                        |   2 +-
 src/conntrack/grp_getter.c                         |  12 +-
 src/conntrack/grp_setter.c                         |  18 +--
 src/conntrack/parse.c                              |  82 +++++++-------
 src/conntrack/parse_mnl.c                          |   6 +-
 src/conntrack/setter.c                             | 126 ++++++++++-----------
 src/conntrack/snprintf_xml.c                       |   4 +-
 src/expect/api.c                                   |  26 ++---
 src/expect/build.c                                 |   6 +-
 src/expect/parse.c                                 |  14 +--
 src/expect/setter.c                                |  10 +-
 src/main.c                                         |   4 +-
 utils/conntrack_dump.c                             |   2 +-
 utils/conntrack_flush.c                            |   2 +-
 utils/expect_dump.c                                |   2 +-
 utils/expect_flush.c                               |   2 +-
 30 files changed, 354 insertions(+), 354 deletions(-)
include/internal/bitops.h +7 -7
index aefff0e..34d12c3 100644
@@ -4,28 +4,28 @@
 #ifndef _NFCT_BITOPS_H_
 #define _NFCT_BITOPS_H_
 
-static inline void set_bit(int nr, u_int32_t *addr)
+static inline void set_bit(int nr, uint32_t *addr)
 {
 	addr[nr >> 5] |= (1UL << (nr & 31));
 }
 
-static inline void unset_bit(int nr, u_int32_t *addr)
+static inline void unset_bit(int nr, uint32_t *addr)
 {
 	addr[nr >> 5] &= ~(1UL << (nr & 31));
 }
 
-static inline void set_bit_u16(int nr, u_int16_t *addr)
+static inline void set_bit_u16(int nr, uint16_t *addr)
 {
 	addr[nr >> 4] |= (1UL << (nr & 15));
 }
 
-static inline void unset_bit_u16(int nr, u_int16_t *addr)
+static inline void unset_bit_u16(int nr, uint16_t *addr)
 {
 	addr[nr >> 4] &= ~(1UL << (nr & 15));
 }
 
 static inline void
-set_bitmask_u32(u_int32_t *buf1, const u_int32_t *buf2, int len)
+set_bitmask_u32(uint32_t *buf1, const uint32_t *buf2, int len)
 {
 	int i;
 
@@ -34,7 +34,7 @@ set_bitmask_u32(u_int32_t *buf1, const u_int32_t *buf2, int len)
 }
 
 static inline void
-unset_bitmask_u32(u_int32_t *buf1, const u_int32_t *buf2, int len)
+unset_bitmask_u32(uint32_t *buf1, const uint32_t *buf2, int len)
 {
 	int i;
 
@@ -42,7 +42,7 @@ unset_bitmask_u32(u_int32_t *buf1, const u_int32_t *buf2, int len)
 		buf1[i] &= ~buf2[i];
 }
 
-static inline int test_bit(int nr, const u_int32_t *addr)
+static inline int test_bit(int nr, const uint32_t *addr)
 {
 	return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
 }
include/internal/internal.h +2 -2
index aaf6bd4..45b4aa7 100644
@@ -78,8 +78,8 @@
 
 /* extracted from include/linux/netfilter/nf_conntrack_tcp.h .*/
 struct nf_ct_tcp_flags {
-	u_int8_t flags;
-	u_int8_t mask;
+	uint8_t flags;
+	uint8_t mask;
 };
 
 #define NFCT_BITMASK_AND	0
include/internal/object.h +63 -63

254 lines not on this page · raw message

include/internal/prototypes.h +6 -6
index 21aa7f3..a984a2f 100644
@@ -4,11 +4,11 @@
 /*
  * conntrack internal prototypes
  */
-int __build_conntrack(struct nfnl_subsys_handle *ssh, struct nfnlhdr *req, size_t size, u_int16_t type, u_int16_t flags, const struct nf_conntrack *ct);
+int __build_conntrack(struct nfnl_subsys_handle *ssh, struct nfnlhdr *req, size_t size, uint16_t type, uint16_t flags, const struct nf_conntrack *ct);
 void __build_tuple(struct nfnlhdr *req, size_t size, const struct __nfct_tuple *t, const int type);
 int __parse_message_type(const struct nlmsghdr *nlh);
 void __parse_conntrack(const struct nlmsghdr *nlh, struct nfattr *cda[], struct nf_conntrack *ct);
-void __parse_tuple(const struct nfattr *attr, struct __nfct_tuple *tuple, int dir, u_int32_t *set);
+void __parse_tuple(const struct nfattr *attr, struct __nfct_tuple *tuple, int dir, uint32_t *set);
 int __snprintf_conntrack(char *buf, unsigned int len, const struct nf_conntrack *ct, unsigned int type, unsigned int msg_output, unsigned int flags, struct nfct_labelmap *);
 int __snprintf_address(char *buf, unsigned int len, const struct __nfct_tuple *tuple, const char *src_tag, const char *dst_tag);
 int __snprintf_protocol(char *buf, unsigned int len, const struct nf_conntrack *ct);
@@ -25,8 +25,8 @@ int __snprintf_addr_xml(char *buf, unsigned int len, const struct __nfct_tuple *
 int __snprintf_proto_xml(char *buf, unsigned int len, const struct __nfct_tuple *tuple, enum __nfct_addr type);
 int __snprintf_localtime_xml(char *buf, unsigned int len, const struct tm *tm);
 
-const char *__proto2str(u_int8_t protonum);
-const char *__l3proto2str(u_int8_t protonum);
+const char *__proto2str(uint8_t protonum);
+const char *__l3proto2str(uint8_t protonum);
 
 int __callback(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data);
 
@@ -41,12 +41,12 @@ int __setup_netlink_socket_filter(int fd, struct nfct_filter *filter);
 void __build_filter_dump(struct nfnlhdr *req, size_t size, const struct nfct_filter_dump *filter_dump);
 
 int nfct_build_tuple(struct nlmsghdr *nlh, const struct __nfct_tuple *t, int type);
-int nfct_parse_tuple(const struct nlattr *attr, struct __nfct_tuple *tuple, int dir, u_int32_t *set);
+int nfct_parse_tuple(const struct nlattr *attr, struct __nfct_tuple *tuple, int dir, uint32_t *set);
 
 /*
  * expectation internal prototypes
  */
-int __build_expect(struct nfnl_subsys_handle *ssh, struct nfnlhdr *req, size_t size, u_int16_t type, u_int16_t flags, const struct nf_expect *exp);
+int __build_expect(struct nfnl_subsys_handle *ssh, struct nfnlhdr *req, size_t size, uint16_t type, uint16_t flags, const struct nf_expect *exp);
 int __parse_expect_message_type(const struct nlmsghdr *nlh);
 void __parse_expect(const struct nlmsghdr *nlh, struct nfattr *cda[], struct nf_expect *exp);
 int __expect_callback(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data);
include/libnetfilter_conntrack/libnetfilter_conntrack.h +42 -42

207 lines not on this page · raw message

qa/ct_echo_event.c +2 -2
index 6874395..eb9c82f 100644
@@ -11,7 +11,7 @@
 static void udp_echo(const struct mnl_socket *nl,
 		     const char *pre, const char *post)
 {
-	u_int8_t proto = IPPROTO_UDP;
+	uint8_t proto = IPPROTO_UDP;
 
 	sync_fifo(pre);
 	timeout.tv_sec = INIT_TIMEOUT;
@@ -25,7 +25,7 @@ static void udp_echo(const struct mnl_socket *nl,
 static void icmp_echo(const struct mnl_socket *nl,
 		      const char *pre, const char *post)
 {
-	u_int8_t proto = IPPROTO_ICMP;
+	uint8_t proto = IPPROTO_ICMP;
 
 	sync_fifo(pre);
 	timeout.tv_sec = INIT_TIMEOUT;
qa/ct_mark_filter.c +2 -2
index 276344a..cd6dd27 100644
@@ -12,7 +12,7 @@
 static void tcp_echo_before_fin(const struct mnl_socket *nl,
 			       const char *pre, const char *post)
 {
-	u_int8_t proto = IPPROTO_TCP;
+	uint8_t proto = IPPROTO_TCP;
 
 	sync_fifo(pre);
 	timeout.tv_sec = INIT_TIMEOUT;
@@ -26,7 +26,7 @@ static void tcp_echo_before_fin(const struct mnl_socket *nl,
 static void tcp_echo_after_fin(const struct mnl_socket *nl,
 			       const char *pre, const char *post)
 {
-	u_int8_t proto = IPPROTO_TCP;
+	uint8_t proto = IPPROTO_TCP;
 
 	sync_fifo(pre);
 	timeout.tv_sec = INIT_TIMEOUT;
qa/nssocket.c +7 -7
index a5f606d..114938c 100644
@@ -435,7 +435,7 @@ struct nf_conntrack *author_new(const struct nlmsghdr *nlh, void *data)
 	ct = nfct_new();
 	assert(ct != NULL);
 	assert(nfct_nlmsg_parse((nlh), ct) == 0);
-	assert_proto(ct, AF_INET, *(u_int8_t *) data);
+	assert_proto(ct, AF_INET, *(uint8_t *) data);
 	assert_inaddr(ct, VETH_PARENT_ADDR, VETH_CHILD_ADDR);
 	assert((nfct_get_attr_u32(ct, ATTR_STATUS) & IPS_SEEN_REPLY) == 0);
 	timeout.tv_sec = nfct_get_attr_u32(ct, ATTR_TIMEOUT) + 1;
@@ -452,7 +452,7 @@ struct nf_conntrack *author_update(const struct nlmsghdr *nlh, void *data)
 	ct = nfct_new();
 	assert(ct != NULL);
 	assert(nfct_nlmsg_parse((nlh), ct) == 0);
-	assert_proto(ct, AF_INET, *(u_int8_t *) data);
+	assert_proto(ct, AF_INET, *(uint8_t *) data);
 	assert_inaddr(ct, VETH_PARENT_ADDR, VETH_CHILD_ADDR);
 	assert((nfct_get_attr_u32(ct, ATTR_STATUS) & IPS_SEEN_REPLY));
 	timeout.tv_sec = nfct_get_attr_u32(ct, ATTR_TIMEOUT) + 1;
@@ -469,7 +469,7 @@ struct nf_conntrack *author_destroy(const struct nlmsghdr *nlh, void *data)
 	ct = nfct_new();
 	assert(ct != NULL);
 	assert(nfct_nlmsg_parse((nlh), ct) == 0);
-	assert_proto(ct, AF_INET, *(u_int8_t *) data);
+	assert_proto(ct, AF_INET, *(uint8_t *) data);
 	assert_inaddr(ct, VETH_PARENT_ADDR, VETH_CHILD_ADDR);
 	assert((nfct_get_attr_u32(ct, ATTR_STATUS) & IPS_SEEN_REPLY));
 
@@ -477,7 +477,7 @@ struct nf_conntrack *author_destroy(const struct nlmsghdr *nlh, void *data)
 }
 
 void assert_proto(const struct nf_conntrack *ct,
-		  u_int8_t l3proto, u_int8_t l4proto)
+		  uint8_t l3proto, uint8_t l4proto)
 {
 	assert(nfct_get_attr_u8(ct, ATTR_ORIG_L3PROTO) == l3proto);
 	assert(nfct_get_attr_u8(ct, ATTR_REPL_L3PROTO) == l3proto);
@@ -498,7 +498,7 @@ void assert_inaddr(const struct nf_conntrack *ct,
 }
 
 void assert_port(const struct nf_conntrack *ct,
-		 u_int16_t src, u_int16_t dst)
+		 uint16_t src, uint16_t dst)
 {
 	if ((src)) {
 		assert(nfct_get_attr_u16((ct), ATTR_ORIG_PORT_SRC) == htons((src)));
@@ -511,7 +511,7 @@ void assert_port(const struct nf_conntrack *ct,
 }
 
 void assert_typecode(const struct nf_conntrack *ct,
-		     u_int8_t type, u_int8_t code)
+		     uint8_t type, uint8_t code)
 {
 	assert(nfct_get_attr_u8((ct), ATTR_ICMP_TYPE) == type);
 	assert(nfct_get_attr_u8((ct), ATTR_ICMP_CODE) == code);
@@ -636,7 +636,7 @@ int cb_tcp_destroy(const struct nlmsghdr *nlh, void *data)
 void tcp_echo(const struct mnl_socket *nl,
 	      const char *pre, const char *post)
 {
-	u_int8_t proto = IPPROTO_TCP;
+	uint8_t proto = IPPROTO_TCP;
 
 	sync_fifo(pre);
 	timeout.tv_sec = INIT_TIMEOUT;
qa/nssocket.h +3 -3
index 17c859f..338ed2f 100644
@@ -29,13 +29,13 @@ struct nf_conntrack *author_new(const struct nlmsghdr *nlh, void *data);
 struct nf_conntrack *author_update(const struct nlmsghdr *nlh, void *data);
 struct nf_conntrack *author_destroy(const struct nlmsghdr *nlh, void *data);
 void assert_proto(const struct nf_conntrack *ct,
-		  u_int8_t l3proto, u_int8_t l4proto);
+		  uint8_t l3proto, uint8_t l4proto);
 void assert_inaddr(const struct nf_conntrack *ct,
 		   const char *src, const char *dst);
 void assert_port(const struct nf_conntrack *ct,
-		 u_int16_t src, u_int16_t dst);
+		 uint16_t src, uint16_t dst);
 void assert_typecode(const struct nf_conntrack *ct,
-		     u_int8_t type, u_int8_t code);
+		     uint8_t type, uint8_t code);
 int cb_icmp_new(const struct nlmsghdr *nlh, void *data);
 int cb_icmp_update(const struct nlmsghdr *nlh, void *data);
 int cb_icmp_destroy(const struct nlmsghdr *nlh, void *data);
src/callback.c +3 -3
index 19cc663..69640da 100644
@@ -11,8 +11,8 @@
 
 static int __parse_message(const struct nlmsghdr *nlh)
 {
-	u_int16_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
-	u_int16_t flags = nlh->nlmsg_flags;
+	uint16_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+	uint16_t flags = nlh->nlmsg_flags;
 	int ret = NFCT_T_UNKNOWN;
 
 	switch(type) {
@@ -36,7 +36,7 @@ int __callback(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data)
 	struct nf_conntrack *ct = NULL;
 	struct nf_expect *exp = NULL;
 	struct __data_container *container = data;
-	u_int8_t subsys = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+	uint8_t subsys = NFNL_SUBSYS_ID(nlh->nlmsg_type);
 
 	if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(struct nfgenmsg))) {
 		errno = EINVAL;
src/conntrack/api.c +22 -22

134 lines not on this page · raw message

src/conntrack/bsf.c +7 -7
index bc73369..1549815 100644
@@ -25,7 +25,7 @@
 #define NFCT_FILTER_ACCEPT	~0U
 
 #if 0
-static char *code2str(u_int16_t code)
+static char *code2str(uint16_t code)
 {
 	switch(code) {
 	case BPF_LD|BPF_IMM:
@@ -156,8 +156,8 @@ nfct_bsf_find_attr_nest(struct sock_filter *this, int attr, int pos)
 
 struct jump {
 	int line;
-	u_int8_t jt;
-	u_int8_t jf;
+	uint8_t jt;
+	uint8_t jf;
 };
 
 static int
@@ -290,7 +290,7 @@ nfct_bsf_jump_to(struct sock_filter *this, int line, int pos)
 
 /* this helps to skip messages coming from the ctnetlink expectation subsys. */
 static int
-bsf_cmp_subsys(struct sock_filter *this, int pos, u_int8_t subsys)
+bsf_cmp_subsys(struct sock_filter *this, int pos, uint8_t subsys)
 {
 	struct sock_filter __code[] = {
 		[0] = {
@@ -301,7 +301,7 @@ bsf_cmp_subsys(struct sock_filter *this, int pos, u_int8_t subsys)
 		[1] = {
 			/* A = skb->data[X+k:B] (subsys_id) */
 			.code	= BPF_LD|BPF_B|BPF_IND,
-			.k	= sizeof(u_int8_t),
+			.k	= sizeof(uint8_t),
 		},
 		[2] = {
 			/* A == subsys ? jump +1 : accept */
@@ -319,7 +319,7 @@ static int
 add_state_filter_cta(struct sock_filter *this,
 		     unsigned int cta_protoinfo_proto,
 		     unsigned int cta_protoinfo_state,
-		     u_int16_t state_flags,
+		     uint16_t state_flags,
 		     unsigned int logic)
 {
 	unsigned int i, j;
@@ -375,7 +375,7 @@ add_state_filter_cta(struct sock_filter *this,
 static int 
 add_state_filter(struct sock_filter *this, 
 		 int proto,
-		 u_int16_t flags,
+		 uint16_t flags,
 		 unsigned int logic)
 {
 	static const struct {
src/conntrack/build.c +25 -25

144 lines not on this page · raw message

src/conntrack/filter.c +4 -4
index 78fbbc5..4cbc116 100644
@@ -59,9 +59,9 @@ static void filter_attr_src_ipv6(struct nfct_filter *filter, const void *value)
 		return;
 
 	memcpy(filter->l3proto_ipv6[0][filter->l3proto_elems_ipv6[0]].addr,
-	       this->addr, sizeof(u_int32_t)*4);
+	       this->addr, sizeof(uint32_t)*4);
 	memcpy(filter->l3proto_ipv6[0][filter->l3proto_elems_ipv6[0]].mask,
-	       this->mask, sizeof(u_int32_t)*4);
+	       this->mask, sizeof(uint32_t)*4);
 	filter->l3proto_elems_ipv6[0]++;
 }
 
@@ -73,9 +73,9 @@ static void filter_attr_dst_ipv6(struct nfct_filter *filter, const void *value)
 		return;
 
 	memcpy(filter->l3proto_ipv6[1][filter->l3proto_elems_ipv6[1]].addr,
-	       this->addr, sizeof(u_int32_t)*4);
+	       this->addr, sizeof(uint32_t)*4);
 	memcpy(filter->l3proto_ipv6[1][filter->l3proto_elems_ipv6[1]].mask,
-	       this->mask, sizeof(u_int32_t)*4);
+	       this->mask, sizeof(uint32_t)*4);
 	filter->l3proto_elems_ipv6[1]++;
 }
 
src/conntrack/filter_dump.c +1 -1
index 4819759..158b4cb 100644
@@ -23,7 +23,7 @@ static void
 set_filter_dump_attr_family(struct nfct_filter_dump *filter_dump,
 			    const void *value)
 {
-	filter_dump->l3num = *((u_int8_t *)value);
+	filter_dump->l3num = *((uint8_t *)value);
 }
 
 const set_filter_dump_attr set_filter_dump_attr_array[NFCT_FILTER_DUMP_MAX] = {
src/conntrack/grp_getter.c +6 -6
index 9770340..2756aea 100644
@@ -26,15 +26,15 @@ static void get_attr_grp_repl_ipv4(const struct nf_conntrack *ct, void *data)
 static void get_attr_grp_orig_ipv6(const struct nf_conntrack *ct, void *data)
 {
 	struct nfct_attr_grp_ipv6 *this = data;
-	memcpy(this->src, &ct->head.orig.src.v6, sizeof(u_int32_t)*4);
-	memcpy(this->dst, &ct->head.orig.dst.v6, sizeof(u_int32_t)*4);
+	memcpy(this->src, &ct->head.orig.src.v6, sizeof(uint32_t)*4);
+	memcpy(this->dst, &ct->head.orig.dst.v6, sizeof(uint32_t)*4);
 }
 
 static void get_attr_grp_repl_ipv6(const struct nf_conntrack *ct, void *data)
 {
 	struct nfct_attr_grp_ipv6 *this = data;
-	memcpy(this->src, &ct->repl.src.v6, sizeof(u_int32_t)*4);
-	memcpy(this->dst, &ct->repl.dst.v6, sizeof(u_int32_t)*4);
+	memcpy(this->src, &ct->repl.src.v6, sizeof(uint32_t)*4);
+	memcpy(this->dst, &ct->repl.dst.v6, sizeof(uint32_t)*4);
 }
 
 static void get_attr_grp_orig_port(const struct nf_conntrack *ct, void *data)
@@ -69,8 +69,8 @@ static void get_attr_grp_master_ipv4(const struct nf_conntrack *ct, void *data)
 static void get_attr_grp_master_ipv6(const struct nf_conntrack *ct, void *data)
 {
 	struct nfct_attr_grp_ipv6 *this = data;
-	memcpy(this->src, &ct->master.src.v6, sizeof(u_int32_t)*4);
-	memcpy(this->dst, &ct->master.dst.v6, sizeof(u_int32_t)*4);
+	memcpy(this->src, &ct->master.src.v6, sizeof(uint32_t)*4);
+	memcpy(this->dst, &ct->master.dst.v6, sizeof(uint32_t)*4);
 }
 
 static void get_attr_grp_master_port(const struct nf_conntrack *ct, void *data)
src/conntrack/grp_setter.c +9 -9
index 0cc5f18..fccf578 100644
@@ -11,7 +11,7 @@
 #include <linux/icmp.h>
 #include <linux/icmpv6.h>
 
-static const u_int8_t invmap_icmp[] = {
+static const uint8_t invmap_icmp[] = {
 	[ICMP_ECHO]		= ICMP_ECHOREPLY + 1,
 	[ICMP_ECHOREPLY]	= ICMP_ECHO + 1,
 	[ICMP_TIMESTAMP]	= ICMP_TIMESTAMPREPLY + 1,
@@ -30,7 +30,7 @@ static const u_int8_t invmap_icmp[] = {
 #define ICMPV6_NI_REPLY 140
 #endif
 
-static const u_int8_t invmap_icmpv6[] = {
+static const uint8_t invmap_icmpv6[] = {
 	[ICMPV6_ECHO_REQUEST - 128]	= ICMPV6_ECHO_REPLY + 1,
 	[ICMPV6_ECHO_REPLY - 128]	= ICMPV6_ECHO_REQUEST + 1,
 	[ICMPV6_NI_QUERY - 128]		= ICMPV6_NI_QUERY + 1,
@@ -56,16 +56,16 @@ static void set_attr_grp_repl_ipv4(struct nf_conntrack *ct, const void *value)
 static void set_attr_grp_orig_ipv6(struct nf_conntrack *ct, const void *value)
 {
 	const struct nfct_attr_grp_ipv6 *this = value;
-	memcpy(&ct->head.orig.src.v6, this->src, sizeof(u_int32_t)*4);
-	memcpy(&ct->head.orig.dst.v6, this->dst, sizeof(u_int32_t)*4);
+	memcpy(&ct->head.orig.src.v6, this->src, sizeof(uint32_t)*4);
+	memcpy(&ct->head.orig.dst.v6, this->dst, sizeof(uint32_t)*4);
 	ct->head.orig.l3protonum = AF_INET6;
 }
 
 static void set_attr_grp_repl_ipv6(struct nf_conntrack *ct, const void *value)
 {
 	const struct nfct_attr_grp_ipv6 *this = value;
-	memcpy(&ct->repl.src.v6, this->src, sizeof(u_int32_t)*4);
-	memcpy(&ct->repl.dst.v6, this->dst, sizeof(u_int32_t)*4);
+	memcpy(&ct->repl.src.v6, this->src, sizeof(uint32_t)*4);
+	memcpy(&ct->repl.dst.v6, this->dst, sizeof(uint32_t)*4);
 	ct->repl.l3protonum = AF_INET6;
 }
 
@@ -85,7 +85,7 @@ static void set_attr_grp_repl_port(struct nf_conntrack *ct, const void *value)
 
 static void set_attr_grp_icmp(struct nf_conntrack *ct, const void *value)
 {
-	u_int8_t rtype;
+	uint8_t rtype;
 	const struct nfct_attr_grp_icmp *this = value;
 
 	ct->head.orig.l4dst.icmp.type = this->type;
@@ -126,8 +126,8 @@ static void set_attr_grp_master_ipv4(struct nf_conntrack *ct, const void *value)
 static void set_attr_grp_master_ipv6(struct nf_conntrack *ct, const void *value)
 {
 	const struct nfct_attr_grp_ipv6 *this = value;
-	memcpy(&ct->master.src.v6, this->src, sizeof(u_int32_t)*4);
-	memcpy(&ct->master.dst.v6, this->dst, sizeof(u_int32_t)*4);
+	memcpy(&ct->master.src.v6, this->src, sizeof(uint32_t)*4);
+	memcpy(&ct->master.dst.v6, this->dst, sizeof(uint32_t)*4);
 	ct->master.l3protonum = AF_INET6;
 }
 
src/conntrack/parse.c +41 -41

297 lines not on this page · raw message

src/conntrack/parse_mnl.c +3 -3
index 98b680b..5da9933 100644
@@ -44,7 +44,7 @@ nfct_parse_ip_attr_cb(const struct nlattr *attr, void *data)
 
 static int
 nfct_parse_ip(const struct nlattr *attr, struct __nfct_tuple *tuple,
-	     const int dir, u_int32_t *set)
+	     const int dir, uint32_t *set)
 {
 	struct nlattr *tb[CTA_IP_MAX+1] = {};
 
@@ -147,7 +147,7 @@ nfct_parse_proto_attr_cb(const struct nlattr *attr, void *data)
 
 static int
 nfct_parse_proto(const struct nlattr *attr, struct __nfct_tuple *tuple,
-		const int dir, u_int32_t *set)
+		const int dir, uint32_t *set)
 {
 	struct nlattr *tb[CTA_PROTO_MAX+1] = {};
 
@@ -261,7 +261,7 @@ static int nfct_parse_tuple_attr_cb(const struct nlattr *attr, void *data)
 
 int
 nfct_parse_tuple(const struct nlattr *attr, struct __nfct_tuple *tuple,
-		int dir, u_int32_t *set)
+		int dir, uint32_t *set)
 {
 	struct nlattr *tb[CTA_TUPLE_MAX+1] = {};
 
src/conntrack/setter.c +63 -63

429 lines not on this page · raw message

src/conntrack/snprintf_xml.c +2 -2
index 37f51b4..bf52362 100644
@@ -53,12 +53,12 @@
  * </flow>
  */
 
-const char *__proto2str(u_int8_t protonum)
+const char *__proto2str(uint8_t protonum)
 {
 	return proto2str[protonum] ? proto2str[protonum] : "unknown";
 }
 
-const char *__l3proto2str(u_int8_t protonum)
+const char *__l3proto2str(uint8_t protonum)
 {
 	return l3proto2str[protonum] ? l3proto2str[protonum] : "unknown";
 }
src/expect/api.c +13 -13
index a1dbbff..8ff20e2 100644
@@ -329,7 +329,7 @@ void nfexp_set_attr(struct nf_expect *exp,
  */
 void nfexp_set_attr_u8(struct nf_expect *exp,
 		       const enum nf_expect_attr type, 
-		       u_int8_t value)
+		       uint8_t value)
 {
 	nfexp_set_attr(exp, type, &value);
 }
@@ -342,7 +342,7 @@ void nfexp_set_attr_u8(struct nf_expect *exp,
  */
 void nfexp_set_attr_u16(struct nf_expect *exp,
 			const enum nf_expect_attr type, 
-			u_int16_t value)
+			uint16_t value)
 {
 	nfexp_set_attr(exp, type, &value);
 }
@@ -355,7 +355,7 @@ void nfexp_set_attr_u16(struct nf_expect *exp,
  */
 void nfexp_set_attr_u32(struct nf_expect *exp,
 			const enum nf_expect_attr type, 
-			u_int32_t value)
+			uint32_t value)
 {
 	nfexp_set_attr(exp, type, &value);
 }
@@ -395,10 +395,10 @@ const void *nfexp_get_attr(const struct nf_expect *exp,
  * set, 0 is returned. In order to check if the attribute is set or not,
  * use nfexp_attr_is_set.
  */
-u_int8_t nfexp_get_attr_u8(const struct nf_expect *exp,
+uint8_t nfexp_get_attr_u8(const struct nf_expect *exp,
 			   const enum nf_expect_attr type)
 {
-	const u_int8_t *ret = nfexp_get_attr(exp, type);
+	const uint8_t *ret = nfexp_get_attr(exp, type);
 	return ret == NULL ? 0 : *ret;
 }
 
@@ -411,10 +411,10 @@ u_int8_t nfexp_get_attr_u8(const struct nf_expect *exp,
  * set, 0 is returned. In order to check if the attribute is set or not,
  * use nfexp_attr_is_set.
  */
-u_int16_t nfexp_get_attr_u16(const struct nf_expect *exp,
+uint16_t nfexp_get_attr_u16(const struct nf_expect *exp,
 			     const enum nf_expect_attr type)
 {
-	const u_int16_t *ret = nfexp_get_attr(exp, type);
+	const uint16_t *ret = nfexp_get_attr(exp, type);
 	return ret == NULL ? 0 : *ret;
 }
 
@@ -427,10 +427,10 @@ u_int16_t nfexp_get_attr_u16(const struct nf_expect *exp,
  * set, 0 is returned. In order to check if the attribute is set or not,
  * use nfexp_attr_is_set.
  */
-u_int32_t nfexp_get_attr_u32(const struct nf_expect *exp,
+uint32_t nfexp_get_attr_u32(const struct nf_expect *exp,
 			    const enum nf_expect_attr type)
 {
-	const u_int32_t *ret = nfexp_get_attr(exp, type);
+	const uint32_t *ret = nfexp_get_attr(exp, type);
 	return ret == NULL ? 0 : *ret;
 }
 
@@ -504,8 +504,8 @@ int nfexp_attr_unset(struct nf_expect *exp,
 int nfexp_build_expect(struct nfnl_subsys_handle *ssh,
 		       void *req,
 		       size_t size,
-		       u_int16_t type,
-		       u_int16_t flags,
+		       uint16_t type,
+		       uint16_t flags,
 		       const struct nf_expect *exp)
 {
 	assert(ssh != NULL);
@@ -521,7 +521,7 @@ __build_query_exp(struct nfnl_subsys_handle *ssh,
 		  const void *data, void *buffer, unsigned int size)
 {
 	struct nfnlhdr *req = buffer;
-	const u_int8_t *family = data;
+	const uint8_t *family = data;
 
 	assert(ssh != NULL);
 	assert(data != NULL);
@@ -580,7 +580,7 @@ __build_query_exp(struct nfnl_subsys_handle *ssh,
  * 	NFEXP_Q_FLUSH
  * 	NFEXP_Q_DUMP
  * 
- * Pass a valid pointer to the protocol family (u_int8_t)
+ * Pass a valid pointer to the protocol family (uint8_t)
  * 
  * On success, 0 is returned. On error, -1 is returned and errno is set
  * appropiately.
src/expect/build.c +3 -3
index d480fad..da59022 100644
@@ -52,11 +52,11 @@ static void __build_expectfn(struct nfnlhdr *req,
 int __build_expect(struct nfnl_subsys_handle *ssh,
 		   struct nfnlhdr *req,
 		   size_t size,
-		   u_int16_t type,
-		   u_int16_t flags,
+		   uint16_t type,
+		   uint16_t flags,
 		   const struct nf_expect *exp)
 {
-	u_int8_t l3num;
+	uint8_t l3num;
 
 	if (test_bit(ATTR_ORIG_L3PROTO, exp->master.set))
 		l3num = exp->master.orig.l3protonum;
src/expect/parse.c +7 -7
index e71118b..9b944a6 100644
@@ -11,8 +11,8 @@
 
 int __parse_expect_message_type(const struct nlmsghdr *nlh)
 {
-	u_int16_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
-	u_int16_t flags = nlh->nlmsg_flags;
+	uint16_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+	uint16_t flags = nlh->nlmsg_flags;
 	int ret = NFCT_T_UNKNOWN;
 
 	if (type == IPCTNL_MSG_EXP_NEW) {
@@ -65,18 +65,18 @@ void __parse_expect(const struct nlmsghdr *nlh,
 	}
 	if (cda[CTA_EXPECT_TIMEOUT-1]) {
 		exp->timeout = 
-		      ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_TIMEOUT-1]));
+		      ntohl(*(uint32_t *)NFA_DATA(cda[CTA_EXPECT_TIMEOUT-1]));
 		set_bit(ATTR_EXP_TIMEOUT, exp->set);
 	}
 
 	if (cda[CTA_EXPECT_ZONE-1]) {
 		exp->zone =
-		      ntohs(*(u_int16_t *)NFA_DATA(cda[CTA_EXPECT_ZONE-1]));
+		      ntohs(*(uint16_t *)NFA_DATA(cda[CTA_EXPECT_ZONE-1]));
 		set_bit(ATTR_EXP_ZONE, exp->set);
 	}
 	if (cda[CTA_EXPECT_FLAGS-1]) {
 		exp->flags =
-		      ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_FLAGS-1]));
+		      ntohl(*(uint32_t *)NFA_DATA(cda[CTA_EXPECT_FLAGS-1]));
 		set_bit(ATTR_EXP_FLAGS, exp->set);
 	}
 	if (cda[CTA_EXPECT_HELP_NAME-1]) {
@@ -86,7 +86,7 @@ void __parse_expect(const struct nlmsghdr *nlh,
 	}
 	if (cda[CTA_EXPECT_CLASS-1]) {
 		exp->class =
-		      ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_CLASS-1]));
+		      ntohl(*(uint32_t *)NFA_DATA(cda[CTA_EXPECT_CLASS-1]));
 		set_bit(ATTR_EXP_CLASS, exp->set);
 	}
 	if (cda[CTA_EXPECT_NAT-1]) {
@@ -107,7 +107,7 @@ void __parse_expect(const struct nlmsghdr *nlh,
 		}
 		if (tb[CTA_EXPECT_NAT_DIR-1]) {
 			exp->nat_dir =
-			      ntohl(*((u_int32_t *)
+			      ntohl(*((uint32_t *)
 				NFA_DATA(tb[CTA_EXPECT_NAT_DIR-1])));
 			set_bit(ATTR_EXP_NAT_DIR, exp->set);
 		}
src/expect/setter.c +5 -5
index 2cf29c2..18c925a 100644
@@ -26,22 +26,22 @@ static void set_exp_attr_mask(struct nf_expect *exp, const void *value)
 
 static void set_exp_attr_timeout(struct nf_expect *exp, const void *value)
 {
-	exp->timeout = *((u_int32_t *) value);
+	exp->timeout = *((uint32_t *) value);
 }
 
 static void set_exp_attr_zone(struct nf_expect *exp, const void *value)
 {
-	exp->zone = *((u_int16_t *) value);
+	exp->zone = *((uint16_t *) value);
 }
 
 static void set_exp_attr_flags(struct nf_expect *exp, const void *value)
 {
-	exp->flags = *((u_int32_t *) value);
+	exp->flags = *((uint32_t *) value);
 }
 
 static void set_exp_attr_class(struct nf_expect *exp, const void *value)
 {
-	exp->class = *((u_int32_t *) value);
+	exp->class = *((uint32_t *) value);
 }
 
 static void set_exp_attr_helper_name(struct nf_expect *exp, const void *value)
@@ -52,7 +52,7 @@ static void set_exp_attr_helper_name(struct nf_expect *exp, const void *value)
 
 static void set_exp_attr_nat_dir(struct nf_expect *exp, const void *value)
 {
-	exp->nat_dir = *((u_int32_t *) value);
+	exp->nat_dir = *((uint32_t *) value);
 }
 
 static void set_exp_attr_nat_tuple(struct nf_expect *exp, const void *value)
src/main.c +2 -2
index 82b2644..2cbf79e 100644
@@ -13,7 +13,7 @@
 #include "internal/internal.h"
 
 struct nfct_handle *nfct_open_nfnl(struct nfnl_handle *nfnlh,
-				   u_int8_t subsys_id,
+				   uint8_t subsys_id,
 				   unsigned int subscriptions)
 {
 	struct nfct_handle *cth;
@@ -81,7 +81,7 @@ out_free:
  *
  * On error, NULL is returned and errno is explicitly set.
  */
-struct nfct_handle *nfct_open(u_int8_t subsys_id, unsigned subscriptions)
+struct nfct_handle *nfct_open(uint8_t subsys_id, unsigned subscriptions)
 {
 	struct nfnl_handle *nfnlh = nfnl_open();
 	struct nfct_handle *nfcth;
utils/conntrack_dump.c +1 -1
index f1d63bb..8da5c8c 100644
@@ -20,7 +20,7 @@ static int cb(enum nf_conntrack_msg_type type,
 int main(void)
 {
 	int ret;
-	u_int32_t family = AF_INET;
+	uint32_t family = AF_INET;
 	struct nfct_handle *h;
 
 	h = nfct_open(CONNTRACK, 0);
utils/conntrack_flush.c +1 -1
index 36437e2..265c4ae 100644
@@ -8,7 +8,7 @@
 int main(void)
 {
 	int ret;
-	u_int8_t family = AF_INET;
+	uint8_t family = AF_INET;
 	struct nfct_handle *h;
 
 	h = nfct_open(CONNTRACK, 0);
utils/expect_dump.c +1 -1
index b227e1a..d80c4c8 100644
@@ -20,7 +20,7 @@ static int cb(enum nf_conntrack_msg_type type,
 int main(void)
 {
 	int ret;
-	u_int8_t family = AF_INET;
+	uint8_t family = AF_INET;
 	struct nfct_handle *h;
 
 	h = nfct_open(EXPECT, 0);
utils/expect_flush.c +1 -1
index 1ae69c9..8a4897f 100644
@@ -8,7 +8,7 @@
 int main(void)
 {
 	int ret;
-	u_int8_t family = AF_INET;
+	uint8_t family = AF_INET;
 	struct nfct_handle *h;
 
 	h = nfct_open(EXPECT, 0);
Signature · 1 line
2.3.6