]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
xt_psd: cleanup and reduce number of condition checks
authorJan Engelhardt <jengelh@medozas.de>
Thu, 11 Aug 2011 13:44:35 +0000 (15:44 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Thu, 11 Aug 2011 13:46:53 +0000 (15:46 +0200)
extensions/xt_psd.c

index 940b7daaf902e7f636d01b1bbee388eb9794cf9c..62b799170d8d5af6454a2cb69938816f24a838fc 100644 (file)
@@ -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