diff options
author | Brian Kemper <bkemper@gmail.com> | 2023-03-30 14:12:52 -0600 |
---|---|---|
committer | Brian Kemper <bkemper@gmail.com> | 2023-04-13 10:38:02 -0600 |
commit | df9ba4adc1acd679beae3c48cd1adc4c2a96f2e3 (patch) | |
tree | 53ec59ff308e3b3acdf44a81d3a93f7db5c83e4d /dhcpv4/nclient4 | |
parent | 4ec57e88f4b754ab1680a52ca86808bc271a0671 (diff) |
Fix errors
Signed-off-by: Brian Kemper <bkemper@gmail.com>
Diffstat (limited to 'dhcpv4/nclient4')
-rw-r--r-- | dhcpv4/nclient4/conn_unix.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/dhcpv4/nclient4/conn_unix.go b/dhcpv4/nclient4/conn_unix.go index 6442e70..7f79f50 100644 --- a/dhcpv4/nclient4/conn_unix.go +++ b/dhcpv4/nclient4/conn_unix.go @@ -13,9 +13,9 @@ import ( "io" "net" - "github.com/mdlayher/ethernet" "github.com/mdlayher/packet" "github.com/u-root/uio/uio" + "golang.org/x/sys/unix" ) var ( @@ -39,7 +39,7 @@ func NewRawUDPConn(iface string, port int) (net.PacketConn, error) { if err != nil { return nil, err } - rawConn, err := packet.Listen(ifc, packet.Datagram, int(ethernet.EtherTypeIPv4), nil) + rawConn, err := packet.Listen(ifc, packet.Datagram, unix.ETH_P_IP, nil) if err != nil { return nil, err } @@ -152,8 +152,8 @@ func (upc *BroadcastRawUDPConn) WriteTo(b []byte, addr net.Addr) (int, error) { } // Using the boundAddr is not quite right here, but it works. - packet := udp4pkt(b, udpAddr, upc.boundAddr) + pkt := udp4pkt(b, udpAddr, upc.boundAddr) // Broadcasting is not always right, but hell, what the ARP do I know. - return upc.PacketConn.WriteTo(packet, &packet.Addr{HardwareAddr: BroadcastMac}) + return upc.PacketConn.WriteTo(pkt, &packet.Addr{HardwareAddr: BroadcastMac}) } |