summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dhcpv6/dhcpv6relay.go4
-rw-r--r--dhcpv6/dhcpv6relay_test.go12
2 files changed, 8 insertions, 8 deletions
diff --git a/dhcpv6/dhcpv6relay.go b/dhcpv6/dhcpv6relay.go
index fae01bf..d7dc4b9 100644
--- a/dhcpv6/dhcpv6relay.go
+++ b/dhcpv6/dhcpv6relay.go
@@ -52,8 +52,8 @@ func (r *DHCPv6Relay) ToBytes() []byte {
ret := make([]byte, RelayHeaderSize)
ret[0] = byte(r.messageType)
ret[1] = byte(r.hopCount)
- copy(ret[2:18], r.peerAddr)
- copy(ret[18:34], r.linkAddr)
+ copy(ret[2:18], r.linkAddr)
+ copy(ret[18:34], r.peerAddr)
for _, opt := range r.options {
ret = append(ret, opt.ToBytes()...)
}
diff --git a/dhcpv6/dhcpv6relay_test.go b/dhcpv6/dhcpv6relay_test.go
index 99704b9..1c5947e 100644
--- a/dhcpv6/dhcpv6relay_test.go
+++ b/dhcpv6/dhcpv6relay_test.go
@@ -66,10 +66,10 @@ func TestDHCPv6RelaySettersAndGetters(t *testing.T) {
func TestDHCPv6RelayToBytes(t *testing.T) {
expected := []byte{
- 12, // RELAY_FORW
- 1, // hop count
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // link addr
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // peer addr
+ 12, // RELAY_FORW
+ 1, // hop count
+ 0xff, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, // link addr
+ 0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02, // peer addr
// option relay message
0, 9, // relay msg
0, 10, // option length
@@ -84,8 +84,8 @@ func TestDHCPv6RelayToBytes(t *testing.T) {
r := DHCPv6Relay{
messageType: RELAY_FORW,
hopCount: 1,
- linkAddr: net.IPv6loopback,
- peerAddr: net.IPv6loopback,
+ linkAddr: net.IPv6interfacelocalallnodes,
+ peerAddr: net.IPv6linklocalallrouters,
}
opt := OptRelayMsg{
relayMessage: &DHCPv6Message{