diff options
author | Kirill Smorodinnikov <shaitan@yandex-team.ru> | 2021-02-24 14:59:31 +0300 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2021-03-01 22:23:39 +0900 |
commit | 1d80152c34f367cad5a467187d574bfa3b1f2d1a (patch) | |
tree | b2996cab9b70a2e7e366a14985fdf54ade8de4f1 /pkg/packet/bgp/bgp.go | |
parent | f33148428ac2c035e526303742983db8428236b1 (diff) |
Fix LsTLVIgpRouterID.DecodeFromBytes
According to https://tools.ietf.org/html/rfc7752#section-3.2.1.4, IGPRouterID could be 4-octet for OSPFv2 or OSPFv3 non-pseudonode.
Diffstat (limited to 'pkg/packet/bgp/bgp.go')
-rw-r--r-- | pkg/packet/bgp/bgp.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/packet/bgp/bgp.go b/pkg/packet/bgp/bgp.go index cb28bd7f..af0656d3 100644 --- a/pkg/packet/bgp/bgp.go +++ b/pkg/packet/bgp/bgp.go @@ -6298,9 +6298,12 @@ func (l *LsTLVIgpRouterID) DecodeFromBytes(data []byte) error { } // https://tools.ietf.org/html/rfc7752#section-3.2.1.4 - // 6, 7, and 8 are the only valid values. - if len(value) < 6 || len(value) > 8 { - return malformedAttrListErr("Incorrect IGP Router ID length") + // 4, 6, 7, and 8 are the only valid values. + switch len(value) { + case 4, 6, 7, 8: + break + default: + return malformedAttrListErr(fmt.Sprintf("Incorrect IGP Router ID length: %d", len(value))) } l.RouterID = value |