summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-13 09:24:04 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-13 09:24:04 +0900
commite2fdf3c3684434a92d46ecbfe9a5ba6f3ef0e587 (patch)
treec184eeb902869d08b13de4e4ff1ce6f463cee4f9
parent661246af2bfa2496b575ef361cc19d58daa4ca2b (diff)
packet: fix PathAttributeMpReachNLRI's Serialize()
Properly serializes LinkLocalNexthop. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--packet/bgp.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index dabb9067..db3c2093 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -4144,6 +4144,9 @@ func (p *PathAttributeMpReachNLRI) Serialize() ([]byte, error) {
nexthoplen := 4
if afi == AFI_IP6 {
nexthoplen = 16
+ if p.LinkLocalNexthop != nil {
+ nexthoplen += 16
+ }
}
offset := 0
switch safi {
@@ -4158,6 +4161,9 @@ func (p *PathAttributeMpReachNLRI) Serialize() ([]byte, error) {
buf[2] = safi
buf[3] = uint8(nexthoplen)
copy(buf[4+offset:], p.Nexthop)
+ if p.LinkLocalNexthop != nil {
+ copy(buf[4+offset+len(p.Nexthop):], p.LinkLocalNexthop)
+ }
buf = append(buf, make([]byte, 1)...)
for _, prefix := range p.Value {
pbuf, err := prefix.Serialize()