Skip to content

Commit

Permalink
mac address
Browse files Browse the repository at this point in the history
  • Loading branch information
xmh0511 committed Aug 29, 2024
1 parent 0c7c9ac commit 7cc685e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ use crate::IntoAddress;
#[allow(unused_imports)]
use std::net::IpAddr;

#[cfg(target_family = "unix")]
#[allow(dead_code)]
pub(crate) const ETHER_ADDR_LEN: u8 = 6;
/// A TUN abstract device interface.
pub trait AbstractDevice {
/// Get the device tun name.
Expand Down
2 changes: 1 addition & 1 deletion src/platform/freebsd/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ impl AbstractDevice for Device {
let mut req = self.request()?;
let mut sa_data = [0i8; 14];
req.ifr_ifru.ifru_addr.sa_len = ETHER_ADDR_LEN;
req.ifr_ifru.ifru_addr.sa_family = AF_LINK;
req.ifr_ifru.ifru_addr.sa_family = AF_LINK as u8;
req.ifr_ifru.ifru_addr.sa_data[0..ETHER_ADDR_LEN]
.copy_from_slice(eth_addr.map(|c| c as i8).as_slice());
if let Err(err) = siocsiflladdr(self.ctl.as_raw_fd(), &mut req) {
Expand Down

0 comments on commit 7cc685e

Please sign in to comment.