Skip to content

Commit b787909

Browse files
author
Emil Gustafsson
committed
change to correct multicast address as dst ip
Signed-off-by: Emil Gustafsson <[email protected]>
1 parent f4d82a7 commit b787909

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/com/cisco/trex/stateless/IPv6NeighborDiscoveryService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,16 @@ private static Packet buildICMPV6NSPkt(
387387
.correctChecksumAtBuild(true)
388388
.payloadBuilder(ipv6NSBuilder);
389389

390+
// Calculate the Solicited-Node multicast address, RFC 4291 chapter 2.7.1
391+
String[] destIpParts = dstIp.split(":");
392+
String multicastIp =
393+
String.format(
394+
"FF02::1:FF%s:%s", destIpParts[6].substring(2, 4), destIpParts[7].substring(0, 4));
395+
390396
IpV6Packet.Builder ipV6Builder = new IpV6Packet.Builder();
391397
ipV6Builder
392398
.srcAddr((Inet6Address) InetAddress.getByName(specifiedSrcIP))
393-
.dstAddr((Inet6Address) InetAddress.getByName(dstIp))
399+
.dstAddr((Inet6Address) InetAddress.getByName(multicastIp))
394400
.version(IpVersion.IPV6)
395401
.hopLimit((byte) -1)
396402
.trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0))

0 commit comments

Comments
 (0)