summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dhcpv6/dhcpv6message.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go
index db29a44..e7e6bda 100644
--- a/dhcpv6/dhcpv6message.go
+++ b/dhcpv6/dhcpv6message.go
@@ -4,10 +4,11 @@ import (
"crypto/rand"
"encoding/binary"
"fmt"
- "github.com/insomniacslk/dhcp/iana"
"log"
"net"
"time"
+
+ "github.com/insomniacslk/dhcp/iana"
)
const MessageHeaderSize = 4
@@ -201,6 +202,16 @@ func (d *DHCPv6Message) AddOption(option Option) {
d.options = append(d.options, option)
}
+func (d *DHCPv6Message) UpdateOption(option Option) {
+ for idx, opt := range d.options {
+ if opt.Code() == option.Code() {
+ d.options[idx] = option
+ // don't look further
+ break
+ }
+ }
+}
+
func (d *DHCPv6Message) String() string {
return fmt.Sprintf("DHCPv6Message(messageType=%v transactionID=0x%06x, %d options)",
d.MessageTypeToString(), d.TransactionID(), len(d.options),