summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip6_forward.c6
-rw-r--r--src/vnet/ip/ip6_link.c16
-rw-r--r--src/vnet/ip/ip6_link.h5
-rw-r--r--src/vnet/ip/ip_api.c4
4 files changed, 18 insertions, 13 deletions
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 0325627a1ef..0a455351ad2 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -320,7 +320,7 @@ ip6_add_del_interface_address (vlib_main_t * vm,
{
int rv;
- rv = ip6_set_link_local_address (sw_if_index, address);
+ rv = ip6_link_set_local_address (sw_if_index, address);
if (rv)
{
@@ -342,6 +342,8 @@ ip6_add_del_interface_address (vlib_main_t * vm,
return clib_error_create ("address not found");
}
}
+
+ return (NULL);
}
vec_validate (im->fib_index_by_sw_if_index, sw_if_index);
@@ -479,7 +481,7 @@ ip6_add_del_interface_address (vlib_main_t * vm,
ip6_sw_interface_enable_disable (sw_if_index, !is_del);
if (!is_del)
- ip6_link_enable (sw_if_index);
+ ip6_link_enable (sw_if_index, NULL);
/* intf addr routes are added/deleted on admin up/down */
if (vnet_sw_interface_is_admin_up (vnm, sw_if_index))
diff --git a/src/vnet/ip/ip6_link.c b/src/vnet/ip/ip6_link.c
index 35b718e6dcb..d2142f9aced 100644
--- a/src/vnet/ip/ip6_link.c
+++ b/src/vnet/ip/ip6_link.c
@@ -146,7 +146,7 @@ ip6_link_is_enabled (u32 sw_if_index)
int
-ip6_link_enable (u32 sw_if_index)
+ip6_link_enable (u32 sw_if_index, const ip6_address_t * link_local_addr)
{
ip6_link_t *il;
int rv;
@@ -187,9 +187,11 @@ ip6_link_enable (u32 sw_if_index)
sw = vnet_get_sup_sw_interface (vnm, sw_if_index);
- if (sw->type == VNET_SW_INTERFACE_TYPE_SUB ||
- sw->type == VNET_SW_INTERFACE_TYPE_PIPE ||
- sw->type == VNET_SW_INTERFACE_TYPE_P2P)
+ if (NULL != link_local_addr)
+ ip6_address_copy (&il->il_ll_addr, link_local_addr);
+ else if (sw->type == VNET_SW_INTERFACE_TYPE_SUB ||
+ sw->type == VNET_SW_INTERFACE_TYPE_PIPE ||
+ sw->type == VNET_SW_INTERFACE_TYPE_P2P)
{
il->il_ll_addr.as_u64[0] =
clib_host_to_net_u64 (0xFE80000000000000ULL);
@@ -367,7 +369,7 @@ ip6_src_address_for_packet (u32 sw_if_index,
}
int
-ip6_set_link_local_address (u32 sw_if_index, const ip6_address_t * address)
+ip6_link_set_local_address (u32 sw_if_index, const ip6_address_t * address)
{
ip6_link_delegate_t *ild;
ip6_link_t *il;
@@ -375,7 +377,7 @@ ip6_set_link_local_address (u32 sw_if_index, const ip6_address_t * address)
il = ip6_link_get (sw_if_index);
if (NULL == il)
- return (VNET_API_ERROR_IP6_NOT_ENABLED);
+ return ip6_link_enable (sw_if_index, address);
ip6_ll_prefix_t ilp = {
.ilp_addr = il->il_ll_addr,
@@ -794,7 +796,7 @@ enable_ip6_interface_cmd (vlib_main_t * vm,
if (unformat_user (input, unformat_vnet_sw_interface, vnm, &sw_if_index))
{
- if (ip6_link_enable (sw_if_index))
+ if (ip6_link_enable (sw_if_index, NULL))
error = clib_error_return (0, "Failed\n");
}
else
diff --git a/src/vnet/ip/ip6_link.h b/src/vnet/ip/ip6_link.h
index 01506bb4765..a9dfa5edcb0 100644
--- a/src/vnet/ip/ip6_link.h
+++ b/src/vnet/ip/ip6_link.h
@@ -19,13 +19,14 @@
* IPv6 Configuration on an interface
*/
-extern int ip6_link_enable (u32 sw_if_index);
+extern int ip6_link_enable (u32 sw_if_index,
+ const ip6_address_t * link_local_addr);
extern bool ip6_link_is_enabled (u32 sw_if_index);
extern int ip6_link_disable (u32 sw_if_index);
extern const ip6_address_t *ip6_get_link_local_address (u32 sw_if_index);
-extern int ip6_set_link_local_address (u32 sw_if_index,
+extern int ip6_link_set_local_address (u32 sw_if_index,
const ip6_address_t * address);
extern adj_index_t ip6_link_get_mcast_adj (u32 sw_if_index);
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 5c0784f9cb3..3bc46fee59b 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -111,7 +111,7 @@ static void
VALIDATE_SW_IF_INDEX (mp);
rv = ((mp->enable == 1) ?
- ip6_link_enable (ntohl (mp->sw_if_index)) :
+ ip6_link_enable (ntohl (mp->sw_if_index), NULL) :
ip6_link_disable (ntohl (mp->sw_if_index)));
BAD_SW_IF_INDEX_LABEL;
@@ -1262,7 +1262,7 @@ static void
ip6_address_decode (mp->ip, &ip);
- rv = ip6_set_link_local_address (ntohl (mp->sw_if_index), &ip);
+ rv = ip6_link_set_local_address (ntohl (mp->sw_if_index), &ip);
BAD_SW_IF_INDEX_LABEL;
REPLY_MACRO (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY);