aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorJuraj Sloboda <jsloboda@cisco.com>2018-05-25 14:02:20 +0200
committerOle Trøan <otroan@employees.org>2018-06-08 20:39:05 +0000
commit81119e86bdf47f41f06218f91e52024bc4d00e7c (patch)
tree8aaca952221133e7ffad441c3018c27d549d8e29 /src/vnet/ip
parent898cd8f83d56ece9df9f02d54170a96f7cf6d500 (diff)
Implement DHCPv6 PD client (VPP-718, VPP-1050)
Change-Id: I72a1ccdfdd5573335ef78fc01d5268934c73bd31 Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
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);