From 50d25dda1b08a57e63d3133070cfec6d0efdcfd2 Mon Sep 17 00:00:00 2001 From: Paolo Pisati <piso@FreeBSD.org> Date: Sat, 11 Apr 2009 15:26:31 +0000 Subject: [PATCH] What's the point of adjusting a checksum if we are going to toss the packet? Anticipate the check/return code. --- sys/netinet/libalias/alias.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index 4a7392865c69..2e469d7e49a4 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -762,6 +762,9 @@ UdpAliasIn(struct libalias *la, struct ip *pip) /* 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 ip *pip) &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); }