Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jul 2012 06:56:46 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r238515 - stable/8/sys/netinet/ipfw
Message-ID:  <201207160656.q6G6ukJ4013222@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Mon Jul 16 06:56:46 2012
New Revision: 238515
URL: http://svn.freebsd.org/changeset/base/238515

Log:
  MFC r237479, r238265
  
  Finally fix lookup (account remaining '\0') and deletion
  (provide valid key length for radix lookup).
  
  Submitted by:    Ihor Kaharlichenko<madkinder at gmail.com>  (prev version)
  Approved by:     kib(mentor)
  Sponsored by:    Shtorm ISP

Modified:
  stable/8/sys/netinet/ipfw/ip_fw_table.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/netinet/ipfw/ip_fw_table.c
==============================================================================
--- stable/8/sys/netinet/ipfw/ip_fw_table.c	Mon Jul 16 06:43:04 2012	(r238514)
+++ stable/8/sys/netinet/ipfw/ip_fw_table.c	Mon Jul 16 06:56:46 2012	(r238515)
@@ -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
@@ -568,7 +571,8 @@ ipfw_lookup_table_extended(struct ip_fw_
 		break;
 
 	case IPFW_TABLE_INTERFACE:
-		KEY_LEN(iface) = strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE);
+		KEY_LEN(iface) = KEY_LEN_IFACE +
+		    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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207160656.q6G6ukJ4013222>