summaryrefslogtreecommitdiffhomepage
path: root/table/message.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-31 23:34:58 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-31 23:34:58 +0900
commit875e89292affa7101c89ff5f774c397f6e7332c0 (patch)
tree49b7aa6f0d6f1b79055559f2363155d524e99fd0 /table/message.go
parent3f324d55bd3cc6dca6612ad582624d2933dc6b10 (diff)
table: fix UpdatePathAttrs2ByteAs
Needs to clone PathAttributes. We can't touch PathAttributes in table. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/message.go')
-rw-r--r--table/message.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/table/message.go b/table/message.go
index b3f730a3..4539834b 100644
--- a/table/message.go
+++ b/table/message.go
@@ -22,18 +22,21 @@ import (
)
func UpdatePathAttrs2ByteAs(msg *bgp.BGPUpdate) error {
- // FIXME: clone
var asAttr *bgp.PathAttributeAsPath
- for _, attr := range msg.PathAttributes {
+ idx := 0
+ for i, attr := range msg.PathAttributes {
switch attr.(type) {
case *bgp.PathAttributeAsPath:
asAttr = attr.(*bgp.PathAttributeAsPath)
+ idx = i
}
}
if asAttr == nil {
return nil
}
+ msg.PathAttributes = clonePathAttributes(msg.PathAttributes)
+ asAttr = msg.PathAttributes[idx].(*bgp.PathAttributeAsPath)
as4pathParam := make([]*bgp.As4PathParam, 0)
for i, param := range asAttr.Value {