From f0b11471594801ed0bfbf7af9bba164ccc134ac5 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Sun, 8 Mar 2015 21:39:43 +0100 Subject: Delete trailing spaces/tabs --- pcap-netfilter-linux.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'pcap-netfilter-linux.c') diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c index 9e61e455..3ee6faa3 100644 --- a/pcap-netfilter-linux.c +++ b/pcap-netfilter-linux.c @@ -11,8 +11,8 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -57,14 +57,14 @@ #include /* NOTE: if your program drops privilages after pcap_activate() it WON'T work with nfqueue. - * It took me quite some time to debug ;/ + * It took me quite some time to debug ;/ * * Sending any data to nfnetlink socket requires CAP_NET_ADMIN privilages, * and in nfqueue we need to send verdict reply after recving packet. * * In tcpdump you can disable dropping privilages with -Z root */ - + #include "pcap-netfilter-linux.h" #define HDR_LENGTH (NLMSG_LENGTH(NLMSG_ALIGN(sizeof(struct nfgenmsg)))) @@ -116,10 +116,10 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c return -1; } - if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_ULOG && - NFNL_MSG_TYPE(nlh->nlmsg_type) == NFULNL_MSG_PACKET) + if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_ULOG && + NFNL_MSG_TYPE(nlh->nlmsg_type) == NFULNL_MSG_PACKET) type = NFLOG; - else if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_QUEUE && + else if (NFNL_SUBSYS_ID(nlh->nlmsg_type) == NFNL_SUBSYS_QUEUE && NFNL_MSG_TYPE(nlh->nlmsg_type) == NFQNL_MSG_PACKET) type = NFQUEUE; @@ -184,7 +184,7 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c gettimeofday(&pkth.ts, NULL); if (handle->fcode.bf_insns == NULL || - bpf_filter(handle->fcode.bf_insns, payload, pkth.len, pkth.caplen)) + bpf_filter(handle->fcode.bf_insns, payload, pkth.len, pkth.caplen)) { handlep->packets_read++; callback(user, &pkth, payload); @@ -234,7 +234,7 @@ netfilter_inject_linux(pcap_t *handle, const void *buf, size_t size) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on netfilter devices"); return (-1); -} +} struct my_nfattr { u_int16_t nfa_len; @@ -252,7 +252,7 @@ netfilter_send_config_msg(const pcap_t *handle, u_int16_t msg_type, int ack, u_i struct sockaddr_nl snl; static unsigned int seq_id; - + if (!seq_id) seq_id = time(NULL); ++seq_id; @@ -344,7 +344,7 @@ nflog_send_config_cmd(const pcap_t *handle, u_int16_t group_id, u_int8_t cmd, u_ return nflog_send_config_msg(handle, family, group_id, &nfa); } -static int +static int nflog_send_config_mode(const pcap_t *handle, u_int16_t group_id, u_int8_t copy_mode, u_int32_t copy_range) { struct nfulnl_msg_config_mode msg; @@ -398,7 +398,7 @@ nfqueue_send_config_cmd(const pcap_t *handle, u_int16_t group_id, u_int8_t cmd, return nfqueue_send_config_msg(handle, AF_UNSPEC, group_id, &nfa); } -static int +static int nfqueue_send_config_mode(const pcap_t *handle, u_int16_t group_id, u_int8_t copy_mode, u_int32_t copy_range) { struct nfqnl_msg_config_params msg; @@ -431,7 +431,7 @@ netfilter_activate(pcap_t* handle) dev += strlen(NFQUEUE_IFACE); type = NFQUEUE; } - + if (type != OTHER && *dev == ':') { dev++; while (*dev) { @@ -440,7 +440,7 @@ netfilter_activate(pcap_t* handle) if (group_count == 32) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Maximum 32 netfilter groups! dev: %s", + "Maximum 32 netfilter groups! dev: %s", handle->opt.source); return PCAP_ERROR; } @@ -465,7 +465,7 @@ netfilter_activate(pcap_t* handle) if (type == OTHER || *dev) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Can't get netfilter group(s) index from %s", + "Can't get netfilter group(s) index from %s", handle->opt.source); return PCAP_ERROR; } @@ -602,7 +602,7 @@ netfilter_create(const char *device, char *ebuf, int *is_ours) /* Does it begin with NFLOG_IFACE or NFQUEUE_IFACE? */ if (strncmp(cp, NFLOG_IFACE, sizeof NFLOG_IFACE - 1) == 0) cp += sizeof NFLOG_IFACE - 1; - else if (strncmp(cp, NFQUEUE_IFACE, sizeof NFQUEUE_IFACE - 1) == 0) + else if (strncmp(cp, NFQUEUE_IFACE, sizeof NFQUEUE_IFACE - 1) == 0) cp += sizeof NFQUEUE_IFACE - 1; else { /* Nope, doesn't begin with NFLOG_IFACE nor NFQUEUE_IFACE */ @@ -631,11 +631,11 @@ netfilter_create(const char *device, char *ebuf, int *is_ours) return (p); } -int +int netfilter_findalldevs(pcap_if_t **alldevsp, char *err_str) { int sock; - + sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER); if (sock < 0) { /* if netlink is not supported this is not fatal */ -- cgit v1.2.1