Use stdint types everywhere
PATCH v2 1/1 Use stdint types everywhere
Signed-off-by Felix Janda <[email protected]>
---
v2: Ensure that <stdint.h> is included where used. Only the changes to
the headers are different from v1.
--- 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 | 7 +++--- include/ulogd/addr.h | 4 ++- include/ulogd/conffile.h | 10 ++++---- include/ulogd/ipfix_protocol.h | 38 +++++++++++++++------------- 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, 129 insertions(+), 126 deletions(-)
filter/raw2packet/ulogd_raw2packet_BASE.c +21 -21
@@ -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],
filter/ulogd_filter_HWHDR.c +3 -3
@@ -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],
filter/ulogd_filter_IP2HBIN.c +2 -2
@@ -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) {
filter/ulogd_filter_IP2STR.c +1 -1
@@ -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]),
filter/ulogd_filter_MARK.c +2 -2
@@ -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 ; }
filter/ulogd_filter_PWSNIFF.c +2 -2
@@ -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 ;
include/libipulog/libipulog.h +3 -4
@@ -4,10 +4,9 @@#include <errno.h> #include <unistd.h> #include <fcntl.h> -#include <sys/types.h> #include <sys/socket.h> #include <sys/uio.h> -#include <asm/types.h> +#include <stdint.h> #include <linux/netlink.h> #include <net/if.h> #include <linux/netfilter_ipv4/ipt_ULOG.h>
@@ -20,9 +19,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);
include/ulogd/addr.h +3 -1
@@ -8,7 +8,9 @@#ifndef _ADDR_H#define _ADDR_H -u_int32_t ulogd_bits2netmask (int bits); +#include <stdint.h> + +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);
include/ulogd/conffile.h +5 -5
@@ -7,7 +7,7 @@#ifndef _CONFFILE_H#define _CONFFILE_H -#include <sys/types.h> +#include <stdint.h> /* errors returned by config functions */ enum {
@@ -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;
include/ulogd/ipfix_protocol.h +20 -18
@@ -1,6 +1,8 @@#ifndef _IPFIX_PROTOCOL_H#define _IPFIX_PROTOCOL_H +#include <stdint.h> +/* This header file defines structures for the IPFIX protocol in accordance with * draft-ietf-ipfix-protocol-19.txt */
@@ -11,29 +13,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 +221,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
include/ulogd/ulogd.h +21 -21
110 lines not on this page · raw message
input/packet/ulogd_inppkt_NFLOG.c +8 -8
@@ -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;
input/packet/ulogd_inppkt_UNIXSOCK.c +17 -17
@@ -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_pokey_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_pokey_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_pokey_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 ; }
libipulog/libipulog.c +4 -4
@@ -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;
output/mysql/ulogd_output_MYSQL.c +1 -1
@@ -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;
output/ulogd_output_IPFIX.c +10 -10
@@ -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 *
src/addr.c +2 -2
@@ -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 );
util/db.c +1 -1
@@ -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 ;
util/printpkt.c +3 -3
@@ -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 ",
Signature · 1 line
2.3.6
Hi,
Quoted 6 lines · Felix Janda
Signed-off-by Felix Janda <[email protected]>---
v2: Ensure that <stdint.h> is included where used. Only the changes to
the headers are different from v1.
---
...
Quoted 4 lines
filter/raw2packet/ulogd_raw2packet_BASE.c +0
-0@@ -594,14 +594,14 @@ static int _interp_udp(struct ulogd_pluginstance *pi, struct udphdr *udph, /* Section 3.1. SCTP Common Header Format */
filter/raw2packet/ulogd_raw2packet_BASE.c static int _interp_udp(struct · line 602
Quoted 10 lines
filter/raw2packet/ulogd_raw2packet_BASE.c +4
-4typedef 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 ;
Sorry for not mentioning that in previous mail but I'm not comfortable with this hunk. We are loosing synchronization with upstream definition as well as some information on endianness.
Could you repost the patch removing this hunk?
BR,
Signature · 2 lines
Eric Leblond <[email protected]> Blog: https://home.regit.org/