diff options
author | Yunchih Chen <yunchih.cat@gmail.com> | 2018-03-21 17:15:55 +0800 |
---|---|---|
committer | Yunchih Chen <yunchih.cat@gmail.com> | 2018-03-21 17:15:55 +0800 |
commit | c3570154ea3a4210253cba4febc857ebb5d5c5e7 (patch) | |
tree | 45ca25ef9455a8a7cc99af3af898650159da0362 | |
parent | 972d4094714d78beef56fd53e11dc3bff9960678 (diff) | |
download | nfcollect-c3570154ea3a4210253cba4febc857ebb5d5c5e7.tar.gz nfcollect-c3570154ea3a4210253cba4febc857ebb5d5c5e7.tar.zst nfcollect-c3570154ea3a4210253cba4febc857ebb5d5c5e7.zip |
Fix possible NULL pointer returned by nflog_bind_group
-rw-r--r-- | lib/collect.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/collect.c b/lib/collect.c index 79f6086..4b3dd3e 100644 --- a/lib/collect.c +++ b/lib/collect.c @@ -143,6 +143,12 @@ static void nfl_init(nfl_state_t *nf) { // bind to group nf->nfl_group_fd = nflog_bind_group(nf->nfl_fd, nf->global->nfl_group_id); + // If the returned group_fd is NULL, it's likely + // that another process (like ulogd) has already + // bound to the same NFLOD group. + if(!nf->nfl_group_fd) + FATAL("Cannot bind to NFLOG group %d, is it used by another process?", + nf->global->nfl_group_id); ERR(nflog_set_mode(nf->nfl_group_fd, NFULNL_COPY_PACKET, nfl_recv_size) < 0, "Could not set copy mode"); |