From 1c56fb8996d9014e1b96332344f663fa201f3a5e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 28 Feb 2019 17:41:30 +0100 Subject: tunnel: make winipcfg sort of work The duplicate route thing is silly, and we currently don't do DNS or the fancy socket routing. But this is a step in the right direction, perhaps. --- conf/parser.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'conf/parser.go') diff --git a/conf/parser.go b/conf/parser.go index 6a397a9d..48cf88b6 100644 --- a/conf/parser.go +++ b/conf/parser.go @@ -40,17 +40,21 @@ func parseIPCidr(s string) (ipcidr *IPCidr, err error) { if addr == nil { return } + maybeV4 := addr.To4() + if maybeV4 != nil { + addr = maybeV4 + } if len(cidrStr) > 0 { err = &ParseError{"Invalid network prefix length", s} cidr, err = strconv.Atoi(cidrStr) if err != nil || cidr < 0 || cidr > 128 { return } - if cidr > 32 && addr.To4() != nil { + if cidr > 32 && maybeV4 != nil { return } } else { - if addr.To4() != nil { + if maybeV4 != nil { cidr = 32 } else { cidr = 128 -- cgit v1.2.3-59-g8ed1b