summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/network.go
diff options
context:
space:
mode:
authorTony Gong <gongt@google.com>2021-09-15 14:57:10 -0700
committergVisor bot <gvisor-bot@google.com>2021-09-15 15:00:01 -0700
commit8b56b6b83b86009191587c86e134d6c924834831 (patch)
tree2f2b066624bdc02b570f2027235299e419304013 /runsc/boot/network.go
parent149ca009678edc580de9f0b1d54f551d376742cb (diff)
Pass address properties in a single struct
Replaced the current AddAddressWithOptions method with AddAddressWithProperties which passes all address properties in a single AddressProperties type. More properties that need to be configured in the future are expected, so adding a type makes adding them easier. PiperOrigin-RevId: 396930729
Diffstat (limited to 'runsc/boot/network.go')
-rw-r--r--runsc/boot/network.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/runsc/boot/network.go b/runsc/boot/network.go
index 2257ecca7..9fb3ebd95 100644
--- a/runsc/boot/network.go
+++ b/runsc/boot/network.go
@@ -282,12 +282,15 @@ func (n *Network) createNICWithAddrs(id tcpip.NICID, name string, ep stack.LinkE
for _, addr := range addrs {
proto, tcpipAddr := ipToAddressAndProto(addr.Address)
- ap := tcpip.AddressWithPrefix{
- Address: tcpipAddr,
- PrefixLen: addr.PrefixLen,
+ protocolAddr := tcpip.ProtocolAddress{
+ Protocol: proto,
+ AddressWithPrefix: tcpip.AddressWithPrefix{
+ Address: tcpipAddr,
+ PrefixLen: addr.PrefixLen,
+ },
}
- if err := n.Stack.AddAddressWithPrefix(id, proto, ap); err != nil {
- return fmt.Errorf("AddAddress(%v, %v, %v) failed: %v", id, proto, tcpipAddr, err)
+ if err := n.Stack.AddProtocolAddress(id, protocolAddr, stack.AddressProperties{}); err != nil {
+ return fmt.Errorf("AddProtocolAddress(%d, %+v, {}) failed: %s", id, protocolAddr, err)
}
}
return nil