From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Sep 12 06:40:00 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB84F106566C for ; Fri, 12 Sep 2008 06:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AEB528FC19 for ; Fri, 12 Sep 2008 06:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m8C6e0YY005746 for ; Fri, 12 Sep 2008 06:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m8C6e0Td005745; Fri, 12 Sep 2008 06:40:00 GMT (envelope-from gnats) Resent-Date: Fri, 12 Sep 2008 06:40:00 GMT Resent-Message-Id: <200809120640.m8C6e0Td005745@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Duane Wessels Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B77EB1065678 for ; Fri, 12 Sep 2008 06:36:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 9E4C68FC1C for ; Fri, 12 Sep 2008 06:36:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m8C6ap6W008433 for ; Fri, 12 Sep 2008 06:36:51 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m8C6apxT008432; Fri, 12 Sep 2008 06:36:51 GMT (envelope-from nobody) Message-Id: <200809120636.m8C6apxT008432@www.freebsd.org> Date: Fri, 12 Sep 2008 06:36:51 GMT From: Duane Wessels To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/127313: [patch] security/knockd: use less CPU X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2008 06:40:01 -0000 >Number: 127313 >Category: ports >Synopsis: [patch] security/knockd: use less CPU >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Sep 12 06:40:00 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Duane Wessels >Release: 6.3-STABLE >Organization: >Environment: FreeBSD ipsec.life-gone-hazy.com 6.3-STABLE FreeBSD 6.3-STABLE #1: Sun Aug 17 23:23:58 PDT 2008 root@life-gone-hazy.com:/usr/obj/usr/src/sys/SOEKRIS i386 >Description: knockd uses too much CPU, especially on systems with slower or low-power CPUS (such as the Soekris net4501). The timeout argument to pcap_open_live (1 ms) seems unreasonably small. On a soekris box it uses 15% of CPU. Setting the timeout to 1 second reduces it to "0.00%". >How-To-Repeat: Install and configure on a system with ~133 MHz CPU. Check process CPU usage with 'top'. >Fix: Patch attached with submission follows: --- src/knockd.c.orig 2008-09-11 23:24:37.000000000 -0700 +++ src/knockd.c 2008-09-11 23:24:49.000000000 -0700 @@ -200,7 +200,7 @@ } #if defined(__FreeBSD__) || defined(__APPLE__) - cap = pcap_open_live(o_int, 65535, 0, 1, pcapErr); + cap = pcap_open_live(o_int, 65535, 0, 1000, pcapErr); #else cap = pcap_open_live(o_int, 65535, 0, 0, pcapErr); #endif >Release-Note: >Audit-Trail: >Unformatted: