mirror of
https://github.com/danderson/netboot.git
synced 2025-12-08 02:51:38 +01:00
Create UDP address directly. Also dropped address zone from destination address as it wasn't needed.
This commit is contained in:
parent
08daa9f0da
commit
24498fac2f
@ -109,12 +109,11 @@ func (c *Conn) RecvDHCP() (*Packet, net.IP, error) {
|
|||||||
|
|
||||||
// SendDHCP sends a dhcp packet to the specified ip address using Conn
|
// SendDHCP sends a dhcp packet to the specified ip address using Conn
|
||||||
func (c *Conn) SendDHCP(dst net.IP, p []byte) error {
|
func (c *Conn) SendDHCP(dst net.IP, p []byte) error {
|
||||||
dstAddr, err := net.ResolveUDPAddr("udp6", fmt.Sprintf("[%s]:%s", dst.String() + "%en0", "546"))
|
dstAddr := &net.UDPAddr{
|
||||||
if err != nil {
|
IP: dst,
|
||||||
return fmt.Errorf("Error resolving ipv6 address %s: %s", dst.String(), err)
|
Port: 546,
|
||||||
}
|
}
|
||||||
_, err = c.conn.WriteTo(p, nil, dstAddr)
|
_, err := c.conn.WriteTo(p, nil, dstAddr); if err != nil {
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error sending a reply to %s: %s", dst.String(), err)
|
return fmt.Errorf("Error sending a reply to %s: %s", dst.String(), err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user