diff options
author | Andrea Barberio <insomniac@slackware.it> | 2019-04-23 20:23:45 +0100 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-04-23 21:18:28 +0100 |
commit | ebf43962e121b9c5c982d6a647a29fa4ae9b6a14 (patch) | |
tree | f0b5c068389f88a5c27acf8fa28f594f81a74f5f /dhcpv6/dhcpv6message.go | |
parent | b071bdc86a58037f6c745647c97fca202f3caef9 (diff) |
Revert "[dhcpv6] Solicit messages derive default IAID from MAC address"
This reverts commit b071bdc86a58037f6c745647c97fca202f3caef9.
Signed-off-by: Andrea Barberio <insomniac@slackware.it>
Diffstat (limited to 'dhcpv6/dhcpv6message.go')
-rw-r--r-- | dhcpv6/dhcpv6message.go | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go index bc23156..9237c1b 100644 --- a/dhcpv6/dhcpv6message.go +++ b/dhcpv6/dhcpv6message.go @@ -43,7 +43,7 @@ func GetTime() uint32 { } // NewSolicitWithCID creates a new SOLICIT message with CID. -func NewSolicitWithCID(duid Duid, hwaddr net.HardwareAddr, modifiers ...Modifier) (*Message, error) { +func NewSolicitWithCID(duid Duid, modifiers ...Modifier) (*Message, error) { m, err := NewMessage() if err != nil { return nil, err @@ -57,13 +57,12 @@ func NewSolicitWithCID(duid Duid, hwaddr net.HardwareAddr, modifiers ...Modifier }) m.AddOption(oro) m.AddOption(&OptElapsedTime{}) - if len(hwaddr) < 4 { - return nil, errors.New("short hardware addrss: less than 4 bytes") - } - l := len(hwaddr) - var iaid [4]byte - copy(iaid[:], hwaddr[l-4:l]) - modifiers = append([]Modifier{WithIAID(iaid)}, modifiers...) + // FIXME use real values for IA_NA + iaNa := &OptIANA{} + iaNa.IaId = [4]byte{0xfa, 0xce, 0xb0, 0x0c} + iaNa.T1 = 0xe10 + iaNa.T2 = 0x1518 + m.AddOption(iaNa) // Apply modifiers for _, mod := range modifiers { mod(m) @@ -80,7 +79,7 @@ func NewSolicit(ifaceHWAddr net.HardwareAddr, modifiers ...Modifier) (*Message, Time: GetTime(), LinkLayerAddr: ifaceHWAddr, } - return NewSolicitWithCID(duid, ifaceHWAddr, modifiers...) + return NewSolicitWithCID(duid, modifiers...) } // NewAdvertiseFromSolicit creates a new ADVERTISE packet based on an SOLICIT packet. @@ -102,12 +101,6 @@ func NewAdvertiseFromSolicit(sol *Message, modifiers ...Modifier) (*Message, err return nil, errors.New("Client ID cannot be nil in SOLICIT when building ADVERTISE") } adv.AddOption(cid) - // add IA_NA - iaNa := sol.GetOneOption(OptionIANA) - if iaNa == nil { - return nil, fmt.Errorf("IA_NA cannot be nil in SOLICIT when building ADVERTISE") - } - adv.AddOption(iaNa) // apply modifiers for _, mod := range modifiers { |