Skip to content

Commit

Permalink
Routing (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
moubctez authored Sep 10, 2024
1 parent ef1cf37 commit d42cdc5
Show file tree
Hide file tree
Showing 11 changed files with 767 additions and 316 deletions.
86 changes: 43 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "defguard_wireguard_rs"
version = "0.4.7"
version = "0.4.8"
edition = "2021"
description = "A unified multi-platform high-level API for managing WireGuard interfaces"
license = "Apache-2.0"
Expand Down Expand Up @@ -28,6 +28,10 @@ nix = { version = "0.29", features = ["ioctl", "socket"] }
libc = { version = "0.2", default-features = false }
nix = { version = "0.29", features = ["ioctl", "socket"] }

[target.'cfg(target_os = "netbsd")'.dependencies]
libc = { version = "0.2", default-features = false }
nix = { version = "0.29", features = ["ioctl", "socket"] }

[target.'cfg(target_os = "linux")'.dependencies]
netlink-packet-core = "0.7"
netlink-packet-generic = "0.3"
Expand Down
11 changes: 10 additions & 1 deletion src/bsd/ifconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,22 @@ const ND6_INFINITE_LIFETIME: u32 = u32::MAX;
// SIOCIFDESTROY
ioctl_write_ptr!(destroy_clone_if, b'i', 121, IfReq);
// SIOCIFCREATE2
// FIXME: not on NetBSD
ioctl_readwrite!(create_clone_if, b'i', 124, IfReq);
// SIOCGIFMTU
#[cfg(any(target_os = "freebsd", target_os = "macos"))]
ioctl_readwrite!(get_if_mtu, b'i', 51, IfMtu);
#[cfg(target_os = "netbsd")]
ioctl_readwrite!(get_if_mtu, b'i', 126, IfMtu);
// SIOCSIFMTU
#[cfg(any(target_os = "freebsd", target_os = "macos"))]
ioctl_write_ptr!(set_if_mtu, b'i', 52, IfMtu);
#[cfg(target_os = "netbsd")]
ioctl_write_ptr!(set_if_mtu, b'i', 127, IfMtu);
// SIOCAIFADDR
#[cfg(target_os = "freebsd")]
ioctl_write_ptr!(add_addr_if, b'i', 43, InAliasReq);
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "macos", target_os = "netbsd"))]
ioctl_write_ptr!(add_addr_if, b'i', 26, InAliasReq);
// SIOCDIFADDR
ioctl_write_ptr!(del_addr_if, b'i', 25, IfReq);
Expand All @@ -37,6 +44,8 @@ ioctl_write_ptr!(del_addr_if, b'i', 25, IfReq);
ioctl_write_ptr!(add_addr_if_in6, b'i', 27, In6AliasReq);
#[cfg(target_os = "macos")]
ioctl_write_ptr!(add_addr_if_in6, b'i', 26, In6AliasReq);
#[cfg(target_os = "netbsd")]
ioctl_write_ptr!(add_addr_if_in6, b'i', 107, In6AliasReq);
// SIOCDIFADDR_IN6
ioctl_write_ptr!(del_addr_if_in6, b'i', 25, IfReq6);
// SIOCSIFFLAGS
Expand Down
Loading

0 comments on commit d42cdc5

Please sign in to comment.