diff options
author | Googler <noreply@google.com> | 2018-09-28 12:16:47 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-09-28 12:18:15 -0700 |
commit | fb65b0b471621b430969fe1c3009bee68209bf67 (patch) | |
tree | 7e4d84cb3596bb2def1284388628f6c5f078b58a /runsc/boot | |
parent | e22c4cba47c9e29c7bf6e6c4d064bb7f3a71ca2f (diff) |
Change tcpip.Route.Mask to tcpip.AddressMask.
PiperOrigin-RevId: 214975659
Change-Id: I7bd31a2c54f03ff52203109da312e4206701c44c
Diffstat (limited to 'runsc/boot')
-rw-r--r-- | runsc/boot/network.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/runsc/boot/network.go b/runsc/boot/network.go index 0e43c91be..6a2678ac9 100644 --- a/runsc/boot/network.go +++ b/runsc/boot/network.go @@ -86,7 +86,7 @@ func (r *Route) toTcpipRoute(id tcpip.NICID) tcpip.Route { return tcpip.Route{ Destination: ipToAddress(r.Destination), Gateway: ipToAddress(r.Gateway), - Mask: ipToAddress(net.IP(r.Mask)), + Mask: ipToAddressMask(net.IP(r.Mask)), NIC: id, } } @@ -203,6 +203,12 @@ func ipToAddress(ip net.IP) tcpip.Address { return addr } +// ipToAddressMask converts IP to tcpip.AddressMask, ignoring the protocol. +func ipToAddressMask(ip net.IP) tcpip.AddressMask { + _, addr := ipToAddressAndProto(ip) + return tcpip.AddressMask(addr) +} + // generateRndMac returns a random local MAC address. // Copied from eth_random_addr() (include/linux/etherdevice.h) func generateRndMac() net.HardwareAddr { |