[dpdk-dev] [dpdk-users] Unable to Forward the Packet after UDP Payload Modification
Stephen Hemminger
stephen at networkplumber.org
Fri Jun 28 17:38:20 CEST 2019
On Thu, 27 Jun 2019 23:00:35 +0530
satyavalli rama <satyavalli.rama at gmail.com> wrote:
> Hi
>
>
> With Scapy we are sending UDP Packets to ‘P0’ of DPDK - VM -1 as below
>
> >>>sendp(Ether(src="52:00:00:00:00:4a",dst="50:00:00:00:00:8F")/IP(dst="20.20.20.20",proto=17)/UDP(sport=4009,dport=4019)/Raw(load=('Helllo Basha')), iface="ens9", loop=1, count=10, inter=1.0002)
>
>
> I'm modifying MAC address in l2fwd_simple_forward (52:00:00:00:AB:CD)
> and calling the below API after mac updation, in the ‘l2fwd’ DPDK
> Sample application.
>
> But I'm unable to receive the ‘Appended Data’ on the Destination Port.
> P0 itself is dropping our packets...
>
> Without Appending the Payload/Data we are able to see our packets on
> the Destination Port.
>
> Please let me know whether this issue is with respect to appending or
> buffering or checksum related...
>
> static void
>
> pkt_modify(struct rte_mbuf *m, unsigned dest_portid)
>
> {
>
> struct ether_hdr *eth;
>
> struct ipv4_hdr *ipv4;
>
> struct udp_hdr *udp;
>
> char *udpData;
>
> int len = 0;
>
> const char *mess = "Eureka";
>
> char *newData = NULL;
>
> eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
>
> ipv4 = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *,sizeof(struct ether_hdr));
>
> udp = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, sizeof(struct
> ether_hdr)+sizeof(struct ipv4_hdr));
>
> len = m->data_len;
>
> udpData = rte_pktmbuf_mtod_offset(m, char *, len);
>
> newData = rte_pktmbuf_append(m, 6);
>
> if (newData != NULL)
>
> rte_memcpy(newData, mess, 6);
>
>
> len = m->data_len;
>
> udpData = rte_pktmbuf_mtod_offset(m, char *, sizeof(struct
> ether_hdr)+sizeof(struct ipv4_hdr)+
>
> sizeof(struct udp_hdr));
>
> return ;
>
> }
>
>
> Please help me on figuring out this....
>
> Thanks,
>
> Satya Valli.
You aren't changing the ip header length or checksum.
So your message at the end just looks like additional L2 trailer.
More information about the dev
mailing list