Skip to content

Commit 9c80662

Browse files
authored
feat: added fib_rules.h to netlink (#175)
1 parent 24e3aba commit 9c80662

File tree

20 files changed

+2395
-0
lines changed

20 files changed

+2395
-0
lines changed

gen/modules/netlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
#include <linux/rtnetlink.h>
66
#include <linux/if_link.h>
77
#include <linux/if_addr.h>
8+
#include <linux/fib_rules.h>

src/aarch64/netlink.rs

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,31 @@ pub tca_family: crate::ctypes::c_uchar,
612612
pub tca__pad1: crate::ctypes::c_uchar,
613613
pub tca__pad2: crate::ctypes::c_ushort,
614614
}
615+
#[repr(C)]
616+
#[derive(Debug, Copy, Clone)]
617+
pub struct fib_rule_hdr {
618+
pub family: __u8,
619+
pub dst_len: __u8,
620+
pub src_len: __u8,
621+
pub tos: __u8,
622+
pub table: __u8,
623+
pub res1: __u8,
624+
pub res2: __u8,
625+
pub action: __u8,
626+
pub flags: __u32,
627+
}
628+
#[repr(C)]
629+
#[derive(Debug, Copy, Clone)]
630+
pub struct fib_rule_uid_range {
631+
pub start: __u32,
632+
pub end: __u32,
633+
}
634+
#[repr(C)]
635+
#[derive(Debug, Copy, Clone)]
636+
pub struct fib_rule_port_range {
637+
pub start: __u16,
638+
pub end: __u16,
639+
}
615640
pub const _K_SS_MAXSIZE: u32 = 128;
616641
pub const SOCK_SNDBUF_LOCK: u32 = 1;
617642
pub const SOCK_RCVBUF_LOCK: u32 = 2;
@@ -872,6 +897,13 @@ pub const RTEXT_FILTER_MRP: u32 = 16;
872897
pub const RTEXT_FILTER_CFM_CONFIG: u32 = 32;
873898
pub const RTEXT_FILTER_CFM_STATUS: u32 = 64;
874899
pub const RTEXT_FILTER_MST: u32 = 128;
900+
pub const FIB_RULE_PERMANENT: u32 = 1;
901+
pub const FIB_RULE_INVERT: u32 = 2;
902+
pub const FIB_RULE_UNRESOLVED: u32 = 4;
903+
pub const FIB_RULE_IIF_DETACHED: u32 = 8;
904+
pub const FIB_RULE_DEV_DETACHED: u32 = 8;
905+
pub const FIB_RULE_OIF_DETACHED: u32 = 16;
906+
pub const FIB_RULE_FIND_SADDR: u32 = 65536;
875907
pub const NETLINK_UNCONNECTED: _bindgen_ty_1 = _bindgen_ty_1::NETLINK_UNCONNECTED;
876908
pub const NETLINK_CONNECTED: _bindgen_ty_1 = _bindgen_ty_1::NETLINK_CONNECTED;
877909
pub const IFLA_UNSPEC: _bindgen_ty_2 = _bindgen_ty_2::IFLA_UNSPEC;
@@ -1646,6 +1678,48 @@ pub const TCA_ROOT_COUNT: _bindgen_ty_68 = _bindgen_ty_68::TCA_ROOT_COUNT;
16461678
pub const TCA_ROOT_TIME_DELTA: _bindgen_ty_68 = _bindgen_ty_68::TCA_ROOT_TIME_DELTA;
16471679
pub const TCA_ROOT_EXT_WARN_MSG: _bindgen_ty_68 = _bindgen_ty_68::TCA_ROOT_EXT_WARN_MSG;
16481680
pub const __TCA_ROOT_MAX: _bindgen_ty_68 = _bindgen_ty_68::__TCA_ROOT_MAX;
1681+
pub const FRA_UNSPEC: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNSPEC;
1682+
pub const FRA_DST: _bindgen_ty_69 = _bindgen_ty_69::FRA_DST;
1683+
pub const FRA_SRC: _bindgen_ty_69 = _bindgen_ty_69::FRA_SRC;
1684+
pub const FRA_IIFNAME: _bindgen_ty_69 = _bindgen_ty_69::FRA_IIFNAME;
1685+
pub const FRA_GOTO: _bindgen_ty_69 = _bindgen_ty_69::FRA_GOTO;
1686+
pub const FRA_UNUSED2: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED2;
1687+
pub const FRA_PRIORITY: _bindgen_ty_69 = _bindgen_ty_69::FRA_PRIORITY;
1688+
pub const FRA_UNUSED3: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED3;
1689+
pub const FRA_UNUSED4: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED4;
1690+
pub const FRA_UNUSED5: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED5;
1691+
pub const FRA_FWMARK: _bindgen_ty_69 = _bindgen_ty_69::FRA_FWMARK;
1692+
pub const FRA_FLOW: _bindgen_ty_69 = _bindgen_ty_69::FRA_FLOW;
1693+
pub const FRA_TUN_ID: _bindgen_ty_69 = _bindgen_ty_69::FRA_TUN_ID;
1694+
pub const FRA_SUPPRESS_IFGROUP: _bindgen_ty_69 = _bindgen_ty_69::FRA_SUPPRESS_IFGROUP;
1695+
pub const FRA_SUPPRESS_PREFIXLEN: _bindgen_ty_69 = _bindgen_ty_69::FRA_SUPPRESS_PREFIXLEN;
1696+
pub const FRA_TABLE: _bindgen_ty_69 = _bindgen_ty_69::FRA_TABLE;
1697+
pub const FRA_FWMASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_FWMASK;
1698+
pub const FRA_OIFNAME: _bindgen_ty_69 = _bindgen_ty_69::FRA_OIFNAME;
1699+
pub const FRA_PAD: _bindgen_ty_69 = _bindgen_ty_69::FRA_PAD;
1700+
pub const FRA_L3MDEV: _bindgen_ty_69 = _bindgen_ty_69::FRA_L3MDEV;
1701+
pub const FRA_UID_RANGE: _bindgen_ty_69 = _bindgen_ty_69::FRA_UID_RANGE;
1702+
pub const FRA_PROTOCOL: _bindgen_ty_69 = _bindgen_ty_69::FRA_PROTOCOL;
1703+
pub const FRA_IP_PROTO: _bindgen_ty_69 = _bindgen_ty_69::FRA_IP_PROTO;
1704+
pub const FRA_SPORT_RANGE: _bindgen_ty_69 = _bindgen_ty_69::FRA_SPORT_RANGE;
1705+
pub const FRA_DPORT_RANGE: _bindgen_ty_69 = _bindgen_ty_69::FRA_DPORT_RANGE;
1706+
pub const FRA_DSCP: _bindgen_ty_69 = _bindgen_ty_69::FRA_DSCP;
1707+
pub const FRA_FLOWLABEL: _bindgen_ty_69 = _bindgen_ty_69::FRA_FLOWLABEL;
1708+
pub const FRA_FLOWLABEL_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_FLOWLABEL_MASK;
1709+
pub const FRA_SPORT_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_SPORT_MASK;
1710+
pub const FRA_DPORT_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_DPORT_MASK;
1711+
pub const FRA_DSCP_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_DSCP_MASK;
1712+
pub const __FRA_MAX: _bindgen_ty_69 = _bindgen_ty_69::__FRA_MAX;
1713+
pub const FR_ACT_UNSPEC: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_UNSPEC;
1714+
pub const FR_ACT_TO_TBL: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_TO_TBL;
1715+
pub const FR_ACT_GOTO: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_GOTO;
1716+
pub const FR_ACT_NOP: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_NOP;
1717+
pub const FR_ACT_RES3: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_RES3;
1718+
pub const FR_ACT_RES4: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_RES4;
1719+
pub const FR_ACT_BLACKHOLE: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_BLACKHOLE;
1720+
pub const FR_ACT_UNREACHABLE: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_UNREACHABLE;
1721+
pub const FR_ACT_PROHIBIT: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_PROHIBIT;
1722+
pub const __FR_ACT_MAX: _bindgen_ty_70 = _bindgen_ty_70::__FR_ACT_MAX;
16491723
#[repr(u32)]
16501724
#[non_exhaustive]
16511725
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -5191,6 +5265,58 @@ TCA_ROOT_TIME_DELTA = 4,
51915265
TCA_ROOT_EXT_WARN_MSG = 5,
51925266
__TCA_ROOT_MAX = 6,
51935267
}
5268+
#[repr(u32)]
5269+
#[non_exhaustive]
5270+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
5271+
pub enum _bindgen_ty_69 {
5272+
FRA_UNSPEC = 0,
5273+
FRA_DST = 1,
5274+
FRA_SRC = 2,
5275+
FRA_IIFNAME = 3,
5276+
FRA_GOTO = 4,
5277+
FRA_UNUSED2 = 5,
5278+
FRA_PRIORITY = 6,
5279+
FRA_UNUSED3 = 7,
5280+
FRA_UNUSED4 = 8,
5281+
FRA_UNUSED5 = 9,
5282+
FRA_FWMARK = 10,
5283+
FRA_FLOW = 11,
5284+
FRA_TUN_ID = 12,
5285+
FRA_SUPPRESS_IFGROUP = 13,
5286+
FRA_SUPPRESS_PREFIXLEN = 14,
5287+
FRA_TABLE = 15,
5288+
FRA_FWMASK = 16,
5289+
FRA_OIFNAME = 17,
5290+
FRA_PAD = 18,
5291+
FRA_L3MDEV = 19,
5292+
FRA_UID_RANGE = 20,
5293+
FRA_PROTOCOL = 21,
5294+
FRA_IP_PROTO = 22,
5295+
FRA_SPORT_RANGE = 23,
5296+
FRA_DPORT_RANGE = 24,
5297+
FRA_DSCP = 25,
5298+
FRA_FLOWLABEL = 26,
5299+
FRA_FLOWLABEL_MASK = 27,
5300+
FRA_SPORT_MASK = 28,
5301+
FRA_DPORT_MASK = 29,
5302+
FRA_DSCP_MASK = 30,
5303+
__FRA_MAX = 31,
5304+
}
5305+
#[repr(u32)]
5306+
#[non_exhaustive]
5307+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
5308+
pub enum _bindgen_ty_70 {
5309+
FR_ACT_UNSPEC = 0,
5310+
FR_ACT_TO_TBL = 1,
5311+
FR_ACT_GOTO = 2,
5312+
FR_ACT_NOP = 3,
5313+
FR_ACT_RES3 = 4,
5314+
FR_ACT_RES4 = 5,
5315+
FR_ACT_BLACKHOLE = 6,
5316+
FR_ACT_UNREACHABLE = 7,
5317+
FR_ACT_PROHIBIT = 8,
5318+
__FR_ACT_MAX = 9,
5319+
}
51945320
#[repr(C)]
51955321
#[derive(Copy, Clone)]
51965322
pub union __kernel_sockaddr_storage__bindgen_ty_1 {

src/arm/netlink.rs

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,31 @@ pub tca_family: crate::ctypes::c_uchar,
610610
pub tca__pad1: crate::ctypes::c_uchar,
611611
pub tca__pad2: crate::ctypes::c_ushort,
612612
}
613+
#[repr(C)]
614+
#[derive(Debug, Copy, Clone)]
615+
pub struct fib_rule_hdr {
616+
pub family: __u8,
617+
pub dst_len: __u8,
618+
pub src_len: __u8,
619+
pub tos: __u8,
620+
pub table: __u8,
621+
pub res1: __u8,
622+
pub res2: __u8,
623+
pub action: __u8,
624+
pub flags: __u32,
625+
}
626+
#[repr(C)]
627+
#[derive(Debug, Copy, Clone)]
628+
pub struct fib_rule_uid_range {
629+
pub start: __u32,
630+
pub end: __u32,
631+
}
632+
#[repr(C)]
633+
#[derive(Debug, Copy, Clone)]
634+
pub struct fib_rule_port_range {
635+
pub start: __u16,
636+
pub end: __u16,
637+
}
613638
pub const _K_SS_MAXSIZE: u32 = 128;
614639
pub const SOCK_SNDBUF_LOCK: u32 = 1;
615640
pub const SOCK_RCVBUF_LOCK: u32 = 2;
@@ -870,6 +895,13 @@ pub const RTEXT_FILTER_MRP: u32 = 16;
870895
pub const RTEXT_FILTER_CFM_CONFIG: u32 = 32;
871896
pub const RTEXT_FILTER_CFM_STATUS: u32 = 64;
872897
pub const RTEXT_FILTER_MST: u32 = 128;
898+
pub const FIB_RULE_PERMANENT: u32 = 1;
899+
pub const FIB_RULE_INVERT: u32 = 2;
900+
pub const FIB_RULE_UNRESOLVED: u32 = 4;
901+
pub const FIB_RULE_IIF_DETACHED: u32 = 8;
902+
pub const FIB_RULE_DEV_DETACHED: u32 = 8;
903+
pub const FIB_RULE_OIF_DETACHED: u32 = 16;
904+
pub const FIB_RULE_FIND_SADDR: u32 = 65536;
873905
pub const NETLINK_UNCONNECTED: _bindgen_ty_1 = _bindgen_ty_1::NETLINK_UNCONNECTED;
874906
pub const NETLINK_CONNECTED: _bindgen_ty_1 = _bindgen_ty_1::NETLINK_CONNECTED;
875907
pub const IFLA_UNSPEC: _bindgen_ty_2 = _bindgen_ty_2::IFLA_UNSPEC;
@@ -1644,6 +1676,48 @@ pub const TCA_ROOT_COUNT: _bindgen_ty_68 = _bindgen_ty_68::TCA_ROOT_COUNT;
16441676
pub const TCA_ROOT_TIME_DELTA: _bindgen_ty_68 = _bindgen_ty_68::TCA_ROOT_TIME_DELTA;
16451677
pub const TCA_ROOT_EXT_WARN_MSG: _bindgen_ty_68 = _bindgen_ty_68::TCA_ROOT_EXT_WARN_MSG;
16461678
pub const __TCA_ROOT_MAX: _bindgen_ty_68 = _bindgen_ty_68::__TCA_ROOT_MAX;
1679+
pub const FRA_UNSPEC: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNSPEC;
1680+
pub const FRA_DST: _bindgen_ty_69 = _bindgen_ty_69::FRA_DST;
1681+
pub const FRA_SRC: _bindgen_ty_69 = _bindgen_ty_69::FRA_SRC;
1682+
pub const FRA_IIFNAME: _bindgen_ty_69 = _bindgen_ty_69::FRA_IIFNAME;
1683+
pub const FRA_GOTO: _bindgen_ty_69 = _bindgen_ty_69::FRA_GOTO;
1684+
pub const FRA_UNUSED2: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED2;
1685+
pub const FRA_PRIORITY: _bindgen_ty_69 = _bindgen_ty_69::FRA_PRIORITY;
1686+
pub const FRA_UNUSED3: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED3;
1687+
pub const FRA_UNUSED4: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED4;
1688+
pub const FRA_UNUSED5: _bindgen_ty_69 = _bindgen_ty_69::FRA_UNUSED5;
1689+
pub const FRA_FWMARK: _bindgen_ty_69 = _bindgen_ty_69::FRA_FWMARK;
1690+
pub const FRA_FLOW: _bindgen_ty_69 = _bindgen_ty_69::FRA_FLOW;
1691+
pub const FRA_TUN_ID: _bindgen_ty_69 = _bindgen_ty_69::FRA_TUN_ID;
1692+
pub const FRA_SUPPRESS_IFGROUP: _bindgen_ty_69 = _bindgen_ty_69::FRA_SUPPRESS_IFGROUP;
1693+
pub const FRA_SUPPRESS_PREFIXLEN: _bindgen_ty_69 = _bindgen_ty_69::FRA_SUPPRESS_PREFIXLEN;
1694+
pub const FRA_TABLE: _bindgen_ty_69 = _bindgen_ty_69::FRA_TABLE;
1695+
pub const FRA_FWMASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_FWMASK;
1696+
pub const FRA_OIFNAME: _bindgen_ty_69 = _bindgen_ty_69::FRA_OIFNAME;
1697+
pub const FRA_PAD: _bindgen_ty_69 = _bindgen_ty_69::FRA_PAD;
1698+
pub const FRA_L3MDEV: _bindgen_ty_69 = _bindgen_ty_69::FRA_L3MDEV;
1699+
pub const FRA_UID_RANGE: _bindgen_ty_69 = _bindgen_ty_69::FRA_UID_RANGE;
1700+
pub const FRA_PROTOCOL: _bindgen_ty_69 = _bindgen_ty_69::FRA_PROTOCOL;
1701+
pub const FRA_IP_PROTO: _bindgen_ty_69 = _bindgen_ty_69::FRA_IP_PROTO;
1702+
pub const FRA_SPORT_RANGE: _bindgen_ty_69 = _bindgen_ty_69::FRA_SPORT_RANGE;
1703+
pub const FRA_DPORT_RANGE: _bindgen_ty_69 = _bindgen_ty_69::FRA_DPORT_RANGE;
1704+
pub const FRA_DSCP: _bindgen_ty_69 = _bindgen_ty_69::FRA_DSCP;
1705+
pub const FRA_FLOWLABEL: _bindgen_ty_69 = _bindgen_ty_69::FRA_FLOWLABEL;
1706+
pub const FRA_FLOWLABEL_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_FLOWLABEL_MASK;
1707+
pub const FRA_SPORT_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_SPORT_MASK;
1708+
pub const FRA_DPORT_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_DPORT_MASK;
1709+
pub const FRA_DSCP_MASK: _bindgen_ty_69 = _bindgen_ty_69::FRA_DSCP_MASK;
1710+
pub const __FRA_MAX: _bindgen_ty_69 = _bindgen_ty_69::__FRA_MAX;
1711+
pub const FR_ACT_UNSPEC: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_UNSPEC;
1712+
pub const FR_ACT_TO_TBL: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_TO_TBL;
1713+
pub const FR_ACT_GOTO: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_GOTO;
1714+
pub const FR_ACT_NOP: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_NOP;
1715+
pub const FR_ACT_RES3: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_RES3;
1716+
pub const FR_ACT_RES4: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_RES4;
1717+
pub const FR_ACT_BLACKHOLE: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_BLACKHOLE;
1718+
pub const FR_ACT_UNREACHABLE: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_UNREACHABLE;
1719+
pub const FR_ACT_PROHIBIT: _bindgen_ty_70 = _bindgen_ty_70::FR_ACT_PROHIBIT;
1720+
pub const __FR_ACT_MAX: _bindgen_ty_70 = _bindgen_ty_70::__FR_ACT_MAX;
16471721
#[repr(u32)]
16481722
#[non_exhaustive]
16491723
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -5189,6 +5263,58 @@ TCA_ROOT_TIME_DELTA = 4,
51895263
TCA_ROOT_EXT_WARN_MSG = 5,
51905264
__TCA_ROOT_MAX = 6,
51915265
}
5266+
#[repr(u32)]
5267+
#[non_exhaustive]
5268+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
5269+
pub enum _bindgen_ty_69 {
5270+
FRA_UNSPEC = 0,
5271+
FRA_DST = 1,
5272+
FRA_SRC = 2,
5273+
FRA_IIFNAME = 3,
5274+
FRA_GOTO = 4,
5275+
FRA_UNUSED2 = 5,
5276+
FRA_PRIORITY = 6,
5277+
FRA_UNUSED3 = 7,
5278+
FRA_UNUSED4 = 8,
5279+
FRA_UNUSED5 = 9,
5280+
FRA_FWMARK = 10,
5281+
FRA_FLOW = 11,
5282+
FRA_TUN_ID = 12,
5283+
FRA_SUPPRESS_IFGROUP = 13,
5284+
FRA_SUPPRESS_PREFIXLEN = 14,
5285+
FRA_TABLE = 15,
5286+
FRA_FWMASK = 16,
5287+
FRA_OIFNAME = 17,
5288+
FRA_PAD = 18,
5289+
FRA_L3MDEV = 19,
5290+
FRA_UID_RANGE = 20,
5291+
FRA_PROTOCOL = 21,
5292+
FRA_IP_PROTO = 22,
5293+
FRA_SPORT_RANGE = 23,
5294+
FRA_DPORT_RANGE = 24,
5295+
FRA_DSCP = 25,
5296+
FRA_FLOWLABEL = 26,
5297+
FRA_FLOWLABEL_MASK = 27,
5298+
FRA_SPORT_MASK = 28,
5299+
FRA_DPORT_MASK = 29,
5300+
FRA_DSCP_MASK = 30,
5301+
__FRA_MAX = 31,
5302+
}
5303+
#[repr(u32)]
5304+
#[non_exhaustive]
5305+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
5306+
pub enum _bindgen_ty_70 {
5307+
FR_ACT_UNSPEC = 0,
5308+
FR_ACT_TO_TBL = 1,
5309+
FR_ACT_GOTO = 2,
5310+
FR_ACT_NOP = 3,
5311+
FR_ACT_RES3 = 4,
5312+
FR_ACT_RES4 = 5,
5313+
FR_ACT_BLACKHOLE = 6,
5314+
FR_ACT_UNREACHABLE = 7,
5315+
FR_ACT_PROHIBIT = 8,
5316+
__FR_ACT_MAX = 9,
5317+
}
51925318
#[repr(C)]
51935319
#[derive(Copy, Clone)]
51945320
pub union __kernel_sockaddr_storage__bindgen_ty_1 {

0 commit comments

Comments
 (0)