aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip6_neighbor.c23
-rw-r--r--src/vnet/ip/ip6_neighbor.h2
2 files changed, 25 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
diff --git a/src/vnet/ip/ip6_neighbor.h b/src/vnet/ip/ip6_neighbor.h
index 27d8cb27eae..b346563c83b 100644
--- a/src/vnet/ip/ip6_neighbor.h
+++ b/src/vnet/ip/ip6_neighbor.h
@@ -44,6 +44,8 @@ typedef struct
fib_node_index_t fib_entry_index;
} ip6_neighbor_t;
+extern ip6_address_t ip6_neighbor_get_link_local_address (u32 sw_if_index);
+
extern ip6_neighbor_t *ip6_neighbors_pool (void);
extern ip6_neighbor_t *ip6_neighbors_entries (u32 sw_if_index);