From 5aba21216378970cb7c627fb50ea47ac55d0a6c5 Mon Sep 17 00:00:00 2001 From: Ameya Gawde Date: Mon, 25 Apr 2022 09:27:32 -0700 Subject: [PATCH] Adding ExternalPortReserved flag to NatPolicy for HNS API V1. THis is a flag exposed for docker to avoid port reservation conflict with external port (#1370) HNS API V2 will use NatFlags to check and see if ExternalPortReserved is set (cherry picked from commit b85f3fdc17dad534a2cebbc67e0c18f77fb0fca8) Signed-off-by: Ameya Gawde Co-authored-by: Kendall Stratton (cherry picked from commit dbb347e403747f0eb470bf9f17bf7ec32da14b0a) Signed-off-by: Ameya Gawde --- internal/hns/hnspolicy.go | 9 +++++---- .../Microsoft/hcsshim/internal/hns/hnspolicy.go | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/internal/hns/hnspolicy.go b/internal/hns/hnspolicy.go index 591a2631e4..84b3682184 100644 --- a/internal/hns/hnspolicy.go +++ b/internal/hns/hnspolicy.go @@ -21,10 +21,11 @@ const ( ) type NatPolicy struct { - Type PolicyType `json:"Type"` - Protocol string `json:",omitempty"` - InternalPort uint16 `json:",omitempty"` - ExternalPort uint16 `json:",omitempty"` + Type PolicyType `json:"Type"` + Protocol string `json:",omitempty"` + InternalPort uint16 `json:",omitempty"` + ExternalPort uint16 `json:",omitempty"` + ExternalPortReserved bool `json:",omitempty"` } type QosPolicy struct { diff --git a/test/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go b/test/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go index 591a2631e4..84b3682184 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go +++ b/test/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go @@ -21,10 +21,11 @@ const ( ) type NatPolicy struct { - Type PolicyType `json:"Type"` - Protocol string `json:",omitempty"` - InternalPort uint16 `json:",omitempty"` - ExternalPort uint16 `json:",omitempty"` + Type PolicyType `json:"Type"` + Protocol string `json:",omitempty"` + InternalPort uint16 `json:",omitempty"` + ExternalPort uint16 `json:",omitempty"` + ExternalPortReserved bool `json:",omitempty"` } type QosPolicy struct {