From: Patrick McHardy <kaber@trash.net>
To: Amin Azez <azez@ufomechanic.net>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: more nf_conntrack/ip_conntrack questions
Date: Mon, 12 Sep 2005 12:42:51 +0200 [thread overview]
Message-ID: <43255BAB.9040508@trash.net> (raw)
In-Reply-To: <43255737.3040109@ufomechanic.net>
Amin Azez wrote:
> 2 questions, part style, relating to nf_conntrack and ip_conntrack
>
> In nf_conntrack_tuple.h in
>
> #define NF_CT_TUPLE_U_BLANK(tuple) \
> do { \
> (tuple)->src.u.all = 0; \
> (tuple)->dst.u.all = 0; \
> memset((tuple)->src.u3.all, 0, \
> sizeof(u_int32_t)*NF_CT_TUPLE_L3SIZE); \
> memset((tuple)->dst.u3.all, 0, \
> sizeof(u_int32_t)*NF_CT_TUPLE_L3SIZE); \
> } while (0)
>
> why do we have:
> sizeof(u_int32_t)*NF_CT_TUPLE_L3SIZE
>
> as the size, instead of just:
> sizeof((tuple)->dst.u3)
>
> it seems to presume that:
> 1) .all will always be the biggest member
> 2) .all is always an array of NF_CT_TUPLE_L3SIZE of u_int32_t
>
> I wonder why we need to duplicate this knowledge when a small definition
> appears to suffice.
I have no idea, but I agree that it looks confusing. You should ask
Yasuyuki, he wrote this code.
> Also; and I asked about somehting similar before, why is
> ip_conntrack_tuple.src almost exactly the same as
> ip_conntrack_tuple.dst, but .src is defined in terms of pre-declared
> structs and unions but dst is declared in terms of (nearly) identical
> structs and unions. With nf_conntrack as far as I can tell they are the
> same. The inline explanation of "manipulatable" doesn't seem to cover it.
Well, for one dst is only nearly identical. The "maniputable" part is
also used on its own for function arguments in the NAT code, the
non-manipulable part isn't, so there's no need to put it in a seperate
structure.
next prev parent reply other threads:[~2005-09-12 10:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-09 14:56 nf_conntrack/ip_conntrack disrepencies Amin Azez
2005-09-09 15:08 ` Patrick McHardy
2005-09-12 10:23 ` more nf_conntrack/ip_conntrack questions Amin Azez
2005-09-12 10:42 ` Patrick McHardy [this message]
2005-09-12 11:29 ` Yasuyuki KOZAKAI
2005-09-12 11:41 ` Yasuyuki KOZAKAI
[not found] ` <200509121141.j8CBfHp1003079@toshiba.co.jp>
2005-09-12 12:04 ` Amin Azez
2005-09-12 12:56 ` Yasuyuki KOZAKAI
[not found] ` <200509121256.j8CCuHwd028705@toshiba.co.jp>
2005-09-13 13:15 ` Harald Welte
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=43255BAB.9040508@trash.net \
--to=kaber@trash.net \
--cc=azez@ufomechanic.net \
--cc=netfilter-devel@lists.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.