aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-01-13 07:57:46 -0800
committerNeale Ranns <nranns@cisco.com>2017-01-26 05:14:35 -0800
commitfca0c242e4edfdb05231ef18d60c14273067ff0a (patch)
tree440c9952bd79e9c58699eb787a619803c5fa49fa /src
parentdc90d423a547f3f948953e427b681f2834c8a9d6 (diff)
DHCPv[46] proxy tests
Change-Id: I6aaf9c602cd515ed9d4416d286f9191d048c1a87 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/dhcp/proxy_node.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/vnet/dhcp/proxy_node.c b/src/vnet/dhcp/proxy_node.c
index d0d99d7e03b..6a58fcdb185 100644
--- a/src/vnet/dhcp/proxy_node.c
+++ b/src/vnet/dhcp/proxy_node.c
@@ -703,6 +703,12 @@ int dhcp_proxy_set_server_2 (ip4_address_t *addr, ip4_address_t *src_address,
dhcp_server_t * server = 0;
u32 server_index = 0;
u32 rx_fib_index = 0;
+ const fib_prefix_t all_1s =
+ {
+ .fp_len = 32,
+ .fp_addr.ip4.as_u32 = 0xffffffff,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ };
if (addr->as_u32 == 0)
return VNET_API_ERROR_INVALID_DST_ADDRESS;
@@ -720,8 +726,18 @@ int dhcp_proxy_set_server_2 (ip4_address_t *addr, ip4_address_t *src_address,
if (is_del)
{
memset (server, 0, sizeof (*server));
- return 0;
+ fib_table_entry_special_remove(rx_fib_index,
+ &all_1s,
+ FIB_SOURCE_DHCP);
+ return 0;
}
+ if (!server->valid)
+ fib_table_entry_special_add(rx_fib_index,
+ &all_1s,
+ FIB_SOURCE_DHCP,
+ FIB_ENTRY_FLAG_LOCAL,
+ ADJ_INDEX_INVALID);
+
goto initialize_it;
}
@@ -738,6 +754,11 @@ int dhcp_proxy_set_server_2 (ip4_address_t *addr, ip4_address_t *src_address,
server = pool_elt_at_index (dpm->dhcp_servers, server_index);
memset (server, 0, sizeof (*server));
pool_put (dpm->dhcp_servers, server);
+
+ fib_table_entry_special_remove(rx_fib_index,
+ &all_1s,
+ FIB_SOURCE_DHCP);
+
return 0;
}
@@ -752,9 +773,16 @@ int dhcp_proxy_set_server_2 (ip4_address_t *addr, ip4_address_t *src_address,
}
pool_get (dpm->dhcp_servers, server);
+
+ fib_table_entry_special_add(rx_fib_index,
+ &all_1s,
+ FIB_SOURCE_DHCP,
+ FIB_ENTRY_FLAG_LOCAL,
+ ADJ_INDEX_INVALID);
initialize_it:
+
server->dhcp_server.as_u32 = addr->as_u32;
server->server_fib_index =
fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4,