summaryrefslogtreecommitdiffhomepage
path: root/netboot
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2019-04-23 23:09:44 +0100
committerinsomniac <insomniacslk@users.noreply.github.com>2019-04-24 21:37:02 +0100
commit8166b9a9db9b180c02622ebf3dcff01ff2b2e0a6 (patch)
tree31d3044177cebed28784b1b282a9ea73fc9b65a6 /netboot
parentebf43962e121b9c5c982d6a647a29fa4ae9b6a14 (diff)
[dhcpv6] Solicit messages derive default IAID from MAC address
IAID must be set by the client. This patch generates the IAID from the MAC address of the interface. To do so, a new WithIAID modifier is added, the interface of NewSolicitWithCID now requires a hwaddr parameter, and NewAdvertiseFromSolicit copies the IA_NA option from the solicit if present. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
Diffstat (limited to 'netboot')
-rw-r--r--netboot/netconf_test.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/netboot/netconf_test.go b/netboot/netconf_test.go
index 69d58ad..1341af4 100644
--- a/netboot/netconf_test.go
+++ b/netboot/netconf_test.go
@@ -7,27 +7,20 @@ import (
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/dhcpv6"
- "github.com/insomniacslk/dhcp/iana"
"github.com/stretchr/testify/require"
)
-func getAdv(modifiers ...dhcpv6.Modifier) *dhcpv6.Message {
+func getAdv(advModifiers ...dhcpv6.Modifier) *dhcpv6.Message {
hwaddr, err := net.ParseMAC("aa:bb:cc:dd:ee:ff")
if err != nil {
log.Panic(err)
}
- duid := dhcpv6.Duid{
- Type: dhcpv6.DUID_LLT,
- HwType: iana.HWTypeEthernet,
- Time: dhcpv6.GetTime(),
- LinkLayerAddr: hwaddr,
- }
- sol, err := dhcpv6.NewSolicitWithCID(duid, modifiers...)
+ sol, err := dhcpv6.NewSolicit(hwaddr)
if err != nil {
log.Panic(err)
}
- d, err := dhcpv6.NewAdvertiseFromSolicit(sol, modifiers...)
+ d, err := dhcpv6.NewAdvertiseFromSolicit(sol, advModifiers...)
if err != nil {
log.Panic(err)
}