summaryrefslogtreecommitdiffhomepage
path: root/table/table.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-04-03 07:44:32 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-04-03 08:02:56 +0000
commitcd0d357a553bafa977a86e5fcc78c9f2a301db1a (patch)
tree3490984d4e6c3cb807c688298122cdfa97c8dc23 /table/table.go
parent8bd986b7e89cb28763aec75e1a14357e38a49e0b (diff)
table: support displaying evpn destination through cli
evpn nlri key is not expressed in CIDR format. in that case give up sorting. we can think later how to sort evpn nlri after we decided the way to express evpn nlri key(current evpn nlri key is insufficient to keep evpn nlris unique in evpn table). this patch also add a MarshalJSON method to EVPNDestination for displaying evpn routes through cli Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/table.go')
-rw-r--r--table/table.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/table/table.go b/table/table.go
index 656f132c..28799a24 100644
--- a/table/table.go
+++ b/table/table.go
@@ -56,7 +56,10 @@ func NewTableDefault(scope_id int) *TableDefault {
}
func cidr2prefix(cidr string) patricia.Prefix {
- _, n, _ := net.ParseCIDR(cidr)
+ _, n, err := net.ParseCIDR(cidr)
+ if err != nil {
+ return patricia.Prefix(cidr)
+ }
var buffer bytes.Buffer
for i := 0; i < len(n.IP); i++ {
buffer.WriteString(fmt.Sprintf("%08b", n.IP[i]))