summaryrefslogtreecommitdiffhomepage
path: root/table/path.go
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 /table/path.go
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 'table/path.go')
-rw-r--r--table/path.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/table/path.go b/table/path.go
index 02b24416..812046bc 100644
--- a/table/path.go
+++ b/table/path.go
@@ -39,6 +39,7 @@ type Path struct {
Validation config.RpkiValidationResultType
IsFromZebra bool
Filtered bool
+ Owner net.IP
}
func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pattrs []bgp.PathAttributeInterface, medSetByTargetNeighbor bool, timestamp time.Time, noImplicitWithdraw bool) *Path {
@@ -51,6 +52,11 @@ func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pa
return nil
}
+ var owner net.IP
+ if source != nil {
+ owner = source.Address
+ }
+
return &Path{
source: source,
IsWithdraw: isWithdraw,
@@ -59,6 +65,7 @@ func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pa
medSetByTargetNeighbor: medSetByTargetNeighbor,
timestamp: timestamp,
NoImplicitWithdraw: noImplicitWithdraw,
+ Owner: owner,
}
}
@@ -213,7 +220,7 @@ func (path *Path) MarshalJSON() ([]byte, error) {
}
// create new PathAttributes
-func (path *Path) Clone(isWithdraw bool) *Path {
+func (path *Path) Clone(owner net.IP, isWithdraw bool) *Path {
newPathAttrs := make([]bgp.PathAttributeInterface, len(path.pathAttrs))
for i, v := range path.pathAttrs {
newPathAttrs[i] = v
@@ -221,6 +228,7 @@ func (path *Path) Clone(isWithdraw bool) *Path {
p := NewPath(path.source, path.nlri, isWithdraw, newPathAttrs, false, path.timestamp, path.NoImplicitWithdraw)
p.Validation = path.Validation
+ p.Owner = owner
return p
}