From c62d5ec226c40614d25ebcd6698a9f596ba3a8b8 Mon Sep 17 00:00:00 2001 From: Chen Hanxiao Date: Fri, 6 Feb 2015 14:07:17 +0800 Subject: [PATCH] nat: enable upper case proto We only accepted lower case proto: tcp, udp. This patch will enable us to use upper case of proto such as: EXPOSE 1234/TCP Signed-off-by: Chen Hanxiao Upstream-commit: 270642643452b440b159216d843ea4fc2239ff4f Component: engine --- components/engine/nat/nat.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/nat/nat.go b/components/engine/nat/nat.go index 8f2e90e668..fdecf3f9d1 100644 --- a/components/engine/nat/nat.go +++ b/components/engine/nat/nat.go @@ -140,7 +140,7 @@ func ParsePortSpecs(ports []string) (map[Port]struct{}, map[Port][]PortBinding, return nil, nil, fmt.Errorf("Invalid ranges specified for container and host Ports: %s and %s", containerPort, hostPort) } - if !validateProto(proto) { + if !validateProto(strings.ToLower(proto)) { return nil, nil, fmt.Errorf("Invalid proto: %s", proto) } @@ -149,7 +149,7 @@ func ParsePortSpecs(ports []string) (map[Port]struct{}, map[Port][]PortBinding, if len(hostPort) > 0 { hostPort = strconv.FormatUint(startHostPort+i, 10) } - port := NewPort(proto, containerPort) + port := NewPort(strings.ToLower(proto), containerPort) if _, exists := exposedPorts[port]; !exists { exposedPorts[port] = struct{}{} }