All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: "Netfilter Developer Mailing List"
	<netfilter-devel@vger.kernel.org>,
	"Sebastian Claßen" <sebastian.classen@freenet.de>
Subject: Re: NF [PATCH 2/4] xt_TEE
Date: Tue, 27 Nov 2007 01:12:17 +0100	[thread overview]
Message-ID: <474B60E1.6060002@trash.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0711262105080.22369@fbirervta.pbzchgretzou.qr>

Jan Engelhardt wrote:
> On Nov 26 2007 08:24, Patrick McHardy wrote:
>   
>> Jan Engelhardt wrote:
>>> +struct xt_tee_target_info {
>>> +	union {
>>> +		/* Address of gateway */
>>> +		u_int32_t gateway_v4;
>>> +		u_int32_t gateway_v6[4];
>>>       
>> These should be __be32 or simply use in_addr/in6_addr. At some
>> point it would be good to have a nf_inet_addr type (or something
>> net/-wide) so we don't have to introduce more and more of these.
>>
>>     
> In include/net/netfilter/nf_conntrack_tuple.h there is
> nf_conntrack_address, which would be perfectly suited for the task.
> But I am not sure if I can use that, since it would have to be
> exported to userspacce (would probably need to move the union to
> include/linux/netfilter/ too). Thoughts?
>   

And the name doesn't really match. I'd prefer to type for all of
netfilter and then have conntrack use that one.

>
>   
>>> +	/* Trying to route the packet using the standard routing table. */
>>> +	err = ip_route_output_key(&rt, &fl);
>>> +	if (err != 0) {
>>> +		if (net_ratelimit())
>>> +			pr_debug(KBUILD_MODNAME
>>> +			         ": could not route packet (%d)", err);
>>>       
>> No need to log this IMO. Not being able to route a packet is a
>> quite normal condition.
>>
>>     
> It is a pr_debug(), which is compiled out by default. But I'll
> happily rip it.
>   

Right, I missed that. Still seems like something that should go after
debugging.

>>> +/*
>>> + * Stolen from ip_finish_output2
>>> + * PRE : skb->dev is set to the device we are leaving by
>>> + *       skb->dst is not NULL
>>> + * POST: the packet is sent with the link layer header pushed
>>> + *       the packet is destroyed
>>> + */
>>> +static void tee_ip_direct_send(struct sk_buff *skb)
>>> +{
>>>       
>> Why is this function needed? dst_output should do fine.
>>
>>     
> Could IPsec xfrmation perhaps recurse? Thinking of something like
>
> 	(iptables -F OUTPUT)
> 	iptables -A OUTPUT -j TEE --gw overthere
>
> Now, if overthere leads to an xfrm tunnel, the kernel will create an ESP
> packet, and also send it through OUTPUT, would not it? Then there be a
> recursion if using ipsec-aware dst_output.
> How valid is this thought?
>   

Packets only go through IPsec once unless the IPSKB_XFRM_TRANSFORMED
flag is cleared. You need to clear it once of course to handle already
encapsulated packets, your tee_ct should prevent further recursion,
right?

>
>   
>>> +static void __exit tee_tg_exit(void)
>>> +{
>>> +	xt_unregister_target(&tee_tg_reg);
>>> +	/* [SC]: shoud not we cleanup tee_track here? */
>>>       
>> No, but you need to wait until all references to it
>> are gone.
>>
>>     
> What's the _put() function I need for it?

None, something like for the untracked conntrack:

        /* wait until all references to nf_conntrack_untracked are 
dropped */
        while (atomic_read(&nf_conntrack_untracked.ct_general.use) > 1)
                schedule();



  reply	other threads:[~2007-11-27  0:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-25 19:05 NF [PATCH 1/4] xt_owner Jan Engelhardt
2007-11-25 19:06 ` NF [PATCH 2/4] xt_TEE Jan Engelhardt
2007-11-25 19:39   ` Krzysztof Oledzki
2007-11-25 19:55     ` Jan Engelhardt
2007-11-25 20:22       ` Krzysztof Oledzki
2007-11-26  7:24   ` Patrick McHardy
2007-11-26 20:14     ` Jan Engelhardt
2007-11-27  0:12       ` Patrick McHardy [this message]
2007-12-05 17:24         ` nf_inet_address (was: NF [PATCH 2/4] xt_TEE) Jan Engelhardt
2007-12-05 17:35           ` Jan Engelhardt
2007-12-06  9:54             ` nf_inet_address Patrick McHardy
2007-11-25 19:06 ` NF [PATCH 3/4] xt_TCPOPTSTRIP Jan Engelhardt
2007-11-26  7:24   ` Patrick McHardy
2007-11-26 16:19     ` Jan Engelhardt
2007-11-26 16:19       ` Patrick McHardy
2007-11-26 16:25         ` Jan Engelhardt
2007-11-27 12:37           ` Patrick McHardy
2007-11-27 14:50             ` Jan Engelhardt
2007-11-27 15:25               ` Patrick McHardy
2007-11-25 19:07 ` NF [PATCH 4/4] xt_gateway Jan Engelhardt
2007-11-26  7:30   ` Patrick McHardy
2007-11-26  9:17     ` Amin Azez
2007-11-26 15:35       ` Patrick McHardy
2007-11-26 16:34         ` Amin Azez
2007-11-27  0:19           ` Patrick McHardy
2007-11-27  9:33             ` Amin Azez
2007-11-27 13:03               ` Patrick McHardy
2007-11-27 13:33                 ` Amin Azez
2007-12-03 14:19                   ` Jan Engelhardt
2007-12-03 14:23                     ` Amin Azez
2007-11-25 19:07 ` IPT [PATCH 1/4] libxt_owner Jan Engelhardt
2007-11-25 19:08   ` IPT [PATCH 2/4] libxt_TEE Jan Engelhardt
2007-11-25 19:08   ` IPT [PATCH 3/4] libxt_TCPOPTSTRIP Jan Engelhardt
2007-11-25 19:08   ` IPT [PATCH 4/4] libxt_gateway Jan Engelhardt
2007-11-26  7:12 ` NF [PATCH 1/4] xt_owner Patrick McHardy

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=474B60E1.6060002@trash.net \
    --to=kaber@trash.net \
    --cc=jengelh@computergmbh.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=sebastian.classen@freenet.de \
    /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.