Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Apr 2009 14:24:29 +0000 (UTC)
From:      Paolo Pisati <piso@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r190926 - user/piso/ipfw/sys/netinet/libalias
Message-ID:  <200904111424.n3BEOTIW088779@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: piso
Date: Sat Apr 11 14:24:29 2009
New Revision: 190926
URL: http://svn.freebsd.org/changeset/base/190926

Log:
  Anticipate a check: what's the point of adjusting a checksum if we are
  going to toss the packet anyway?

Modified:
  user/piso/ipfw/sys/netinet/libalias/alias.c

Modified: user/piso/ipfw/sys/netinet/libalias/alias.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias.c	Sat Apr 11 14:20:45 2009	(r190925)
+++ user/piso/ipfw/sys/netinet/libalias/alias.c	Sat Apr 11 14:24:29 2009	(r190926)
@@ -762,6 +762,9 @@ UdpAliasIn(struct libalias *la, struct i
 
 		/* Walk out chain. */		
 		error = find_handler(IN, UDP, la, pip, &ad);
+		/* If we cannot figure out the packet, ignore it. */
+		if (error < 0)
+			return (PKT_ALIAS_IGNORED);
 
 /* If UDP checksum is not zero, then adjust since destination port */
 /* is being unaliased and destination address is being altered.    */
@@ -801,13 +804,7 @@ UdpAliasIn(struct libalias *la, struct i
 		    &original_address, &pip->ip_dst, 2);
 		pip->ip_dst = original_address;
 
-		/*
-		 * If we cannot figure out the packet, ignore it.
-		 */
-		if (error < 0)
-			return (PKT_ALIAS_IGNORED);
-		else
-			return (PKT_ALIAS_OK);
+		return (PKT_ALIAS_OK);
 	}
 	return (PKT_ALIAS_IGNORED);
 }



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