From owner-svn-src-all@FreeBSD.ORG Sat Oct 15 21:17:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED0EA1065676; Sat, 15 Oct 2011 21:16:59 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id E833F8FC08; Sat, 15 Oct 2011 21:16:58 +0000 (UTC) Received: by bkbzu17 with SMTP id zu17so1660860bkb.13 for ; Sat, 15 Oct 2011 14:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=x/Vuplifxe+uYiB4KhEyreKBAqaq3Kp4ULgkPt6IvOo=; b=q8d+8ie4k8tRs38l8Anase5gjUFWOWL/z+Z5Xe1B3elG3bDsLVndWPhLlplASP3doD NRyEEcjWVuTInlK61J6/6F3weg0yZP3vAEfK8ykvTQo7wkDsJXmTf7oo643v4Ybn7T91 rP3aLbSqHQpDaUxmqVkOeqgqLkwr9FoWPI+9Y= Received: by 10.223.14.134 with SMTP id g6mr12983169faa.11.1318711884952; Sat, 15 Oct 2011 13:51:24 -0700 (PDT) Received: from imba-brutale.totalterror.net ([93.152.152.135]) by mx.google.com with ESMTPS id b16sm3712568fao.7.2011.10.15.13.51.22 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Oct 2011 13:51:23 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Nikolay Denev In-Reply-To: <201110151841.p9FIfQLE025750@svn.freebsd.org> Date: Sat, 15 Oct 2011 23:51:21 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201110151841.p9FIfQLE025750@svn.freebsd.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.1251.1) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226402 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2011 21:17:00 -0000 On Oct 15, 2011, at 9:41 PM, Gleb Smirnoff wrote: > Author: glebius > Date: Sat Oct 15 18:41:25 2011 > New Revision: 226402 > URL: http://svn.freebsd.org/changeset/base/226402 >=20 > Log: > Add support for IPv4 /31 prefixes, as described in RFC3021. >=20 > To run a /31 network, participating hosts MUST drop support > for directed broadcasts, and treat the first and last addresses > on subnet as unicast. The broadcast address for the prefix > should be the link local broadcast address, INADDR_BROADCAST. >=20 > Modified: > head/sys/netinet/in.c > head/sys/netinet/in.h >=20 > Modified: head/sys/netinet/in.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet/in.c Sat Oct 15 16:28:06 2011 = (r226401) > +++ head/sys/netinet/in.c Sat Oct 15 18:41:25 2011 = (r226402) > @@ -897,8 +897,11 @@ in_ifinit(struct ifnet *ifp, struct in_i > */ > ia->ia_ifa.ifa_metric =3D ifp->if_metric; > if (ifp->if_flags & IFF_BROADCAST) { > - ia->ia_broadaddr.sin_addr.s_addr =3D > - htonl(ia->ia_subnet | ~ia->ia_subnetmask); > + if (ia->ia_subnetmask =3D=3D IN_RFC3021_MASK) > + ia->ia_broadaddr.sin_addr.s_addr =3D = INADDR_BROADCAST; > + else > + ia->ia_broadaddr.sin_addr.s_addr =3D > + htonl(ia->ia_subnet | ~ia->ia_subnetmask); > } else if (ifp->if_flags & IFF_LOOPBACK) { > ia->ia_dstaddr =3D ia->ia_addr; > flags |=3D RTF_HOST; > @@ -1230,9 +1233,11 @@ in_broadcast(struct in_addr in, struct i > if (ifa->ifa_addr->sa_family =3D=3D AF_INET && > (in.s_addr =3D=3D ia->ia_broadaddr.sin_addr.s_addr = || > /* > - * Check for old-style (host 0) broadcast. > + * Check for old-style (host 0) broadcast, but > + * taking into account that RFC 3021 obsoletes it. > */ > - t =3D=3D ia->ia_subnet) && > + (ia->ia_subnetmask !=3D IN_RFC3021_MASK && > + t =3D=3D ia->ia_subnet)) && > /* > * Check for an all one subnetmask. These > * only exist when an interface gets a secondary >=20 > Modified: head/sys/netinet/in.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet/in.h Sat Oct 15 16:28:06 2011 = (r226401) > +++ head/sys/netinet/in.h Sat Oct 15 18:41:25 2011 = (r226402) > @@ -392,6 +392,8 @@ __END_DECLS >=20 > #define IN_LOOPBACKNET 127 /* = official! */ >=20 > +#define IN_RFC3021_MASK (u_int32_t)0xfffffffe > + > /* > * Options for use with [gs]etsockopt at the IP level. > * First word of comment is data type; bool is stored in int. >=20 That's great! Thanks! Any plans for MFC? Regards, Nikolay