Skip to content

Commit

Permalink
send unicast with specific IP, otherwise it failed with trying to bin…
Browse files Browse the repository at this point in the history
…d to 0.0.0.0:68
  • Loading branch information
jzhoucliqr authored and snehala27 committed Feb 15, 2024
1 parent 7cb31d6 commit a7849d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/vip/dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ func (c *DHCPClient) Start() {
c.initRebootFlag = false
c.lease = lease

log.Info("DHCP lease: %v", lease)

// Set up two ticker to renew/rebind regularly
t1Timeout := c.lease.ACK.IPAddressLeaseTime(defaultDHCPRenew) / 2
t2Timeout := (c.lease.ACK.IPAddressLeaseTime(defaultDHCPRenew) / 8) * 7
Expand Down Expand Up @@ -265,7 +267,7 @@ func (c *DHCPClient) request(rebind bool) (*nclient4.Lease, error) {
}

func (c *DHCPClient) release() error {
dhclient, err := nclient4.New(c.iface.Name)
dhclient, err := nclient4.New(c.iface.Name, nclient4.WithUnicast(&net.UDPAddr{IP: c.lease.ACK.YourIPAddr, Port: nclient4.ClientPort}))
if err != nil {
return fmt.Errorf("create release client failed, error: %w, iface: %s, server ip: %v", err, c.iface.Name, c.lease.ACK.ServerIPAddr)
}
Expand Down

0 comments on commit a7849d3

Please sign in to comment.