2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
19 #include <vnet/ethernet/ethernet.h>
20 #include <vnet/ethernet/arp_packet.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/ip/ip_neighbor.h>
27 ip4_address_t ip4_address;
31 ip_neighbor_flags_t flags;
33 f64 time_last_updated;
36 * The index of the adj-fib entry created
38 fib_node_index_t fib_entry_index;
39 } ethernet_arp_ip4_entry_t;
41 extern u8 *format_ethernet_arp_ip4_entry (u8 * s, va_list * va);
43 ethernet_arp_ip4_entry_t *ip4_neighbors_pool (void);
44 ethernet_arp_ip4_entry_t *ip4_neighbor_entries (u32 sw_if_index);
46 extern int vnet_proxy_arp_add_del (ip4_address_t * lo_addr,
47 ip4_address_t * hi_addr,
48 u32 fib_index, int is_del);
50 extern int vnet_arp_set_ip4_over_ethernet (vnet_main_t * vnm,
53 ethernet_arp_ip4_over_ethernet_address_t
54 * a, ip_neighbor_flags_t flags);
56 extern int vnet_arp_unset_ip4_over_ethernet (vnet_main_t * vnm,
59 ethernet_arp_ip4_over_ethernet_address_t
62 extern int vnet_proxy_arp_fib_reset (u32 fib_id);
64 void vnet_register_ip4_arp_resolution_event (vnet_main_t * vnm,
67 uword type_opaque, uword data);
69 typedef int (*arp_change_event_cb_t) (u32 pool_index,
70 const mac_address_t * mac,
72 const ip4_address_t * address);
74 int vnet_add_del_ip4_arp_change_event (vnet_main_t * vnm,
75 arp_change_event_cb_t data_callback,
80 uword data, int is_add);
82 void wc_arp_set_publisher_node (uword inode_index, uword event_type);
84 void ethernet_arp_change_mac (u32 sw_if_index);
85 void ethernet_ndp_change_mac (u32 sw_if_index);
87 void arp_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai);
97 * call back function when walking the DB of proxy ARPs
98 * @return 0 to stop the walk !0 to continue
100 typedef walk_rc_t (proxy_arp_walk_t) (const ip4_address_t * lo_addr,
101 const ip4_address_t * hi_addr,
102 u32 fib_index, void *dat);
104 extern void proxy_arp_walk (proxy_arp_walk_t cb, void *data);
109 * fd.io coding-style-patch-verification: ON
112 * eval: (c-set-style "gnu")