summaryrefslogtreecommitdiffstats
path: root/etc/network.subr
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Integrate rc.d/network_ipv6 into rc.d/netif:hrs2009-09-121-325/+520
| | | | | | | | | | - Add rc.d/stf and rc.d/faith for stf(4) and faith(4). - Remove rc.d/auto_linklocal and rc.d/network_ipv6. - Move rc.d/sysctl to just before FILESYSTEMS because rc.d/netif depends on some sysctl variables. Reviewed by: brooks MFC after: 3 days
* In the loop through the list of interfaces in network6_interface_setup()dougb2009-08-271-2/+2
| | | | | | | | | | | rtsol_interface gets reset to "yes" each time through the loop, but rtsol_available does not. If a user has lo0 first in their list of interfaces rtsol_available will get set to "no" the first time through the loop and subsequent interfaces will not get rtsol'ed when they should. Therefore change the conditional for the is_wired() test to _interface. Noticed by: Dimitry Andric <dimitry@andric.com>
* Improve the case test to detect the presence of lo0 in the list ofdougb2009-08-241-1/+1
| | | | | | network_interfaces. Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
* Prior to the dire warning about values of network_interfaces other thandougb2009-08-231-0/+7
| | | | | | AUTO the biggest mistake users made was leaving lo0 off the list. Since lo0 is effectively mandatory, check for it and add it to the list if it's not there.
* Move is_wired_interface() from rc.d/wpa_supplicant into network.subr,dougb2009-08-231-3/+19
| | | | | | | | | simplify it a bit, and make use of that method to determine if an interface is a candidate for IPv6 rtsol rather than listing all of the possible wireless interfaces that should _not_ get rtsol'ed. This change is only relevant for 8.0+ unless the "wlan mandatory" code gets ported back to RELENG_7.
* rtsol should not be run on the wireless NIC interfaces directly,dougb2009-06-261-0/+3
| | | | it will run on wlan0 instead.
* Eliminate the warning that "Values of network_interfaces other thandougb2009-06-011-4/+0
| | | | | | AUTO are deprecated.' There is no good reason to deprecate them, and setting this to different values can be useful for custom solutions and/or one-off configuration problems.
* Add support for setting the debug flags on wlan interfaces after the arebrooks2009-03-131-1/+9
| | | | created using wlandebug_<ifn> variables.
* Check for NOAUTO on child interfaces (eg wlanX) so they can be created viathompsa2009-02-041-1/+3
| | | | rc.conf but not necessarily started.
* Remove compat support for vaps_<ifn> and vap_create_<ifn> variables asbrooks2008-10-011-7/+1
| | | | | | promised in r178527. These variables were never in a release version. Reminded by: sam
* Implement a "quiet" mode for rc.d/netif, which only outputsmtm2008-06-231-8/+0
| | | | | | | | | the interface name of interfaces that were configured. This change has the added benefit that ifn_start() and ifn_stop() in network.subr no longer write to standard output. Whether to output and what to output is now handled entirely in rc.d/netif.
* Add a missing space between a variable and the ] for a testdougb2008-05-261-1/+1
|
* Change the default value of synchronous_dhclient to NO.brooks2008-05-151-0/+23
| | | | | | | | | To preserve the existing behavior of etc/rc.d/netif, add code to wait up to if_up_delay seconds (30 seconds by default) for a default route to be configured if there are any dhcp interfaces. This should be extended to test that the interface is actually up. X-MFC after:
* Fix last commit and call childif_destroy() correctly.brooks2008-05-151-1/+1
|
* Don't print the interface status if we only create child or destroybrooks2008-05-141-3/+3
| | | | | | interfaces. Correctly return status from childif_create().
* Emit a warning when the network_interfaces variable is not set to AUTO.brooks2008-04-301-0/+4
| | | | MFC after: 3 days
* Replace the prototype vaps_<ifn> and vap_create_<ifn> variables withbrooks2008-04-251-9/+16
| | | | | | | | | | | | | more wlans_<ifn> and create_args_<ifn> Add documentation for these variants and generally update the wireless device example. There is are very short lived shim from vaps_<ifn> which produces a warning and vap_create_<ifn> which does not. Misuse the MFC notification service to remind me to remove them. MFC after: 3 weeks
* rc support for vapssam2008-04-201-1/+89
|
* Support gif_interface values that don't follow the pattern gif###.brooks2008-03-281-9/+6
| | | | Remove ancient compatablity support for gif_interface="NO".
* Change wpa_supplicant to down the interface at the start of the init routine.thompsa2007-11-051-3/+0
| | | | | | | | | | | | | | | | | | wpa_supplicant expects that it has exclusive access to the net80211 state so when its starts poking in the WEP/WPA settings and the card is already scanning it can cause net80211 to try and associate incorrectly with a protected AP. This is an inconvenience for firmware based cards such as iwi where it can be sent an auth instruction with incomplete security info and cause a firmware error. Remove the 'ifconfig up' from network.subr since wpa_supplicant will immediately down the interface again. Reported by: Guy Helmer (and others) Reviewed by: sam, brooks, avatar MFC after: 3 days
* Do not attempt to load the kernel module when checking if an interface exists.thompsa2007-05-231-1/+1
| | | | | | | This would cause pseudo network modules to be reloaded again when trying to unload the first time if any cloned interfaces exist. MFC after: 2 weeks
* Back out network.subr :- fix and comment out dhc*_fxp0 examples insteadache2007-03-291-1/+1
| | | | Submitted by: jhb
* Fix get_if_var() with 3 args (i.e. with default)ache2007-03-291-1/+1
| | | | | | | | | | | | | All xxx_<ifname> flags are set to empty strings automatically earlier so eval echo \${${prefix}${_if}${suffix}-${_default}} not substitute the default but return just the empty string. Fix it using eval echo \${${prefix}${_if}${suffix}:-${_default}} (i.e. treat empty strings as unset) The bug manifistates itself with the following warning from checkyesno(): /etc/rc.d/dhclient: WARNING: $background_dhclient is not set properly - see rc.conf(5)
* Add support for EtherChannel configuration to rc startup scripts.flz2007-02-091-10/+73
| | | | | | | | | | Note: This also deprecates "NO" as a way to specify an empty list of interfaces for gif_interfaces. PR: conf/104884 Submitted by: nork Harassed by: brd Discussed with: brooks, dougb
* Do not try to rtsol on pflog or pfsync devices.mlaier2006-10-291-1/+1
|
* Restore the behavior that net.inet6.ip6.auto_linklocal=0 couldume2006-10-071-4/+0
| | | | | | be coexist with ipv6_enable="YES". MFC after: 3 days
* Turn off automatic link local address if ipv6_enable is not set to YESgnn2006-10-021-0/+4
| | | | | | | in rc.conf Reviewed by: KAME core team, cperciva MFC after: 3 days
* Introduce a new method ipv6if which attemptes to figure out if anbrooks2006-09-211-0/+24
| | | | | | | | | | | | | | interface is an IPv6 interface. Use this method to decide if we should attempt to configure an interface with an IPv6 address in pccard_ether. The mechanism pccard_ether uses to do this is unsuited to the task because it assumes the list of interfaces it is passed is the full list of IPv6 interfaces and makes decissions based on that. This is at least a step in the right direction and is probably about as much as we can MFC safely. PR: conf/103428 MFC after: 3 days
* Introduce a new function, ifexists and use it to avoid attempting tobrooks2006-08-171-26/+41
| | | | | | | | touch interfaces that don't actually exist in the stop case. In the process move some IPv4 specific code from ifconfig_down to ipv4_down. This should solve problems with ifconfig: error messages on boot when interfaces are renamed.
* Spell synchronous with required silent 'h'.brooks2006-04-131-1/+1
| | | | | Reported by: ru, ceri Pointy hat: brooks
* Add missing _ to $_punct.brooks2006-04-131-1/+1
| | | | Submitted by: Dmitry Pryanishnikov <dmitry at atlantis.dp.ua>
* Commit the various network interface configutation updates I've beenbrooks2006-04-131-22/+79
| | | | | | | | | | | | | | | | working on. 1) Make it possible to configure interfaces with certain characters in their names that aren't valid in shell variables. Currently supported characters are ".-/+". They are converted into '_' characters. 2) Replace nearly all eval statements in network.subr with a new function get_if_var which substitues an interface name (after the translations above) for "IF" in a variable name. 3) Fix list_net_interfaces() in the nodhcp case. 4) Allow the administrator to specify if dhclient should be started when /etc/rc.d/netif configures the interface or only by devd. This can be set on both a per interface and system wide basis. PR: conf/88974 [1,2], conf/92433 [1,2]
* Add a new configuration variable, ipv4_addrs_<ifn>, which adds one orbrooks2005-11-141-0/+58
| | | | | | | | | | | more IPv4 address from a ranged list in CIRD notation: ipv4_addrs_ed0="192.168.0.1/24 192.168.1.1-5/28" In the process move alias processing into new ipv4_up/down functions to more toward a less IPv4 centric world. Submitted by: Philipp Wuensche <cryx dash freebsd at h3q dot com>
* - Alwasy explicitly bring the interface up before configuring it.brooks2005-09-021-7/+17
| | | | | | | | - If an interface's ifconfig_<ifn> is set, but empty, don't set it to ifconfig_DEFAULT. This way interfaces can be disabled even in the presence of ifconfig_DEFAULT. - When listing interfaces and network_interfaces=auto, place lo0 first if it's around.
* Support ifconfig_<ifn> variables containing quoted variables with spacesbrooks2005-08-261-1/+1
| | | | | | | | in them by wrapping the ifconfig command with eval "...". For example, this allows: ifconfig_iwi0="DHCP ssid 'foo bar baz'"
* - Remove the removable_interfaces variable. /etc/pccard_ether willbrooks2005-08-241-2/+27
| | | | | | | | | | | | now run on any interface. - Add a new ifconfig_<ifn> keyword, NOAUTO which prevents configuration of an interface at boot or via /etc/pccard_ether. This allows /etc/rc.d/netif to be used to start and stop an interface on a purely manual basis. The decision to affect pccard_ether may be revisited at a later date. Requested by: imp, gallatin (removable_interfaces) Discussed with: sam, Randy Bush (NOAUTO)
* - Remove the pccard_ifconfig variable in favor of a newbrooks2005-06-301-34/+7
| | | | | | | | | | | | | ifconfig_DEFAULT variable. Unlike pccard_ifconfig, ifconfig_DEFAULT applies to all interfaces that do not specify an ifconfig_<ifn> variable rather than just those listed in removable_interfaces. - Correct the list of interfaces when network_interfaces and removable_interfaces are both set by including removable_interfaces in the list of canidates. - When listing dhcp interfaces, include those with other ifconfig options so nat works. Approved by: re (network interface startup blanket)
* Add support for starting wpa_supplicant by adding the WPA keyword to anbrooks2005-06-301-2/+2
| | | | | | interface's ifconfig_<ifn> entry in /etc/rc.conf. Approved by: re (network interface startup blanket)
* Fix return values of ifconfig_up/down.brooks2005-06-071-4/+5
| | | | Reported by: Andrea Campi
OpenPOWER on IntegriCloud