summaryrefslogtreecommitdiffhomepage
path: root/table/table.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-31 00:01:50 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-31 00:01:50 +0900
commit8fd86716d0a53c3cc5e1b5b4367e908061aacabc (patch)
treee76d5f029378f8bdc7a87a555f04f442a14a34c9 /table/table.go
parenta9160a0061dfeab8a9c48b2b3908832492799fd3 (diff)
table: use 4byte AS as internal data structure
Always use 4byte for AS internally. Convert AS for 2byte AS peer when necessary. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table.go')
-rw-r--r--table/table.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/table/table.go b/table/table.go
index 1f4058f0..0be4c75f 100644
--- a/table/table.go
+++ b/table/table.go
@@ -145,7 +145,23 @@ func (td *TableDefault) validatePath(path Path) {
if path == nil || path.GetRouteFamily() != td.ROUTE_FAMILY {
log.Errorf("Invalid path. Expected instance of %s route family path, got %s.", td.ROUTE_FAMILY, path)
}
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ if attr != nil {
+ pathParam := attr.(*bgp.PathAttributeAsPath).Value
+ for _, as := range pathParam {
+ _, y := as.(*bgp.As4PathParam)
+ if !y {
+ log.Fatal("AsPathParam must be converted to As4PathParam, ", as)
+ }
+ }
+ }
+
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS4_PATH)
+ if attr != nil {
+ log.Fatal("AS4_PATH must be converted to AS_PATH")
+ }
}
+
func (td *TableDefault) validateNlri(nlri bgp.AddrPrefixInterface) {
if nlri == nil {
log.Error("Invalid Vpnv4 prefix given.")