summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-11-28 01:35:23 -0500
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-11-29 15:45:19 -0800
commit33ff2fff1f1e4aa693c2ce010d516934d189e538 (patch)
tree3df7fb9f9ed478ba847c08ef0620563da4d0d47c
parent0f5f9078ea27de52756c63fbf87f9eb286f829d8 (diff)
zebra: add flags for recursive nexthop lookup if necessary
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
-rw-r--r--server/zclient.go14
-rw-r--r--table/destination.go2
2 files changed, 13 insertions, 3 deletions
diff --git a/server/zclient.go b/server/zclient.go
index 6ae25e51..3f8627c3 100644
--- a/server/zclient.go
+++ b/server/zclient.go
@@ -76,11 +76,18 @@ func newIPRouteMessage(dst []*table.Path, version uint8, vrfId uint16) *zebra.Me
default:
return nil
}
- flags := uint8(zebra.MESSAGE_NEXTHOP)
+ msgFlags := uint8(zebra.MESSAGE_NEXTHOP)
plen, _ := strconv.Atoi(l[1])
med, err := path.GetMed()
if err == nil {
- flags |= zebra.MESSAGE_METRIC
+ msgFlags |= zebra.MESSAGE_METRIC
+ }
+ var flags zebra.FLAG
+ info := path.GetSource()
+ if info.AS == info.LocalAS {
+ flags = zebra.FLAG_IBGP | zebra.FLAG_INTERNAL
+ } else if info.MultihopTtl > 0 {
+ flags = zebra.FLAG_INTERNAL
}
return &zebra.Message{
Header: zebra.Header{
@@ -92,8 +99,9 @@ func newIPRouteMessage(dst []*table.Path, version uint8, vrfId uint16) *zebra.Me
},
Body: &zebra.IPRouteBody{
Type: zebra.ROUTE_BGP,
+ Flags: flags,
SAFI: zebra.SAFI_UNICAST,
- Message: flags,
+ Message: msgFlags,
Prefix: prefix,
PrefixLength: uint8(plen),
Nexthops: nexthops,
diff --git a/table/destination.go b/table/destination.go
index f9ed0e2f..ac3ef0c8 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -73,6 +73,7 @@ type PeerInfo struct {
LocalAddress net.IP
RouteReflectorClient bool
RouteReflectorClusterID net.IP
+ MultihopTtl uint8
}
func (lhs *PeerInfo) Equal(rhs *PeerInfo) bool {
@@ -114,6 +115,7 @@ func NewPeerInfo(g *config.Global, p *config.Neighbor) *PeerInfo {
Address: net.ParseIP(p.Config.NeighborAddress),
RouteReflectorClient: p.RouteReflector.Config.RouteReflectorClient,
RouteReflectorClusterID: id,
+ MultihopTtl: p.EbgpMultihop.Config.MultihopTtl,
}
}