Member name references are now consistent with the now-sole definition.
#endif
#include <freeradius-devel/build.h>
+#include <freeradius-devel/ethernet/ethernet.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/hash.h>
#include <freeradius-devel/util/misc.h>
#define IP_MF 0x2000 //!< More fragments flag.
#define IP_OFFMASK 0x1fff //!< Mask for fragmenting bits.
-/*
- * Structure of a DEC/Intel/Xerox or 802.3 Ethernet header.
- */
-typedef struct CC_HINT(__packed__) {
- uint8_t ether_dst[ETHER_ADDR_LEN];
- uint8_t ether_src[ETHER_ADDR_LEN];
- uint16_t ether_type;
-} ethernet_header_t;
-
/*
* Structure of an internet header, naked of options.
*/
* Set the destination MAC as the target address from
* ARP.
*/
- memcpy(eth_hdr->ether_src, thread->pcap->ether_addr, ETHER_ADDR_LEN);
- memcpy(eth_hdr->ether_dst, arp->tha, ETHER_ADDR_LEN);
+ memcpy(eth_hdr->src_addr, thread->pcap->ether_addr, ETHER_ADDR_LEN);
+ memcpy(eth_hdr->dst_addr, arp->tha, ETHER_ADDR_LEN);
/*
* If we fail injecting the reply, just ignore it.
/* fill in Ethernet layer (L2) */
eth_hdr = (ethernet_header_t *)dhcp_packet;
- memcpy(eth_hdr->ether_dst, dst_ether_addr, ETH_ADDR_LEN);
- memcpy(eth_hdr->ether_src, pcap->ether_addr, ETH_ADDR_LEN);
+ memcpy(eth_hdr->src_addr, dst_ether_addr, ETH_ADDR_LEN);
+ memcpy(eth_hdr->dst_addr, pcap->ether_addr, ETH_ADDR_LEN);
eth_hdr->ether_type = htons(ETH_TYPE_IP);
end += ETH_ADDR_LEN + ETH_ADDR_LEN + sizeof(eth_hdr->ether_type);
}
/* fill in Ethernet layer (L2) */
- memcpy(eth_hdr->ether_dst, eth_bcast, ETH_ADDR_LEN);
- memcpy(eth_hdr->ether_src, dhmac, ETH_ADDR_LEN);
+ memcpy(eth_hdr->dst_addr, eth_bcast, ETH_ADDR_LEN);
+ memcpy(eth_hdr->src_addr, dhmac, ETH_ADDR_LEN);
eth_hdr->ether_type = htons(ETH_TYPE_IP);
/* fill in IP layer (L3) */
* If Ethernet destination is not broadcast (ff:ff:ff:ff:ff:ff)
* Check if it matches the source HW address used (DHCP-Client-Hardware-Address = 267)
*/
- if ((memcmp(ð_bcast, ð_hdr->ether_dst, ETH_ADDR_LEN) != 0) &&
+ if ((memcmp(ð_bcast, ð_hdr->dst_addr, ETH_ADDR_LEN) != 0) &&
(vp = fr_pair_find_by_da(request->vps, attr_dhcp_client_hardware_address, TAG_ANY)) &&
- ((vp->vp_type == FR_TYPE_ETHERNET) && (memcmp(vp->vp_ether, ð_hdr->ether_dst, ETH_ADDR_LEN) != 0))) {
+ ((vp->vp_type == FR_TYPE_ETHERNET) && (memcmp(vp->vp_ether, ð_hdr->dst_addr, ETH_ADDR_LEN) != 0))) {
/* No match. */
DISCARD_RP("Ethernet destination (%pV) is not broadcast and doesn't match request source (%pV)",
- fr_box_ether(eth_hdr->ether_dst), &vp->data);
+ fr_box_ether(eth_hdr->dst_addr), &vp->data);
}
/*