From owner-freebsd-net@FreeBSD.ORG Thu May 21 16:09:44 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7955EE50; Thu, 21 May 2015 16:09:44 +0000 (UTC) Received: from mail-la0-x232.google.com (mail-la0-x232.google.com [IPv6:2a00:1450:4010:c03::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DDE5511CA; Thu, 21 May 2015 16:09:43 +0000 (UTC) Received: by lagr1 with SMTP id r1so106127746lag.0; Thu, 21 May 2015 09:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=agQRzeEelYRQJwhxaTUsdDMs5nIxVE9xmU5bVkdWrLw=; b=dBFT5WMOzShEulRJ0+Lp+sjoHKLX9Z4vanIB3/uEBLiQtSyPBW6s6TIuRpovp5ZqxE QbJqlbiYOIj7qUYfCD5CtgFmLC7kIykOiJPpdP6urqHjVWlAa6Hzm8w09e6ueuF2DHVU hfJIsvMMsLdjU8rD8aatw/A8ZYTS5H5hUZcv1xceHxZaIvyui6W5CmDdnJ2ofbx8c/MN C2fbC2aNZIF8bm8HoUZ7A14alniNhLGLyQ9IB2DQgCm39Ir8jhxzQytQE3dyBD6yDzcL jtddG6zZiMhZDt/JZdwL4g0KxbWufFSjpzbia3i4vf6wZVVKSq+Viyh8OTYBSGq4owlT nkog== MIME-Version: 1.0 X-Received: by 10.152.6.69 with SMTP id y5mr2852865lay.72.1432224581687; Thu, 21 May 2015 09:09:41 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.20.232 with HTTP; Thu, 21 May 2015 09:09:41 -0700 (PDT) Date: Thu, 21 May 2015 18:09:41 +0200 X-Google-Sender-Auth: 9MmPuqzilt7SDZj2gFbn0Ju9nBc Message-ID: Subject: sys/netinet/ip_var.h: enum value exceeding 2^31-1 From: Luigi Rizzo To: "freebsd-net@freebsd.org" Cc: Luigi Rizzo , "Alexander V. Chernikov" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 16:09:44 -0000 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