Skip to content

Commit 19f7653

Browse files
committed
log saddr and daddr if type unmatch
1 parent 379b71a commit 19f7653

File tree

1 file changed

+12
-2
lines changed
  • crates/shadowsocks-service/src/local/tun

1 file changed

+12
-2
lines changed

crates/shadowsocks-service/src/local/tun/mod.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,23 @@ impl Tun {
268268
match (mod_src_addr, &mut ip_header) {
269269
(SocketAddr::V4(v4addr), IpHeader::Version4(v4ip, ..)) => v4ip.source = v4addr.ip().octets(),
270270
(SocketAddr::V6(v6addr), IpHeader::Version6(v6ip, ..)) => v6ip.source = v6addr.ip().octets(),
271-
_ => unreachable!("modified saddr not match"),
271+
_ => {
272+
unreachable!(
273+
"modified TCP saddr not match, addr: {}, header: {:?}",
274+
mod_src_addr, ip_header
275+
);
276+
}
272277
}
273278
tcp_header.source_port = mod_src_addr.port();
274279
match (mod_dst_addr, &mut ip_header) {
275280
(SocketAddr::V4(v4addr), IpHeader::Version4(v4ip, ..)) => v4ip.destination = v4addr.ip().octets(),
276281
(SocketAddr::V6(v6addr), IpHeader::Version6(v6ip, ..)) => v6ip.destination = v6addr.ip().octets(),
277-
_ => unreachable!("modified daddr not match"),
282+
_ => {
283+
unreachable!(
284+
"modified TCP daddr not match, addr: {}, header: {:?}",
285+
mod_dst_addr, ip_header
286+
);
287+
}
278288
}
279289
tcp_header.destination_port = mod_dst_addr.port();
280290
match ip_header {

0 commit comments

Comments
 (0)