summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tun/netstack/tun.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/tun/netstack/tun.go b/tun/netstack/tun.go
index 24d0835..6212493 100644
--- a/tun/netstack/tun.go
+++ b/tun/netstack/tun.go
@@ -204,15 +204,23 @@ func (tun *netTun) MTU() (int, error) {
func convertToFullAddr(ip net.IP, port int) (tcpip.FullAddress, tcpip.NetworkProtocolNumber) {
if ip4 := ip.To4(); ip4 != nil {
+ addr := tcpip.Address(ip4)
+ if addr == header.IPv4Any {
+ addr = ""
+ }
return tcpip.FullAddress{
NIC: 1,
- Addr: tcpip.Address(ip4),
+ Addr: addr,
Port: uint16(port),
}, ipv4.ProtocolNumber
} else {
+ addr := tcpip.Address(ip)
+ if addr == header.IPv6Any {
+ addr = ""
+ }
return tcpip.FullAddress{
NIC: 1,
- Addr: tcpip.Address(ip),
+ Addr: addr,
Port: uint16(port),
}, ipv6.ProtocolNumber
}