26 #define ETHER_ADDR_LEN 6
27 #define ETHER_TYPE_LEN 2
28 #define ETHER_CRC_LEN 4
29 #define ETHER_HDR_LEN \
30 (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN)
31 #define ETHER_MIN_LEN 64
32 #define ETHER_MAX_LEN 1518
34 (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
36 #define ETHER_MAX_VLAN_FRAME_LEN \
39 #define ETHER_MAX_JUMBO_FRAME_LEN \
42 #define ETHER_MAX_VLAN_ID 4095
44 #define ETHER_MIN_MTU 68
59 } __attribute__((__packed__));
61 #define ETHER_LOCAL_ADMIN_ADDR 0x02
62 #define ETHER_GROUP_ADDR 0x01
78 static inline int is_same_ether_addr(const struct ether_addr *ea1,
83 if (ea1->addr_bytes[i] != ea2->addr_bytes[i])
149 const unaligned_uint16_t *ea_words = (
const unaligned_uint16_t *)ea;
151 return (ea_words[0] == 0xFFFF && ea_words[1] == 0xFFFF &&
152 ea_words[2] == 0xFFFF);
210 uint8_t *p = (uint8_t *)&rand;
228 #ifdef __INTEL_COMPILER
229 uint16_t *from_words = (uint16_t *)(ea_from->
addr_bytes);
230 uint16_t *to_words = (uint16_t *)(ea_to->
addr_bytes);
232 to_words[0] = from_words[0];
233 to_words[1] = from_words[1];
234 to_words[2] = from_words[2];
243 #define ETHER_ADDR_FMT_SIZE 18
258 snprintf(buf, size,
"%02X:%02X:%02X:%02X:%02X:%02X",
275 } __attribute__((__packed__));
285 } __attribute__((__packed__));
295 } __attribute__((__packed__));
298 #define ETHER_TYPE_IPv4 0x0800
299 #define ETHER_TYPE_IPv6 0x86DD
300 #define ETHER_TYPE_ARP 0x0806
301 #define ETHER_TYPE_RARP 0x8035
302 #define ETHER_TYPE_VLAN 0x8100
303 #define ETHER_TYPE_QINQ 0x88A8
304 #define ETHER_TYPE_ETAG 0x893F
305 #define ETHER_TYPE_1588 0x88F7
306 #define ETHER_TYPE_SLOW 0x8809
307 #define ETHER_TYPE_TEB 0x6558
308 #define ETHER_TYPE_LLDP 0x88CC
310 #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr))
323 } __attribute__((__packed__));
326 #define VXLAN_GPE_TYPE_IPV4 1
327 #define VXLAN_GPE_TYPE_IPV6 2
328 #define VXLAN_GPE_TYPE_ETH 3
329 #define VXLAN_GPE_TYPE_NSH 4
330 #define VXLAN_GPE_TYPE_MPLS 5
331 #define VXLAN_GPE_TYPE_GBP 6
332 #define VXLAN_GPE_TYPE_VBNG 7
334 #define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \
335 sizeof(struct vxlan_gpe_hdr))