| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
/* glibc's netinet/if_ether.h does the following: |
| 5 |
* - include linux/if_ether.h, net/ethernet.h, and net/if_arp.h, |
| 6 |
* - define struct ether_arp, and relevant macros, |
| 7 |
* - define ETHER_MAP_IP_MULTICAST() macro (currently we do not use it). |
| 8 |
* However, musl's netinet/if_ether.h conflicts with linux/if_ether.h. |
| 9 |
* Let's use the same way that glibc uses. */ |
| 10 |
|
| 11 |
#include <linux/if_ether.h> /* IWYU pragma: export */ |
| 12 |
#include <net/ethernet.h> /* IWYU pragma: export */ |
| 13 |
#include <net/if_arp.h> /* IWYU pragma: export */ |
| 14 |
|
| 15 |
/* |
| 16 |
* Ethernet Address Resolution Protocol. |
| 17 |
* |
| 18 |
* See RFC 826 for protocol description. Structure below is adapted |
| 19 |
* to resolving internet addresses. Field names used correspond to |
| 20 |
* RFC 826. |
| 21 |
*/ |
| 22 |
struct ether_arp { |
| 23 |
struct arphdr ea_hdr; /* fixed-size header */ |
| 24 |
uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */ |
| 25 |
uint8_t arp_spa[4]; /* sender protocol address */ |
| 26 |
uint8_t arp_tha[ETH_ALEN]; /* target hardware address */ |
| 27 |
uint8_t arp_tpa[4]; /* target protocol address */ |
| 28 |
}; |
| 29 |
#define arp_hrd ea_hdr.ar_hrd |
| 30 |
#define arp_pro ea_hdr.ar_pro |
| 31 |
#define arp_hln ea_hdr.ar_hln |
| 32 |
#define arp_pln ea_hdr.ar_pln |
| 33 |
#define arp_op ea_hdr.ar_op |