{
struct ipv4_hdr *ipv4_h;
#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
- struct arp_hdr *arp_h;
+ struct rte_arp_hdr *arp_h;
char dst_ip[16];
char ArpOp[24];
char buf[16];
}
#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) {
- arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset);
+ arp_h = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset);
ipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String);
ipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String);
- arp_op_name(rte_be_to_cpu_16(arp_h->arp_op),
+ arp_op_name(rte_be_to_cpu_16(arp_h->arp_opcode),
ArpOp, sizeof(ArpOp));
MODE6_DEBUG(buf, src_ip, dst_ip, eth_h, ArpOp, port, *burstnumber);
}
for (i = 0; i < nb_pkts; i++) {
eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *);
+ size_t pkt_end = (size_t)eth_hdr + rte_pktmbuf_data_len(buf[i]);
proto = eth_hdr->ether_type;
vlan_offset = get_vlan_offset(eth_hdr, &proto);
l3hash = 0;
tcp_hdr = (struct tcp_hdr *)
((char *)ipv4_hdr +
ip_hdr_offset);
- l4hash = HASH_L4_PORTS(tcp_hdr);
+ if ((size_t)tcp_hdr + sizeof(*tcp_hdr)
+ < pkt_end)
+ l4hash = HASH_L4_PORTS(tcp_hdr);
} else if (ipv4_hdr->next_proto_id ==
IPPROTO_UDP) {
udp_hdr = (struct udp_hdr *)
((char *)ipv4_hdr +
ip_hdr_offset);
- l4hash = HASH_L4_PORTS(udp_hdr);
+ if ((size_t)udp_hdr + sizeof(*udp_hdr)
+ < pkt_end)
+ l4hash = HASH_L4_PORTS(udp_hdr);
}
}
} else if (rte_cpu_to_be_16(ETHER_TYPE_IPv6) == proto) {
"Failed to allocate ARP packet from pool");
continue;
}
- pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr)
- + client_info->vlan_count * sizeof(struct vlan_hdr);
+ pkt_size = sizeof(struct ether_hdr) +
+ sizeof(struct rte_arp_hdr) +
+ client_info->vlan_count *
+ sizeof(struct vlan_hdr);
upd_pkt->data_len = pkt_size;
upd_pkt->pkt_len = pkt_size;