aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/dhcp/client.c
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-05-16 04:12:18 -0700
committerNeale Ranns <nranns@cisco.com>2018-06-07 03:11:10 -0400
commitdaff1784037376f4a5caec2f5975f9b5fc23d5a4 (patch)
tree186701f7fcd64d691de5b5d11b477a5d8b7840a2 /src/vnet/dhcp/client.c
parent0e969ac8431c80ff4bca5f6985876b1c584eefcd (diff)
DHCP Client Dump
- use types on the DHCP API so that the same data is sent in comfing messages and in dumps - add the DHCP client dump API - update VOM to refelct API changes - rename VOM class dhcp_config* dhcp_client* - the VOM dhcp_client class maintains the lease data (which it reads on a dump) for clients to read Change-Id: I2a43463937cbd80c01d45798e74b21288d8b8ead Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vnet/dhcp/client.c')
-rw-r--r--src/vnet/dhcp/client.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/vnet/dhcp/client.c b/src/vnet/dhcp/client.c
index 11e47f9ad7a..98f212334f6 100644
--- a/src/vnet/dhcp/client.c
+++ b/src/vnet/dhcp/client.c
@@ -100,7 +100,6 @@ static void
dhcp_client_addr_callback (dhcp_client_t * c)
{
dhcp_client_main_t *dcm = &dhcp_client_main;
- void (*fp) (u32, u32, u8 *, u8, u8, u8 *, u8 *, u8 *) = c->event_callback;
/* disable the feature */
vnet_feature_enable_disable ("ip4-unicast",
@@ -147,12 +146,8 @@ dhcp_client_addr_callback (dhcp_client_t * c)
/*
* Call the user's event callback to report DHCP information
*/
- if (fp)
- (*fp) (c->client_index, /* clinet index */
- c->pid, c->hostname, c->subnet_mask_width, 0, /* is_ipv6 */
- (u8 *) & c->leased_address, /* host IP address */
- (u8 *) & c->router_address, /* router IP address */
- (u8 *) (c->l2_rewrite + 6)); /* host MAC address */
+ if (c->event_callback)
+ c->event_callback (c->client_index, c);
}
/*
@@ -977,13 +972,14 @@ dhcp_client_add_del (dhcp_client_add_del_args_t * a)
}
int
-dhcp_client_config (vlib_main_t * vm,
+dhcp_client_config (u32 is_add,
+ u32 client_index,
+ vlib_main_t * vm,
u32 sw_if_index,
u8 * hostname,
u8 * client_id,
- u32 is_add,
- u32 client_index,
- void *event_callback, u8 set_broadcast_flag, u32 pid)
+ dhcp_event_cb_t event_callback,
+ u8 set_broadcast_flag, u32 pid)
{
dhcp_client_add_del_args_t _a, *a = &_a;
int rv;
@@ -1061,6 +1057,22 @@ dhcp_client_config (vlib_main_t * vm,
return rv;
}
+void
+dhcp_client_walk (dhcp_client_walk_cb_t cb, void *ctx)
+{
+ dhcp_client_main_t *dcm = &dhcp_client_main;
+ dhcp_client_t *c;
+
+ /* *INDENT-OFF* */
+ pool_foreach (c, dcm->clients,
+ ({
+ if (!cb(c, ctx))
+ break;
+ }));
+ /* *INDENT-ON* */
+
+}
+
static clib_error_t *
dhcp_client_set_command_fn (vlib_main_t * vm,
unformat_input_t * input,