All .c and .h files now have no lines with trailing whitespace. All .c and .h files now indent with tabs followed by <8 spaces. Signed-off-by: Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx> --- include/libnetfilter_log/libipulog.h | 4 ++-- include/libnetfilter_log/libnetfilter_log.h | 2 +- src/libipulog_compat.c | 8 +++---- src/libnetfilter_log.c | 24 ++++++++++----------- utils/nfulnl_test.c | 4 ++-- utils/ulog_test.c | 8 +++---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/libnetfilter_log/libipulog.h b/include/libnetfilter_log/libipulog.h index 4d87913..8fba03a 100644 --- a/include/libnetfilter_log/libipulog.h +++ b/include/libnetfilter_log/libipulog.h @@ -12,7 +12,7 @@ extern "C" { #endif /* FIXME: glibc sucks */ -#ifndef MSG_TRUNC +#ifndef MSG_TRUNC #define MSG_TRUNC 0x20 #endif @@ -55,7 +55,7 @@ const char *ipulog_strerror(int errcode); void ipulog_perror(const char *s); -enum +enum { IPULOG_ERR_NONE = 0, IPULOG_ERR_IMPL, diff --git a/include/libnetfilter_log/libnetfilter_log.h b/include/libnetfilter_log/libnetfilter_log.h index 6192fa3..c27149f 100644 --- a/include/libnetfilter_log/libnetfilter_log.h +++ b/include/libnetfilter_log/libnetfilter_log.h @@ -49,7 +49,7 @@ extern int nflog_set_flags(struct nflog_g_handle *gh, uint16_t flags); extern int nflog_set_qthresh(struct nflog_g_handle *gh, uint32_t qthresh); extern int nflog_set_nlbufsiz(struct nflog_g_handle *gh, uint32_t nlbufsiz); -extern int nflog_callback_register(struct nflog_g_handle *gh, +extern int nflog_callback_register(struct nflog_g_handle *gh, nflog_callback *cb, void *data); extern int nflog_handle_packet(struct nflog_handle *h, char *buf, int len); diff --git a/src/libipulog_compat.c b/src/libipulog_compat.c index 85f7cf5..a0de3cb 100644 --- a/src/libipulog_compat.c +++ b/src/libipulog_compat.c @@ -32,7 +32,7 @@ static const struct ipulog_errmap_t { int errcode; const char *message; -} ipulog_errmap[] = +} ipulog_errmap[] = { { IPULOG_ERR_NONE, "No error" }, { IPULOG_ERR_IMPL, "Not implemented yet" }, @@ -99,7 +99,7 @@ struct ipulog_handle *ipulog_create_handle(uint32_t gmask, h->nfulh = nflog_open(); if (!h->nfulh) goto out_free; - + /* bind_pf returns EEXIST if we are already registered */ rv = nflog_bind_pf(h->nfulh, AF_INET); if (rv < 0 && rv != -EEXIST) @@ -146,7 +146,7 @@ next_msg: printf("next\n"); nfnl_parse_attr(tb, NFULA_MAX, NFM_NFA(NLMSG_DATA(nlh)), NFM_PAYLOAD(nlh)); - + if (!tb[NFULA_PACKET_HDR-1]) goto next_msg; @@ -207,7 +207,7 @@ next_msg: printf("next\n"); h->upmsg.data_len = NFA_PAYLOAD(tb[NFULA_PAYLOAD-1]); } else h->upmsg.data_len = 0; - + return &h->upmsg; } diff --git a/src/libnetfilter_log.c b/src/libnetfilter_log.c index 7d37570..db051b1 100644 --- a/src/libnetfilter_log.c +++ b/src/libnetfilter_log.c @@ -4,7 +4,7 @@ * (C) 2005, 2008-2010 by Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 + * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation (or any later at your option) * * This program is distributed in the hope that it will be useful, @@ -82,7 +82,7 @@ struct nflog_g_handle int nflog_errno; /*********************************************************************** - * low level stuff + * low level stuff ***********************************************************************/ static void del_gh(struct nflog_g_handle *gh) @@ -244,7 +244,7 @@ struct nflog_handle *nflog_open_nfnl(struct nfnl_handle *nfnlh) h->nfnlh = nfnlh; - h->nfnlssh = nfnl_subsys_open(h->nfnlh, NFNL_SUBSYS_ULOG, + h->nfnlssh = nfnl_subsys_open(h->nfnlh, NFNL_SUBSYS_ULOG, NFULNL_MSG_MAX, 0); if (!h->nfnlssh) { /* FIXME: nflog_errno */ @@ -393,10 +393,10 @@ struct nflog_g_handle * nflog_bind_group(struct nflog_handle *h, uint16_t num) { struct nflog_g_handle *gh; - + if (find_gh(h, num)) return NULL; - + gh = calloc(1, sizeof(*gh)); if (!gh) return NULL; @@ -610,8 +610,8 @@ int nflog_set_flags(struct nflog_g_handle *gh, uint16_t flags) * The nfulnl_msg_packet_hdr structure is defined in libnetfilter_log.h as: *\verbatim struct nfulnl_msg_packet_hdr { - uint16_t hw_protocol; // hw protocol (network order) - uint8_t hook; // netfilter hook + uint16_t hw_protocol; // hw protocol (network order) + uint8_t hook; // netfilter hook uint8_t _pad; } __attribute__ ((packed)); \endverbatim @@ -760,11 +760,11 @@ uint32_t nflog_get_physoutdev(struct nflog_data *nfad) * * The nfulnl_msg_packet_hw structure is defined in libnetfilter_log.h as: * \verbatim - struct nfulnl_msg_packet_hw { - uint16_t hw_addrlen; - uint16_t _pad; - uint8_t hw_addr[8]; - } __attribute__ ((packed)); + struct nfulnl_msg_packet_hw { + uint16_t hw_addrlen; + uint16_t _pad; + uint8_t hw_addr[8]; + } __attribute__ ((packed)); \endverbatim */ struct nfulnl_msg_packet_hw *nflog_get_packet_hw(struct nflog_data *nfad) diff --git a/utils/nfulnl_test.c b/utils/nfulnl_test.c index dd3091b..da140b4 100644 --- a/utils/nfulnl_test.c +++ b/utils/nfulnl_test.c @@ -15,9 +15,9 @@ static int print_pkt(struct nflog_data *ldata) char *prefix = nflog_get_prefix(ldata); char *payload; int payload_len = nflog_get_payload(ldata, &payload); - + if (ph) { - printf("hw_protocol=0x%04x hook=%u ", + printf("hw_protocol=0x%04x hook=%u ", ntohs(ph->hw_protocol), ph->hook); } diff --git a/utils/ulog_test.c b/utils/ulog_test.c index 20f6163..213a2bf 100644 --- a/utils/ulog_test.c +++ b/utils/ulog_test.c @@ -22,7 +22,7 @@ void handle_packet(ulog_packet_msg_t *pkt) { unsigned char *p; int i; - + printf("Hook=%u Mark=%lu len=%zu ", pkt->hook, pkt->mark, pkt->data_len); if (strlen(pkt->prefix)) @@ -34,7 +34,7 @@ void handle_packet(ulog_packet_msg_t *pkt) if (pkt->timestamp_sec || pkt->timestamp_usec) printf("Timestamp=%ld.%06lds ", pkt->timestamp_sec, pkt->timestamp_usec); - + if (pkt->mac_len) { printf("mac="); @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) buf = malloc(MYBUFSIZ); if (!buf) exit(1); - + /* create ipulog handle */ h = ipulog_create_handle(ipulog_group2gmask(atoi(argv[2])), 65535); if (!h) @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) handle_packet(upkt); } } - + /* just to give it a cleaner look */ ipulog_destroy_handle(h); return 0; -- 2.17.5