diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2020-11-05 19:05:14 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-05 19:12:09 -0800 |
commit | 06e33cd737c59623ddcca60eacefb112fc1a0cd4 (patch) | |
tree | f4e1c14d2adc608d7e78a82eca047565f052b1c2 /pkg/tcpip/stack/route.go | |
parent | 0e8fdfd3885bda36c0cb9225a107f1ee30c6c65f (diff) |
Cache addressEndpoint.addr.Subnet() to avoid allocations.
This change adds a Subnet() method to AddressableEndpoint so that we
can avoid repeated calls to AddressableEndpoint.AddressWithPrefix().Subnet().
Updates #231
PiperOrigin-RevId: 340969877
Diffstat (limited to 'pkg/tcpip/stack/route.go')
-rw-r--r-- | pkg/tcpip/stack/route.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/tcpip/stack/route.go b/pkg/tcpip/stack/route.go index 2e698f92f..15ff437c7 100644 --- a/pkg/tcpip/stack/route.go +++ b/pkg/tcpip/stack/route.go @@ -440,7 +440,7 @@ func (r *Route) isV4Broadcast(addr tcpip.Address) bool { return true } - subnet := r.localAddressEndpoint.AddressWithPrefix().Subnet() + subnet := r.localAddressEndpoint.Subnet() return subnet.IsBroadcast(addr) } |