File: README.examples

package info (click to toggle)
libnftnl 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,060 kB
  • sloc: ansic: 25,721; sh: 5,175; makefile: 340
file content (15 lines) | stat: -rw-r--r-- 469 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
These are examples C codes of what you can achieve with libnftnl.
Basic functions are:
 * fetch the ruleset from the kernel.
 * update (add/delete) the ruleset.
 * Set-up an event listener environment.
 * Play with nftables sets infraestructure

To compile the examples, run:
 $ gcc -lmnl -lnftnl nft-rule-add.c -o nft-rule-add

You will need the Linux kernel nf_tables.h header:
 * linux/netfilter/nf_tables.h

Then you can run:
 $ sudo ./nft-rule-add ip filter input