summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/bsdp/client.go
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2018-08-13 15:17:02 +0100
committerAndrea Barberio <insomniac@slackware.it>2018-08-13 15:17:02 +0100
commit16f39f1864a93fa6b105659870ff31c3e8fa0d45 (patch)
treeaf3882a7aa943ea352a194396388e227b3012dce /dhcpv4/bsdp/client.go
parent6ed3fbc5a5967c1b2b9af4ff3f3c23a53390dbfc (diff)
BSDP: Exchange returns list of pointers, not list of objects
Diffstat (limited to 'dhcpv4/bsdp/client.go')
-rw-r--r--dhcpv4/bsdp/client.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/dhcpv4/bsdp/client.go b/dhcpv4/bsdp/client.go
index 3d885aa..255d54b 100644
--- a/dhcpv4/bsdp/client.go
+++ b/dhcpv4/bsdp/client.go
@@ -36,8 +36,8 @@ func castVendorOpt(ack *dhcpv4.DHCPv4) {
// Exchange runs a full BSDP exchange (Inform[list], Ack, Inform[select],
// Ack). Returns a list of DHCPv4 structures representing the exchange.
-func (c *Client) Exchange(ifname string, informList *dhcpv4.DHCPv4) ([]dhcpv4.DHCPv4, error) {
- conversation := make([]dhcpv4.DHCPv4, 1)
+func (c *Client) Exchange(ifname string, informList *dhcpv4.DHCPv4) ([]*dhcpv4.DHCPv4, error) {
+ conversation := make([]*dhcpv4.DHCPv4, 1)
var err error
// Get our file descriptor for the broadcast socket.
@@ -57,7 +57,7 @@ func (c *Client) Exchange(ifname string, informList *dhcpv4.DHCPv4) ([]dhcpv4.DH
return conversation, err
}
}
- conversation[0] = *informList
+ conversation[0] = informList
// ACK[LIST]
ackForList, err := dhcpv4.BroadcastSendReceive(sendFd, recvFd, informList, c.ReadTimeout, c.WriteTimeout, dhcpv4.MessageTypeAck)
@@ -67,7 +67,7 @@ func (c *Client) Exchange(ifname string, informList *dhcpv4.DHCPv4) ([]dhcpv4.DH
// Rewrite vendor-specific option for pretty printing.
castVendorOpt(ackForList)
- conversation = append(conversation, *ackForList)
+ conversation = append(conversation, ackForList)
// Parse boot images sent back by server
bootImages, err := ParseBootImageListFromAck(*ackForList)
@@ -83,7 +83,7 @@ func (c *Client) Exchange(ifname string, informList *dhcpv4.DHCPv4) ([]dhcpv4.DH
if err != nil {
return conversation, err
}
- conversation = append(conversation, *informSelect)
+ conversation = append(conversation, informSelect)
// ACK[SELECT]
ackForSelect, err := dhcpv4.BroadcastSendReceive(sendFd, recvFd, informSelect, c.ReadTimeout, c.WriteTimeout, dhcpv4.MessageTypeAck)
@@ -91,5 +91,5 @@ func (c *Client) Exchange(ifname string, informList *dhcpv4.DHCPv4) ([]dhcpv4.DH
if err != nil {
return conversation, err
}
- return append(conversation, *ackForSelect), nil
+ return append(conversation, ackForSelect), nil
}