summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
authorEiichiro Watanabe <a16tochjp@gmail.com>2015-10-15 22:55:33 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-10-21 14:19:26 +0900
commit421b9284ccd2efaff4d5659b78740da53d154102 (patch)
tree27a2c8bc6d1a30352555cc1410550c2857911e38 /packet
parente1bec970c309084569a2f39621f90bc5e6ddb171 (diff)
*: fix wrong types of print verbs
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp.go8
-rw-r--r--packet/mrt.go8
2 files changed, 8 insertions, 8 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index 2d049543..dabb9067 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -1419,7 +1419,7 @@ func (esi *EthernetSegmentIdentifier) DecodeFromBytes(data []byte) error {
switch esi.Type {
case ESI_LACP, ESI_MSTP, ESI_ROUTERID, ESI_AS:
if esi.Value[8] != 0x00 {
- return fmt.Errorf("invalid %s. last octet must be 0x00 (0x%02x)", esi.Type, esi.Value[8])
+ return fmt.Errorf("invalid %s. last octet must be 0x00 (0x%02x)", esi.Type.String(), esi.Value[8])
}
}
return nil
@@ -1443,7 +1443,7 @@ func isZeroBuf(buf []byte) bool {
func (esi *EthernetSegmentIdentifier) String() string {
s := bytes.NewBuffer(make([]byte, 0, 64))
- s.WriteString(fmt.Sprintf("%s | ", esi.Type))
+ s.WriteString(fmt.Sprintf("%s | ", esi.Type.String()))
switch esi.Type {
case ESI_ARBITRARY:
if isZeroBuf(esi.Value) {
@@ -1546,7 +1546,7 @@ func (er *EVPNEthernetAutoDiscoveryRoute) Serialize() ([]byte, error) {
}
func (er *EVPNEthernetAutoDiscoveryRoute) String() string {
- return fmt.Sprintf("[type:A-D][rd:%s][esi:%s][etag:%d][label:%d]", er.RD, er.ESI, er.ETag, er.Label)
+ return fmt.Sprintf("[type:A-D][rd:%s][esi:%s][etag:%d][label:%d]", er.RD, er.ESI.String(), er.ETag, er.Label)
}
func (er *EVPNEthernetAutoDiscoveryRoute) MarshalJSON() ([]byte, error) {
@@ -3233,7 +3233,7 @@ func (p *PathAttribute) Serialize() ([]byte, error) {
}
func (p *PathAttribute) String() string {
- return fmt.Sprintf("%s %s %s", p.Type, p.Flags, []byte(p.Value))
+ return fmt.Sprintf("%s %s %s", p.Type.String(), p.Flags, []byte(p.Value))
}
func (p *PathAttribute) MarshalJSON() ([]byte, error) {
diff --git a/packet/mrt.go b/packet/mrt.go
index b259be7f..ba7dfa06 100644
--- a/packet/mrt.go
+++ b/packet/mrt.go
@@ -700,7 +700,7 @@ func (m *BGP4MPMessage) String() string {
if m.isLocal {
title += "_LOCAL"
}
- return fmt.Sprintf("%s: PeerAS [%d] LocalAS [%d] InterfaceIndex [%d] PeerIP [%s] LocalIP [%s] BGPMessage [%s]", title, m.PeerAS, m.LocalAS, m.InterfaceIndex, m.PeerIpAddress, m.LocalIpAddress, m.BGPMessage)
+ return fmt.Sprintf("%s: PeerAS [%d] LocalAS [%d] InterfaceIndex [%d] PeerIP [%s] LocalIP [%s] BGPMessage [%s]", title, m.PeerAS, m.LocalAS, m.InterfaceIndex, m.PeerIpAddress, m.LocalIpAddress, m.BGPMessage.String())
}
//This function can be passed into a bufio.Scanner.Split() to read buffered mrt msgs
@@ -746,7 +746,7 @@ func ParseMRTBody(h *MRTHeader, data []byte) (*MRTMessage, error) {
rf = RF_IPv6_MC
case RIB_GENERIC:
default:
- return nil, fmt.Errorf("unsupported table dumpv2 subtype: %s\n", subType)
+ return nil, fmt.Errorf("unsupported table dumpv2 subtype: %s\n", subType.String())
}
if subType != PEER_INDEX_TABLE {
@@ -781,10 +781,10 @@ func ParseMRTBody(h *MRTHeader, data []byte) (*MRTMessage, error) {
isLocal: true,
}
default:
- return nil, fmt.Errorf("unsupported bgp4mp subtype: %s\n", subType)
+ return nil, fmt.Errorf("unsupported bgp4mp subtype: %s\n", subType.String())
}
default:
- return nil, fmt.Errorf("unsupported type: %s\n", h.Type)
+ return nil, fmt.Errorf("unsupported type: %s\n", h.Type.String())
}
err := msg.Body.DecodeFromBytes(data)
if err != nil {