mirror of
https://github.com/danderson/netboot.git
synced 2025-10-17 18:41:26 +02: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
|
||||
func (c *Conn) SendDHCP(dst net.IP, p []byte) error {
|
||||
dstAddr, err := net.ResolveUDPAddr("udp6", fmt.Sprintf("[%s]:%s", dst.String() + "%en0", "546"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error resolving ipv6 address %s: %s", dst.String(), err)
|
||||
dstAddr := &net.UDPAddr{
|
||||
IP: dst,
|
||||
Port: 546,
|
||||
}
|
||||
_, err = c.conn.WriteTo(p, nil, dstAddr)
|
||||
if err != nil {
|
||||
_, err := c.conn.WriteTo(p, nil, dstAddr); if err != nil {
|
||||
return fmt.Errorf("Error sending a reply to %s: %s", dst.String(), err)
|
||||
}
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user