aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/vrrp/vrrp_packet.h
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2022-02-08 21:34:05 +0000
committerMatthew Smith <mgsmith@netgate.com>2022-02-22 13:28:53 -0600
commita7d7383a44335358a40d7c2b322999958a717a60 (patch)
treedba3014e24974a2b75862326980b37fe6bd440b2 /src/plugins/vrrp/vrrp_packet.h
parentd9d77076b01347dfc1dd98cee80a298729ce9b85 (diff)
vrrp: fix thread synchronization issue
Type: fix Fixes: 39e9428b90bc When a VRRP advertisement is received by a worker thread, the worker calls vl_api_rpc_call_main_thread() so the main thread will process the packet and make adjustments to VR state if necessary. The data being passed to the main thread included a pointer to the VRRP header in the received packet buffer. Since the main thread processes the RPC request asynchronously from the worker thread, it's possible for the worker to drop the packet and for the buffer to be overwritten before the main thread can process it. Copy the fields which may be needed by the main thread into a struct instead of passing a pointer to a packet buffer. Change-Id: I4e899e967df5a54776b521825a80e9cce1a94f5f Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/plugins/vrrp/vrrp_packet.h')
-rw-r--r--src/plugins/vrrp/vrrp_packet.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/vrrp/vrrp_packet.h b/src/plugins/vrrp/vrrp_packet.h
index 1cbf62d7c72..d5725b6a1a5 100644
--- a/src/plugins/vrrp/vrrp_packet.h
+++ b/src/plugins/vrrp/vrrp_packet.h
@@ -47,6 +47,15 @@ vrrp_adv_int_from_packet (vrrp_header_t * pkt)
return clib_net_to_host_u16 (pkt->rsvd_and_max_adv_int) & ((u16) 0x0fff);
}
+/* Fields from VRRP advertisement packets needed by main thread */
+typedef struct vrrp_input_process_args
+{
+ u32 vr_index;
+ ip46_address_t src_addr;
+ u8 priority;
+ u8 max_adv_int;
+} vrrp_input_process_args_t;
+
#endif /* __included_vrrp_packet_h__ */
/*