summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-07-30 12:42:06 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-30 12:21:53 +0900
commitf9be39235a3aa8e8c7f1553f92da56204da99677 (patch)
tree9bc1b9861ef85c993a96a5e8859baa8c2fecb1c9 /packet
parentc4fe45902e736a858c4870bcab01c9143551f696 (diff)
packet/bgp: treat 0x000000 as a withdraw label
though RFC3107 says the label field should be set to 0x800000 in the withdrawn routes, some platform uses 0x000000 for that purpose. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp/bgp.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go
index 2e4e7c4e..f309f8dd 100644
--- a/packet/bgp/bgp.go
+++ b/packet/bgp/bgp.go
@@ -1108,6 +1108,7 @@ func ParseRouteDistinguisher(rd string) (RouteDistinguisherInterface, error) {
// The label information carried (as part of NLRI) in the Withdrawn
// Routes field should be set to 0x800000.
const WITHDRAW_LABEL = uint32(0x800000)
+const ZERO_LABEL = uint32(0) // some platform uses this as withdraw label
type MPLSLabelStack struct {
Labels []uint32
@@ -1118,7 +1119,7 @@ func (l *MPLSLabelStack) DecodeFromBytes(data []byte) error {
foundBottom := false
for len(data) >= 3 {
label := uint32(data[0])<<16 | uint32(data[1])<<8 | uint32(data[2])
- if label == WITHDRAW_LABEL {
+ if label == WITHDRAW_LABEL || label == ZERO_LABEL {
l.Labels = []uint32{label}
return nil
}