From 8b0c4c64080d2eb625beb8ccd941b721f7f04221 Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Thu, 4 May 2023 15:45:11 -0700 Subject: [PATCH] Use tcpip.NICID when get/set-ing GRO timeout PiperOrigin-RevId: 529535113 --- pkg/sentry/socket/netstack/stack.go | 8 ++++---- pkg/tcpip/stack/stack.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/sentry/socket/netstack/stack.go b/pkg/sentry/socket/netstack/stack.go index c92a50ad7..41ecc0978 100644 --- a/pkg/sentry/socket/netstack/stack.go +++ b/pkg/sentry/socket/netstack/stack.go @@ -511,12 +511,12 @@ func (s *Stack) SetPortRange(start uint16, end uint16) error { } // GROTimeout implements inet.Stack.GROTimeout. -func (s *Stack) GROTimeout(NICID int32) (time.Duration, error) { - timeout, err := s.Stack.GROTimeout(NICID) +func (s *Stack) GROTimeout(nicID int32) (time.Duration, error) { + timeout, err := s.Stack.GROTimeout(tcpip.NICID(nicID)) return timeout, syserr.TranslateNetstackError(err).ToError() } // SetGROTimeout implements inet.Stack.SetGROTimeout. -func (s *Stack) SetGROTimeout(NICID int32, timeout time.Duration) error { - return syserr.TranslateNetstackError(s.Stack.SetGROTimeout(NICID, timeout)).ToError() +func (s *Stack) SetGROTimeout(nicID int32, timeout time.Duration) error { + return syserr.TranslateNetstackError(s.Stack.SetGROTimeout(tcpip.NICID(nicID), timeout)).ToError() } diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go index 762dd1e7b..2a6b73df2 100644 --- a/pkg/tcpip/stack/stack.go +++ b/pkg/tcpip/stack/stack.go @@ -710,11 +710,11 @@ func (s *Stack) SetPortRange(start uint16, end uint16) tcpip.Error { } // GROTimeout returns the GRO timeout. -func (s *Stack) GROTimeout(NICID int32) (time.Duration, tcpip.Error) { +func (s *Stack) GROTimeout(nicID tcpip.NICID) (time.Duration, tcpip.Error) { s.mu.RLock() defer s.mu.RUnlock() - nic, ok := s.nics[tcpip.NICID(NICID)] + nic, ok := s.nics[nicID] if !ok { return 0, &tcpip.ErrUnknownNICID{} } @@ -723,11 +723,11 @@ func (s *Stack) GROTimeout(NICID int32) (time.Duration, tcpip.Error) { } // SetGROTimeout sets the GRO timeout. -func (s *Stack) SetGROTimeout(NICID int32, timeout time.Duration) tcpip.Error { +func (s *Stack) SetGROTimeout(nicID tcpip.NICID, timeout time.Duration) tcpip.Error { s.mu.RLock() defer s.mu.RUnlock() - nic, ok := s.nics[tcpip.NICID(NICID)] + nic, ok := s.nics[nicID] if !ok { return &tcpip.ErrUnknownNICID{} }