diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-07-04 12:24:46 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-07-14 12:30:43 +0200 |
commit | 09f81768090ffea1dbb0362950b0d5414c609436 (patch) | |
tree | 05f388c6ebbbccab960bdb6e93ca8a03c299b860 /src/main.c | |
parent | 654b51ab84cf10591eba1c443e6d65bf2de35c37 (diff) |
mnl: check for NLM_F_DUMP_INTR when dumping object lists
This flag allows to detect that an update has ocurred while dumping
any of the object lists. In case of interference, nft cancels the
netlink socket to skip processing the remaining stale entries and
it retries to obtain fresh list of objects.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -223,8 +223,14 @@ int nft_run(void *scanner, struct parser_state *state, struct list_head *msgs) ret = nft_parse(scanner, state); if (ret != 0 || state->nerrs > 0) return -1; +retry: + ret = nft_netlink(state, msgs); + if (ret < 0 && errno == EINTR) { + netlink_restart(); + goto retry; + } - return nft_netlink(state, msgs); + return ret; } int main(int argc, char * const *argv) |