1111import com .cisco .trex .stateless .model .StreamVM ;
1212import com .cisco .trex .stateless .model .TRexClientResult ;
1313import com .cisco .trex .stateless .model .port .PortVlan ;
14+ import com .cisco .trex .stateless .model .vm .FixChecksumHw ;
15+ import com .cisco .trex .stateless .model .vm .FixChecksumHw .L4Type ;
16+ import com .cisco .trex .stateless .model .vm .VMInstruction ;
1417import com .google .common .collect .Lists ;
1518import com .google .common .net .InetAddresses ;
1619import java .net .Inet6Address ;
@@ -57,6 +60,8 @@ public class IPv6NeighborDiscoveryService {
5760
5861 private static final EtherType QInQ =
5962 new EtherType ((short ) 0x88a8 , "802.1Q Provider Bridge (Q-in-Q)" );
63+ private static final int L3LENGTH = 40 ;
64+ private static final int L2LENGTH = 14 ;
6065 private TRexClient tRexClient ;
6166
6267 public IPv6NeighborDiscoveryService (TRexClient tRexClient ) {
@@ -214,8 +219,14 @@ public EthernetPacket sendNeighborSolicitation(
214219 }
215220
216221 Packet icmpv6NSPkt = buildICMPV6NSPkt (vlan , srcMac , dstMac , dstIp , srcIp );
217-
218- tRexClient .startStreamsIntermediate (portIdx , Arrays .asList (buildStream (icmpv6NSPkt )));
222+ List <VMInstruction > instructions = new ArrayList <>();
223+ int layer2Length = L2LENGTH ;
224+ if (!vlan .getTags ().isEmpty ()) {
225+ layer2Length = 18 ;
226+ }
227+ instructions .add (new FixChecksumHw (layer2Length , L3LENGTH , L4Type .IP ));
228+ tRexClient .startStreamsIntermediate (
229+ portIdx , Arrays .asList (buildStream (icmpv6NSPkt , instructions )));
219230
220231 Predicate <EthernetPacket > ipV6NAPktFilter =
221232 etherPkt -> {
@@ -346,6 +357,11 @@ private Map<String, EthernetPacket> sendNSandIcmpV6Req(
346357 }
347358
348359 private static com .cisco .trex .stateless .model .Stream buildStream (Packet pkt ) {
360+ return buildStream (pkt , Collections .emptyList ());
361+ }
362+
363+ private static com .cisco .trex .stateless .model .Stream buildStream (
364+ Packet pkt , List <VMInstruction > instructions ) {
349365 int streamId = (int ) (Math .random () * 1000 );
350366 return new com .cisco .trex .stateless .model .Stream (
351367 streamId ,
@@ -362,7 +378,7 @@ private static com.cisco.trex.stateless.model.Stream buildStream(Packet pkt) {
362378 -1 ,
363379 pkt ,
364380 new StreamRxStats (false , false , true , streamId ),
365- new StreamVM ("" , Collections . emptyList () ),
381+ new StreamVM ("" , instructions ),
366382 true ,
367383 false ,
368384 null );
0 commit comments