KusakabeShi / EtherGuard-VPN

Layer2 version of wireguard with Floyd Warshall implement in go.
https://www.kskb.eu.org/2021/08/rootless-routerpart-3-etherguard.html
MIT License
158 stars 13 forks source link

Issues with Memory Leak, IP Address Reporting, and IPv6 Handling in P2P Mode #13

Open ZhiShengYuan opened 1 month ago

ZhiShengYuan commented 1 month ago

Description

The following issues have been observed when using EtherGuard-VPN in P2P mode:

Memory Leak and Unresponsiveness : When operating in P2P mode, if any node goes offline, the software may experience a memory leak, characterized by a rapid increase in memory usage. Consequently, the software becomes unresponsive, affecting both the wg command output and data packet transmission.

IP Address Reporting : In P2P mode, the software does not appear to report its own IP address. As a result, if all nodes are configured with static IPv4 addresses, they are unable to connect via IPv6.

IPv6 Handling : In P2P mode, if a peer has an IPv6 address but there is no local IPv6 route, the software exits. Shouldn't the software ignore the issue and attempt to retry later instead of exiting immediately?

Steps to Reproduce

Memory Leak and Unresponsiveness

Set up a P2P network with multiple nodes. Take one or more nodes offline. Observe the memory usage and responsiveness of the software.

IP Address Reporting

Configure a P2P network with nodes using static IPv4 addresses. Attempt to establish connections over IPv6.

IPv6 Handling

Configure a peer with an IPv6 address in a P2P network. Ensure there is no local IPv6 route. Observe the software behavior when attempting to connect.

Expected Behavior

Memory Leak and Unresponsiveness: The software should manage memory efficiently and remain responsive even if some nodes go offline.

IP Address Reporting: The software should report its own IP address correctly, enabling IPv6 connections even if nodes are configured with static IPv4 addresses.

IPv6 Handling: The software should not exit immediately if there is no local IPv6 route. Instead, it should ignore the issue and attempt to retry later.

Environment EtherGuard-VPN version: 0.3.5-f5 Operating System: Linux(Debian 12/ubuntu 22.04) Configuration: Default generated config

Please look into these issues to enhance the reliability and functionality of EtherGuard-VPN in P2P mode. Thank you!

ZhiShengYuan commented 1 month ago

btw,here is some log


Jul 18 11:57:46  2024/07/18 11:57:46 unexpected EOF
Jul 18 11:57:46  2024/07/18 11:57:46 gob: type mismatch: no fields matched compiling decoder for PongMsg
Jul 18 11:57:46  2024/07/18 11:57:46 gob: type mismatch: no fields matched compiling decoder for PongMsg
Jul 18 11:57:46  2024/07/18 11:57:46 gob: type mismatch: no fields matched compiling decoder for PongMsg
Jul 18 11:57:46  2024/07/18 11:57:46 gob: type mismatch: no fields matched compiling decoder for BoardcastPeerMsg
Jul 18 11:57:46  2024/07/18 11:57:46 gob: type mismatch: no fields matched compiling decoder for BoardcastPeerMsg
Jul 18 11:57:51  2024/07/18 11:57:51 gob: duplicate type received
Jul 18 11:58:31  2024/07/18 11:58:31 unexpected EOF
Jul 18 11:59:53  2024/07/18 11:59:53 gob: bad data: field numbers out of bounds
Jul 18 11:59:53  2024/07/18 11:59:53 gob: bad data: field numbers out of bounds
Jul 18 11:59:56  2024/07/18 11:59:56 gob: bad data: field numbers out of bounds
Jul 18 12:00:57  2024/07/18 12:00:57 gob: bad data: field numbers out of bounds
Jul 18 12:01:05  2024/07/18 12:01:05 unexpected EOF
Jul 18 12:01:05  2024/07/18 12:01:05 gob: bad data: field numbers out of bounds
Jul 18 12:01:05  2024/07/18 12:01:05 unexpected EOF
Jul 18 12:01:13  2024/07/18 12:01:13 gob: type mismatch: no fields matched compiling decoder for PongMsg
Jul 18 12:01:46  2024/07/18 12:01:46 unexpected EOF
Jul 18 12:01:46  2024/07/18 12:01:46 gob: bad data: field numbers out of bounds
Jul 18 12:02:07  2024/07/18 12:02:07 gob: bad data: field numbers out of bounds
Jul 18 12:02:17  2024/07/18 12:02:17 unexpected EOF
Jul 18 12:02:17  2024/07/18 12:02:17 unexpected EOF
Jul 18 12:02:17  2024/07/18 12:02:17 gob: encoded unsigned integer out of range
Jul 18 12:03:08  2024/07/18 12:03:08 gob: encoded unsigned integer out of range
Jul 18 12:03:27  2024/07/18 12:03:27 unexpected EOF
Jul 18 12:03:27  2024/07/18 12:03:27 gob: type mismatch: no fields matched compiling decoder for BoardcastPeerMsg
Jul 18 12:03:27  2024/07/18 12:03:27 unexpected EOF
Jul 18 12:03:27  2024/07/18 12:03:27 gob: type mismatch: no fields matched compiling decoder for BoardcastPeerMsg
Jul 18 12:05:37  2024/07/18 12:05:37 gob: type mismatch: no fields matched compiling decoder for PongMsg
Jul 18 12:05:48  2024/07/18 12:05:48 unexpected EOF
Jul 18 12:05:48  2024/07/18 12:05:48 unexpected EOF
Jul 18 12:06:25  2024/07/18 12:06:25 gob: bad data: field numbers out of bounds
Jul 18 12:06:33  2024/07/18 12:06:33 gob: encoded unsigned integer out of range
Jul 18 12:06:33  2024/07/18 12:06:33 gob: bad data: field numbers out of bounds
Jul 18 12:06:50  2024/07/18 12:06:50 gob: bad data: field numbers out of bounds
Jul 18 12:06:52  2024/07/18 12:06:52 gob: type mismatch: no fields matched compiling decoder for PongMsg
Jul 18 12:08:15  2024/07/18 12:08:15 gob: encoded unsigned integer out of range
Jul 18 12:08:15  2024/07/18 12:08:15 gob: bad data: field numbers out of bounds
Jul 18 12:08:26  2024/07/18 12:08:26 gob: encoded unsigned integer out of range
Jul 18 12:08:47  2024/07/18 12:08:47 gob: type mismatch: no fields matched compiling decoder for PongMsg
Jul 18 12:09:03  2024/07/18 12:09:03 unexpected EOF
Jul 18 12:09:03  2024/07/18 12:09:03 unexpected EOF
Jul 18 12:09:03  2024/07/18 12:09:03 unexpected EOF``
ZhiShengYuan commented 1 month ago

and


gob: bad data: undefined type CommonType = struct { Name string; Id int; }
type mismatch in decoder: want struct type mtypes.PongMsg; got non-struct
gob: bad data: undefined type arrayType = struct { CommonType CommonType = struct { Name string; Id int; }; Elem int; Len int; }```
ZhiShengYuan commented 1 month ago

It seems that if one node fails, it will cause many other nodes to fail as well image like this(I setup a notice to telegram)