]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
examples: nft-table-upd: don't use deprecated aliases
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 7 Jun 2016 14:47:38 +0000 (16:47 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 7 Jun 2016 14:53:57 +0000 (16:53 +0200)
Convert this example not to use the deprecated aliases anymore.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
examples/nft-table-upd.c

index bc6e02ae281e857c21f65186efeac96044d773b7..9b960bbfdf24351d2c8eddf02e67ed131000f51c 100644 (file)
@@ -26,7 +26,7 @@ int main(int argc, char *argv[])
        char buf[MNL_SOCKET_BUFFER_SIZE];
        struct nlmsghdr *nlh;
        uint32_t portid, seq, table_seq, family, flags;
-       struct nft_table *t = NULL;
+       struct nftnl_table *t = NULL;
        struct mnl_nlmsg_batch *batch;
        int ret, batching;
 
@@ -35,13 +35,13 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       t = nft_table_alloc();
+       t = nftnl_table_alloc();
        if (t == NULL) {
                perror("OOM");
                exit(EXIT_FAILURE);
        }
 
-       batching = nft_batch_is_supported();
+       batching = nftnl_batch_is_supported();
        if (batching < 0) {
                perror("cannot talk to nfnetlink");
                exit(EXIT_FAILURE);
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
        batch = mnl_nlmsg_batch_start(buf, sizeof(buf));
 
        if (batching) {
-               nft_batch_begin(mnl_nlmsg_batch_current(batch), seq++);
+               nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++);
                mnl_nlmsg_batch_next(batch);
        }
 
@@ -80,19 +80,19 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       nft_table_attr_set(t, NFT_TABLE_ATTR_NAME, argv[2]);
-       nft_table_attr_set_u32(t, NFT_TABLE_ATTR_FLAGS, flags);
+       nftnl_table_set(t, NFTNL_TABLE_NAME, argv[2]);
+       nftnl_table_set_u32(t, NFTNL_TABLE_FLAGS, flags);
 
        table_seq = seq;
-       nlh = nft_table_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
+       nlh = nftnl_table_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
                                        NFT_MSG_NEWTABLE, family,
                                        NLM_F_ACK, seq++);
-       nft_table_nlmsg_build_payload(nlh, t);
-       nft_table_free(t);
+       nftnl_table_nlmsg_build_payload(nlh, t);
+       nftnl_table_free(t);
        mnl_nlmsg_batch_next(batch);
 
        if (batching) {
-               nft_batch_end(mnl_nlmsg_batch_current(batch), seq++);
+               nftnl_batch_end(mnl_nlmsg_batch_current(batch), seq++);
                mnl_nlmsg_batch_next(batch);
        }