Skip to content

Commit 829e136

Browse files
authored
Merge pull request #1628 from vorner/nfqueue-consts
Nfnetfilter queue constants
2 parents 7db4619 + 35db4e4 commit 829e136

File tree

3 files changed

+134
-0
lines changed

3 files changed

+134
-0
lines changed

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,7 @@ fn test_android(target: &str) {
13501350
"linux/net_tstamp.h",
13511351
"linux/netfilter/nfnetlink.h",
13521352
"linux/netfilter/nfnetlink_log.h",
1353+
"linux/netfilter/nfnetlink_queue.h",
13531354
"linux/netfilter/nf_tables.h",
13541355
"linux/netfilter_ipv4.h",
13551356
"linux/netfilter_ipv6.h",
@@ -2236,6 +2237,7 @@ fn test_linux(target: &str) {
22362237
"linux/net_tstamp.h",
22372238
"linux/netfilter/nfnetlink.h",
22382239
"linux/netfilter/nfnetlink_log.h",
2240+
"linux/netfilter/nfnetlink_queue.h",
22392241
"linux/netfilter/nf_tables.h",
22402242
"linux/netfilter_ipv4.h",
22412243
"linux/netfilter_ipv6.h",

src/unix/linux_like/android/mod.rs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,72 @@ pub const NFULNL_CFG_F_SEQ: ::c_int = 0x0001;
14111411
pub const NFULNL_CFG_F_SEQ_GLOBAL: ::c_int = 0x0002;
14121412
pub const NFULNL_CFG_F_CONNTRACK: ::c_int = 0x0004;
14131413

1414+
// linux/netfilter/nfnetlink_log.h
1415+
pub const NFQNL_MSG_PACKET: ::c_int = 0;
1416+
pub const NFQNL_MSG_VERDICT: ::c_int = 1;
1417+
pub const NFQNL_MSG_CONFIG: ::c_int = 2;
1418+
pub const NFQNL_MSG_VERDICT_BATCH: ::c_int = 3;
1419+
1420+
pub const NFQA_UNSPEC: ::c_int = 0;
1421+
pub const NFQA_PACKET_HDR: ::c_int = 1;
1422+
pub const NFQA_VERDICT_HDR: ::c_int = 2;
1423+
pub const NFQA_MARK: ::c_int = 3;
1424+
pub const NFQA_TIMESTAMP: ::c_int = 4;
1425+
pub const NFQA_IFINDEX_INDEV: ::c_int = 5;
1426+
pub const NFQA_IFINDEX_OUTDEV: ::c_int = 6;
1427+
pub const NFQA_IFINDEX_PHYSINDEV: ::c_int = 7;
1428+
pub const NFQA_IFINDEX_PHYSOUTDEV: ::c_int = 8;
1429+
pub const NFQA_HWADDR: ::c_int = 9;
1430+
pub const NFQA_PAYLOAD: ::c_int = 10;
1431+
pub const NFQA_CT: ::c_int = 11;
1432+
pub const NFQA_CT_INFO: ::c_int = 12;
1433+
pub const NFQA_CAP_LEN: ::c_int = 13;
1434+
pub const NFQA_SKB_INFO: ::c_int = 14;
1435+
pub const NFQA_EXP: ::c_int = 15;
1436+
pub const NFQA_UID: ::c_int = 16;
1437+
pub const NFQA_GID: ::c_int = 17;
1438+
pub const NFQA_SECCTX: ::c_int = 18;
1439+
/*
1440+
FIXME: These are not yet available in musl sanitized kernel headers and
1441+
make the tests fail. Enable them once musl has them.
1442+
1443+
See https://github.com/rust-lang/libc/pull/1628 for more details.
1444+
pub const NFQA_VLAN: ::c_int = 19;
1445+
pub const NFQA_L2HDR: ::c_int = 20;
1446+
1447+
pub const NFQA_VLAN_UNSPEC: ::c_int = 0;
1448+
pub const NFQA_VLAN_PROTO: ::c_int = 1;
1449+
pub const NFQA_VLAN_TCI: ::c_int = 2;
1450+
*/
1451+
1452+
pub const NFQNL_CFG_CMD_NONE: ::c_int = 0;
1453+
pub const NFQNL_CFG_CMD_BIND: ::c_int = 1;
1454+
pub const NFQNL_CFG_CMD_UNBIND: ::c_int = 2;
1455+
pub const NFQNL_CFG_CMD_PF_BIND: ::c_int = 3;
1456+
pub const NFQNL_CFG_CMD_PF_UNBIND: ::c_int = 4;
1457+
1458+
pub const NFQNL_COPY_NONE: ::c_int = 0;
1459+
pub const NFQNL_COPY_META: ::c_int = 1;
1460+
pub const NFQNL_COPY_PACKET: ::c_int = 2;
1461+
1462+
pub const NFQA_CFG_UNSPEC: ::c_int = 0;
1463+
pub const NFQA_CFG_CMD: ::c_int = 1;
1464+
pub const NFQA_CFG_PARAMS: ::c_int = 2;
1465+
pub const NFQA_CFG_QUEUE_MAXLEN: ::c_int = 3;
1466+
pub const NFQA_CFG_MASK: ::c_int = 4;
1467+
pub const NFQA_CFG_FLAGS: ::c_int = 5;
1468+
1469+
pub const NFQA_CFG_F_FAIL_OPEN: ::c_int = 0x0001;
1470+
pub const NFQA_CFG_F_CONNTRACK: ::c_int = 0x0002;
1471+
pub const NFQA_CFG_F_GSO: ::c_int = 0x0004;
1472+
pub const NFQA_CFG_F_UID_GID: ::c_int = 0x0008;
1473+
pub const NFQA_CFG_F_SECCTX: ::c_int = 0x0010;
1474+
pub const NFQA_CFG_F_MAX: ::c_int = 0x0020;
1475+
1476+
pub const NFQA_SKB_CSUMNOTREADY: ::c_int = 0x0001;
1477+
pub const NFQA_SKB_GSO: ::c_int = 0x0002;
1478+
pub const NFQA_SKB_CSUM_NOTVERIFIED: ::c_int = 0x0004;
1479+
14141480
pub const GENL_NAMSIZ: ::c_int = 16;
14151481

14161482
pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE;

src/unix/linux_like/linux/mod.rs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,72 @@ pub const NFULNL_CFG_F_SEQ: ::c_int = 0x0001;
17731773
pub const NFULNL_CFG_F_SEQ_GLOBAL: ::c_int = 0x0002;
17741774
pub const NFULNL_CFG_F_CONNTRACK: ::c_int = 0x0004;
17751775

1776+
// linux/netfilter/nfnetlink_log.h
1777+
pub const NFQNL_MSG_PACKET: ::c_int = 0;
1778+
pub const NFQNL_MSG_VERDICT: ::c_int = 1;
1779+
pub const NFQNL_MSG_CONFIG: ::c_int = 2;
1780+
pub const NFQNL_MSG_VERDICT_BATCH: ::c_int = 3;
1781+
1782+
pub const NFQA_UNSPEC: ::c_int = 0;
1783+
pub const NFQA_PACKET_HDR: ::c_int = 1;
1784+
pub const NFQA_VERDICT_HDR: ::c_int = 2;
1785+
pub const NFQA_MARK: ::c_int = 3;
1786+
pub const NFQA_TIMESTAMP: ::c_int = 4;
1787+
pub const NFQA_IFINDEX_INDEV: ::c_int = 5;
1788+
pub const NFQA_IFINDEX_OUTDEV: ::c_int = 6;
1789+
pub const NFQA_IFINDEX_PHYSINDEV: ::c_int = 7;
1790+
pub const NFQA_IFINDEX_PHYSOUTDEV: ::c_int = 8;
1791+
pub const NFQA_HWADDR: ::c_int = 9;
1792+
pub const NFQA_PAYLOAD: ::c_int = 10;
1793+
pub const NFQA_CT: ::c_int = 11;
1794+
pub const NFQA_CT_INFO: ::c_int = 12;
1795+
pub const NFQA_CAP_LEN: ::c_int = 13;
1796+
pub const NFQA_SKB_INFO: ::c_int = 14;
1797+
pub const NFQA_EXP: ::c_int = 15;
1798+
pub const NFQA_UID: ::c_int = 16;
1799+
pub const NFQA_GID: ::c_int = 17;
1800+
pub const NFQA_SECCTX: ::c_int = 18;
1801+
/*
1802+
FIXME: These are not yet available in musl sanitized kernel headers and
1803+
make the tests fail. Enable them once musl has them.
1804+
1805+
See https://github.com/rust-lang/libc/pull/1628 for more details.
1806+
pub const NFQA_VLAN: ::c_int = 19;
1807+
pub const NFQA_L2HDR: ::c_int = 20;
1808+
1809+
pub const NFQA_VLAN_UNSPEC: ::c_int = 0;
1810+
pub const NFQA_VLAN_PROTO: ::c_int = 1;
1811+
pub const NFQA_VLAN_TCI: ::c_int = 2;
1812+
*/
1813+
1814+
pub const NFQNL_CFG_CMD_NONE: ::c_int = 0;
1815+
pub const NFQNL_CFG_CMD_BIND: ::c_int = 1;
1816+
pub const NFQNL_CFG_CMD_UNBIND: ::c_int = 2;
1817+
pub const NFQNL_CFG_CMD_PF_BIND: ::c_int = 3;
1818+
pub const NFQNL_CFG_CMD_PF_UNBIND: ::c_int = 4;
1819+
1820+
pub const NFQNL_COPY_NONE: ::c_int = 0;
1821+
pub const NFQNL_COPY_META: ::c_int = 1;
1822+
pub const NFQNL_COPY_PACKET: ::c_int = 2;
1823+
1824+
pub const NFQA_CFG_UNSPEC: ::c_int = 0;
1825+
pub const NFQA_CFG_CMD: ::c_int = 1;
1826+
pub const NFQA_CFG_PARAMS: ::c_int = 2;
1827+
pub const NFQA_CFG_QUEUE_MAXLEN: ::c_int = 3;
1828+
pub const NFQA_CFG_MASK: ::c_int = 4;
1829+
pub const NFQA_CFG_FLAGS: ::c_int = 5;
1830+
1831+
pub const NFQA_CFG_F_FAIL_OPEN: ::c_int = 0x0001;
1832+
pub const NFQA_CFG_F_CONNTRACK: ::c_int = 0x0002;
1833+
pub const NFQA_CFG_F_GSO: ::c_int = 0x0004;
1834+
pub const NFQA_CFG_F_UID_GID: ::c_int = 0x0008;
1835+
pub const NFQA_CFG_F_SECCTX: ::c_int = 0x0010;
1836+
pub const NFQA_CFG_F_MAX: ::c_int = 0x0020;
1837+
1838+
pub const NFQA_SKB_CSUMNOTREADY: ::c_int = 0x0001;
1839+
pub const NFQA_SKB_GSO: ::c_int = 0x0002;
1840+
pub const NFQA_SKB_CSUM_NOTVERIFIED: ::c_int = 0x0004;
1841+
17761842
pub const GENL_NAMSIZ: ::c_int = 16;
17771843

17781844
pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE;

0 commit comments

Comments
 (0)