diff options
Diffstat (limited to 'dhcpv4/bsdp')
-rw-r--r-- | dhcpv4/bsdp/bsdp.go | 2 | ||||
-rw-r--r-- | dhcpv4/bsdp/bsdp_test.go | 14 | ||||
-rw-r--r-- | dhcpv4/bsdp/client.go | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/dhcpv4/bsdp/bsdp.go b/dhcpv4/bsdp/bsdp.go index df44af9..441893e 100644 --- a/dhcpv4/bsdp/bsdp.go +++ b/dhcpv4/bsdp/bsdp.go @@ -40,7 +40,7 @@ func ParseBootImageListFromAck(ack *dhcpv4.DHCPv4) ([]BootImage, error) { } func needsReplyPort(replyPort uint16) bool { - return replyPort != 0 && replyPort != client4.ClientPort + return replyPort != 0 && replyPort != dhcpv4.ClientPort } // MessageTypeFromPacket extracts the BSDP message type (LIST, SELECT) from the diff --git a/dhcpv4/bsdp/bsdp_test.go b/dhcpv4/bsdp/bsdp_test.go index d5e400b..5efc81e 100644 --- a/dhcpv4/bsdp/bsdp_test.go +++ b/dhcpv4/bsdp/bsdp_test.go @@ -58,7 +58,7 @@ func TestParseBootImageListFromAckNoVendorOption(t *testing.T) { func TestNeedsReplyPort(t *testing.T) { require.True(t, needsReplyPort(123)) require.False(t, needsReplyPort(0)) - require.False(t, needsReplyPort(client4.ClientPort)) + require.False(t, needsReplyPort(dhcpv4.ClientPort)) } func TestNewInformList_NoReplyPort(t *testing.T) { @@ -215,13 +215,13 @@ func TestInformSelectForAck_ReplyPort(t *testing.T) { } func TestNewReplyForInformList_NoDefaultImage(t *testing.T) { - inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, client4.ClientPort) + inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, dhcpv4.ClientPort) _, err := NewReplyForInformList(inform, ReplyConfig{}) require.Error(t, err) } func TestNewReplyForInformList_NoImages(t *testing.T) { - inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, client4.ClientPort) + inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, dhcpv4.ClientPort) fakeImage := BootImage{ ID: BootImageID{ImageType: BootImageTypeMacOSX}, } @@ -239,7 +239,7 @@ func TestNewReplyForInformList_NoImages(t *testing.T) { } func TestNewReplyForInformList(t *testing.T) { - inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, client4.ClientPort) + inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, dhcpv4.ClientPort) images := []BootImage{ BootImage{ ID: BootImageID{ @@ -293,13 +293,13 @@ func TestNewReplyForInformList(t *testing.T) { } func TestNewReplyForInformSelect_NoSelectedImage(t *testing.T) { - inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, client4.ClientPort) + inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, dhcpv4.ClientPort) _, err := NewReplyForInformSelect(inform, ReplyConfig{}) require.Error(t, err) } func TestNewReplyForInformSelect_NoImages(t *testing.T) { - inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, client4.ClientPort) + inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, dhcpv4.ClientPort) fakeImage := BootImage{ ID: BootImageID{ImageType: BootImageTypeMacOSX}, } @@ -317,7 +317,7 @@ func TestNewReplyForInformSelect_NoImages(t *testing.T) { } func TestNewReplyForInformSelect(t *testing.T) { - inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, client4.ClientPort) + inform, _ := NewInformList(net.HardwareAddr{1, 2, 3, 4, 5, 6}, net.IP{1, 2, 3, 4}, dhcpv4.ClientPort) images := []BootImage{ BootImage{ ID: BootImageID{ diff --git a/dhcpv4/bsdp/client.go b/dhcpv4/bsdp/client.go index 173291e..5d0e667 100644 --- a/dhcpv4/bsdp/client.go +++ b/dhcpv4/bsdp/client.go @@ -35,7 +35,7 @@ func (c *Client) Exchange(ifname string) ([]*Packet, error) { } // INFORM[LIST] - informList, err := NewInformListForInterface(ifname, client4.ClientPort) + informList, err := NewInformListForInterface(ifname, dhcpv4.ClientPort) if err != nil { return conversation, err } @@ -60,7 +60,7 @@ func (c *Client) Exchange(ifname string) ([]*Packet, error) { } // INFORM[SELECT] - informSelect, err := InformSelectForAck(PacketFor(ackForList), client4.ClientPort, bootImages[0]) + informSelect, err := InformSelectForAck(PacketFor(ackForList), dhcpv4.ClientPort, bootImages[0]) if err != nil { return conversation, err } |