diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-09-05 02:17:36 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-09-05 02:17:36 +0000 |
commit | ef0576778d7cf4ed1ac63830c75ba856dfbda73a (patch) | |
tree | 66d9f1b158eb520665e6f7be930e3ffe842c5825 /pkg/tcpip/tcpip.go | |
parent | e8ab86cf153ab133a21c29a5b41ed1868cf2c279 (diff) | |
parent | fbbb2f7ed6a2f735c8e8d48e8b5264d2057e93ad (diff) |
Merge fbbb2f7e (automated)
Diffstat (limited to 'pkg/tcpip/tcpip.go')
-rw-r--r-- | pkg/tcpip/tcpip.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/tcpip/tcpip.go b/pkg/tcpip/tcpip.go index 05aa42c98..418e771d2 100644 --- a/pkg/tcpip/tcpip.go +++ b/pkg/tcpip/tcpip.go @@ -219,6 +219,15 @@ func (s *Subnet) Mask() AddressMask { return s.mask } +// Broadcast returns the subnet's broadcast address. +func (s *Subnet) Broadcast() Address { + addr := []byte(s.address) + for i := range addr { + addr[i] |= ^s.mask[i] + } + return Address(addr) +} + // NICID is a number that uniquely identifies a NIC. type NICID int32 |