From 9716d7fdfe361fa6f614a75f4d4c015a0b46ce86 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 27 Jan 2017 20:38:01 +0100 Subject: [PATCH] Fix usage of source in context --- app/router/condition.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/router/condition.go b/app/router/condition.go index ea169f49..2276932b 100644 --- a/app/router/condition.go +++ b/app/router/condition.go @@ -131,6 +131,10 @@ func (v *CIDRMatcher) Apply(ctx context.Context) bool { dest = proxy.DestinationFromContext(ctx) } + if !dest.IsValid() { + return false + } + if !dest.Address.Family().Either(v2net.AddressFamilyIPv4, v2net.AddressFamilyIPv6) { return false } @@ -169,6 +173,10 @@ func (v *IPv4Matcher) Apply(ctx context.Context) bool { } else { dest = proxy.DestinationFromContext(ctx) } + if !dest.IsValid() { + return false + } + if !dest.Address.Family().Either(v2net.AddressFamilyIPv4) { return false }