From ce4bf6adc43d7d81b45362cceef8a571ed3f1247 Mon Sep 17 00:00:00 2001 From: mbuhl Date: Tue, 31 May 2022 19:01:46 +0000 Subject: [PATCH] The pflow regression test could fail due to a race where the close(2) call of the receiver was called before the FIN on the sender was processed. OK bluhm@ OK anton@ --- regress/sys/net/pflow/flow.10_4 | 16 ++++++++-------- regress/sys/net/pflow/flow.10_6 | 16 ++++++++-------- regress/sys/net/pflow/gen_traffic.c | 10 ++-------- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/regress/sys/net/pflow/flow.10_4 b/regress/sys/net/pflow/flow.10_4 index a29d1fec759..d2b15be07cb 100644 --- a/regress/sys/net/pflow/flow.10_4 +++ b/regress/sys/net/pflow/flow.10_4 @@ -3,8 +3,8 @@ SetId: 256 sourceIPv4Address: 0a0b0c0d destinationIPv4Address: 0a0b0c0d -packetDeltaCount: 000000000000000f -octetDeltaCount: 000000000000a318 +packetDeltaCount: 000000000000000e +octetDeltaCount: 000000000000a2e4 sourceTransportPort: 3039 destinationTransportPort: 303a ipClassOfService: 00 @@ -14,8 +14,8 @@ ingressInterface == egressInterface && egressInterface > 0: 1 SetId: 256 sourceIPv4Address: 0a0b0c0d destinationIPv4Address: 0a0b0c0d -packetDeltaCount: 000000000000000e -octetDeltaCount: 00000000000002e4 +packetDeltaCount: 000000000000000d +octetDeltaCount: 00000000000002b0 sourceTransportPort: 303a destinationTransportPort: 3039 ipClassOfService: 00 @@ -25,8 +25,8 @@ ingressInterface == egressInterface && egressInterface > 0: 1 SetId: 256 sourceIPv4Address: 0a0b0c0d destinationIPv4Address: 0a0b0c0d -packetDeltaCount: 000000000000000f -octetDeltaCount: 000000000000a318 +packetDeltaCount: 000000000000000e +octetDeltaCount: 000000000000a2e4 sourceTransportPort: 3039 destinationTransportPort: 303a ipClassOfService: 00 @@ -36,8 +36,8 @@ ingressInterface == egressInterface && egressInterface > 0: 1 SetId: 256 sourceIPv4Address: 0a0b0c0d destinationIPv4Address: 0a0b0c0d -packetDeltaCount: 000000000000000e -octetDeltaCount: 00000000000002e4 +packetDeltaCount: 000000000000000d +octetDeltaCount: 00000000000002b0 sourceTransportPort: 303a destinationTransportPort: 3039 ipClassOfService: 00 diff --git a/regress/sys/net/pflow/flow.10_6 b/regress/sys/net/pflow/flow.10_6 index f90610c9239..c1e075cbb5d 100644 --- a/regress/sys/net/pflow/flow.10_6 +++ b/regress/sys/net/pflow/flow.10_6 @@ -3,8 +3,8 @@ SetId: 257 sourceIPv6Address: 20010db8000000000000000000000013 destinationIPv6Address: 20010db8000000000000000000000013 -packetDeltaCount: 000000000000000f -octetDeltaCount: 000000000000a444 +packetDeltaCount: 000000000000000e +octetDeltaCount: 000000000000a3fc sourceTransportPort: 3039 destinationTransportPort: 303a ipClassOfService: 00 @@ -14,8 +14,8 @@ ingressInterface == egressInterface && egressInterface > 0: 1 SetId: 257 sourceIPv6Address: 20010db8000000000000000000000013 destinationIPv6Address: 20010db8000000000000000000000013 -packetDeltaCount: 000000000000000e -octetDeltaCount: 00000000000003fc +packetDeltaCount: 000000000000000d +octetDeltaCount: 00000000000003b4 sourceTransportPort: 303a destinationTransportPort: 3039 ipClassOfService: 00 @@ -25,8 +25,8 @@ ingressInterface == egressInterface && egressInterface > 0: 1 SetId: 257 sourceIPv6Address: 20010db8000000000000000000000013 destinationIPv6Address: 20010db8000000000000000000000013 -packetDeltaCount: 000000000000000f -octetDeltaCount: 000000000000a444 +packetDeltaCount: 000000000000000e +octetDeltaCount: 000000000000a3fc sourceTransportPort: 3039 destinationTransportPort: 303a ipClassOfService: 00 @@ -36,8 +36,8 @@ ingressInterface == egressInterface && egressInterface > 0: 1 SetId: 257 sourceIPv6Address: 20010db8000000000000000000000013 destinationIPv6Address: 20010db8000000000000000000000013 -packetDeltaCount: 000000000000000e -octetDeltaCount: 00000000000003fc +packetDeltaCount: 000000000000000d +octetDeltaCount: 00000000000003b4 sourceTransportPort: 303a destinationTransportPort: 3039 ipClassOfService: 00 diff --git a/regress/sys/net/pflow/gen_traffic.c b/regress/sys/net/pflow/gen_traffic.c index 51c259cd77f..373138c4a89 100644 --- a/regress/sys/net/pflow/gen_traffic.c +++ b/regress/sys/net/pflow/gen_traffic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gen_traffic.c,v 1.2 2016/10/26 14:06:33 bluhm Exp $ */ +/* $OpenBSD: gen_traffic.c,v 1.3 2022/05/31 19:01:46 mbuhl Exp $ */ /* * Copyright (c) 2013 Florian Obser * @@ -219,18 +219,12 @@ gen_traffic_request(int fd, short events, void *arg) break; case 0: - event_del(&r->ev); - close(fd); - break; + exit(0); default: total += n; /* warnx("read: %lld - %lld", n, total); */ break; } - if (total == 10 * 4096) { - /* warnx("done %lld", total); */ - exit(0); - } } void -- 2.20.1