diff options
author | Chris K <chrisko@google.com> | 2020-02-19 21:58:11 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2020-02-21 23:28:12 +0000 |
commit | 81b9770086ea37a41d98163431b0c53ec70c823c (patch) | |
tree | f1adaaa9613278082e5e473d5973c6e4f467a169 /dhcpv6 | |
parent | 45e5f320b2f0f87515ac27f1a04bbd24f494ac90 (diff) |
nclient6: listen on link-local addr
This allows for multi-NIC DHCPv6 in parallel.
Otherwise:
2020/02/20 05:01:34 Could not configure eth1 for IPv6: listen udp6 %eth1:546: bind: address already in use
2020/02/20 05:01:34 Could not configure eth4 for IPv6: listen udp6 %eth4:546: bind: address already in use
2020/02/20 05:01:34 Attempting to get DHCPv6 lease on eth2
2020/02/20 05:01:34 Could not configure eth0 for IPv6: listen udp6 %eth0:546: bind: address already in use
2020/02/20 05:01:34 Could not configure eth3 for IPv6: listen udp6 %eth3:546: bind: address already in use
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6')
-rw-r--r-- | dhcpv6/nclient6/client.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/dhcpv6/nclient6/client.go b/dhcpv6/nclient6/client.go index a39689a..a90d050 100644 --- a/dhcpv6/nclient6/client.go +++ b/dhcpv6/nclient6/client.go @@ -113,7 +113,13 @@ func (d debugLogger) PrintMessage(prefix string, message *dhcpv6.Message) { // NewIPv6UDPConn returns a UDP connection bound to both the interface and port // given based on a IPv6 DGRAM socket. func NewIPv6UDPConn(iface string, port int) (net.PacketConn, error) { + ip, err := dhcpv6.GetLinkLocalAddr(iface) + if err != nil { + return nil, err + } + return net.ListenUDP("udp6", &net.UDPAddr{ + IP: ip, Port: port, Zone: iface, }) |