summaryrefslogtreecommitdiff
path: root/pcap-netfilter-linux.c
diff options
context:
space:
mode:
authorDenis Ovsienko <denis@ovsienko.info>2017-08-31 11:40:43 +0100
committerDenis Ovsienko <denis@ovsienko.info>2017-08-31 11:42:47 +0100
commit02d818ad909ad9f975bc2ef19491f76c476063ca (patch)
tree5072a5178aacabe48a87c1ee45fe5d70fe98ba12 /pcap-netfilter-linux.c
parentb006c7983b1f4e723c25a633270920e848e85d45 (diff)
downloadlibpcap-02d818ad909ad9f975bc2ef19491f76c476063ca.tar.gz
Squelch a compiler warning after commit 2806e8e.
Put declarations before code.
Diffstat (limited to 'pcap-netfilter-linux.c')
-rw-r--r--pcap-netfilter-linux.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c
index c3d14594..85899559 100644
--- a/pcap-netfilter-linux.c
+++ b/pcap-netfilter-linux.c
@@ -136,6 +136,9 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c
bp = handle->bp;
ep = bp + len;
while (bp < ep) {
+ const struct nlmsghdr *nlh = (const struct nlmsghdr *) bp;
+ u_int32_t msg_len;
+ nftype_t type = OTHER;
/*
* Has "pcap_breakloop()" been called?
* If so, return immediately - if we haven't read any
@@ -162,9 +165,6 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c
*/
break;
}
- const struct nlmsghdr *nlh = (const struct nlmsghdr *) bp;
- u_int32_t msg_len;
- nftype_t type = OTHER;
if (nlh->nlmsg_len < sizeof(struct nlmsghdr) || (u_int)len < nlh->nlmsg_len) {
pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Message truncated: (got: %d) (nlmsg_len: %u)", len, nlh->nlmsg_len);