diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-02-10 23:34:24 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-02-13 15:10:47 +0900 |
commit | 7a3cc616c3126bff5245c7a97d7fbe2904a67a24 (patch) | |
tree | 35ff464b017046c9183fdc0a2d6668bc4c630573 /table | |
parent | f2e2c6e41550e14bf08ec2e5785b97e846f2b2da (diff) |
packet/bgp: Remove raw binary field on PathAttribute
The current implementation, PathAttribute stores the raw binary data as
"Value" field, but this field increases the memory consumption.
This patch removes "Value" field to slim down.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'table')
-rw-r--r-- | table/destination.go | 6 | ||||
-rw-r--r-- | table/path.go | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/table/destination.go b/table/destination.go index c1da67cf..f9ed3509 100644 --- a/table/destination.go +++ b/table/destination.go @@ -831,11 +831,11 @@ func compareByOrigin(path1, path2 *Path) *Path { return nil } - origin1, n1 := binary.Uvarint(attribute1.(*bgp.PathAttributeOrigin).Value) - origin2, n2 := binary.Uvarint(attribute2.(*bgp.PathAttributeOrigin).Value) + origin1 := attribute1.(*bgp.PathAttributeOrigin).Value + origin2 := attribute2.(*bgp.PathAttributeOrigin).Value log.WithFields(log.Fields{ "Topic": "Table", - }).Debugf("compareByOrigin -- origin1: %d(%d), origin2: %d(%d)", origin1, n1, origin2, n2) + }).Debugf("compareByOrigin -- origin1: %d, origin2: %d", origin1, origin2) // If both paths have same origins if origin1 == origin2 { diff --git a/table/path.go b/table/path.go index a32b0e11..cad8cbfa 100644 --- a/table/path.go +++ b/table/path.go @@ -1043,7 +1043,7 @@ func (path *Path) GetClusterList() []net.IP { func (path *Path) GetOrigin() (uint8, error) { if attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN); attr != nil { - return attr.(*bgp.PathAttributeOrigin).Value[0], nil + return attr.(*bgp.PathAttributeOrigin).Value, nil } return 0, fmt.Errorf("no origin path attr") } |