From f7ef33bc4b6115645c6c322c8a281307b7a37d3a Mon Sep 17 00:00:00 2001 From: jca Date: Mon, 4 Mar 2019 13:25:56 +0000 Subject: [PATCH] Calling gettimeofday on a struct bpf_timeval is harmful --- emulators/dynamips/Makefile | 4 ++-- .../dynamips/patches/patch-net_io_filter_c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 emulators/dynamips/patches/patch-net_io_filter_c diff --git a/emulators/dynamips/Makefile b/emulators/dynamips/Makefile index ad46348698a..3d42adc2544 100644 --- a/emulators/dynamips/Makefile +++ b/emulators/dynamips/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2019/03/04 13:01:53 jca Exp $ +# $OpenBSD: Makefile,v 1.16 2019/03/04 13:25:56 jca Exp $ COMMENT= cisco 3600/7200 platform emulator @@ -6,7 +6,7 @@ USE_WXNEEDED= Yes DISTNAME= dynamips-0.2.8-RC2 PKGNAME= ${DISTNAME:S/-RC/rc/} -REVISION= 8 +REVISION= 9 CATEGORIES= emulators HOMEPAGE= http://www.gns3.net/dynamips/ diff --git a/emulators/dynamips/patches/patch-net_io_filter_c b/emulators/dynamips/patches/patch-net_io_filter_c new file mode 100644 index 00000000000..fccd39ca397 --- /dev/null +++ b/emulators/dynamips/patches/patch-net_io_filter_c @@ -0,0 +1,19 @@ +$OpenBSD: patch-net_io_filter_c,v 1.1 2019/03/04 13:25:56 jca Exp $ + +Index: net_io_filter.c +--- net_io_filter.c.orig ++++ net_io_filter.c +@@ -211,9 +211,12 @@ static int pf_capture_pkt_handler(netio_desc_t *nio,vo + { + struct netio_filter_capture *c = opt; + struct pcap_pkthdr pkt_hdr; ++ struct timeval tv; + + if (c != NULL) { +- gettimeofday(&pkt_hdr.ts,0); ++ gettimeofday(&tv,0); ++ pkt_hdr.ts.tv_sec = tv.tv_sec; ++ pkt_hdr.ts.tv_usec = tv.tv_usec; + pkt_hdr.caplen = len; + pkt_hdr.len = len; +