add veilid_api logging to debug calls through the api

This commit is contained in:
Christien Rioux
2024-02-29 21:18:31 -05:00
parent 380ac1883f
commit 292664f3fe
5 changed files with 47 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ cfg_if::cfg_if! {
use self::windows::PlatformSupportWindows as PlatformSupport;
} else if #[cfg(any(target_os = "macos", target_os = "ios"))] {
use self::apple::PlatformSupportApple as PlatformSupport;
} else if #[cfg(any(target_os = "openbsd"))] {
} else if #[cfg(target_os = "openbsd")] {
use self::openbsd::PlatformSupportOpenBSD as PlatformSupport;
} else {
compile_error!("No network interfaces support for this platform!");

View File

@@ -1,11 +1,11 @@
#![cfg(any(target_os = "openbsd"))]
#![cfg(target_os = "openbsd")]
#![allow(non_camel_case_types)]
use super::*;
use libc::{
close, freeifaddrs, getifaddrs, if_nametoindex, ifaddrs, ioctl, pid_t, sockaddr, sockaddr_in6, c_short,
socket, sysctl, time_t, AF_INET6, CTL_NET, IFF_BROADCAST, IFF_LOOPBACK, IFF_POINTOPOINT,
IFF_RUNNING, IFNAMSIZ, NET_RT_FLAGS, PF_ROUTE, SOCK_DGRAM,
c_short, close, freeifaddrs, getifaddrs, if_nametoindex, ifaddrs, ioctl, pid_t, sockaddr,
sockaddr_in6, socket, sysctl, time_t, AF_INET6, CTL_NET, IFF_BROADCAST, IFF_LOOPBACK,
IFF_POINTOPOINT, IFF_RUNNING, IFNAMSIZ, NET_RT_FLAGS, PF_ROUTE, SOCK_DGRAM,
};
use sockaddr_tools::SockAddr;
use std::ffi::CStr;
@@ -29,7 +29,6 @@ const RTA_DST: c_int = 1;
const RTA_GATEWAY: c_int = 2;
const RTF_GATEWAY: c_int = 2;
macro_rules! set_name {
($name_field:expr, $name_str:expr) => {{
let name_c = &::std::ffi::CString::new($name_str.to_owned()).map_err(|_| {
@@ -364,7 +363,7 @@ impl PlatformSupportOpenBSD {
Some(a) => a,
None => continue,
};
let src_ipaddr = match saddr_src.as_ipaddr() {
Some(a) => a,
None => continue,