Linux Netfilter discussions
 help / color / mirror / Atom feed
* nfqueue vs. tproxy
@ 2011-12-08  0:25 msk
  2011-12-08  1:43 ` Susan Hinrichs
  2011-12-08  2:21 ` Jan Engelhardt
  0 siblings, 2 replies; 5+ messages in thread
From: msk @ 2011-12-08  0:25 UTC (permalink / raw)
  To: netfilter

I've been reading up on tproxy and nfqueue.  Just to confirm my understanding
of the two:

Could one write a layer of code that uses the nfq_*() functions to basically
implement what tproxy can do by simply adjusting the destination information
and checksum, and then returning NF_REPEAT verdicts for each?

Thanks,
-MSK

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nfqueue vs. tproxy
  2011-12-08  0:25 nfqueue vs. tproxy msk
@ 2011-12-08  1:43 ` Susan Hinrichs
  2011-12-08  4:21   ` Jan Engelhardt
  2011-12-08  2:21 ` Jan Engelhardt
  1 sibling, 1 reply; 5+ messages in thread
From: Susan Hinrichs @ 2011-12-08  1:43 UTC (permalink / raw)
  To: msk; +Cc: netfilter

You could do that, but the second recipient of the code would lose the
original destination address and port information.

This would be more like the REDIRECT target in iptables.

On Wed, 2011-12-07 at 16:25 -0800, msk@cloudmark.com wrote:
> I've been reading up on tproxy and nfqueue.  Just to confirm my understanding
> of the two:
> 
> Could one write a layer of code that uses the nfq_*() functions to basically
> implement what tproxy can do by simply adjusting the destination information
> and checksum, and then returning NF_REPEAT verdicts for each?
> 
> Thanks,
> -MSK
> --
> 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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nfqueue vs. tproxy
  2011-12-08  0:25 nfqueue vs. tproxy msk
  2011-12-08  1:43 ` Susan Hinrichs
@ 2011-12-08  2:21 ` Jan Engelhardt
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-12-08  2:21 UTC (permalink / raw)
  To: msk; +Cc: netfilter

On Thursday 2011-12-08 01:25, msk@cloudmark.com wrote:

>I've been reading up on tproxy and nfqueue.  Just to confirm my understanding
>of the two:
>
>Could one write a layer of code that uses the nfq_*() functions to basically
>implement what tproxy can do by simply adjusting the destination information
>and checksum, and then returning NF_REPEAT verdicts for each?

That would be really cumbersome, because with nf_queue, you end up 
just having the bare packet. With tproxy, you get the full benefits of 
a socket and TCP handling.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nfqueue vs. tproxy
  2011-12-08  1:43 ` Susan Hinrichs
@ 2011-12-08  4:21   ` Jan Engelhardt
  2011-12-08 10:49     ` Susan Hinrichs
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2011-12-08  4:21 UTC (permalink / raw)
  To: Susan Hinrichs; +Cc: msk, netfilter

On Thursday 2011-12-08 02:43, Susan Hinrichs wrote:

>You could do that, but the second recipient of the code would lose the
>original destination address and port information.

Um, no.
The second recipient of the packet (code? no.) is either

(a) intentionally the same as the original destination, therefore the 
daddr-dport tuple is already known (obviously)

(b) intentionally not the same as the original destination, i.e. not 
meant to know the original daddr-dport tuple.

And if you need, you can add extra bytes into the stream to tell the new 
peer (in case of (b)) the original address within the stream, provided 
the protocol can carry that information. If the protocol does not allow 
for it, it is not going to be interesting for the recipient anyway.

Oh and don't top-post.

>On Wed, 2011-12-07 at 16:25 -0800, msk@cloudmark.com wrote:
>> I've been reading up on tproxy and nfqueue.  Just to confirm my understanding
>> of the two:
>> 
>> Could one write a layer of code that uses the nfq_*() functions to basically
>> implement what tproxy can do by simply adjusting the destination information
>> and checksum, and then returning NF_REPEAT verdicts for each?
>> 
>> Thanks,
>> -MSK

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nfqueue vs. tproxy
  2011-12-08  4:21   ` Jan Engelhardt
@ 2011-12-08 10:49     ` Susan Hinrichs
  0 siblings, 0 replies; 5+ messages in thread
From: Susan Hinrichs @ 2011-12-08 10:49 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: msk, netfilter

On Thu, 2011-12-08 at 05:21 +0100, Jan Engelhardt wrote:
> On Thursday 2011-12-08 02:43, Susan Hinrichs wrote:
> 
> >You could do that, but the second recipient of the code would lose the
> >original destination address and port information.
> 
> Um, no.
> The second recipient of the packet (code? no.) is either
> 
> (a) intentionally the same as the original destination, therefore the 
> daddr-dport tuple is already known (obviously)
> 
> (b) intentionally not the same as the original destination, i.e. not 
> meant to know the original daddr-dport tuple.
> 
> And if you need, you can add extra bytes into the stream to tell the new 
> peer (in case of (b)) the original address within the stream, provided 
> the protocol can carry that information. If the protocol does not allow 
> for it, it is not going to be interesting for the recipient anyway.
> 
> Oh and don't top-post.
> 
> >On Wed, 2011-12-07 at 16:25 -0800, msk@cloudmark.com wrote:
> >> I've been reading up on tproxy and nfqueue.  Just to confirm my understanding
> >> of the two:
> >> 
> >> Could one write a layer of code that uses the nfq_*() functions to basically
> >> implement what tproxy can do by simply adjusting the destination information
> >> and checksum, and then returning NF_REPEAT verdicts for each?
> >> 
> >> Thanks,
> >> -MSK

Thanks for the clarification.  I see now.  And sorry for the breach of
etiquette.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-08 10:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08  0:25 nfqueue vs. tproxy msk
2011-12-08  1:43 ` Susan Hinrichs
2011-12-08  4:21   ` Jan Engelhardt
2011-12-08 10:49     ` Susan Hinrichs
2011-12-08  2:21 ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox