From owner-svn-src-all@FreeBSD.ORG Sun Jul 8 21:13:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D73411065686; Sun, 8 Jul 2012 21:13:04 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C21D58FC08; Sun, 8 Jul 2012 21:13:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q68LD4No074824; Sun, 8 Jul 2012 21:13:04 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q68LD4c1074821; Sun, 8 Jul 2012 21:13:04 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201207082113.q68LD4c1074821@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sun, 8 Jul 2012 21:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238265 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2012 21:13:04 -0000 Author: melifaro Date: Sun Jul 8 21:13:04 2012 New Revision: 238265 URL: http://svn.freebsd.org/changeset/base/238265 Log: Finally fix lookup (account remaining '\0') and deletion (provide valid key length for radix lookup). Submitted by: Ihor Kaharlichenko (prev version) Approved by: kib(mentor) MFC after: 3 days Sponsored by: Shtorm ISP Modified: head/sys/netinet/ipfw/ip_fw_table.c Modified: head/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_table.c Sun Jul 8 20:41:54 2012 (r238264) +++ head/sys/netinet/ipfw/ip_fw_table.c Sun Jul 8 21:13:04 2012 (r238265) @@ -344,9 +344,12 @@ ipfw_del_table_entry(struct ip_fw_chain struct xaddr_iface ifname, ifmask; memset(&ifname, 0, sizeof(ifname)); + /* Include last \0 into comparison */ + mlen++; + /* Set 'total' structure length */ - KEY_LEN(ifname) = mlen; - KEY_LEN(ifmask) = mlen; + KEY_LEN(ifname) = KEY_LEN_IFACE + mlen; + KEY_LEN(ifmask) = KEY_LEN_IFACE + mlen; /* Assume direct match */ /* FIXME: Add interface pattern matching */ #if 0 @@ -569,7 +572,7 @@ ipfw_lookup_table_extended(struct ip_fw_ case IPFW_TABLE_INTERFACE: KEY_LEN(iface) = KEY_LEN_IFACE + - strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE); + strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE) + 1; /* Assume direct match */ /* FIXME: Add interface pattern matching */ xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh));