diff options
author | Eiichiro Watanabe <a16tochjp@gmail.com> | 2015-05-13 18:46:57 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-14 13:12:55 +0900 |
commit | bbb57319134b60d60c41be5273f235d8c4c89651 (patch) | |
tree | ed1c35d8a2687788b74e604871e7fdeaa2762595 /packet | |
parent | f9a997b6b26ae5084c3e1e36bd1638be9166046a (diff) |
packet: cosmetic
Diffstat (limited to 'packet')
-rw-r--r-- | packet/bgp.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/packet/bgp.go b/packet/bgp.go index 0cc8aca9..a5175bca 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -3638,8 +3638,7 @@ func getPathAttribute(data []byte) (PathAttributeInterface, error) { if len(data) < 1 { eCode := uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR) eSubCode := uint8(BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST) - msg := "attribute type length is short" - return nil, NewMessageError(eCode, eSubCode, nil, msg) + return nil, NewMessageError(eCode, eSubCode, nil, "attribute type length is short") } switch BGPAttrType(data[1]) { case BGP_ATTR_TYPE_ORIGIN: @@ -3704,9 +3703,7 @@ func (msg *BGPUpdate) DecodeFromBytes(data []byte) error { // check withdrawn route length if len(data) < 2 { - msg := "message length isn't enough for withdrawn route length" - e := NewMessageError(eCode, eSubCode, nil, msg) - return e + return NewMessageError(eCode, eSubCode, nil, "message length isn't enough for withdrawn route length") } msg.WithdrawnRoutesLen = binary.BigEndian.Uint16(data[0:2]) @@ -3714,9 +3711,7 @@ func (msg *BGPUpdate) DecodeFromBytes(data []byte) error { // check withdrawn route if len(data) < int(msg.WithdrawnRoutesLen) { - msg := "withdrawn route length exceeds message length" - e := NewMessageError(eCode, eSubCode, nil, msg) - return e + return NewMessageError(eCode, eSubCode, nil, "withdrawn route length exceeds message length") } for routelen := msg.WithdrawnRoutesLen; routelen > 0; { @@ -3735,9 +3730,7 @@ func (msg *BGPUpdate) DecodeFromBytes(data []byte) error { // check path total attribute length if len(data) < 2 { - msg := "message length isn't enough for path total attribute length" - e := NewMessageError(eCode, eSubCode, nil, msg) - return e + return NewMessageError(eCode, eSubCode, nil, "message length isn't enough for path total attribute length") } msg.TotalPathAttributeLen = binary.BigEndian.Uint16(data[0:2]) @@ -3745,9 +3738,7 @@ func (msg *BGPUpdate) DecodeFromBytes(data []byte) error { // check path attribute if len(data) < int(msg.TotalPathAttributeLen) { - msg := "path total attribute length exceeds message length" - e := NewMessageError(eCode, eSubCode, nil, msg) - return e + return NewMessageError(eCode, eSubCode, nil, "path total attribute length exceeds message length") } for pathlen := msg.TotalPathAttributeLen; pathlen > 0; { |