Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 May 2015 18:09:41 +0200
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Cc:        Luigi Rizzo <rizzo@iet.unipi.it>, "Alexander V. Chernikov" <melifaro@freebsd.org>
Subject:   sys/netinet/ip_var.h: enum value exceeding 2^31-1
Message-ID:  <CA%2BhQ2%2Bjg6H-nHTjRQpgc3vzhKAvWE7hd1zc0U6UwBNPSw9acEw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
in pedantic mode the compiler complains about
an enum value out of range (in sys/netinet/ip_var.h)

Would people object to the following change ?
It seems to be used internally only in a handful of places


=E2=80=8B+=E2=80=8B
/* ISO C restricts enumerator values to range of 'int'
=E2=80=8B+=E2=80=8B
 * so we need
=E2=80=8BIPFW_INFO_=E2=80=8B
IN to have a smaller value
=E2=80=8B+=E2=80=8B
 */
=E2=80=8B =E2=80=8B
enum {
        IPFW_INFO_MASK  =3D 0x0000ffff,
        IPFW_INFO_OUT   =3D 0x00000000,   /* outgoing, just for convenience=
 */
=E2=80=8B-       =E2=80=8B
IPFW_INFO_IN    =3D 0x8
=E2=80=8B00=E2=80=8B
00000,   /* incoming, overloads dir */
=E2=80=8B+=E2=80=8B
       IPFW_INFO_IN    =3D 0x00800000,   /* incoming, overloads dir */
        IPFW_ONEPASS    =3D 0x40000000,   /* One-pass, do not reinject */

head/sys/netpfil/ipfw/ip_fw2.c:                             cmd->arg1 & ((i
& IPFW_INFO_IN) ? 1 : 2);
head/sys/netgraph/ng_ipfw.c:    if (r->info & IPFW_INFO_IN) {
head/sys/netgraph/ng_ipfw.c:            r->info |=3D dir ? IPFW_INFO_IN :
IPFW_INFO_OUT;
head/sys/netinet/ip_var.h:      IPFW_INFO_IN    =3D 0x80000000,   /*
incoming, overloads dir */
head/sys/netinet/ip_divert.c:           dt->info |=3D IPFW_IS_DIVERT |
IPFW_INFO_IN;

=E2=80=8Bcheers
luigi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhQ2%2Bjg6H-nHTjRQpgc3vzhKAvWE7hd1zc0U6UwBNPSw9acEw>