From 1dea9f83b14c4cdd1f4291c4fc21c27b8b3ffbed Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Wed, 22 May 2024 01:55:42 +0000 Subject: [PATCH] Add support for illumos --- Cargo.toml | 2 +- README.md | 2 +- examples/lookup.rs | 3 +++ src/iter/mod.rs | 1 + src/lib.rs | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9451100..b53cdee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["mac", "address", "network", "interface"] [dependencies] serde = { version = "1.0.198", features = ["derive"], optional = true } -[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "android"))'.dependencies] +[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "android", target_os = "illumos"))'.dependencies] nix = { version = "0.28", features = ["net"] } [target.'cfg(windows)'.dependencies] diff --git a/README.md b/README.md index 0a033e9..f73b6e4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ `mac_address` provides a cross platform way to retrieve the [MAC address](https://en.wikipedia.org/wiki/MAC_address) of network hardware. -Supported platforms: Linux, Windows, MacOS, FreeBSD, OpenBSD +Supported platforms: Linux, Windows, MacOS, FreeBSD, OpenBSD, illumos ## Example diff --git a/examples/lookup.rs b/examples/lookup.rs index 39f4beb..c96c7bf 100644 --- a/examples/lookup.rs +++ b/examples/lookup.rs @@ -16,6 +16,9 @@ fn main() { #[cfg(target_os = "android")] let name = "wlan0"; + #[cfg(target_os = "illumos")] + let name = "igb0"; + match mac_address_by_name(name) { Ok(Some(ma)) => { println!("MAC addr of {} = {}", name, ma); diff --git a/src/iter/mod.rs b/src/iter/mod.rs index abea135..2ec910b 100644 --- a/src/iter/mod.rs +++ b/src/iter/mod.rs @@ -8,6 +8,7 @@ mod internal; target_os = "freebsd", target_os = "openbsd", target_os = "android", + target_os = "illumos", ))] #[path = "linux.rs"] mod internal; diff --git a/src/lib.rs b/src/lib.rs index e5b56d5..6d0569f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,7 @@ mod os; target_os = "freebsd", target_os = "openbsd", target_os = "android", + target_os = "illumos", ))] #[path = "linux.rs"] mod os; @@ -38,6 +39,7 @@ pub enum MacAddressError { target_os = "freebsd", target_os = "openbsd", target_os = "android", + target_os = "illumos", ))] impl From for MacAddressError { fn from(_: nix::Error) -> MacAddressError {