Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "U. George" <netbeans@gatworks.com>
To: ratheesh k <ratheesh.ksz@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: multiport needs `-p tcp', `-p udp' - Why?
Date: Sat, 27 Feb 2010 12:28:53 -0500	[thread overview]
Message-ID: <4B895655.90005@gatworks.com> (raw)
In-Reply-To: <cfeab66d1002270846q65493ac2y57ef59ca1eb2c650@mail.gmail.com>

source      port offset for udp and tcp are both at  0 for IPv4
destination port offset for udp and tcp are both at 16 for IPv4


On 02/27/2010 11:46 AM, ratheesh k wrote:
> port offset may be differ  based on which layer 4 protocol , you are
> using . If u dont specify protocol ( layer 4 ) , netfilter dont know
> this .
>
>
> Please find below some code sinppet from  xt_multiport.c .
>
>
> 113  pptr = skb_header_pointer(skb, protoff, sizeof(_ports), _ports);
> 114         if (pptr == NULL) {
> 115                 /* We've been asked to examine this packet, and we
> 116                  * can't.  Hence, no choice but to drop.
> 117                  */
> 118                 duprintf("xt_multiport: Dropping evil offset=0
> tinygram.\n");
> 119                 *hotdrop = 1;
> 120                 return 0;
> 121         }
> 122
> 123         return ports_match(multiinfo->ports,
> 124                            multiinfo->flags, multiinfo->count,
> 125                            ntohs(pptr[0]), ntohs(pptr[1]));
>
> thanks,
> Ratheesh
>
>
>
> On Sat, Feb 27, 2010 at 9:47 PM, U. George<netbeans@gatworks.com>  wrote:
>> U'll have to let me know why "-p udp" is needed when the chain can only have
>> udp packets, and therefor can only process udp packets.
>>
>> I dont want to test over (( and over ) and over ) again when I know that the
>> packet is already KNOWN to be from eth1 and of protocol UDP.
>>
>> adding "-p UDP" to multiport does make iptables happy, but appears to be a
>> useless test.
>>
>> On 02/27/2010 10:06 AM, ratheesh k wrote:
>>>
>>> Port is in Layer 4 of protocol stack .
>>>
>>>
>>> On Sat, Feb 27, 2010 at 8:33 PM, U. George<netbeans@gatworks.com>    wrote:
>>>>
>>>> In order to get to the chain, the protocol, as well as the interface must
>>>> match. PRE_UDP if already filtered for "-p udp" . So why does multiport
>>>> require another check for -p udp? Does it really need to have that option
>>>> in
>>>> order for it to work?
>>>>
>>>>> + /sbin/iptables -t filter -N PRE_UDP
>>>>> + /sbin/iptables -t filter -A INPUT -i eth1 -p udp -j PRE_UDP
>>>>> + /sbin/iptables -t filter -A PRE_UDP -m multiport --dport
>>>>> 137,138,139,512,514,515,1433,1434 -j DROP
>>>>> iptables v1.4.5: multiport needs `-p tcp', `-p udp', `-p udplite', `-p
>>>>> sctp' or `-p dccp'
>>>>> Try `iptables -h' or 'iptables --help' for more information.
>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>

  reply	other threads:[~2010-02-27 17:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-27 15:03 multiport needs `-p tcp', `-p udp' - Why? U. George
2010-02-27 15:06 ` ratheesh k
2010-02-27 16:17   ` U. George
2010-02-27 16:46     ` ratheesh k
2010-02-27 17:28       ` U. George [this message]
2010-02-27 17:18     ` Dennis J.
2010-02-28  6:54     ` Mart Frauenlob
2010-02-28 10:53       ` ratheesh k
2010-02-28 13:59       ` U. George
2010-02-28 14:41         ` Mart Frauenlob
2010-02-28 15:17           ` U. George
     [not found] <4b8984a7.0ab6660a.24bd.1f7f@mx.google.com>
2010-02-27 21:14 ` U. George
2010-02-28  4:46   ` ratheesh k
2010-02-28  6:38     ` Mart Frauenlob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B895655.90005@gatworks.com \
    --to=netbeans@gatworks.com \
    --cc=netfilter@vger.kernel.org \
    --cc=ratheesh.ksz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox