From nobody@FreeBSD.org  Tue Mar 11 22:06:29 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 994E1A88
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Mar 2014 22:06:29 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 85CF39A7
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Mar 2014 22:06:29 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s2BM6S94085652
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Mar 2014 22:06:28 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s2BM6SEf085651;
	Tue, 11 Mar 2014 22:06:28 GMT
	(envelope-from nobody)
Message-Id: <201403112206.s2BM6SEf085651@cgiserv.freebsd.org>
Date: Tue, 11 Mar 2014 22:06:28 GMT
From: Adam McDougall <mcdouga9@egr.msu.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ifconfig IP range assignment too restrictive
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         187457
>Category:       bin
>Synopsis:       ifconfig(8): ifconfig IP range assignment too restrictive
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 11 22:10:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Wed Apr 16 01:47:20 UTC 2014
>Originator:     Adam McDougall
>Release:        FreeBSD 10.0-STABLE
>Organization:
>Environment:
FreeBSD build10 10.0-STABLE FreeBSD 10.0-STABLE #0 r262298: Fri Feb 21 18:28:26 EST 2014     root@build10:/usr/obj/usr/src/sys/BUILD10  amd64
>Description:
Recently I came up with the need to assign almost every IP in a /24 subnet
to an interface.  I wanted to avoid 250+ lines in /etc/rc.conf so I read
the rc.conf manpage and discovered the wonderful range feature where I
thought I could use:

ifconfig_lagg0_alias0="inet 10.0.30.2-254/24"

I found out it only creates addresses up to around .34 and prints "Range
specification is too large", all as an anti foot-shooting protection due
to _IPEXPANDMAX=31 in /etc/network.subr.  Could the code be changed to
allow for example a whole /24 to be created with a single range?

Looking at SVN, this appears to apply to 9 as well.

Workaround: define a bunch of smaller ranges:
ifconfig_lagg0_aliases="inet 10.0.30.2-31/24 inet 10.0.30.32-63/32 \
inet .... etc etc"

>How-To-Repeat:
Try to set a large range in /etc/rc.conf and reboot.
ifconfig_interfacename0="up"
ifconfig_interfacename0_alias0="inet 10.0.30.2-254/24"
>Fix:
Raise _IPEXPANDMAX=31 in network.subr?  Untested but seems logical since
the only apparent purpose is to prevent accidental misconfiguration.
It is easy to see if the range is defined too large then it might make
a poor choice regarding broadcast IPs, oversized netmasks or something.
I didn't check exactly how many IPs it assigned, it should be near 32.
I was in a rush and had to settle for a workaround that evening.
>Release-Note:
>Audit-Trail:
>Unformatted:
