From d7f397c2367286432a840759527f6899c22ae720 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 22 Nov 2018 21:40:36 +0100 Subject: [PATCH] Touch-up error-message and godoc for ConfigVXLANUDPPort Minor changes following review of the engine pull request for this feature; - Remove the name of the function from the error message as it's not a debug message. - Add the valid range to the error message, so that a user has sufficient information to address the problem. - Update GoDoc for the function to describe the default port, and valid port-ranges. Signed-off-by: Sebastiaan van Stijn --- libnetwork/drivers/overlay/overlayutils/utils.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libnetwork/drivers/overlay/overlayutils/utils.go b/libnetwork/drivers/overlay/overlayutils/utils.go index f5f6239dd6..73136e8e2a 100644 --- a/libnetwork/drivers/overlay/overlayutils/utils.go +++ b/libnetwork/drivers/overlay/overlayutils/utils.go @@ -17,9 +17,10 @@ func init() { vxlanUDPPort = defaultVXLANUDPPort } -// ConfigVXLANUDPPort configures vxlan udp port number. +// ConfigVXLANUDPPort configures the VXLAN UDP port (data path port) number. +// If no port is set, the default (4789) is returned. Valid port numbers are +// between 1024 and 49151. func ConfigVXLANUDPPort(vxlanPort uint32) error { - // if the value comes as 0 by any reason we set it to default value 4789 if vxlanPort == 0 { vxlanPort = defaultVXLANUDPPort } @@ -29,7 +30,7 @@ func ConfigVXLANUDPPort(vxlanPort uint32) error { // The Dynamic Ports, aka the Private Ports, from 49152-65535 // So we can allow range between 1024 to 49151 if vxlanPort < 1024 || vxlanPort > 49151 { - return fmt.Errorf("ConfigVxlanUDPPort Vxlan UDP port number is not in valid range %d", vxlanPort) + return fmt.Errorf("VXLAN UDP port number is not in valid range (1024-49151): %d", vxlanPort) } mutex.Lock() vxlanUDPPort = vxlanPort