From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Aug 23 16:20:00 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 951DE510 for ; Fri, 23 Aug 2013 16:20:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7556A2194 for ; Fri, 23 Aug 2013 16:20:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NGK0Hn095519 for ; Fri, 23 Aug 2013 16:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r7NGK0aO095518; Fri, 23 Aug 2013 16:20:00 GMT (envelope-from gnats) Resent-Date: Fri, 23 Aug 2013 16:20:00 GMT Resent-Message-Id: <201308231620.r7NGK0aO095518@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, John Baldwin Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BEAFC38B for ; Fri, 23 Aug 2013 16:12:27 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AC58A214A for ; Fri, 23 Aug 2013 16:12:27 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7NGCRsA086821 for ; Fri, 23 Aug 2013 16:12:27 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7NGCR18086820; Fri, 23 Aug 2013 16:12:27 GMT (envelope-from nobody) Message-Id: <201308231612.r7NGCR18086820@oldred.freebsd.org> Date: Fri, 23 Aug 2013 16:12:27 GMT From: John Baldwin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/181488: [PATCH] Change security/prelude-pflogger to use getprotobynumber(3) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2013 16:20:00 -0000 >Number: 181488 >Category: ports >Synopsis: [PATCH] Change security/prelude-pflogger to use getprotobynumber(3) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Aug 23 16:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: John Baldwin >Release: HEAD >Organization: FreeBSD Project >Environment: >Description: I'm attempting to remove the obsolete sysctl description name macros from the tree, but this port uses CTL_IPPROTO_NAMES as a hack to map IP protocol numbers to names. A more portable solution is to use getprotobynumber(3) which queries /etc/protocols (and is POSIX). >How-To-Repeat: >Fix: The attached patch should change the port to use getprotobynumber(3). It compiles, but I have no way to verify it works at runtime. Patch attached with submission follows: Index: files/patch-process_packet.c =================================================================== --- files/patch-process_packet.c (revision 320950) +++ files/patch-process_packet.c (working copy) @@ -1,5 +1,5 @@ ---- src/process_packet.c.orig 2012-04-11 12:08:57.000000000 -0500 -+++ src/process_packet.c 2012-04-11 12:05:26.000000000 -0500 +--- src/process_packet.c.orig 2005-09-18 10:29:54.000000000 -0400 ++++ src/process_packet.c 2013-08-16 14:36:28.000000000 -0400 @@ -43,10 +43,10 @@ #include #include @@ -12,3 +12,20 @@ #include #include +@@ -494,12 +494,12 @@ + char *dir_str, + char *buffer, size_t size) + { +- struct { char *name; int n; } ip_proto_table[] = CTL_IPPROTO_NAMES; ++ struct protoent *proto; + char *proto_name = "unknown"; + +- if ( packet_info->ip_proto_type < sizeof (ip_proto_table) / sizeof (ip_proto_table[0]) && +- ip_proto_table[packet_info->ip_proto_type].name ) +- proto_name = ip_proto_table[packet_info->ip_proto_type].name; ++ proto = getprotobynumber(packet_info->ip_proto_type); ++ if (proto != NULL) ++ proto_name = proto->p_name; + + return snprintf(buffer, size, + "OpenBSD PF %s an %s %s packet %s -> %s on interface %s (TTL:%hhu)", >Release-Note: >Audit-Trail: >Unformatted: