Bug 186841 - rc.conf ifconfig syntax for binding ip-ranges broken [regression]
Summary: rc.conf ifconfig syntax for binding ip-ranges broken [regression]
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 10.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Hiroki Sato
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-17 14:00 UTC by Daniel Ylitalo
Modified: 2014-10-13 14:53 UTC (History)
3 users (show)

See Also:


Attachments
A patch to make the limit user-configurable and bump the default value up to 2048. (2.88 KB, patch)
2014-09-09 06:40 UTC, Hiroki Sato
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Ylitalo 2014-02-17 14:00:00 UTC
According to the manual binding ip ranges has been merged into the default ifconfig_<iface>_alias<n> line, however, if you try to bind a /24 it stops at ip 35.

Ie:
ifconfig_bce0_alias0="inet 10.0.68.3-254/24"

Binds ip's 10.0.68.3-10.0.68.35 and not the full 254

Using the old and deprecated syntax is also broken:
ipv4_addrs_bce0="10.0.68.3-254/24"


However, using the old syntax in FreeBSD 9.1 works fine and binds all 252 ip's to the nic.

Fix: 

Worked fine in 9.1-RELEASE so one should only have to check what's changed.
How-To-Repeat: Add this line to your /etc/rc.conf

ifconfig_bce0_alias0="inet 10.0.68.3-254/24"

reload or reboot

IP's 10.0.68.3 through 10.0.68.35 will be binded and not the full 252 ip's.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2014-02-24 07:00:37 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

reclassify.
Comment 2 Bryan Drewery freebsd_committer freebsd_triage 2014-09-05 20:05:50 UTC
Intentionally broken in r252015.

We need to remove the _IPEXPANDMAX limit. This is a regression over how it previously worked.
Comment 3 Bryan Drewery freebsd_committer freebsd_triage 2014-09-05 20:24:27 UTC
https://reviews.freebsd.org/D727 fixes it
Comment 4 Hiroki Sato freebsd_committer freebsd_triage 2014-09-08 05:27:17 UTC
Sorry, I had missed this PR.  I am thinking that making _IPEXPANDMAX be user-configurable in rc.conf is better than removing it completely because the number of resulting addresses can be too large.  Do you have any specific reason that we should remove this restriction at all?
Comment 5 Daniel Ylitalo 2014-09-08 07:51:47 UTC
May I ask why having the restriction at all? If one wants to bind a /16, let the dude do so! :D
Comment 6 Bryan Drewery freebsd_committer freebsd_triage 2014-09-08 15:06:33 UTC
(In reply to Hiroki Sato from comment #4)
> Sorry, I had missed this PR.  I am thinking that making _IPEXPANDMAX be
> user-configurable in rc.conf is better than removing it completely because
> the number of resulting addresses can be too large.  Do you have any
> specific reason that we should remove this restriction at all?

My reasoning is that it is a regression over how the _addrs mechanism has always worked. It would make sense to limit the ranges by the size of the CIDR mask, but a blanket limit is not right IMHO. If the user specifies X-N/MASK they expect all IPS between X and N to be added, at least for the size of the mask.
Comment 7 Hiroki Sato freebsd_committer freebsd_triage 2014-09-09 06:40:49 UTC
Created attachment 147097 [details]
A patch to make the limit user-configurable and bump the default value up to 2048.

_IPEXPANDMAX was not intended for a hard limit of this functionality, just a safety-belt though I did not add it as a user-configurable knob.  The reason why I added it is that a misconfiguration can unexpectedly generate a very very large number of addresses, especially in IPv6 because range specification handling in a shell-script is not so robust.  A typo in IPv6 address can generate over 2^64 addresses.

So, the moot point is whether this limit is still problematic even when it is user-configurable and an appropriate warning message is displayed.  My proposed patch is attached.  With this patch, one can increase it arbitrarily in rc.conf.
Comment 8 Bryan Drewery freebsd_committer freebsd_triage 2014-09-09 15:31:05 UTC
(In reply to Hiroki Sato from comment #7)
> Created attachment 147097 [details]
> A patch to make the limit user-configurable and bump the default value up to
> 2048.

This is acceptable to me for now. Please also add a note in rc.conf.5 near the ipv4_addrs_ content about the limit and how to change. Possibly even noting it in the warning that "netif_ipexpand_max=${netif_ipexpand_max} was exceeded".
Comment 9 commit-hook freebsd_committer freebsd_triage 2014-09-11 12:30:37 UTC
A commit references this bug:

Author: hrs
Date: Thu Sep 11 12:30:30 UTC 2014
New revision: 271424
URL: http://svnweb.freebsd.org/changeset/ports/271424

Log:
  - Add $netif_ipexpand_max to specify the upper limit for the number of
    addresses generated by an address range specification.  The default
    value is 2048.  This can be increased by setting $netif_ipexpand_max
    in rc.conf.

  - Fix warning messages when an address range spec exceeds the upper limit.

  PR:	186841

Changes:
  head/etc/defaults/rc.conf
  head/etc/network.subr
  head/share/man/man5/rc.conf.5
Comment 10 Hiroki Sato freebsd_committer freebsd_triage 2014-09-11 12:32:00 UTC
Committed the patch and rc.conf(5) manual page update to 11-CURRENT.  I will MFC them to stable branches.
Comment 11 commit-hook freebsd_committer freebsd_triage 2014-10-05 23:33:49 UTC
A commit references this bug:

Author: bdrewery
Date: Sun Oct  5 23:32:59 UTC 2014
New revision: 272577
URL: https://svnweb.freebsd.org/changeset/base/272577

Log:
  MFC r271424:

    - Add $netif_ipexpand_max to specify the upper limit for the number of
      addresses generated by an address range specification.  The default value
      is 2048.  This can be increased by setting $netif_ipexpand_max in rc.conf.

  PR:	186841

Changes:
_U  stable/10/
  stable/10/etc/defaults/rc.conf
  stable/10/etc/network.subr
  stable/10/share/man/man5/rc.conf.5
Comment 12 Bryan Drewery freebsd_committer freebsd_triage 2014-10-06 00:32:40 UTC
Also committed to stable/9 in r272581.

Will petition to get it into 10.1.
Comment 13 commit-hook freebsd_committer freebsd_triage 2014-10-13 14:53:20 UTC
A commit references this bug:

Author: bdrewery
Date: Mon Oct 13 14:52:55 UTC 2014
New revision: 273039
URL: https://svnweb.freebsd.org/changeset/base/273039

Log:
  MFS r272577,r272577:

  - Add $netif_ipexpand_max to specify the upper limit for the number of
    addresses generated by an address range specification.  The default value
    is 2048.  This can be increased by setting $netif_ipexpand_max in rc.conf.

  PR:		186841
  Approved by:	re (hrs)

Changes:
_U  releng/10.1/
  releng/10.1/etc/defaults/rc.conf
  releng/10.1/etc/network.subr
  releng/10.1/share/man/man5/rc.conf.5