Skip to content

Commit 9971283

Browse files
committed
Add Netlink Protocol Families to SockProtocol enum
Currently the SockProtocol enum is rather scarce. This commit adds the Netlink protocols defined in netlink(7) to the SockProtocol enum allowing us to use the Nix socket library for more indepth Netlink work
1 parent 96054b6 commit 9971283

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

src/sys/socket/mod.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,64 @@ pub enum SockProtocol {
9292
/// ([ref](https://developer.apple.com/library/content/documentation/Darwin/Conceptual/NKEConceptual/control/control.html))
9393
#[cfg(any(target_os = "ios", target_os = "macos"))]
9494
KextControl = libc::SYSPROTO_CONTROL,
95+
/// Receives routing and link updates and may be used to modify the routing tables (both IPv4 and IPv6), IP addresses, link
96+
// parameters, neighbor setups, queueing disciplines, traffic classes and packet classifiers
97+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
98+
#[cfg(any(target_os = "android", target_os = "linux"))]
99+
NetlinkRoute = libc::NETLINK_ROUTE,
100+
/// Reserved for user-mode socket protocols
101+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
102+
#[cfg(any(target_os = "android", target_os = "linux"))]
103+
NetlinkUserSock = libc::NETLINK_USERSOCK,
104+
/// Query information about sockets of various protocol families from the kernel
105+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
106+
#[cfg(any(target_os = "android", target_os = "linux"))]
107+
NetlinkSockDiag = libc::NETLINK_SOCK_DIAG,
108+
/// SELinux event notifications.
109+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
110+
#[cfg(any(target_os = "android", target_os = "linux"))]
111+
NetlinkSELinux = libc::NETLINK_SELINUX,
112+
/// Open-iSCSI
113+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
114+
#[cfg(any(target_os = "android", target_os = "linux"))]
115+
NetlinkISCSI = libc::NETLINK_ISCSI,
116+
/// Auditing
117+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
118+
#[cfg(any(target_os = "android", target_os = "linux"))]
119+
NetlinkAudit = libc::NETLINK_AUDIT,
120+
/// Access to FIB lookup from user space
121+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
122+
#[cfg(any(target_os = "android", target_os = "linux"))]
123+
NetlinkFIBLookup = libc::NETLINK_FIB_LOOKUP,
124+
/// Netfilter subsystem
125+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
126+
#[cfg(any(target_os = "android", target_os = "linux"))]
127+
NetlinkNetFilter = libc::NETLINK_NETFILTER,
128+
/// SCSI Transports
129+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
130+
#[cfg(any(target_os = "android", target_os = "linux"))]
131+
NetlinkSCSITransport = libc::NETLINK_SCSITRANSPORT,
132+
/// Infiniband RDMA
133+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
134+
#[cfg(any(target_os = "android", target_os = "linux"))]
135+
NetlinkRDMA = libc::NETLINK_RDMA,
136+
/// Transport IPv6 packets from netfilter to user space. Used by ip6_queue kernel module.
137+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
138+
#[cfg(any(target_os = "android", target_os = "linux"))]
139+
NetlinkIPv6Firewall = libc::NETLINK_IP6_FW,
140+
/// DECnet routing messages
141+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
142+
#[cfg(any(target_os = "android", target_os = "linux"))]
143+
NetlinkDECNetRoutingMessage = libc::NETLINK_DNRTMSG,
144+
/// Kernel messages to user space
145+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
146+
#[cfg(any(target_os = "android", target_os = "linux"))]
147+
NetlinkKObjectUEvent = libc::NETLINK_KOBJECT_UEVENT,
148+
/// Netlink interface to request information about ciphers registered with the kernel crypto API as well as allow
149+
/// configuration of the kernel crypto API.
150+
/// ([ref](https://www.man7.org/linux/man-pages/man7/netlink.7.html))
151+
#[cfg(any(target_os = "android", target_os = "linux"))]
152+
NetlinkCrypto = libc::NETLINK_CRYPTO,
95153
}
96154

97155
libc_bitflags!{

0 commit comments

Comments
 (0)