[dpdk-dev] Segmentation Fault on printf()

sabu kurian sabu2kurian at gmail.com
Fri Mar 14 11:27:18 CET 2014


Hello friends,

I'm trying to print the ether_type for a packet that I captured from a port
on my machine. Suppose 'm' holds the packet. 'm' is of type 'struct
rte_mbuf'. Intels API reference for DPDK says 'ether_type' is of uint16_t.
I used the following code to retrieve ether_type.

void * eth_type;
struct ether_hdr *eth;

eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
eth_type = &eth->ether_type;

printf("\n Type is %" PRIu16 , *((uint16_t *)eth_type));

rte_pktmbuf_free(m);

I get a 'Segmentation fault' when the printf() statement gets executed.
Where am I going wrong ?

Thanks in advance


More information about the dev mailing list