diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-04 16:36:21 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-07 00:53:37 +0900 |
commit | 4b0830a5fe7ba20d9bb100b2bd03a944d634b447 (patch) | |
tree | 2024e87643453118437d88a37605609aaadde696 /table | |
parent | 869f1cee342f5babc703ac7d8cf637830887cb49 (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')
-rw-r--r-- | table/path.go | 10 | ||||
-rw-r--r-- | table/table_manager.go | 2 |
2 files changed, 10 insertions, 2 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 } diff --git a/table/table_manager.go b/table/table_manager.go index 25807566..6ec65617 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -265,7 +265,7 @@ func (manager *TableManager) calculate(destinationList []*Destination) ([]*Path, }).Debug("best path is lost") p := destination.GetBestPath() - newPaths = append(newPaths, p.Clone(true)) + newPaths = append(newPaths, p.Clone(p.Owner, true)) } destination.setBestPath(nil) } else { |