Skip to content

Commit ca0cb16

Browse files
committed
fix windows route
1 parent 39f13d0 commit ca0cb16

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

agent/crates/public/src/utils/net/windows.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ pub fn get_interface_by_index_from_win32(if_index: u32) -> Result<Link> {
140140
);
141141

142142
if result != 111 {
143+
println!("{} {} GetAdaptersAddresses {}", file!(), line!(), result);
143144
return Err(Error::Windows(format!(
144145
"Get buffer len by GetAdaptersAddresses failed error code {}",
145146
result
@@ -159,6 +160,7 @@ pub fn get_interface_by_index_from_win32(if_index: u32) -> Result<Link> {
159160
&mut buffer_len,
160161
);
161162
if result != 0 {
163+
println!("{} {} GetAdaptersAddresses {}", file!(), line!(), result);
162164
return Err(Error::Windows(format!(
163165
"Get adapter addresses by GetAdaptersAddresses failed error code {}",
164166
result
@@ -170,6 +172,7 @@ pub fn get_interface_by_index_from_win32(if_index: u32) -> Result<Link> {
170172
while !current_adapter.is_null() {
171173
let mac_address = unsafe {
172174
let adapter_ref = &*current_adapter;
175+
println!("{} {} adapter ifindex {}", file!(), line!(), adapter_ref.Anonymous1.Anonymous.IfIndex);
173176
if if_index != adapter_ref.Anonymous1.Anonymous.IfIndex {
174177
current_adapter = adapter_ref.Next;
175178
continue;
@@ -326,6 +329,7 @@ pub fn route_get(dest_addr: IpAddr) -> Result<Route> {
326329
"failed to run GetBestInterfaceEx function with destination address={} because of win32 error code({}),\n{}",
327330
dest_addr, ret_code, WIN_ERROR_CODE_STR
328331
);
332+
println!("{} {} {}", file!(), line!(), err_msg);
329333
return Err(Error::Windows(err_msg));
330334
}
331335

@@ -351,6 +355,7 @@ pub fn route_get(dest_addr: IpAddr) -> Result<Route> {
351355
"failed to run GetBestRoute2 function with destination address={} error: {}",
352356
dest_addr, err
353357
);
358+
println!("{} {} {}", file!(), line!(), err_msg);
354359
return Err(Error::Windows(err_msg));
355360
}
356361

@@ -381,6 +386,7 @@ pub fn route_get(dest_addr: IpAddr) -> Result<Route> {
381386
(src_addr, gateway)
382387
}
383388
};
389+
println!("{} {} route_get({}) return {} {}", file!(), line!(), dest_addr, src_addr, best_if_index);
384390

385391
Ok(Route {
386392
pref_src: Some(src_addr),

0 commit comments

Comments
 (0)