]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
ipp2p: partial revert of 3c8131b9
authorJan Engelhardt <jengelh@medozas.de>
Sat, 10 Jan 2009 07:23:27 +0000 (08:23 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sat, 10 Jan 2009 07:25:42 +0000 (08:25 +0100)
Revert part of 3c8131b976d2fb61c8e54437658bc632b46fd77f.

The transport header offset is not (yet) set by the time Netfilter
is invoked so using tcp_hdr/udp_hdr has undefined behavior.

extensions/xt_ipp2p.c

index 3c5f2388ae95311beb66e6240ad7d3c03964e156..83fa201be10e092cf49012727847af397a2b31f1 100644 (file)
@@ -837,7 +837,7 @@ ipp2p_mt(const struct sk_buff *skb, const struct xt_match_param *par)
        switch (ip->protocol) {
        case IPPROTO_TCP:       /* what to do with a TCP packet */
        {
-               const struct tcphdr *tcph = tcp_hdr(skb);
+               const struct tcphdr *tcph = (const void *)ip + ip_hdrlen(skb);
 
                if (tcph->fin) return 0;  /* if FIN bit is set bail out */
                if (tcph->syn) return 0;  /* if SYN bit is set bail out */
@@ -864,7 +864,7 @@ ipp2p_mt(const struct sk_buff *skb, const struct xt_match_param *par)
 
        case IPPROTO_UDP:       /* what to do with an UDP packet */
        {
-               const struct udphdr *udph = udp_hdr(skb);
+               const struct udphdr *udph = (const void *)ip + ip_hdrlen(skb);
 
                while (udp_list[i].command) {
                        if ((info->cmd & udp_list[i].command) == udp_list[i].command &&