cisco-system-traffic-generator / trex-core

trex-core site
https://trex-tgn.cisco.com/
Other
1.28k stars 459 forks source link

Need help in generating VxLAN packet with variable inner IP #766

Open raghavendrachari08 opened 2 years ago

raghavendrachari08 commented 2 years ago

Hi , I want to generate the packet like shown below. pkt= Ether()/IP(src=3.1.1.1,dst=3.1.1.2)/UDP(dst=4789)/VxLAN(vni=1111)/Ether()/IP(src="1.0.0.x",dst="2.0.0.x") Here x is varible when i used STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), it is changing both Outer IP and Inner IP headers values.

I tried this method , created new class InnerIP and added in the scapy layers inet. class InnerIP(IP): name="InnerIP" pkt= Ether()/IP(src=3.1.1.1,dst=3.1.1.2)/UDP(dst=4789)/VxLAN(vni=1111)/Ether()/InnerIP(src="1.0.0.x",dst="2.0.0.x") STLVmWrFlowVar(fv_name="dst", pkt_offset="InnerIP.dst"), it is working fine now as generated the traffic as expected , But is this reliable or any other method to generate only variable inner packets??

jsmoon commented 2 years ago

Hi, why don't you use "IP:1.dst" instead of "IP.dst"?