mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
*: fix wrong types of print verbs
This commit is contained in:
committed by
FUJITA Tomonori
parent
e1bec970c3
commit
421b9284cc
+4
-4
@@ -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) {
|
||||
|
||||
+4
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user