mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
ipfix: Fix SIGFPE in bridge exporter sampling.
A divide-by-zero exception like the below could occur when IPFIX configuration is cleared while handling sampled packets from the datapath. While it's not valid to configure the sampling probability of IPFIX to zero via explicitly setting it in OVSDB, it is possible to clear the configuration, which results in a probability of zero. In this case, there is a window during which it is possible for upcalls to find the cleared IPFIX object and attempt to perform sampling using it. Fix the issue by ensuring that the probability is nonzero before using it. "Program terminated with signal SIGFPE, Arithmetic exception." dpif_ipfix_bridge_sample (...) at ../ofproto/ofproto-dpif-ipfix.c:1701 process_upcall (...) at ../ofproto/ofproto-dpif-upcall.c:1145 recv_upcalls (...) at ../ofproto/ofproto-dpif-upcall.c:705 udpif_upcall_handler (...) at ../ofproto/ofproto-dpif-upcall.c:631 ovsthread_wrapper (...) at ../lib/ovs-thread.c:340 start_thread (...) at pthread_create.c:312 clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Romain Lenglet <romain.lenglet@oracle.com>
This commit is contained in:
@@ -1692,6 +1692,10 @@ dpif_ipfix_bridge_sample(struct dpif_ipfix *di, const struct dp_packet *packet,
|
||||
struct dpif_ipfix_port * tunnel_port = NULL;
|
||||
|
||||
ovs_mutex_lock(&mutex);
|
||||
if (!bridge_exporter_enabled(di)) {
|
||||
ovs_mutex_unlock(&mutex);
|
||||
return;
|
||||
}
|
||||
/* Use the sampling probability as an approximation of the number
|
||||
* of matched packets. */
|
||||
packet_delta_count = UINT32_MAX / di->bridge_exporter.probability;
|
||||
|
Reference in New Issue
Block a user