From b711580b07f56d2a4d7ba49c0f937066c9003911 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 9 May 2019 16:15:01 +0200 Subject: conf: don't verify scope as part of ip checking --- conf/parser.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'conf/parser.go') diff --git a/conf/parser.go b/conf/parser.go index b9ceb20e..a8ccca07 100644 --- a/conf/parser.go +++ b/conf/parser.go @@ -80,7 +80,11 @@ func parseEndpoint(s string) (*Endpoint, error) { if host[0] == '[' || host[len(host)-1] == ']' || hostColon > 0 { err := &ParseError{"Brackets must contain an IPv6 address", host} if len(host) > 3 && host[0] == '[' && host[len(host)-1] == ']' && hostColon > 0 { - maybeV6 := net.ParseIP(host[1 : len(host)-1]) + end := len(host) - 1 + if i := strings.LastIndexByte(host, '%'); i > 1 { + end = i + } + maybeV6 := net.ParseIP(host[1:end]) if maybeV6 == nil || len(maybeV6) != net.IPv6len { return nil, err } -- cgit v1.2.3-59-g8ed1b