summaryrefslogtreecommitdiffstats
path: root/src/netlink.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-08-15 01:43:03 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-08-15 12:26:36 +0200
commit0155bc4df3e9985e4784baff7752959e1b817900 (patch)
tree90adf316b0e025a3c675ba7ad18a5a84a36da39b /src/netlink.c
parent97fc68267afd46db08c891420e5702e27d890611 (diff)
netlink: Fix segfault when using --echo flag
Commit 07b45939972eb ("src: introduce struct nft_cache") added cache pointer to struct netlink_mon_handler and the code assumes it is never NULL. Therefore initialize it in the dummy version of netlink_mon_handler in netlink_echo_callback(). Fixes: b99c4d072d996 ("Implement --echo option") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/netlink.c')
-rw-r--r--src/netlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/netlink.c b/src/netlink.c
index 8aef8d9a..f631c26b 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -3075,12 +3075,14 @@ static int netlink_events_cb(const struct nlmsghdr *nlh, void *data)
int netlink_echo_callback(const struct nlmsghdr *nlh, void *data)
{
+ struct netlink_ctx *ctx = data;
struct netlink_mon_handler echo_monh = {
.format = NFTNL_OUTPUT_DEFAULT,
- .ctx = data,
+ .ctx = ctx,
.loc = &netlink_location,
.monitor_flags = 0xffffffff,
.cache_needed = true,
+ .cache = ctx->cache,
};
if (!echo_monh.ctx->octx->echo)