I'm trying to modify advanced03-AF_XDP to receive data from a UDP client. The client is running on another Linux machine connected via ethernet.
When I run my UDP client it appears that etherType on my af_xdp_user.c program is 0x0000 which I print as shown below
static bool process_packet(struct xsk_socket_info *xsk,
uint64_t addr, uint32_t len)
{
uint8_t *pkt = xsk_umem__get_data(xsk->umem->buffer, addr);
/* Lesson#3: Write an IPv6 ICMP ECHO parser to send responses
*
* Some assumptions to make it easier:
* - No VLAN handling
* - Only if nexthdr is ICMP
* - Just return all data with MAC/IP swapped, and type set to
* ICMPV6_ECHO_REPLY
* - Recalculate the icmp checksum */
if (true) {
int ret;
uint32_t tx_idx = 0;
uint8_t tmp_mac[ETH_ALEN];
struct in6_addr tmp_ip;
struct ethhdr *eth = (struct ethhdr *) pkt;
struct ipv6hdr *ipv6 = (struct ipv6hdr *) (eth + 1);
struct icmp6hdr *icmp = (struct icmp6hdr *) (ipv6 + 1);
printf("------------------eth->h_proto: %x----------------------\n",ntohs(eth->h_proto));
I have observed that sometimes I get etherType as 0x0800 and 0x0806 as well, this is what I receive when I send data again and again from the UDP client.May be this is loss of packets when I get 0, I'm not sure.
Also I'm not sure if 0x0800 and 0x0806 are valid in this case.
I'm trying to modify advanced03-AF_XDP to receive data from a UDP client. The client is running on another Linux machine connected via ethernet. When I run my UDP client it appears that etherType on my af_xdp_user.c program is 0x0000 which I print as shown below
I have observed that sometimes I get etherType as 0x0800 and 0x0806 as well, this is what I receive when I send data again and again from the UDP client.May be this is loss of packets when I get 0, I'm not sure.
Also I'm not sure if 0x0800 and 0x0806 are valid in this case.
I'm running my XDP program for eth1 interface as