summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-07-01 01:38:21 +0000
committergVisor bot <gvisor-bot@google.com>2021-07-01 01:38:21 +0000
commit28291a5a5d25633c8bdf45ed5affe90f779c74b4 (patch)
tree1d70f35b00068a83e568d84a00c8555dbb27edb5 /pkg
parente75120d9b11f25bf12cf999efb0bd738eb82c662 (diff)
parent07ffecef83bd31e78786af901c49a7be93b20517 (diff)
Merge release-20210628.0-15-g07ffecef8 (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/header/ndp_router_advert.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/tcpip/header/ndp_router_advert.go b/pkg/tcpip/header/ndp_router_advert.go
index 7e2f0c797..7d6efa083 100644
--- a/pkg/tcpip/header/ndp_router_advert.go
+++ b/pkg/tcpip/header/ndp_router_advert.go
@@ -16,9 +16,12 @@ package header
import (
"encoding/binary"
+ "fmt"
"time"
)
+var _ fmt.Stringer = NDPRoutePreference(0)
+
// NDPRoutePreference is the preference values for default routers or
// more-specific routes.
//
@@ -64,6 +67,22 @@ const (
ReservedRoutePreference = 0b10
)
+// String implements fmt.Stringer.
+func (p NDPRoutePreference) String() string {
+ switch p {
+ case HighRoutePreference:
+ return "HighRoutePreference"
+ case MediumRoutePreference:
+ return "MediumRoutePreference"
+ case LowRoutePreference:
+ return "LowRoutePreference"
+ case ReservedRoutePreference:
+ return "ReservedRoutePreference"
+ default:
+ return fmt.Sprintf("NDPRoutePreference(%d)", p)
+ }
+}
+
// NDPRouterAdvert is an NDP Router Advertisement message. It will only contain
// the body of an ICMPv6 packet.
//