aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-03-31 02:15:17 +0300
committereyal bari <ebari@cisco.com>2017-03-31 14:43:01 +0000
commit8db1de83ec540e01bb0577b726770bbb2338edcb (patch)
tree3359ac53033b7a1de5089088ad61628823905afa /src/vpp
parent0f60ff8af3dd72bb1fa8f13886a80d110d78c7b0 (diff)
ARP/API:protect against identical registrations
Change-Id: Ia3acf87d3e07a7d41c047869de504e1972334b55 Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vpp')
-rw-r--r--src/vpp/api/api.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index f169d7fc..14ccd864 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -1574,6 +1574,14 @@ vl_api_want_ip4_arp_events_t_handler (vl_api_want_ip4_arp_events_t * mp)
if (mp->enable_disable)
{
+ rv = vnet_add_del_ip4_arp_change_event
+ (vnm, arp_change_data_callback,
+ mp->pid, &mp->address /* addr, in net byte order */ ,
+ vpe_resolver_process_node.index,
+ IP4_ARP_EVENT, event - am->arp_events, 1 /* is_add */ );
+
+ if (rv)
+ goto out;
pool_get (am->arp_events, event);
memset (event, 0, sizeof (*event));
@@ -1584,12 +1592,6 @@ vl_api_want_ip4_arp_events_t_handler (vl_api_want_ip4_arp_events_t * mp)
event->pid = mp->pid;
if (mp->address == 0)
event->mac_ip = 1;
-
- rv = vnet_add_del_ip4_arp_change_event
- (vnm, arp_change_data_callback,
- mp->pid, &mp->address /* addr, in net byte order */ ,
- vpe_resolver_process_node.index,
- IP4_ARP_EVENT, event - am->arp_events, 1 /* is_add */ );
}
else
{
@@ -1599,6 +1601,7 @@ vl_api_want_ip4_arp_events_t_handler (vl_api_want_ip4_arp_events_t * mp)
vpe_resolver_process_node.index,
IP4_ARP_EVENT, ~0 /* pool index */ , 0 /* is_add */ );
}
+out:
REPLY_MACRO (VL_API_WANT_IP4_ARP_EVENTS_REPLY);
}