sabu kurian
2014-03-14 10:27:18 UTC
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 = ð->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
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 = ð->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