summaryrefslogtreecommitdiffhomepage
path: root/policy
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-10-04 16:36:21 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-10-07 00:53:37 +0900
commit4b0830a5fe7ba20d9bb100b2bd03a944d634b447 (patch)
tree2024e87643453118437d88a37605609aaadde696 /policy
parent869f1cee342f5babc703ac7d8cf637830887cb49 (diff)
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 <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'policy')
-rw-r--r--policy/policy.go10
1 files changed, 6 insertions, 4 deletions
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)
}