tcpreplay
tcpreplay copied to clipboard
version of tcpreplay-edit with innermost ip randomaization
tcpreplay-edit is a great tool to replay traffic from a simple seed pcap file, especially with --unique-ip feature. This works great with simply structured pcaps. By simple I mean each packet is NOT encapsulated with layers such as vlan,mpls, vxlan, etc. In reality, especially in data center, encapsulations abound.
Current version of tcpreplay-edit makes effort to handle these encapsulations. It handles vlan (including QinQ, 802.1q, 802.1ad) and mpls (with additional support on EoMPLS). However, this is just the tip of the iceberg. The typical vxlan, for example, is not supported.
Improper handling of the stripping of encapsulation results in parse_metadata() function results in l2offset: the first appeared ethernet header vlan_offset: the first appeared vlan header. l2len stops at the first ip header.
When --unique-ip is applied, it's actually applied on the outermost IP header, which is the first encapsulation layer when the packet is encapsulated in another protocol such as vxlan. This makes --unique-ip almost useless for performance/loadbalance tests.
This MR makes an effort to handle most encapsulation protocols. It also creates a recursive programming structure to extend to more protocols easily.
With the new parse_metadata() function, l2offset: the last appeared ethernet header vlan_offset: the first appeared vlan header after the last appeared ethernet header. l2len stops at the last ip header.
The protocols it covers are below:
Over Ethernet:
vlan: 802.1q, 802.1ad, QinQ mpls: multiple labels. PPPoE
Over IPv4/IPv6:
MPLS over IP MPLS over IPv6 IPinIP IP6 in IP6 IP4 in IP6 IP6 in IP4
over MPLS:
EoMPLS: wrap the whole ethernet frame inside MPLS
overPPP
MPLS over PPP IPv4 over PPP IPv6 over PPP
over GRE
EoGRE ERSPAN I ERSPAN II ERSPAN III PPPoGRE
over UDP
VXLAN over UDP GENEVE over UDP MPLS over UDP