Skip to contentSkip to conversation

examples: load modules when adding chains or tables

PATCH Applied Daniel Wagner 3 participants 3 messages Apr 29, 2016 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples: load modules when adding chains or tables

From: Daniel Wagner <[email protected]>

Tell the kernel to load the necessary modules by adding the NLM_F_CREATE flag.

---

This is for libnftnl.

examples/nft-chain-add.c | 2 +-

 examples/nft-table-add.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
examples/nft-chain-add.c +1 -1
index 3afc06e..ca1edf9 100644
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
 	chain_seq = seq;
 	nlh = nftnl_chain_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
 					NFT_MSG_NEWCHAIN, family,
-					NLM_F_ACK, seq++);
+					NLM_F_CREATE|NLM_F_ACK, seq++);
 	nftnl_chain_nlmsg_build_payload(nlh, t);
 	nftnl_chain_free(t);
 	mnl_nlmsg_batch_next(batch);
examples/nft-table-add.c +1 -1
index db6e39e..aa6e268 100644
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
 	family = nftnl_table_get_u32(t, NFTNL_TABLE_FAMILY);
 	nlh = nftnl_table_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
 					NFT_MSG_NEWTABLE, family,
-					NLM_F_ACK, seq++);
+					NLM_F_CREATE|NLM_F_ACK, seq++);
 	nftnl_table_nlmsg_build_payload(nlh, t);
 	nftnl_table_free(t);
 	mnl_nlmsg_batch_next(batch);
Signature · 1 line
2.5.5
maintainer Applied
#1 lore raw
Quoted 4 lines · Daniel Wagner

From: Daniel Wagner <[email protected]>

Tell the kernel to load the necessary modules by adding the NLM_F_CREATE flag.

Applied, thanks for following up on this.

#2 lore raw
Quoted 7 lines · Pablo Neira Ayuso
Quoted 4 lines · Daniel Wagner

From: Daniel Wagner <[email protected]>

Tell the kernel to load the necessary modules by adding the NLM_F_CREATE flag.

Applied, thanks for following up on this.

np. you saved me time debugging, so it's a fair deal :)