The NFCT_Q_FLUSH command flushes both IPv4 and IPv6 conntrack tables. Add new command NFCT_Q_FLUSH_FILTER that allows to flush based on the family to retain backward compatibility on NFCT_Q_FLUSH. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- include/libnetfilter_conntrack/libnetfilter_conntrack.h | 1 + src/conntrack/api.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/libnetfilter_conntrack/libnetfilter_conntrack.h b/include/libnetfilter_conntrack/libnetfilter_conntrack.h index c5c6b615a3bf..f02d827761a8 100644 --- a/include/libnetfilter_conntrack/libnetfilter_conntrack.h +++ b/include/libnetfilter_conntrack/libnetfilter_conntrack.h @@ -452,6 +452,7 @@ enum nf_conntrack_query { NFCT_Q_CREATE_UPDATE, NFCT_Q_DUMP_FILTER, NFCT_Q_DUMP_FILTER_RESET, + NFCT_Q_FLUSH_FILTER, }; extern int nfct_query(struct nfct_handle *h, diff --git a/src/conntrack/api.c b/src/conntrack/api.c index 78d7d613d925..b7f64fb43ce8 100644 --- a/src/conntrack/api.c +++ b/src/conntrack/api.c @@ -831,6 +831,9 @@ __build_query_ct(struct nfnl_subsys_handle *ssh, nfct_fill_hdr(req, IPCTNL_MSG_CT_DELETE, NLM_F_ACK, *family, NFNETLINK_V0); break; + case NFCT_Q_FLUSH_FILTER: + nfct_fill_hdr(req, IPCTNL_MSG_CT_DELETE, NLM_F_ACK, *family, 1); + break; case NFCT_Q_DUMP: nfct_fill_hdr(req, IPCTNL_MSG_CT_GET, NLM_F_DUMP, *family, NFNETLINK_V0); -- 2.20.1