summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dhcpv4/dhcpv4.go4
-rw-r--r--dhcpv4/dhcpv4_test.go2
2 files changed, 2 insertions, 4 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go
index db418e1..1482091 100644
--- a/dhcpv4/dhcpv4.go
+++ b/dhcpv4/dhcpv4.go
@@ -144,6 +144,7 @@ func New(modifiers ...Modifier) (*DHCPv4, error) {
d := DHCPv4{
OpCode: OpcodeBootRequest,
HWType: iana.HWTypeEthernet,
+ ClientHWAddr: make(net.HardwareAddr, 6),
HopCount: 0,
TransactionID: xid,
NumSeconds: 0,
@@ -476,9 +477,6 @@ func (d *DHCPv4) ToBytes() []byte {
// HwAddrLen
hlen := uint8(len(d.ClientHWAddr))
- if hlen == 0 && d.HWType == iana.HWTypeEthernet {
- hlen = 6
- }
buf.Write8(hlen)
buf.Write8(d.HopCount)
buf.WriteBytes(d.TransactionID[:])
diff --git a/dhcpv4/dhcpv4_test.go b/dhcpv4/dhcpv4_test.go
index aa1b2f6..6bbee31 100644
--- a/dhcpv4/dhcpv4_test.go
+++ b/dhcpv4/dhcpv4_test.go
@@ -354,7 +354,7 @@ func TestSummary(t *testing.T) {
" your IP: 0.0.0.0\n" +
" server IP: 0.0.0.0\n" +
" gateway IP: 0.0.0.0\n" +
- " client MAC: \n" +
+ " client MAC: 00:00:00:00:00:00\n" +
" server hostname: \n" +
" bootfile name: \n" +
" options:\n" +