}
static const char *
-ip_proto_name(uint8_t ip_proto)
+ip_proto_name(uint16_t ip_proto)
{
static const char * ip_proto_names[] = {
"IP6HOPOPTS", /**< IP6 hop-by-hop options */
if (ip_proto < sizeof(ip_proto_names) / sizeof(ip_proto_names[0]))
return ip_proto_names[ip_proto];
switch (ip_proto) {
+#ifdef IPPROTO_PGM
case IPPROTO_PGM: /**< PGM */
return "PGM";
+#endif
case IPPROTO_SCTP: /**< Stream Control Transport Protocol */
return "SCTP";
+#ifdef IPPROTO_DIVERT
case IPPROTO_DIVERT: /**< divert pseudo-protocol */
return "DIVERT";
+#endif
case IPPROTO_RAW: /**< raw IP packet */
return "RAW";
default:
continue;
}
if (verbose_level > 0) {
- memcpy(ð_addr,
- arp_h->arp_data.arp_ip.arp_sha, 6);
+ ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr);
ether_addr_dump(" sha=", ð_addr);
- memcpy(&ip_addr,
- arp_h->arp_data.arp_ip.arp_sip, 4);
+ ip_addr = arp_h->arp_data.arp_sip;
ipv4_addr_dump(" sip=", ip_addr);
printf("\n");
- memcpy(ð_addr,
- arp_h->arp_data.arp_ip.arp_tha, 6);
+ ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr);
ether_addr_dump(" tha=", ð_addr);
- memcpy(&ip_addr,
- arp_h->arp_data.arp_ip.arp_tip, 4);
+ ip_addr = arp_h->arp_data.arp_tip;
ipv4_addr_dump(" tip=", ip_addr);
printf("\n");
}
ð_h->s_addr);
arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY);
- memcpy(ð_addr, arp_h->arp_data.arp_ip.arp_tha, 6);
- memcpy(arp_h->arp_data.arp_ip.arp_tha,
- arp_h->arp_data.arp_ip.arp_sha, 6);
- memcpy(arp_h->arp_data.arp_ip.arp_sha,
- ð_h->s_addr, 6);
+ 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(ð_addr, &arp_h->arp_data.arp_sha);
/* Swap IP addresses in ARP payload */
- memcpy(&ip_addr, arp_h->arp_data.arp_ip.arp_sip, 4);
- memcpy(arp_h->arp_data.arp_ip.arp_sip,
- arp_h->arp_data.arp_ip.arp_tip, 4);
- memcpy(arp_h->arp_data.arp_ip.arp_tip, &ip_addr, 4);
+ ip_addr = arp_h->arp_data.arp_sip;
+ arp_h->arp_data.arp_sip = arp_h->arp_data.arp_tip;
+ arp_h->arp_data.arp_tip = ip_addr;
pkts_burst[nb_replies++] = pkt;
continue;
}