This method of using pcap file to generate packets is fine.
But why should we use a dedicated interface with "pcap" as the name?

I was imagining something like an ODP application which reads from a
given pcap file constructs the packet and sends the packet through an
interface.

The concern I have is this method of creating a dummy interface with
"pcap" name will work fine in Linux-generic code but if you want to do
the same in other platforms then the platforms will have to implement
this virtual pcap interface but if this was an ODP application then
the platforms can simply run the application over their platform
without any change.

Regards,
Bala

On 4 September 2015 at 18:50, Stuart Haslam <stuart.has...@linaro.org> wrote:
> This is pretty handy for testing, for example to test classifier rules
> using packets from a pcap;
>
> odp_classifier -ipcap:in=test.pcap -p -m 0 
> "ODP_PMR_SIP_ADDR:192.168.111.2:FFFFFFFF:queue1" -t 5
>
> Use the l2fwd app send packets from a pcap out over a real interface;
>
> odp_l2fwd -ipcap:in=test.pcap:loops=10,eth0 -t 5
>
> Check that l2fwd doesn't reorder packets;
>
> odp_l2fwd -m 0 -i pcap:in=test.pcap,pcap:out=test_out.pcap
> editcap -v -D 0 test.pcap     /dev/null | awk '{print $7}' > test.txt
> editcap -v -D 0 test_out.pcap /dev/null | awk '{print $7}' > test_out.txt
> diff -q test.txt test_out.txt
>
> (oops, it does when using > 2 workers)
>
> Changes since v1;
>  - Increased the pktio name length
>  - Rebased
>
> Stuart Haslam (4):
>   linux-generic: pktio: extend maximum devname length
>   example: classifier: fix potential buffer overflow
>   linux-generic: pktio: add pcap pktio type
>   linux-generic: pktio: add test for pcap pktio
>
>  example/classifier/odp_classifier.c                |  18 +-
>  platform/linux-generic/Makefile.am                 |   4 +
>  .../linux-generic/include/odp_packet_io_internal.h |  25 +-
>  platform/linux-generic/m4/configure.m4             |  16 +
>  platform/linux-generic/odp_packet_io.c             |   9 +-
>  platform/linux-generic/pktio/io_ops.c              |   3 +
>  platform/linux-generic/pktio/pcap.c                | 334 
> +++++++++++++++++++++
>  platform/linux-generic/test/Makefile.am            |   5 +
>  platform/linux-generic/test/pktio/Makefile.am      |   4 +
>  platform/linux-generic/test/pktio/pktio_run_pcap   |  33 ++
>  10 files changed, 439 insertions(+), 12 deletions(-)
>  create mode 100644 platform/linux-generic/pktio/pcap.c
>  create mode 100755 platform/linux-generic/test/pktio/pktio_run_pcap
>
> --
> 2.1.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to