From: Patrick McHardy <kaber@trash.net>
To: Hans Schillstrom <hans@schillstrom.com>
Cc: pablo@netfilter.org, jengelh@medozas.de,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
hans.schillstrom@ericsson.com
Subject: Re: [v4 PATCH 1/2] NETFILTER module xt_hmark, new target for HASH based fwmark
Date: Thu, 01 Dec 2011 12:46:08 +0100 [thread overview]
Message-ID: <4ED76900.6000108@trash.net> (raw)
In-Reply-To: <jec613b.2c905808e36d8b8192d285d691c5499b@obelix.schillstrom.com>
On 12/01/2011 12:39 PM, Hans Schillstrom wrote:
> t: Re: [v4 PATCH 1/2] NETFILTER module xt_hmark, new target for HASH based fwmark
>> On 12/01/2011 12:05 PM, Hans Schillstrom wrote:
>>>>>> And final question, why not simply use ipv6_skip_exthdr()?
>>>>> problems with fragments...
>>>> So the probem is that it will return the transport layer protocol
>>>> header for fragments with frag_off == 0? We also have ipv6_find_hdr()
>>>> which we could modify to indicate this in the frag_off pointer.
>>> ipv6_find_hdr() will do the trick with a light modification
>>> What about a wrapper like:
>>>
>>> int __ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
>>> int target, unsigned short *fragoff, int *fragflg)
>>> {
>>> ...
>>> if (nexthdr == NEXTHDR_FRAGMENT) {
>>> unsigned short _frag_off;
>>> __be16 *fp;
>>>
>>> if (fragflg)
>>> fragflg = 1;
>>> fp = skb_header_pointer(skb,
>>> start+offsetof(struct frag_hdr,
>>> frag_off),
>>> sizeof(_frag_off),
>>> &_frag_off);
>>>
>>> ...
>>> }
>>>
>>> int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
>>> int target, unsigned short *fragoff)
>>> {
>>> return __ipv6_find_hdr(skb, offset, terget, fragoff, NULL);
>>> }
>> Hmm that would require to change all current callers.
> Nope, ipv6_find_hdr() looks the same,
> __ipv6_find_hdr() have an extra param.
Ah, right, apparently need more coffee :)
>> I was more thinking of unconditionally setting *frag_off in case of
>> fragments, then you can initialize it to some impossible value
>> like 0xffff and determine the presence of a fragment header
>> based on its value after calling ipv6_find_hdr().
> That's another way :-)
>
> Which one do you prefer ?
You way seems cleaner to me, lets do that.
next prev parent reply other threads:[~2011-12-01 11:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 11:39 Re[2]: [v4 PATCH 1/2] NETFILTER module xt_hmark, new target for HASH based fwmark Hans Schillstrom
2011-12-01 11:46 ` Patrick McHardy [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-12-01 11:05 Hans Schillstrom
2011-12-01 11:24 ` Patrick McHardy
2011-11-28 9:36 Re[2]: " Hans Schillstrom
2011-11-30 15:27 ` Patrick McHardy
2011-11-30 18:28 ` Pablo Neira Ayuso
2011-12-01 0:52 ` Hans Schillstrom
2011-11-25 9:36 [v4 PATCH 0/2] NETFILTER new target module, HMARK Hans Schillstrom
2011-11-25 9:36 ` [v4 PATCH 1/2] NETFILTER module xt_hmark, new target for HASH based fwmark Hans Schillstrom
2011-11-25 14:19 ` David Laight
2011-11-25 14:36 ` Eric Dumazet
2011-11-25 14:43 ` Eric Dumazet
2011-11-25 17:36 ` Pablo Neira Ayuso
2011-11-25 18:31 ` Jan Engelhardt
2011-11-30 15:51 ` Patrick McHardy
2011-12-01 0:25 ` Hans Schillstrom
2011-12-01 10:05 ` 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=4ED76900.6000108@trash.net \
--to=kaber@trash.net \
--cc=hans.schillstrom@ericsson.com \
--cc=hans@schillstrom.com \
--cc=jengelh@medozas.de \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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.