Skip to content

Commit

Permalink
linux: add missing netfilter definitions
Browse files Browse the repository at this point in the history
Fill in missing constants available as of Linux v5.18. The
relevant UAPI headers are

- nfnetlink.h
- nfnetlink_log.h
- nfnetlink_queue.h

NFNL_SUBSYS_COUNT was mistakenly defined to the value of
NFNL_SUBSYS_HOOK in fcd94cc which is also corrected in this
commit.
  • Loading branch information
phi-gamma committed Aug 16, 2022
1 parent d9eb957 commit c2a5607
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/unix/linux_like/linux/mod.rs
Expand Up @@ -2086,6 +2086,7 @@ pub const NFNLGRP_CONNTRACK_EXP_UPDATE: ::c_int = 5;
pub const NFNLGRP_CONNTRACK_EXP_DESTROY: ::c_int = 6;
pub const NFNLGRP_NFTABLES: ::c_int = 7;
pub const NFNLGRP_ACCT_QUOTA: ::c_int = 8;
pub const NFNLGRP_NFTRACE: ::c_int = 9;

pub const NFNETLINK_V0: ::c_int = 0;

Expand All @@ -2101,15 +2102,23 @@ pub const NFNL_SUBSYS_CTNETLINK_TIMEOUT: ::c_int = 8;
pub const NFNL_SUBSYS_CTHELPER: ::c_int = 9;
pub const NFNL_SUBSYS_NFTABLES: ::c_int = 10;
pub const NFNL_SUBSYS_NFT_COMPAT: ::c_int = 11;
pub const NFNL_SUBSYS_COUNT: ::c_int = 12;
pub const NFNL_SUBSYS_HOOK: ::c_int = 12;
pub const NFNL_SUBSYS_COUNT: ::c_int = 13;

pub const NFNL_MSG_BATCH_BEGIN: ::c_int = NLMSG_MIN_TYPE;
pub const NFNL_MSG_BATCH_END: ::c_int = NLMSG_MIN_TYPE + 1;

pub const NFNL_BATCH_UNSPEC: ::c_int = 0;
pub const NFNL_BATCH_GENID: ::c_int = 0;

// linux/netfilter/nfnetlink_log.h
pub const NFULNL_MSG_PACKET: ::c_int = 0;
pub const NFULNL_MSG_CONFIG: ::c_int = 1;

pub const NFULA_VLAN_UNSPEC: ::c_int = 0;
pub const NFULA_VLAN_PROTO: ::c_int = 1;
pub const NFULA_VLAN_TCI: ::c_int = 2;

pub const NFULA_UNSPEC: ::c_int = 0;
pub const NFULA_PACKET_HDR: ::c_int = 1;
pub const NFULA_MARK: ::c_int = 2;
Expand All @@ -2130,6 +2139,8 @@ pub const NFULA_HWHEADER: ::c_int = 16;
pub const NFULA_HWLEN: ::c_int = 17;
pub const NFULA_CT: ::c_int = 18;
pub const NFULA_CT_INFO: ::c_int = 19;
pub const NFULA_VLAN: ::c_int = 20;
pub const NFULA_L2HDR: ::c_int = 21;

pub const NFULNL_CFG_CMD_NONE: ::c_int = 0;
pub const NFULNL_CFG_CMD_BIND: ::c_int = 1;
Expand All @@ -2153,7 +2164,7 @@ pub const NFULNL_CFG_F_SEQ: ::c_int = 0x0001;
pub const NFULNL_CFG_F_SEQ_GLOBAL: ::c_int = 0x0002;
pub const NFULNL_CFG_F_CONNTRACK: ::c_int = 0x0004;

// linux/netfilter/nfnetlink_log.h
// linux/netfilter/nfnetlink_queue.h
pub const NFQNL_MSG_PACKET: ::c_int = 0;
pub const NFQNL_MSG_VERDICT: ::c_int = 1;
pub const NFQNL_MSG_CONFIG: ::c_int = 2;
Expand Down Expand Up @@ -2185,6 +2196,7 @@ pub const NFQA_SECCTX: ::c_int = 18;
See https://github.com/rust-lang/libc/pull/1628 for more details.
pub const NFQA_VLAN: ::c_int = 19;
pub const NFQA_L2HDR: ::c_int = 20;
pub const NFQA_PRIORITY: ::c_int = 21;
pub const NFQA_VLAN_UNSPEC: ::c_int = 0;
pub const NFQA_VLAN_PROTO: ::c_int = 1;
Expand Down Expand Up @@ -2219,6 +2231,8 @@ pub const NFQA_SKB_CSUMNOTREADY: ::c_int = 0x0001;
pub const NFQA_SKB_GSO: ::c_int = 0x0002;
pub const NFQA_SKB_CSUM_NOTVERIFIED: ::c_int = 0x0004;

// linux/genetlink.h

pub const GENL_NAMSIZ: ::c_int = 16;

pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE;
Expand Down

0 comments on commit c2a5607

Please sign in to comment.