summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg')
-rw-r--r--internal/pkg/table/path.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/pkg/table/path.go b/internal/pkg/table/path.go
index 55748b08..eba0a6ec 100644
--- a/internal/pkg/table/path.go
+++ b/internal/pkg/table/path.go
@@ -146,7 +146,12 @@ type Path struct {
IsWithdraw bool
}
+var localSource = &PeerInfo{}
+
func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pattrs []bgp.PathAttributeInterface, timestamp time.Time, noImplicitWithdraw bool) *Path {
+ if source == nil {
+ source = localSource
+ }
if !isWithdraw && pattrs == nil {
log.WithFields(log.Fields{
"Topic": "Table",
@@ -323,7 +328,8 @@ func (path *Path) IsLocal() bool {
}
func (path *Path) IsIBGP() bool {
- return path.GetSource().AS == path.GetSource().LocalAS
+ as := path.GetSource().AS
+ return (as == path.GetSource().LocalAS) && as != 0
}
// create new PathAttributes
@@ -380,9 +386,6 @@ func (path *Path) GetRouteFamily() bgp.RouteFamily {
return bgp.AfiSafiToRouteFamily(path.OriginInfo().nlri.AFI(), path.OriginInfo().nlri.SAFI())
}
-func (path *Path) SetSource(source *PeerInfo) {
- path.OriginInfo().source = source
-}
func (path *Path) GetSource() *PeerInfo {
return path.OriginInfo().source
}