Skip to content

Commit 4b89876

Browse files
authored
Merge pull request #37 from PSandro/main
fix: ipv6 solicited-node multicast: take last 24 bits
2 parents f89714b + ca01272 commit 4b89876

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/components/tools/IPv6SolicitedNode.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
const lastGroup = groups[7]; // e.g., "5678"
109109
110110
// Take last digit of second-last group and all digits of last group
111-
const last24Bits = secondLastGroup.slice(-1) + lastGroup; // "45678"
111+
const last24Bits = secondLastGroup.slice(-2) + lastGroup; // "45678"
112112
113113
// Solicited-node multicast prefix is ff02::1:ff00:0/104
114114
const solicitedNodePrefix = 'ff02:0000:0000:0000:0000:0001:ff';
@@ -149,7 +149,7 @@
149149
const normalizedUnicast = expandIPv6(trimmed);
150150
const solicitedNodeAddress = calculateSolicitedNodeMulticast(trimmed);
151151
const groups = normalizedUnicast.split(':');
152-
const last24Bits = groups[6].slice(-1) + groups[7];
152+
const last24Bits = groups[6].slice(-2) + groups[7];
153153
154154
const explanation = [
155155
`1. Take the last 24 bits of the unicast address: ${groups[6]}:${groups[7]} → ${last24Bits}`,

0 commit comments

Comments
 (0)