1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #2303 from thaJeztah/docs_and_error_touchup

Touch-up error-message and godoc for ConfigVXLANUDPPort
This commit is contained in:
Flavio Crisciani 2019-01-23 09:42:36 -08:00 committed by GitHub
commit a52a6ba44e

View file

@ -17,9 +17,10 @@ func init() {
vxlanUDPPort = defaultVXLANUDPPort 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 { func ConfigVXLANUDPPort(vxlanPort uint32) error {
// if the value comes as 0 by any reason we set it to default value 4789
if vxlanPort == 0 { if vxlanPort == 0 {
vxlanPort = defaultVXLANUDPPort vxlanPort = defaultVXLANUDPPort
} }
@ -29,7 +30,7 @@ func ConfigVXLANUDPPort(vxlanPort uint32) error {
// The Dynamic Ports, aka the Private Ports, from 49152-65535 // The Dynamic Ports, aka the Private Ports, from 49152-65535
// So we can allow range between 1024 to 49151 // So we can allow range between 1024 to 49151
if vxlanPort < 1024 || vxlanPort > 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() mutex.Lock()
vxlanUDPPort = vxlanPort vxlanUDPPort = vxlanPort