aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYunchih Chen <yunchih.cat@gmail.com>2018-03-20 10:25:27 +0800
committerYunchih Chen <yunchih.cat@gmail.com>2018-03-20 10:27:54 +0800
commite6698bc32ce45dda55823825d837291b5850ac8b (patch)
tree5d08aa42d577d5da4bab98641e2ef6e75ff79884 /lib
parent75fad3d9443170d81624060a7ff73149c84e06b0 (diff)
downloadnfcollect-e6698bc32ce45dda55823825d837291b5850ac8b.tar
nfcollect-e6698bc32ce45dda55823825d837291b5850ac8b.tar.gz
nfcollect-e6698bc32ce45dda55823825d837291b5850ac8b.tar.bz2
nfcollect-e6698bc32ce45dda55823825d837291b5850ac8b.tar.lz
nfcollect-e6698bc32ce45dda55823825d837291b5850ac8b.tar.xz
nfcollect-e6698bc32ce45dda55823825d837291b5850ac8b.tar.zst
nfcollect-e6698bc32ce45dda55823825d837291b5850ac8b.zip
Add comments && formatting
Diffstat (limited to 'lib')
-rw-r--r--lib/collect.c6
-rw-r--r--lib/common.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/collect.c b/lib/collect.c
index 0fdbe52..5ca8139 100644
--- a/lib/collect.c
+++ b/lib/collect.c
@@ -120,8 +120,7 @@ static void nfl_init(nfl_state_t *nf) {
/* ERR(nflog_set_mode(nf->nfl_group_fd, NFULNL_COPY_PACKET, sizeof(struct
* iphdr) + 4) < 0, */
- ERR(nflog_set_mode(nf->nfl_group_fd, NFULNL_COPY_PACKET, nfl_recv_size) <
- 0,
+ ERR(nflog_set_mode(nf->nfl_group_fd, NFULNL_COPY_PACKET, nfl_recv_size) < 0,
"Could not set copy mode");
nflog_callback_register(nf->nfl_group_fd, &handle_packet, nf);
@@ -222,7 +221,8 @@ void nfl_state_init(nfl_state_t **nf, uint32_t id, uint32_t entries_max,
}
// Ensure trunk with same id in previous run has finished to prevent reusing
- // a trunk which it's still being used. Furthermore, this hopefully alleviate us
+ // a trunk which it's still being used. Furthermore, this hopefully
+ // alleviate us
// from bursty network traffic.
pthread_mutex_lock(&(*nf)->has_finished_lock);
while (!(*nf)->has_finished)
diff --git a/lib/common.c b/lib/common.c
index 3cbf19b..e1f7e91 100644
--- a/lib/common.c
+++ b/lib/common.c
@@ -35,7 +35,7 @@ int nfl_storage_match_index(const char *fn) {
regmatch_t match[1];
int ret;
- if(unlikely(!strcmp(fn, ".") || !strcmp(fn, "..")))
+ if (unlikely(!strcmp(fn, ".") || !strcmp(fn, "..")))
return -1;
if (!compiled) {
@@ -72,7 +72,7 @@ uint32_t nfl_get_filesize(FILE *f) {
}
uint32_t nfl_header_cksum(nfl_header_t *header) {
- #define H(s) (0x9e3779b9 + (s<< 6) + (s>> 1))
+#define H(s) (0x9e3779b9 + (s << 6) + (s >> 1))
register uint64_t s = 3784672181;
s ^= H(header->id);
s ^= H(header->max_n_entries);