-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2013 6WIND
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of 6WIND S.A. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2013 6WIND S.A.
*/
#include <stdarg.h>
static const char *
arp_op_name(uint16_t arp_op)
{
- switch (arp_op ) {
+ switch (arp_op) {
case ARP_OP_REQUEST:
return "ARP Request";
case ARP_OP_REPLY:
struct rte_mbuf *pkt;
struct ether_hdr *eth_h;
struct vlan_hdr *vlan_h;
- struct arp_hdr *arp_h;
+ struct rte_arp_hdr *arp_h;
struct ipv4_hdr *ip_h;
struct icmp_hdr *icmp_h;
struct ether_addr eth_addr;
/* Reply to ARP requests */
if (eth_type == ETHER_TYPE_ARP) {
- arp_h = (struct arp_hdr *) ((char *)eth_h + l2_len);
- arp_op = RTE_BE_TO_CPU_16(arp_h->arp_op);
- arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_pro);
+ arp_h = (struct rte_arp_hdr *) ((char *)eth_h + l2_len);
+ arp_op = RTE_BE_TO_CPU_16(arp_h->arp_opcode);
+ arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_protocol);
if (verbose_level > 0) {
printf(" ARP: hrd=%d proto=0x%04x hln=%d "
"pln=%d op=%u (%s)\n",
- RTE_BE_TO_CPU_16(arp_h->arp_hrd),
- arp_pro, arp_h->arp_hln,
- arp_h->arp_pln, arp_op,
+ RTE_BE_TO_CPU_16(arp_h->arp_hardware),
+ arp_pro, arp_h->arp_hlen,
+ arp_h->arp_plen, arp_op,
arp_op_name(arp_op));
}
- if ((RTE_BE_TO_CPU_16(arp_h->arp_hrd) !=
+ if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) !=
ARP_HRD_ETHER) ||
(arp_pro != ETHER_TYPE_IPv4) ||
- (arp_h->arp_hln != 6) ||
- (arp_h->arp_pln != 4)
+ (arp_h->arp_hlen != 6) ||
+ (arp_h->arp_plen != 4)
) {
rte_pktmbuf_free(pkt);
if (verbose_level > 0)
ether_addr_copy(&ports[fs->tx_port].eth_addr,
ð_h->s_addr);
- arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY);
+ arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY);
ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr);
ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha);
ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha);