Browse Source

ipv6: fix Solicited Node address calculation

Dario Nieuwenhuis 3 years ago
parent
commit
4b1de1199c
1 changed files with 4 additions and 6 deletions
  1. 4 6
      src/wire/ipv6.rs

+ 4 - 6
src/wire/ipv6.rs

@@ -183,12 +183,10 @@ impl Address {
     /// unicast.
     pub fn solicited_node(&self) -> Address {
         assert!(self.is_unicast());
-        let mut bytes = [
-            0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-            0x00, 0x00,
-        ];
-        bytes[14..].copy_from_slice(&self.0[14..]);
-        Address(bytes)
+        Address([
+            0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF,
+            self.0[13], self.0[14], self.0[15],
+        ])
     }
 }