Skip to content

Commit 87591a5

Browse files
committed
Add netfilter constants to Linux
1 parent 11cabde commit 87591a5

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

libc-test/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ fn main() {
239239
}
240240
cfg.header("sys/reboot.h");
241241
if !emscripten {
242+
cfg.header("linux/netfilter.h")
242243
cfg.header("linux/netfilter_ipv4.h");
244+
cfg.header("linux/netfilter/nf_tables.h")
243245
cfg.header("linux/fs.h");
244246
}
245247
if !musl {

src/unix/notbsd/linux/mod.rs

+67
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,73 @@ pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
12651265
pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x10;
12661266
pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x20;
12671267

1268+
pub const NF_DROP: ::c_int = 0;
1269+
pub const NF_ACCEPT: ::c_int = 1;
1270+
pub const NF_STOLEN: ::c_int = 2;
1271+
pub const NF_QUEUE: ::c_int = 3;
1272+
pub const NF_REPEAT: ::c_int = 4;
1273+
pub const NF_STOP: ::c_int = 5;
1274+
pub const NF_MAX_VERDICT: ::c_int = NF_STOP;
1275+
1276+
pub const NF_VERDICT_MASK: ::c_int = 0x000000ff;
1277+
pub const NF_VERDICT_FLAG_QUEUE_BYPASS: ::c_int = 0x00008000;
1278+
1279+
pub const NF_VERDICT_QMASK: ::c_int = 0xffff0000;
1280+
pub const NF_VERDICT_QBITS: ::c_int = 16;
1281+
1282+
pub const NF_VERDICT_BITS: ::c_int = 16;
1283+
1284+
pub const NF_INET_PRE_ROUTING: ::c_int = 0;
1285+
pub const NF_INET_LOCAL_IN: ::c_int = 1;
1286+
pub const NF_INET_FORWARD: ::c_int = 2;
1287+
pub const NF_INET_LOCAL_OUT: ::c_int = 3;
1288+
pub const NF_INET_POST_ROUTING: ::c_int = 4;
1289+
pub const NF_INET_NUMHOOKS: ::c_int = 5;
1290+
1291+
pub const NF_NETDEV_INGRESS: ::c_int = 0;
1292+
pub const NF_NETDEV_NUMHOOKS: ::c_int = 1;
1293+
1294+
pub const NFPROTO_UNSPEC: ::c_int = 0;
1295+
pub const NFPROTO_INET: ::c_int = 1;
1296+
pub const NFPROTO_IPV4: ::c_int = 2;
1297+
pub const NFPROTO_ARP: ::c_int = 3;
1298+
pub const NFPROTO_NETDEV: ::c_int = 5;
1299+
pub const NFPROTO_BRIDGE: ::c_int = 7;
1300+
pub const NFPROTO_IPV6: ::c_int = 10;
1301+
pub const NFPROTO_DECNET: ::c_int = 12;
1302+
pub const NFPROTO_NUMPROTO: ::c_int = 13;
1303+
1304+
pub const NFT_NAME_MAXLEN: ::c_int = 256;
1305+
pub const NFT_TABLE_MAXNAMELEN: ::c_int = NFT_NAME_MAXLEN;
1306+
pub const NFT_CHAIN_MAXNAMELEN: ::c_int = NFT_NAME_MAXLEN;
1307+
pub const NFT_SET_MAXNAMELEN: ::c_int = NFT_NAME_MAXLEN;
1308+
pub const NFT_OBJ_MAXNAMELEN: ::c_int = NFT_NAME_MAXLEN;
1309+
pub const NFT_USERDATA_MAXLEN: ::c_int = 256;
1310+
1311+
pub const NFT_MSG_NEWTABLE: ::c_int = 0;
1312+
pub const NFT_MSG_GETTABLE: ::c_int = 1;
1313+
pub const NFT_MSG_DELTABLE: ::c_int = 2;
1314+
pub const NFT_MSG_NEWCHAIN: ::c_int = 3;
1315+
pub const NFT_MSG_GETCHAIN: ::c_int = 4;
1316+
pub const NFT_MSG_DELCHAIN: ::c_int = 5;
1317+
pub const NFT_MSG_NEWRULE: ::c_int = 6;
1318+
pub const NFT_MSG_GETRULE: ::c_int = 7;
1319+
pub const NFT_MSG_DELRULE: ::c_int = 8;
1320+
pub const NFT_MSG_NEWSET: ::c_int = 9;
1321+
pub const NFT_MSG_GETSET: ::c_int = 10;
1322+
pub const NFT_MSG_DELSET: ::c_int = 11;
1323+
pub const NFT_MSG_NEWSETELEM: ::c_int = 12;
1324+
pub const NFT_MSG_GETSETELEM: ::c_int = 13;
1325+
pub const NFT_MSG_DELSETELEM: ::c_int = 14;
1326+
pub const NFT_MSG_NEWGEN: ::c_int = 15;
1327+
pub const NFT_MSG_GETGEN: ::c_int = 16;
1328+
pub const NFT_MSG_TRACE: ::c_int = 17;
1329+
pub const NFT_MSG_NEWOBJ: ::c_int = 18;
1330+
pub const NFT_MSG_GETOBJ: ::c_int = 19;
1331+
pub const NFT_MSG_DELOBJ: ::c_int = 20;
1332+
pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21;
1333+
pub const NFT_MSG_MAX: ::c_int = 22;
1334+
12681335
f! {
12691336
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
12701337
for slot in cpuset.bits.iter_mut() {

0 commit comments

Comments
 (0)