All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martijn Lievaart <m@rtij.nl>
To: noa levy <noalevy@hotmail.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: stateful UDP with unknown source port on INPUT?
Date: Fri, 30 Mar 2007 01:06:15 +0200	[thread overview]
Message-ID: <460C4667.1090406@rtij.nl> (raw)
In-Reply-To: <BAY121-F279EE21E84B52D2FA87CB1A9740@phx.gbl>

noa levy wrote:
> Hi,
> I am working on a machine that needs to send SNMP informs, and receive
> ACKs for these informs. I am using iptables as my firewall, and I need
> to find a way to open a pinhole for the ACK to get back to me. My
> problem is that SNMP informs are sent to a predefined UDP port (162)
> but the ACKs are returned from a random port.
> The following rules exist to allow established UDP sessions:
> iptables -A INPUT-p udp -m state –state ESTABLISHED -j ACCEPT
> iptables -A OUTPUT -p udp -m state –state NEW,ESTABLISHED -j ACCEPT
>
> My problem is that, since the source port of the ACK is a random one,
> the ACKs are dropped. Is there a way to allow all incoming UDP packets
> with an unknown source port and an established dest port?

Not directly, but you could use the recent match for this. On outgoing
requests, add the IP to the recent set. On incoming packets, first match
on the destination port, then match on recent to see if the IP had an
recent outgoing request.

I use a similar strategy to reject (instead of drop) indent queries from
hosts I made a tcp connection to and that works, so this should to.

HTH,
M4



  reply	other threads:[~2007-03-29 23:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21 17:30 stateful UDP with unknown source port on INPUT? noa levy
2007-03-29 23:06 ` Martijn Lievaart [this message]
2007-04-01 12:39   ` noa levy
2007-04-01 13:24     ` Franck Joncourt
2007-04-02  5:28     ` Robert Nichols
2007-04-02 12:35       ` Robert Nichols

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=460C4667.1090406@rtij.nl \
    --to=m@rtij.nl \
    --cc=netfilter@lists.netfilter.org \
    --cc=noalevy@hotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.