aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip6_neighbor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip/ip6_neighbor.c')
-rw-r--r--src/vnet/ip/ip6_neighbor.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 3daea6bafbe..a76decf3431 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -236,6 +236,29 @@ static ip6_address_t ip6a_zero; /* ip6 address 0 */
static void wc_nd_signal_report (wc_nd_report_t * r);
static void ra_signal_report (ra_report_t * r);
+ip6_address_t
+ip6_neighbor_get_link_local_address (u32 sw_if_index)
+{
+ static ip6_address_t empty_address = { {0} };
+ ip6_neighbor_main_t *nm = &ip6_neighbor_main;
+ ip6_radv_t *radv_info;
+ u32 ri;
+
+ ri = nm->if_radv_pool_index_by_sw_if_index[sw_if_index];
+ if (ri == ~0)
+ {
+ clib_warning ("IPv6 is not enabled for sw_if_index %d", sw_if_index);
+ return empty_address;
+ }
+ radv_info = pool_elt_at_index (nm->if_radv_pool, ri);
+ if (radv_info == NULL)
+ {
+ clib_warning ("Internal error");
+ return empty_address;
+ }
+ return radv_info->link_local_address;
+}
+
/**
* @brief publish wildcard arp event
* @param sw_if_index The interface on which the ARP entires are acted