summaryrefslogtreecommitdiffstats
path: root/etc/network.subr
Commit message (Collapse)AuthorAgeFilesLines
* MFC r278933:rpaulo2015-02-261-1/+1
| | | | | | Fix a typo in ipv6_down(). Submitted by: Ashutosh Kumar AK0037447 at TechMahindra.com
* MFC r266267, r267636:hrs2014-10-091-2/+2
| | | | | Fix an issue in range specification handling when a "-foo" is specified in ifconfig_IF_aliasN.
* MFC r265225:hrs2014-10-091-7/+10
| | | | | | Move configuration of IPv6 NDP flags to a point before handling ifconfig_IF. This fixes a race that a non-IPv4 interface can get an EUI64 LLA even if it has IFDISABLED nd6 flag at boot time.
* MFC r271424:bdrewery2014-10-051-7/+5
| | | | | | | | - 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
* MFC r267812 (hrs): Fix ifname normalization. ifconfig_IF_alias{es,N} did notdteske2014-07-231-11/+10
| | | | | | | | | | | | | | | | | | | | work if ifname has any of [.-/+]. While here, also perform the following to reduce diff size between major branches for etc/network.subr: MFC r266475 (rea): Fix warning messages after r252015 $alias used to hold alias number, but now it carries full variable name, so messages were tuned to account for that. Other fixes: - eliminate unneeded double spaces; - tell user where inet/inet6 keywords are expected to be. Reviewed by: hrs Spotted by: jhay PR: conf/191961
* MFC r264243:dteske2014-04-141-12/+14
| | | | | | | | | | | | | | Loosen the processing of *_IF_aliasN vars to be less strict. Previously, the first alias had to be _alias0 and processing stopped at the first non- defined variable (preventing gaps). Allowing gaps gives the administrator the ability to group aliases in an adhoc manner and also lifts the requirement to renumber aliases simply to comment-out an existing one. Aliases are processed in numerical ascending order. NB: Also Patches mdconfig{,2} rc(8) boot scripts to loosen the numbering scheme for mdconfig_mdN settings to be less strict in the same manner. Discussed on: -rc
* Add support for "vnet jname" argument in ifconfig_IF. The vnet keywordhrs2013-10-101-10/+67
| | | | | | | | | | | is ignored except for "rc.d/netif vnet{up,down} ifn" because a jail is usually created after interface initialization on boot time. "rc.d/netif vnetup ifn" moves ifn into the specified jail. It is designed to be used in other scripts like rc.d/jail, not automatically invoked during the interface initialization. Approved by: re (kib)
* Do not attempt to do AF-specific configurations on a interface whenhrs2013-10-041-7/+12
| | | | | | | | | | noafif() is true. The following warning message was displayed when pflog0 interface existed, for example: ifconfig: ioctl(SIOCGIFINFO_IN6): Protocol family not supported Reported by: bz Approved by: re (gjb)
* Add epair(4) support in $cloned_interfaces. One should be specifiedhrs2013-10-041-41/+93
| | | | | | | | | | | | | | as "epair0" in $cloned_interfaces and "epair0[ab]" in the others in rc.conf like the following: cloned_interfaces="epair0" ifconfig_epair0a="inet 192.168.1.1/24" ifconfig_epair0b="inet 192.168.2.1/24" /etc/rc.d/netif now accepts both "netif start epair0" and "netif start epair0a". Approved by: re (kib)
* Fix parsing lines of ifconfig output which include \t in the case ofhrs2013-09-171-7/+8
| | | | | | inet and inet6. Approved by: re (delphij)
* Correctly remove an interface's ipv4 address when the user callsasomers2013-08-231-3/+3
| | | | | | | | | | "/etc/rc.d/netif stop XXX". The old globbing pattern failed to account for the possibility of a tab occuring before "inet". Reviewed by: will Approved by: ken (mentor, implicit) MFC after: Never (bug affects head only) Sponsored by: Spectra Logic
* - Reimplement $gif_interfaces as a variant of $cloned_interfaces.hrs2013-08-041-32/+80
| | | | | | | | | | | | | | | | | | Newly-configured systems should use $cloned_interfaces. - Call clone_{up,down}() and ifnet_rename() in rc.d/netif {start,stop}. ifnet_rename() now accepts an interface name list as its argument. - Add rc.d/netif clear. The "clear" subcommand is basically equivalent to "stop" but it does not call clone_down(). - Add "ifname:sticky" keyword into $cloned_interfaces. If :sticky is specified, the interface will not be destroyed in rc.d/netif stop. - Add cloned_interfaces_sticky={YES,NO}. This variable globally sets :sticky keyword above for all interfaces. The default value is NO. When cloned_interfaces_sticky=YES, :nosticky keyword can be used to override it on per interface basis.
* Do not set ND6_IFF_ACCEPT_RTADV on if_bridge(4) interfaces whenhrs2013-07-211-5/+23
| | | | | | ipv6_enable=yes. MFC after: 3 days
* Fix address range specification with ifconfig(8) options such as:hrs2013-07-201-19/+54
| | | | | | | | | | | - inet 192.0.2.1-10 netmask 255.255.255.0 (inet range spec + ifconfig options) - inet6 2001:db8:1::1-f prefixlen 60 (inet6 range spec + ifconfig options) If prefixlen or netmask option is specified with CIDR notation at the same time, the option is used. Tested by: Michael Grimm MFC after: 3 days
* - Fix a bug in ipv6_prefix_IF. It did not work with the 64-bit prefixhrs2013-07-181-16/+4
| | | | | | | | | | notation like 2001:db8:1:1. - Use eui64 flag in ifconfig(8) instead of network6_getladdr()[*] for interface indentifier part. Suggested by: ume [*] MFC after: 3 days
* Add "ether" and "link" to ifconfig_alias{es,N}.hrs2013-06-301-2/+15
|
* Don't attempt to do DHCP on certain interfaces, similar to what's done fordelphij2013-06-281-1/+10
| | | | | | ipv6_autoconfif() in r212577. MFC after: 1 week
* Implement ifconfig_wlanX="HOSTAP".rpaulo2013-06-261-0/+25
| | | | | | | | | Not only this is a bit cleaner, it allows multiple instances of hostapd to be running on the system host, useful for simultaneous dual-band WiFi. This is similar to ifconfig_wlanX="WPA" but it uses /etc/hostapd-wlanX.conf. Compatibility with hostapd_enable=YES/NO was kept. Reviewed by: adrian
* - Add CIDR notation support like 192.168.1-2.10-16/24 to $ifconfig_IF_aliasN.hrs2013-06-201-235/+372
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an extended version of ipv4_addr_IF which supports both IPv4 and IPv6, and multiple range specifications. To avoid to generate too many addresses, the maximum number of the generated addresses is currently limited to 31. - Add $ifconfig_IF_aliases, which accepts multiple IP aliases in a variable. - ipv6_prefix_IF now supports !/64 prefix length. In addition to the old 64-bit format (2001:db8:1:1), a full 128-bit format like 2001:db8:1:1::/64 is supported. - Replace ifconfig command with $IFCONFIG_CMD variable to support a dry-run mode in the future. - Remove IP aliases before removing all of IPv4 addresses when doing "rc.d/netif down". - Add a DAD wait to network6_getladdr() because it is possible to fail to configure an EUI64 address when ipv6_prefix_IF is specified. A summary of the supported ifconfig_* variables is as follows: # IPv4 configuration. ifconfig_em0="inet 192.168.0.1" # IPv6 configuration. ifconfig_em0_ipv6="inet6 2001:db8::1/64" # IPv4 address range spec. Now deprecated. ipv4_addr_em0="10.2.1.1-10" # IPv6 alias. ifconfig_em0_alias0="inet6 2001:db8:5::1 prefixlen 70" # IPv4 alias. ifconfig_em0_alias1="inet 10.2.2.1/24" # IPv4 alias with range spec w/o AF keyword (backward compat). ifconfig_em0_alias2="10.3.1.1-10/32" # IPv6 alias with range spec. ifconfig_em0_alias3="inet6 2001:db8:20-2f::1/64" # ifconfig_IF_aliases is just like ifconfig_IF_aliasN. ifconfig_em0_aliases="inet 10.3.3.201-204/24 inet6 2001:db8:210-213::1/64 inet 10.1.1.1/24" # IPv6 alias (backward compat) ipv6_ifconfig_em0_alias0="inet6 2001:db8:f::1/64" # IPv6 alias w/o AF keyword (backward compat) ipv6_ifconfig_em0_alias1="2001:db8:f:1::1/64" # IPv6 prefix. ipv6_prefix_em0="2001:db8::/64" Tested by: Kimmo Paasiala
* Fix an issue when ipv6_enable=YES && ipv6_gateway_enable=YES which couldhrs2012-10-271-1/+5
| | | | | | | prevent rtadvd(8) from working as intended. Spotted by: brian Discussed with: brian
* Fix several glitches in IPv6-related knobs:hrs2012-01-221-6/+18
| | | | | | | | | | | | | | - ipv6_enable + ipv6_gateway_enable should unset ACCEPT_RTADV by default for backward compatibility. - Configurations in ipv6_prefix_IF should be recognized even if there is no ifconfig_IF_ipv6. - DAD wait should be performed at once, not on a per-interface basis, if possible. This fixes an issue that a system with a lot of IPv6-capable interfaces takes too long for booting. MFC after: 1 week
* Spelling fixes for etc/uqs2012-01-071-1/+1
|
* Add compatibility support for specifing IPv4 aliases inglebius2011-12-131-0/+7
| | | | | | rc.conf without the "inet" keyword. Obtained from: hrs
* Add support for removing addresses added by ipv6_prefix_hostid_addr_up()hrs2011-10-231-7/+10
| | | | upon rc.d/netif stop.
* Fix an issue that 127/8 is not configured when $ifconfig_DEFAULT is not empty.hrs2011-10-231-1/+1
| | | | Spotted by: ume
* Test if the interface is afif in dhcpif() and syncdhcpif(), asdelphij2011-09-281-0/+8
| | | | | | | done in ipv6_autoconfif. Reviewed by: hrs (freebsd-rc@) MFC after: 1 week
* Minor spelling, wording and punctuation fixes in comments.brueffer2011-09-141-6/+6
| | | | | | | PR: 155984 Submitted by: gcooper Approved by: re (kib) MFC after: 1 week
* - Add an warning when ifconfig_IF_ipv6 has no inet6 keyword in fronthrs2011-09-131-2/+10
| | | | | | | | of an IPv6 address. (r225489) - Use eval for ${ifconfig_args} to fix an issue fixed in r223506. (r225489) Approved by: re (bz)
* Add $ipv6_cpe_wanif to enable functionality required for IPv6 CPEhrs2011-09-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | (r225485). When setting an interface name to it, the following configurations will be enabled: 1. "no_radr" is set to all IPv6 interfaces automatically. 2. "-no_radr accept_rtadv" will be set only for $ipv6_cpe_wanif. This is done just before evaluating $ifconfig_IF_ipv6 in the rc.d scripts (this means you can manually supersede this configuration if necessary). 3. The node will add RA-sending routers to the default router list even if net.inet6.ip6.forwarding=1. This mode is added to conform to RFC 6204 (a router which connects the end-user network to a service provider network). To enable packet forwarding, you still need to set ipv6_gateway_enable=YES. Note that accepting router entries into the default router list when packet forwarding capability and a routing daemon are enabled can result in messing up the routing table. To minimize such unexpected behaviors, "no_radr" is set on all interfaces but $ipv6_cpe_wanif. Approved by: re (bz)
* Add support for string values with white spaces for ifconfig(8)pluknet2011-06-241-1/+1
| | | | | | | | | | | | parameters accepting them (such as description, group). Changes discussed on freebsd-rc. PR: conf/156675 Reported by: "Alexander V. Chernikov" <melifaro att ipfw ru> Suggested by: hrs Analyzed with: Alexander V. Chernikov via IRC MFC after: 2 weeks
* Add a helper function to check kern.features.* sysctls.hrs2011-06-111-5/+2
| | | | Discussed with: dougb
* Do not mark lo0 as IFDISABLED even if there is no $ifconfig_lo0_ipv6 line.hrs2011-06-061-1/+1
|
* Remove "ifconfig IF inet6 -accept_rtadv" when ipv6_gateway_enable=YES becausehrs2011-06-061-16/+10
| | | | this is no longer needed.
* No logner set an IPv4 loopback address by default in defaults/rc.conf.bz2011-05-311-8/+20
| | | | | | | | | | | | | | | | | | If not specified, network.subr will add it automatically if we have INET support (1). In network.subr only call the address family up/down functions if the respective AF is available. Switch to new kern.features variables for inet and inet6 as the inet sysctl tree is also available for IPv6-only kernels leading to unexpected results. Suggested by: hrs (1) Reviewed by: hrs Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 20 days
* network.subr: Use printf(1) builtin for hexprint function.jilles2011-05-141-26/+2
| | | | | | | | | Now that printf(1) is a shell builtin, there is no need to emulate it anymore. The external printf(1) is /usr/bin/printf and therefore may not be available in early boot. It may be faster to use printf directly but the function is useful for compatibility.
* Split $ipv6_prefer into $ip6addrctl_policy and $ipv6_activate_all_interfaces.hrs2010-09-131-1/+1
| | | | | | | | | | | | | | | | | | | The $ip6addrctl_policy is a variable to choose a pre-defined address selection policy set by ip6addrctl(8). The keyword "ipv4_prefer" sets IPv4-preferred one described in Section 10.3, the keyword "ipv6_prefer" sets IPv6-preferred one in Section 2.1 in RFC 3484, respectively. When "AUTO" is specified, it attempts to read /etc/ip6addrctl.conf first. If it is found, it reads and installs it as a policy table. If not, either of the two pre-defined policy tables is chosen automatically according to $ipv6_activate_all_interfaces. When $ipv6_activate_all_interfaces=NO, interfaces which have no corresponding $ifconfig_IF_ipv6 is marked as IFDISABLED for security reason. The default values are ip6addrctl_policy=AUTO and ipv6_activate_all_interfaces=NO. Discussed with: ume and bz
* Localize $_punct_c in get_if_var() and whitespace clean-ups.hrs2010-09-131-6/+6
| | | | Based on: changes in r206408 by dougb
* - Check some specific IFs first in ipv6_autoconfif().hrs2010-09-131-18/+15
| | | | | | - $ipv6_enable supports YES|TRUE|ON|1 as in checkyesno(). Based on: changes in r206408 by dougb
* Fix $ipv6_network_interfaces and set it as AUTO by default.hrs2010-09-131-22/+11
| | | | Based on: changes in r206408 by dougb
* Revert changes in r206408.hrs2010-09-131-85/+126
| | | | Discussed with: dougb, core.5, and core.6
* Prevent unloading a kld for a driver that has subinterfaces (vlan and/orjhb2010-05-171-9/+3
| | | | | | | | | | | | | | | | | wlan interfaces) from being automatically reloaded via devd shutdown event handlers. - Revert part of my previous changes to call ifn_stop on subinterfaces when an interface is detached. It is better to destroy the interfaces first so that an 'ifconfig foo0.blah down' doesn't result in ifconfig auto-loading if_foo.ko. The ifconfig command will not be invoked if foo0.blah is gone when ifn_stop() is called. Furthermore, it is not necessary to explicitly invoke ifn_stop() after the subinterface is destroyed as devd will already do that. - Pass -n to ifconfig when destroying interfaces so that destroying a cloned interface does not kldload any drivers. Reviewed by: dougb MFC after: 4 days
* Remove trailing white space. No functional changes.dougb2010-05-141-5/+5
|
* Make address assignment via ipv6_prefix_IF work againdougb2010-05-041-0/+2
|
* Improve the handling of IPv6 configuration in rc.d. The ipv6_enabledougb2010-04-091-121/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and ipv6_ifconfig_<interface> options have already been deprecated, these changes do not alter that. With these changes any value set for ipv6_enable will emit a warning. In order to avoid a POLA violation for the deprecation of the option ipv6_enable=NO will still disable configuration for all interfaces other than lo0. ipv6_enable=YES will not have any effect, but will emit an additional warning. Support and warnings for this option will be removed in FreeBSD 10.x. Consistent with the current code, in order for IPv6 to be configured on an interface (other than lo0) an ifconfig_<interface>_ipv6 option will have to be added to /etc/rc.conf[.local]. 1. Clean up and minor optimizations for the following functions: ifconfig_up (the ipv6 elements) ipv6if ipv6_autoconfif get_if_var _ifconfig_getargs The cleanups generally were to move the "easy" tests earlier in the functions, and consolidate duplicate code. 2. Stop overloading ipv6_prefer with the ability to disable IPv6 configuration. 3. Remove noafif() which was only ever called from ipv6_autoconfif. Instead, simplify and integrate the tests into that function, and convert the test to use is_wired_interface() instead of listing wireless interfaces explicitly. 4. Integrate backwards compatibility for ipv6_ifconfig_<interface> into _ifconfig_getargs. This dramatically simplifies the code in all of the callers, and avoids a lot of other code duplication. 5. In rc.d/netoptions, add code for an ipv6_privacy option to use RFC 4193 style pseudo-random addresses (this is what windows does by default, FYI). 6. Add support for the [NO]RTADV options in ifconfig_getargs() and ipv6_autoconfif(). In the latter, include support for the explicit addition of [-]accept_rtadv in ifconfig_<interface>_ipv6 as is done in the current code. 7. In rc.d/netif add a warning if $ipv6_enable is set, and remove the set_rcvar_obsolete for it. Also remove the latter from rc.d/ip6addrctl. 8. In /etc/defaults/rc.conf: Add an example for RTADV configuration. Set ipv6_network_interfaces to AUTO. Switch ipv6_prefer to YES. If ipv6_enable is not set this will have no effect. Add a default for ipv6_privacy (NO). 9. Document all of this in rc.conf.5.
* Add rc.d script for the rtsold(8) daemon.ume2010-02-031-1/+3
| | | | | | | | | | The rtsol(8) handles just one RA then exit. So, the OtherConfig flag may not be handled well by rtsol(8) in the environment where there are multiple RA servers on the segment. In such case, rtsold(8) will be your friend. Reviewed by: hrs MFC after: 2 weeks
* Remove a trailing reference to the obsolete vaps_<IF> variable.jhb2009-12-291-1/+1
| | | | | Reviewed by: brooks MFC after: 3 days
* Add support for configuring vlan(4) interfaces as child devices similar tojhb2009-12-291-2/+48
| | | | | | | | | | | | | | wlan(4) interfaces. vlan(4) interfaces are listed via a new 'vlans_<IF>' variable. If a vlan interface is a number, then that number is treated as the vlan tag for the interface and the interface will be named '<IF>.<tag>'. Otherwise, the vlan tag must be provided via a vlan parameter in a 'create_args_<vlan>' variable. While I'm here, fix a few nits in rc.conf(5) and mention create_args_<IF> in the description of cloned_interfaces. Reviewed by: brooks MFC after: 2 weeks
* - Add AF_IPX and AF_NATM to afexists().hrs2009-10-021-0/+10
| | | | | | - Add afexists() check to address family specific rc.d scripts. A script for an AF will be silently ignored if the kernel has no support for the AF.
* Fix several logic bugs in the previous IPv6 variable change andhrs2009-09-261-12/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | re-add $ipv6_enable support for backward compatibility. From UPDATING: 1. To use IPv6, simply define $ifconfig_IF_ipv6 like $ifconfig_IF for IPv4. For aliases, $ifconfig_IF_aliasN should be used. Note that both variables need the "inet6" keyword at the head. Do not set $ipv6_network_interfaces manually if you do not understand what you are doing. It is not needed in most cases. $ipv6_ifconfig_IF and $ipv6_ifconfig_IF_aliasN still work, but they are obsolete. 2. $ipv6_enable is obsolete. Use $ipv6_prefer and/or "inet6 accept_rtadv" keyword in ifconfig(8) instead. If you define $ipv6_enable=YES, it means $ipv6_prefer=YES and all configured interfaces have "inet6 accept_rtadv" in the $ifconfig_IF_ipv6. These are for backward compatibility. 3. A new variable $ipv6_prefer has been added. If NO, IPv6 functionality of interfaces with no corresponding $ifconfig_IF_ipv6 is disabled by using "inet6 ifdisabled" flag, and the default address selection policy of ip6addrctl(8) is the IPv4-preferred one (see rc.d/ip6addrctl for more details). Note that if you want to configure IPv6 functionality on the disabled interfaces after boot, first you need to clear the flag by using ifconfig(8) like: ifconfig em0 inet6 -ifdisabled If YES, the default address selection policy is set as IPv6-preferred. The default value of $ipv6_prefer is NO. 4. If your system need to receive Router Advertisement messages, define "inet6 accept_rtadv" in $ifconfig_IF_ipv6. The rc(8) scripts automatically invoke rtsol(8) when the interface becomes UP. The Router Advertisement messages are used for SLAAC (State-Less Address AutoConfiguration).
* Add missing comments and whitespace clean-ups.hrs2009-09-121-42/+64
|
OpenPOWER on IntegriCloud