diff options
Diffstat (limited to 'runsc/boot/network.go')
-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 { |