Skip to content

Commit

Permalink
nflog: make sure the messages aren't buffered for default 1 second
Browse files Browse the repository at this point in the history
Also: improve documentation.
  • Loading branch information
majek committed Feb 19, 2015
1 parent f4fdb6a commit ff1cd5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Expand Up @@ -79,8 +79,15 @@ This will cause `pmtud` to listen to packets from NFLOG and use `eth0`
to brodcast them if neccesary. Debug by listing this /proc file:

cat /proc/net/netfilter/nfnetlink_log
33 32781 0 2 65535 0 1

Where the format of this file is similar to `nfnetling_queue`
described here:
Where columns read:

* nflog group number of a given queue (16 bits)
* peer portid: most likely the pid of process
* number of messages buffered on the kernel side
* copy mode: 2 for full packet copy
* copy range: max packet size
* flush timeout in 1/100th of a second
* use count

* https://home.regit.org/netfilter-en/using-nfqueue-and-libnetfilter_queue/
6 changes: 6 additions & 0 deletions src/nflog.c
Expand Up @@ -121,6 +121,12 @@ struct nflog *nflog_alloc(uint16_t group_no, unsigned queue_maxlen,
PFATAL("nflog_set_mode");
}

/* Disable netlink timeout, to reduce latency. The units of
* value are 1/100th of second. */
if (nflog_set_timeout(n->qh, 0) < 0) {
PFATAL("nflog_set_timeout");
}

int fd = nflog_fd(n->h);

int opt = 1;
Expand Down

0 comments on commit ff1cd5f

Please sign in to comment.