lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100722013817.GB15008@verge.net.au>
Date:	Thu, 22 Jul 2010 10:38:17 +0900
From:	Simon Horman <horms@...ge.net.au>
To:	Jan Engelhardt <jengelh@...ozas.de>
Cc:	lvs-devel@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, netfilter@...r.kernel.org,
	netfilter-devel@...r.kernel.org,
	Malcolm Turnbull <malcolm@...dbalancer.org>,
	Wensong Zhang <wensong@...ux-vs.org>,
	Julius Volz <julius.volz@...il.com>,
	Patrick McHardy <kaber@...sh.net>,
	"David S. Miller" <davem@...emloft.net>,
	Hannes Eder <heder@...gle.com>
Subject: Re: [patch v2.6 4/4] libxt_ipvs: user-space lib for netfilter
 matcher xt_ipvs

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ