return s;
}
-/* get first interface address */
-static ip4_address_t *
-ip4_interface_first_address (ip4_main_t * im, u32 sw_if_index)
-{
- ip_lookup_main_t * lm = &im->lookup_main;
- ip_interface_address_t * ia = 0;
- ip4_address_t * result = 0;
-
- foreach_ip_interface_address (lm, ia, sw_if_index,
- 1 /* honor unnumbered */,
- ({
- ip4_address_t * a = ip_interface_address_get_address (lm, ia);
- result = a;
- break;
- }));
- return result;
-}
-
static uword
dhcp_proxy_to_server_input (vlib_main_t * vm,
vlib_node_runtime_t * node,
* RX interface, if not unnumbered. otherwise use
* the loopback interface's ip address.
*/
- ia0 = ip4_interface_first_address(&ip4_main, sw_if_index);
+ ia0 = ip4_interface_first_address(&ip4_main, sw_if_index, 0);
if (ia0 == 0)
{
if (swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED)
sw_if_index = swif->unnumbered_sw_if_index;
- ia0 = ip4_interface_first_address (&ip4_main, sw_if_index);
+ ia0 = ip4_interface_first_address (&ip4_main, sw_if_index, 0);
if (ia0 == 0)
{
error0 = DHCP_PROXY_ERROR_NO_INTERFACE_ADDRESS;
swif = vnet_get_sw_interface (vnm, sw_if_index0);
sw_if_index = (swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) ?
swif->unnumbered_sw_if_index : sw_if_index0;
- ia0 = ip4_interface_first_address(&ip4_main, sw_if_index);
+ ia0 = ip4_interface_first_address(&ip4_main, sw_if_index, 0);
if (ia0)
{
vlib_cli_output (vm, "%=20s%=20s", "interface",
u32 sw_if_index,
u32 if_address_index);
+ip4_address_t *
+ip4_interface_first_address (ip4_main_t * im, u32 sw_if_index,
+ ip_interface_address_t ** result_ia);
+
/* Send an ARP request to see if given destination is reachable on given interface. */
clib_error_t *
ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index);
ip4_lookup_init (vlib_main_t * vm)
{
ip4_main_t * im = &ip4_main;
+ clib_error_t * error;
uword i;
for (i = 0; i < ARRAY_LEN (im->fib_masks); i++)
"ip4 arp");
}
- ip4_feature_init (vm, im);
+ error = ip4_feature_init (vm, im);
- return 0;
+ return error;
}
VLIB_INIT_FUNCTION (ip4_lookup_init);
ip6_lookup_init (vlib_main_t * vm)
{
ip6_main_t * im = &ip6_main;
+ clib_error_t * error;
uword i;
for (i = 0; i < ARRAY_LEN (im->fib_masks); i++)
"ip6 neighbor discovery");
}
- ip6_feature_init (vm, im);
+ error = ip6_feature_init (vm, im);
- return 0;
+ return error;
}
VLIB_INIT_FUNCTION (ip6_lookup_init);
return clib_error_return (0, "comma_split failed!");
p = hash_get_mem (index_by_name, a_name);
+ /*
+ * Note: the next two errors mean that the xxx_FEATURE_INIT macros are
+ * b0rked. As in: if you code "A depends on B," and you forget
+ * to define a FEATURE_INIT macro for B, you lose.
+ * Nonexistent graph nodes are tolerated.
+ */
if (p == 0)
return clib_error_return (0, "feature node '%s' not found", a_name);
a_index = p[0];