From 21da1dfea539c26323505b7501fc2b1cd6c66d3a Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 11 Aug 2011 15:44:35 +0200 Subject: [PATCH] xt_psd: cleanup and reduce number of condition checks --- extensions/xt_psd.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extensions/xt_psd.c b/extensions/xt_psd.c index 940b7da..62b7991 100644 --- a/extensions/xt_psd.c +++ b/extensions/xt_psd.c @@ -127,12 +127,6 @@ xt_psd_match(const struct sk_buff *pskb, struct xt_action_param *match) /* TCP or UDP ? */ proto = iph->protocol; - - if (proto != IPPROTO_TCP && proto != IPPROTO_UDP) { - pr_debug("protocol not supported\n"); - return false; - } - /* Get the source address, source & destination ports, and TCP flags */ addr.s_addr = iph->saddr; @@ -155,6 +149,9 @@ xt_psd_match(const struct sk_buff *pskb, struct xt_action_param *match) src_port = udph->source; dest_port = udph->dest; tcp_flags = 0; + } else { + pr_debug("protocol not supported\n"); + return false; } /* We're using IP address 0.0.0.0 for a special purpose here, so don't let