]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: get rid of EINTR handling for nft_netlink()
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 7 Jul 2015 11:36:17 +0000 (13:36 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 17 Aug 2015 23:36:12 +0000 (01:36 +0200)
The only remaining caller that needs this is netlink_dump_ruleset(), that is
used to export the ruleset using markup representation. We can remove it and
handle this from do_command_export() now that we have a centralized point to
build up the object cache.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/main.c
src/rule.c

index d6c9cccf681002ae65f6961d719039a766c0408b..7bbcfc418efc8bab794e50526b360289a86bb668 100644 (file)
@@ -233,12 +233,7 @@ int nft_run(void *scanner, struct parser_state *state, struct list_head *msgs)
                ret = -1;
                goto err1;
        }
-retry:
        ret = nft_netlink(state, msgs);
-       if (ret < 0 && errno == EINTR) {
-               netlink_restart();
-               goto retry;
-       }
 err1:
        list_for_each_entry_safe(cmd, next, &state->cmds, list) {
                list_del(&cmd->list);
index 79f93e128f994530197edc4c49fad5f38bc0ee02..f3a5a99074aedfca116212e286ecc12f8ff8dc2c 100644 (file)
@@ -955,11 +955,13 @@ static int do_command_delete(struct netlink_ctx *ctx, struct cmd *cmd)
 
 static int do_command_export(struct netlink_ctx *ctx, struct cmd *cmd)
 {
-       struct nft_ruleset *rs = netlink_dump_ruleset(ctx, &cmd->handle,
-                                                     &cmd->location);
+       struct nft_ruleset *rs;
 
-       if (rs == NULL)
-               return -1;
+       do {
+               rs = netlink_dump_ruleset(ctx, &cmd->handle, &cmd->location);
+               if (rs == NULL && errno != EINTR)
+                       return -1;
+       } while (rs == NULL);
 
        nft_ruleset_fprintf(stdout, rs, cmd->export->format, 0);
        fprintf(stdout, "\n");