X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fethernet%2Farp_packet.h;h=6b4dfa6ab3d28bd8b13f8a82929dad5d82f6a488;hb=bdfe5955f;hp=d2a23a5949fb5d7c9969e7471ec3733d60adc5fb;hpb=7f358b30b04aabe9a35680997cc1eeefb080a869;p=vpp.git diff --git a/src/vnet/ethernet/arp_packet.h b/src/vnet/ethernet/arp_packet.h index d2a23a5949f..6b4dfa6ab3d 100644 --- a/src/vnet/ethernet/arp_packet.h +++ b/src/vnet/ethernet/arp_packet.h @@ -18,6 +18,9 @@ #ifndef included_ethernet_arp_packet_h #define included_ethernet_arp_packet_h +#include +#include + #define foreach_ethernet_arp_hardware_type \ _ (0, reserved) \ _ (1, ethernet) \ @@ -109,21 +112,24 @@ typedef enum typedef enum { - IP4_ARP_ERROR_DROP, + IP4_ARP_ERROR_THROTTLED, + IP4_ARP_ERROR_RESOLVED, + IP4_ARP_ERROR_NO_BUFFERS, IP4_ARP_ERROR_REQUEST_SENT, IP4_ARP_ERROR_NON_ARP_ADJ, - IP4_ARP_ERROR_REPLICATE_DROP, - IP4_ARP_ERROR_REPLICATE_FAIL, IP4_ARP_ERROR_NO_SOURCE_ADDRESS, } ip4_arp_error_t; /* *INDENT-OFF* */ typedef CLIB_PACKED (struct { - u8 ethernet[6]; + mac_address_t mac; ip4_address_t ip4; }) ethernet_arp_ip4_over_ethernet_address_t; /* *INDENT-ON* */ +STATIC_ASSERT (sizeof (ethernet_arp_ip4_over_ethernet_address_t) == 10, + "Packet ethernet address and IP4 address too big"); + typedef struct { u16 l2_type; @@ -140,38 +146,12 @@ typedef struct }; } ethernet_arp_header_t; -typedef enum ethernet_arp_entry_flags_t_ -{ - ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC = (1 << 0), - ETHERNET_ARP_IP4_ENTRY_FLAG_DYNAMIC = (1 << 1), - ETHERNET_ARP_IP4_ENTRY_FLAG_NO_FIB_ENTRY = (1 << 2), -} __attribute__ ((packed)) ethernet_arp_entry_flags_t; - -typedef struct -{ - u32 sw_if_index; - ip4_address_t ip4_address; - - u8 ethernet_address[6]; - - ethernet_arp_entry_flags_t flags; - - f64 time_last_updated; - - /** - * The index of the adj-fib entry created - */ - fib_node_index_t fib_entry_index; -} ethernet_arp_ip4_entry_t; - -ethernet_arp_ip4_entry_t *ip4_neighbors_pool (void); -ethernet_arp_ip4_entry_t *ip4_neighbor_entries (u32 sw_if_index); -u8 *format_ethernet_arp_ip4_entry (u8 * s, va_list * va); +#define ARP_SENDER 0 +#define ARP_TARGET 1 -void send_ip4_garp (vlib_main_t * vm, const vnet_hw_interface_t * hi); -void send_ip4_garp_w_addr (vlib_main_t * vm, - const ip4_address_t * ip4_addr, - const vnet_hw_interface_t * hi); +extern u8 *format_ethernet_arp_header (u8 * s, va_list * va); +extern u8 *format_ethernet_arp_opcode (u8 * s, va_list * va); +extern u8 *format_ethernet_arp_hardware_type (u8 * s, va_list * va); #endif /* included_ethernet_arp_packet_h */