From 4b0830a5fe7ba20d9bb100b2bd03a944d634b447 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Sun, 4 Oct 2015 16:36:21 +0900 Subject: policy: fix bug of export neighbor condition matching export neighbor condition must match to the remote address of destination peer. Signed-off-by: ISHIDA Wataru --- policy/policy.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'policy/policy.go') diff --git a/policy/policy.go b/policy/policy.go index 2a1524af..839cb926 100644 --- a/policy/policy.go +++ b/policy/policy.go @@ -296,10 +296,12 @@ func (c *NeighborCondition) evaluate(path *table.Path) bool { return true } - sAddr := path.GetSource().Address + if path.Owner == nil { + return false + } result := false for _, neighbor := range c.NeighborList { - if sAddr.Equal(neighbor) { + if path.Owner.Equal(neighbor) { result = true break } @@ -312,7 +314,7 @@ func (c *NeighborCondition) evaluate(path *table.Path) bool { log.WithFields(log.Fields{ "Topic": "Policy", "Condition": "neighbor", - "NeighborAddress": sAddr.String(), + "NeighborAddress": path.Owner, "Matched": result, }).Debug("evaluate neighbor") @@ -1406,7 +1408,7 @@ func (p *Policy) Apply(path *table.Path) (RouteType, *table.Path) { return ROUTE_TYPE_ACCEPT, path } // apply all modification actions - cloned := path.Clone(p.IsWithdraw) + cloned := path.Clone(p.Owner, p.IsWithdraw) for _, action := range statement.modificationActions { cloned = action.apply(cloned) } -- cgit v1.2.3