@@ -32,7 +32,10 @@ public IPv6NeighborDiscoveryService(TRexClient tRexClient) {
3232 this .tRexClient = tRexClient ;
3333 }
3434
35- public Map <String , Ipv6Node > scan (int portIdx , int timeDuration , String dstIp ) throws ServiceModeRequiredException {
35+ public Map <String , Ipv6Node > scan (int portIdx , int timeDuration , String dstIP ) throws ServiceModeRequiredException {
36+
37+ String broadcastIP = "ff02::1" ;
38+
3639 long endTs = System .currentTimeMillis () + timeDuration /2 * 1000 ;
3740 TRexClientResult <PortStatus > portStatusResult = tRexClient .getPortStatus (portIdx );
3841 PortStatus portStatus = portStatusResult .get ();
@@ -43,7 +46,7 @@ public Map<String, Ipv6Node> scan(int portIdx, int timeDuration, String dstIp)
4346
4447 srcMac = portStatus .getAttr ().getLayerConiguration ().getL2Configuration ().getSrc ();
4548
46- Packet pingPkt = buildICMPV6EchoReq (srcMac , multicastMacFromIPv6 (dstIp ).toString (), expandIPv6Address (dstIp ));
49+ Packet pingPkt = buildICMPV6EchoReq (srcMac , multicastMacFromIPv6 (broadcastIP ).toString (), expandIPv6Address (broadcastIP ));
4750 tRexClient .startStreamsIntermediate (portIdx , Arrays .asList (buildStream (pingPkt )));
4851
4952
@@ -74,6 +77,13 @@ public Map<String, Ipv6Node> scan(int portIdx, int timeDuration, String dstIp)
7477 return icmpNAReplies .stream ()
7578 .map (this ::toIpv6Node )
7679 .distinct ()
80+ .filter (ipv6Node -> {
81+ if (dstIP != null ) {
82+ //TODO: Implement logic which will compare compressed and expanded addresses properly
83+ return ipv6Node .getIp ().equals (dstIP );
84+ }
85+ return true ;
86+ })
7787 .collect (Collectors .toMap (Ipv6Node ::getIp , node -> node ));
7888 }
7989
0 commit comments