appneta / tcpreplay

Pcap editing and replay tools for *NIX and Windows - Users please download source from
http://tcpreplay.appneta.com/wiki/installation.html#downloads
1.16k stars 268 forks source link

Support GRE over IP for tcprewrite #686

Closed hamzah-13 closed 2 years ago

hamzah-13 commented 2 years ago

tcprewrite was failing to rewrite the lab ethernet addresses because the IP over GRE was not defined in the code and the source packet capture was missing L2 headers and tcprewrite was failing with Fatal Error: From plugins/dlt_linuxsll/linuxsll.c:dlt_linuxsll_decode() line 194: DLT_LINUX_SLL pcap's must contain only ethernet or loopback packets

We had to collate date from multiple sources to understand the changes that could be made to made this work:

type = ntohs(linux_sll->type); if (type == ARPHRD_ETHER || type == ARPHRD_LOOPBACK) { / ethernet or loopback / memcpy(&(ctx->srcaddr), linux_sll->address, ETHER_ADDR_LEN); } else { tcpedit_seterr(ctx->tcpedit, "%s", "DLT_LINUX_SLL pcap's must contain only ethernet or loopback packets"); return TCPEDIT_ERROR; }

and

/*

};

We then recompiled the package and were able to run the tcprewrite successfully

fklassen commented 2 years ago

Thanks for the PR. Do you have a PCAP file that can be used to test this?

hamzah-13 commented 2 years ago

test.pcap.zip

PFA pcap file