From: Simon Horman on
On Sun, Jul 11, 2010 at 06:03:46PM +0900, horms(a)vergenet.net wrote:
> From: Hannes Eder <heder(a)google.com>
>
> The user-space library for the netfilter matcher xt_ipvs.

[snip]

> Index: iptables/include/linux/netfilter/xt_ipvs.h
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ iptables/include/linux/netfilter/xt_ipvs.h 2010-07-04 20:23:30.000000000 +0900
> @@ -0,0 +1,25 @@
> +#ifndef _XT_IPVS_H
> +#define _XT_IPVS_H 1
> +
> +#define XT_IPVS_IPVS_PROPERTY (1 << 0) /* all other options imply this one */
> +#define XT_IPVS_PROTO (1 << 1)
> +#define XT_IPVS_VADDR (1 << 2)
> +#define XT_IPVS_VPORT (1 << 3)
> +#define XT_IPVS_DIR (1 << 4)
> +#define XT_IPVS_METHOD (1 << 5)
> +#define XT_IPVS_VPORTCTL (1 << 6)
> +#define XT_IPVS_MASK ((1 << 7) - 1)
> +#define XT_IPVS_ONCE_MASK (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY)
> +
> +struct xt_ipvs_mtinfo {
> + union nf_inet_addr vaddr, vmask;
> + __be16 vport;
> + __u16 l4proto;
> + __u16 fwd_method;

The kernel version of this file has been updated so that
l4proto and fwd_method are __u8. This also needs to be updated.
I will post an updated patch (v2.7).

> + __be16 vportctl;
> +
> + __u8 invert;
> + __u8 bitmask;
> +};
> +
> +#endif /* _XT_IPVS_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Simon Horman on
On Wed, Jul 21, 2010 at 08:35:19AM +0200, Jan Engelhardt wrote:
>
> On Wednesday 2010-07-21 03:21, Simon Horman wrote:
> >> +
> >> +#define XT_IPVS_IPVS_PROPERTY (1 << 0) /* all other options imply this one */
> >> +#define XT_IPVS_PROTO (1 << 1)
> >> +#define XT_IPVS_VADDR (1 << 2)
> >> +#define XT_IPVS_VPORT (1 << 3)
> >> +#define XT_IPVS_DIR (1 << 4)
> >> +#define XT_IPVS_METHOD (1 << 5)
> >> +#define XT_IPVS_VPORTCTL (1 << 6)
> >> +#define XT_IPVS_MASK ((1 << 7) - 1)
> >> +#define XT_IPVS_ONCE_MASK (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY)
>
> Can't these just be an enum?

More than one option can be used at once - they form a mini bitmap -
so no, I don't think we can use an enum.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Simon Horman on
On Wed, Jul 21, 2010 at 03:28:16PM +0200, Jan Engelhardt wrote:
>
> On Wednesday 2010-07-21 15:21, Simon Horman wrote:
> >> On Wednesday 2010-07-21 03:21, Simon Horman wrote:
> >> >> +
> >> >> +#define XT_IPVS_IPVS_PROPERTY (1 << 0) /* all other options imply this one */
> >> >> +#define XT_IPVS_PROTO (1 << 1)
> >> >> +#define XT_IPVS_VADDR (1 << 2)
> >> >> +#define XT_IPVS_VPORT (1 << 3)
> >> >> +#define XT_IPVS_DIR (1 << 4)
> >> >> +#define XT_IPVS_METHOD (1 << 5)
> >> >> +#define XT_IPVS_VPORTCTL (1 << 6)
> >> >> +#define XT_IPVS_MASK ((1 << 7) - 1)
> >> >> +#define XT_IPVS_ONCE_MASK (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY)
> >>
> >> Can't these just be an enum?
> >
> >More than one option can be used at once - they form a mini bitmap -
> >so no, I don't think we can use an enum.
>
> An enum does not dictate that you cannot combine values of it with itself.
>
> enum { A = 1 << 0, B = 1 << 0, };
> unsigned int flags = A | B;
>
> is perfectly fine, which is what other modules do.

Understood. I'll make it so.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Simon Horman on
On Wed, Jul 21, 2010 at 10:41:03PM +0900, Simon Horman wrote:
> On Wed, Jul 21, 2010 at 03:28:16PM +0200, Jan Engelhardt wrote:
> >
> > On Wednesday 2010-07-21 15:21, Simon Horman wrote:
> > >> On Wednesday 2010-07-21 03:21, Simon Horman wrote:
> > >> >> +
> > >> >> +#define XT_IPVS_IPVS_PROPERTY (1 << 0) /* all other options imply this one */
> > >> >> +#define XT_IPVS_PROTO (1 << 1)
> > >> >> +#define XT_IPVS_VADDR (1 << 2)
> > >> >> +#define XT_IPVS_VPORT (1 << 3)
> > >> >> +#define XT_IPVS_DIR (1 << 4)
> > >> >> +#define XT_IPVS_METHOD (1 << 5)
> > >> >> +#define XT_IPVS_VPORTCTL (1 << 6)
> > >> >> +#define XT_IPVS_MASK ((1 << 7) - 1)
> > >> >> +#define XT_IPVS_ONCE_MASK (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY)
> > >>
> > >> Can't these just be an enum?
> > >
> > >More than one option can be used at once - they form a mini bitmap -
> > >so no, I don't think we can use an enum.
> >
> > An enum does not dictate that you cannot combine values of it with itself.
> >
> > enum { A = 1 << 0, B = 1 << 0, };
> > unsigned int flags = A | B;
> >
> > is perfectly fine, which is what other modules do.
>
> Understood. I'll make it so.

Hi Jan,

I must confess that I'm not familiar with using enum in this way.
Can I confirm that you are suggesting the following?

enum {
XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */
XT_IPVS_PROTO = 1 << 1,
XT_IPVS_VADDR = 1 << 2,
XT_IPVS_VPORT = 1 << 3,
XT_IPVS_DIR = 1 << 4,
XT_IPVS_METHOD = 1 << 5,
XT_IPVS_VPORTCTL = 1 << 6,
XT_IPVS_MASK = (1 << 7) - 1,
XT_IPVS_ONCE_MASK = (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY)
};

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Simon Horman on
On Thu, Jul 22, 2010 at 08:25:01AM +0200, Jan Engelhardt wrote:
>
> On Thursday 2010-07-22 03:38, Simon Horman wrote:
> >
> >I must confess that I'm not familiar with using enum in this way.
> >Can I confirm that you are suggesting the following?
> >
> >enum {
> > XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */
> > XT_IPVS_PROTO = 1 << 1,
> > XT_IPVS_VADDR = 1 << 2,
> > XT_IPVS_VPORT = 1 << 3,
> > XT_IPVS_DIR = 1 << 4,
> > XT_IPVS_METHOD = 1 << 5,
> > XT_IPVS_VPORTCTL = 1 << 6,
> > XT_IPVS_MASK = (1 << 7) - 1,
> > XT_IPVS_ONCE_MASK = (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY)
> >};
>
> Yes; You may drop the () in ONCE_MASK though.

Thanks; and yes, silliness on my part.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/