From cb26b985ddfda7e272a6f43fc9a1a30cb904910b Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 15 Apr 2026 14:19:51 +0800 Subject: [PATCH] drop_multicast is configured with CommandLine --- src/bin/punchnet/main.rs | 2 +- src/lib.rs | 2 +- src/network/tun_win.rs | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/bin/punchnet/main.rs b/src/bin/punchnet/main.rs index 9c02d07..7f32290 100755 --- a/src/bin/punchnet/main.rs +++ b/src/bin/punchnet/main.rs @@ -169,7 +169,7 @@ async fn daemonize_me( // nat_server2: "47.98.178.3:1265".to_owned(), nat_server2: server.clone() +":1366", allow_routing: allow_routing, - _drop_multicast: true, + _drop_multicast: false, register_ttl: 1, mtu: 1400, name: "tau".to_owned(), diff --git a/src/lib.rs b/src/lib.rs index f609c2e..0f487bf 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -162,7 +162,7 @@ async fn parse_config(uuid: String, args: &CommandLine) -> Result { let node_conf = NodeConfig { name: args.name.to_owned(), allow_routing: AtomicBool::new(args.allow_routing), - _drop_multicast: true, + _drop_multicast: args._drop_multicast, allow_p2p: args.allow_p2p, mtu: args.mtu, _tos: 0, diff --git a/src/network/tun_win.rs b/src/network/tun_win.rs index 0fe3e24..d9a8690 100755 --- a/src/network/tun_win.rs +++ b/src/network/tun_win.rs @@ -69,10 +69,6 @@ impl Iface { } let mask = net_bit_len_to_mask(netbit); - let mut default_gw = (ip & mask) + 1; - if default_gw == ip { - default_gw += 1; - } let ip = ip_to_string(&ip); let netbit = ip_to_string(&net_bit_len_to_mask(netbit)); @@ -123,9 +119,9 @@ impl Iface { } } - let gw = ip_to_string(&default_gw); - debug!("gw = {}", gw); - if let Err(e) = set_dns(&self.name, network_domain, &gw, self.if_idx) { + // let gw = ip_to_string(&default_gw); + debug!("gw = {}", ip); + if let Err(e) = set_dns(&self.name, network_domain, &ip, self.if_idx) { error!("failed to set dns: {:?}", e); } else { error!("set dns ok");