Skip to content

Commit 29db4bc

Browse files
committed
Add netfilter constants to Linux and Android
1 parent 11cabde commit 29db4bc

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-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/android/mod.rs

+62
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,68 @@ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
912912
pub const MFD_CLOEXEC: ::c_uint = 0x0001;
913913
pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
914914

915+
pub const NF_DROP: ::c_int = 0;
916+
pub const NF_ACCEPT: ::c_int = 1;
917+
pub const NF_STOLEN: ::c_int = 2;
918+
pub const NF_QUEUE: ::c_int = 3;
919+
pub const NF_REPEAT: ::c_int = 4;
920+
pub const NF_STOP: ::c_int = 5;
921+
pub const NF_MAX_VERDICT: ::c_int = NF_STOP;
922+
923+
pub const NF_VERDICT_MASK: ::c_int = 0x000000ff;
924+
pub const NF_VERDICT_FLAG_QUEUE_BYPASS: ::c_int = 0x00008000;
925+
926+
pub const NF_VERDICT_QMASK: ::c_int = 0xffff0000;
927+
pub const NF_VERDICT_QBITS: ::c_int = 16;
928+
929+
pub const NF_VERDICT_BITS: ::c_int = 16;
930+
931+
pub const NF_INET_PRE_ROUTING: ::c_int = 0;
932+
pub const NF_INET_LOCAL_IN: ::c_int = 1;
933+
pub const NF_INET_FORWARD: ::c_int = 2;
934+
pub const NF_INET_LOCAL_OUT: ::c_int = 3;
935+
pub const NF_INET_POST_ROUTING: ::c_int = 4;
936+
pub const NF_INET_NUMHOOKS: ::c_int = 5;
937+
938+
pub const NF_NETDEV_INGRESS: ::c_int = 0;
939+
pub const NF_NETDEV_NUMHOOKS: ::c_int = 1;
940+
941+
pub const NFPROTO_UNSPEC: ::c_int = 0;
942+
pub const NFPROTO_INET: ::c_int = 1;
943+
pub const NFPROTO_IPV4: ::c_int = 2;
944+
pub const NFPROTO_ARP: ::c_int = 3;
945+
pub const NFPROTO_NETDEV: ::c_int = 5;
946+
pub const NFPROTO_BRIDGE: ::c_int = 7;
947+
pub const NFPROTO_IPV6: ::c_int = 10;
948+
pub const NFPROTO_DECNET: ::c_int = 12;
949+
pub const NFPROTO_NUMPROTO: ::c_int = 13;
950+
951+
pub const NFT_TABLE_MAXNAMELEN: ::c_int = 32;
952+
pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 32;
953+
pub const NFT_SET_MAXNAMELEN: ::c_int = 32;
954+
pub const NFT_OBJ_MAXNAMELEN: ::c_int = 32;
955+
pub const NFT_USERDATA_MAXLEN: ::c_int = 256;
956+
957+
pub const NFT_MSG_NEWTABLE: ::c_int = 0;
958+
pub const NFT_MSG_GETTABLE: ::c_int = 1;
959+
pub const NFT_MSG_DELTABLE: ::c_int = 2;
960+
pub const NFT_MSG_NEWCHAIN: ::c_int = 3;
961+
pub const NFT_MSG_GETCHAIN: ::c_int = 4;
962+
pub const NFT_MSG_DELCHAIN: ::c_int = 5;
963+
pub const NFT_MSG_NEWRULE: ::c_int = 6;
964+
pub const NFT_MSG_GETRULE: ::c_int = 7;
965+
pub const NFT_MSG_DELRULE: ::c_int = 8;
966+
pub const NFT_MSG_NEWSET: ::c_int = 9;
967+
pub const NFT_MSG_GETSET: ::c_int = 10;
968+
pub const NFT_MSG_DELSET: ::c_int = 11;
969+
pub const NFT_MSG_NEWSETELEM: ::c_int = 12;
970+
pub const NFT_MSG_GETSETELEM: ::c_int = 13;
971+
pub const NFT_MSG_DELSETELEM: ::c_int = 14;
972+
pub const NFT_MSG_NEWGEN: ::c_int = 15;
973+
pub const NFT_MSG_GETGEN: ::c_int = 16;
974+
pub const NFT_MSG_TRACE: ::c_int = 17;
975+
pub const NFT_MSG_MAX: ::c_int = 18;
976+
915977
f! {
916978
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
917979
for slot in cpuset.__bits.iter_mut() {

src/unix/notbsd/linux/mod.rs

+66
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,72 @@ 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_TABLE_MAXNAMELEN: ::c_int = 32;
1305+
pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 32;
1306+
pub const NFT_SET_MAXNAMELEN: ::c_int = 32;
1307+
pub const NFT_OBJ_MAXNAMELEN: ::c_int = 32;
1308+
pub const NFT_USERDATA_MAXLEN: ::c_int = 256;
1309+
1310+
pub const NFT_MSG_NEWTABLE: ::c_int = 0;
1311+
pub const NFT_MSG_GETTABLE: ::c_int = 1;
1312+
pub const NFT_MSG_DELTABLE: ::c_int = 2;
1313+
pub const NFT_MSG_NEWCHAIN: ::c_int = 3;
1314+
pub const NFT_MSG_GETCHAIN: ::c_int = 4;
1315+
pub const NFT_MSG_DELCHAIN: ::c_int = 5;
1316+
pub const NFT_MSG_NEWRULE: ::c_int = 6;
1317+
pub const NFT_MSG_GETRULE: ::c_int = 7;
1318+
pub const NFT_MSG_DELRULE: ::c_int = 8;
1319+
pub const NFT_MSG_NEWSET: ::c_int = 9;
1320+
pub const NFT_MSG_GETSET: ::c_int = 10;
1321+
pub const NFT_MSG_DELSET: ::c_int = 11;
1322+
pub const NFT_MSG_NEWSETELEM: ::c_int = 12;
1323+
pub const NFT_MSG_GETSETELEM: ::c_int = 13;
1324+
pub const NFT_MSG_DELSETELEM: ::c_int = 14;
1325+
pub const NFT_MSG_NEWGEN: ::c_int = 15;
1326+
pub const NFT_MSG_GETGEN: ::c_int = 16;
1327+
pub const NFT_MSG_TRACE: ::c_int = 17;
1328+
pub const NFT_MSG_NEWOBJ: ::c_int = 18;
1329+
pub const NFT_MSG_GETOBJ: ::c_int = 19;
1330+
pub const NFT_MSG_DELOBJ: ::c_int = 20;
1331+
pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21;
1332+
pub const NFT_MSG_MAX: ::c_int = 22;
1333+
12681334
f! {
12691335
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
12701336
for slot in cpuset.bits.iter_mut() {

0 commit comments

Comments
 (0)