aboutsummaryrefslogtreecommitdiff
path: root/etc/network.subr
Commit message (Collapse)AuthorAgeFilesLines
* Opps, I missed moving a couple of files in r336845.Brad Davis2018-07-281-1793/+0
| | | | | | | | Approved by: will (mentor) Differential Revision: https://reviews.freebsd.org/D16466 Notes: svn path=/head/; revision=336847
* Reduce code duplication for wlan(4) interface creation in network.subr.Andriy Voskoboinyk2017-11-191-15/+7
| | | | | | | | Since wlandebug(8) can accept any (original or changed) interface name this part may be simplified a bit. Notes: svn path=/head/; revision=326001
* Add suitable knob ifconfig_<interface>_descr for static interface description.Eugene Grosbein2017-11-081-1/+6
| | | | | | | | | | Document availability of interface descriptions within rc.conf(5). Approved by: avg (mentor), mav (mentor) MFC after: 3 days Notes: svn path=/head/; revision=325559
* Remove NATM configuration bits and assorted NATM and ATM remnants.Brooks Davis2017-04-251-7/+0
| | | | | | | | | Reported by: ak Reviewed by: ngie (first version) Differential Revision: https://reviews.freebsd.org/D10497 Notes: svn path=/head/; revision=317424
* network.subr: avoid unnecessary reinitializationAndriy Voskoboinyk2016-02-291-4/+2
| | | | | | | | | | | | | | | Do not start interface when wpa_supplicant or hostapd is used; they will restart it anyway Tested with: * Intel 3945BG, STA mode (wpa_supplicant) * RTL8188EU, HOSTAP mode (hostapd) Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5486 Notes: svn path=/head/; revision=296226
* Replay r286410. Change KPI of how device drivers that provide wirelessGleb Smirnoff2015-08-271-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | connectivity interact with the net80211 stack. Historical background: originally wireless devices created an interface, just like Ethernet devices do. Name of an interface matched the name of the driver that created. Later, wlan(4) layer was introduced, and the wlanX interfaces become the actual interface, leaving original ones as "a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer and a driver became a mix of methods that pass a pointer to struct ifnet as identifier and methods that pass pointer to struct ieee80211com. From user point of view, the parent interface just hangs on in the ifconfig list, and user can't do anything useful with it. Now, the struct ifnet goes away. The struct ieee80211com is the only KPI between a device driver and net80211. Details: - The struct ieee80211com is embedded into drivers softc. - Packets are sent via new ic_transmit method, which is very much like the previous if_transmit. - Bringing parent up/down is done via new ic_parent method, which notifies driver about any changes: number of wlan(4) interfaces, number of them in promisc or allmulti state. - Device specific ioctls (if any) are received on new ic_ioctl method. - Packets/errors accounting are done by the stack. In certain cases, when driver experiences errors and can not attribute them to any specific interface, driver updates ic_oerrors or ic_ierrors counters. Details on interface configuration with new world order: - A sequence of commands needed to bring up wireless DOESN"T change. - /etc/rc.conf parameters DON'T change. - List of devices that can be used to create wlan(4) interfaces is now provided by net.wlan.devices sysctl. Most drivers in this change were converted by me, except of wpi(4), that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann, Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in testing. Reviewed by: adrian Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=287197
* Commit more of the reversion of r286410 . Sorry.Adrian Chadd2015-08-101-67/+0
| | | | Notes: svn path=/head/; revision=286564
* Change KPI of how device drivers that provide wireless connectivity interactGleb Smirnoff2015-08-071-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with the net80211 stack. Historical background: originally wireless devices created an interface, just like Ethernet devices do. Name of an interface matched the name of the driver that created. Later, wlan(4) layer was introduced, and the wlanX interfaces become the actual interface, leaving original ones as "a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer and a driver became a mix of methods that pass a pointer to struct ifnet as identifier and methods that pass pointer to struct ieee80211com. From user point of view, the parent interface just hangs on in the ifconfig list, and user can't do anything useful with it. Now, the struct ifnet goes away. The struct ieee80211com is the only KPI between a device driver and net80211. Details: - The struct ieee80211com is embedded into drivers softc. - Packets are sent via new ic_transmit method, which is very much like the previous if_transmit. - Bringing parent up/down is done via new ic_parent method, which notifies driver about any changes: number of wlan(4) interfaces, number of them in promisc or allmulti state. - Device specific ioctls (if any) are received on new ic_ioctl method. - Packets/errors accounting are done by the stack. In certain cases, when driver experiences errors and can not attribute them to any specific interface, driver updates ic_oerrors or ic_ierrors counters. Details on interface configuration with new world order: - A sequence of commands needed to bring up wireless DOESN"T change. - /etc/rc.conf parameters DON'T change. - List of devices that can be used to create wlan(4) interfaces is now provided by net.wlan.devices sysctl. Most drivers in this change were converted by me, except of wpi(4), that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing changes to at least 8 drivers. Thanks to Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in testing. Details here: https://wiki.freebsd.org/projects/ifnet/net80211 Still, drivers: ndis, wtap, mwl, ipw, bwn, wi, upgt, uath were not tested. Changes to mwl, ipw, bwn, wi, upgt are trivial and chances of problems are low. The wtap wasn't compilable even before this change. But the ndis driver is complex, and it is likely to be broken with this commit. Help with testing and debugging it is appreciated. Differential Revision: D2655, D2740 Sponsored by: Nginx, Inc. Sponsored by: Netflix Notes: svn path=/head/; revision=286410
* Fix a typo in ipv6_down().Rui Paulo2015-02-181-1/+1
| | | | | | | | | | We weren't skipping extraneous entries in the ifconfig | grep inet6 case. Submitted by: Ashutosh Kumar AK0037447 at TechMahindra.com MFC after: 1 week Notes: svn path=/head/; revision=278933
* Renove faith(4) and faithd(8) from base. It looks like industryAlexander V. Chernikov2014-11-091-2/+0
| | | | | | | | | | | | have chosen different (and more traditional) stateless/statuful NAT64 as translation mechanism. Last non-trivial commits to both faith(4) and faithd(8) happened more than 12 years ago, so I assume it is time to drop RFC3142 in FreeBSD. No objections from: net@ Notes: svn path=/head/; revision=274331
* - Add $netif_ipexpand_max to specify the upper limit for the number ofHiroki Sato2014-09-111-7/+5
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=271424
* Fix ifname normalization. ifconfig_IF_alias{es,N} did not work if ifname hasHiroki Sato2014-06-241-7/+7
| | | | | | | | | any of [.-/+]. Spotted by: jhay Notes: svn path=/head/; revision=267812
* Fix address matching rule.Hiroki Sato2014-06-191-1/+1
| | | | | | | Reported by: jase Notes: svn path=/head/; revision=267636
* Fix warning messages after r252015Eygene Ryabinkin2014-05-201-5/+4
| | | | | | | | | | | | | | $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 MFC after: 1 week Notes: svn path=/head/; revision=266475
* Fix an issue in range specification handling when a "-foo" is specified inHiroki Sato2014-05-161-2/+2
| | | | | | | ifconfig_IF_aliasN. Notes: svn path=/head/; revision=266267
* Move configuration of IPv6 NDP flags to a point before handling ifconfig_IF.Hiroki Sato2014-05-161-7/+10
| | | | | | | | This fixes a race that a non-IPv4 interface can get an EUI64 LLA even if it has IFDISABLED nd6 flag at boot time. Notes: svn path=/head/; revision=266225
* Loosen the processing of *_IF_aliasN vars to be less strict. Previously,Devin Teske2014-04-071-12/+14
| | | | | | | | | | | | | | 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. Discussed on: -rc MFC after: 1 week Notes: svn path=/head/; revision=264243
* Remove IPX support.Gleb Smirnoff2014-03-141-56/+1
| | | | | | | | | | | | | | IPX was a network transport protocol in Novell's NetWare network operating system from late 80s and then 90s. The NetWare itself switched to TCP/IP as default transport in 1998. Later, in this century the Novell Open Enterprise Server became successor of Novell NetWare. The last release that claimed to still support IPX was OES 2 in 2007. Routing equipment vendors (e.g. Cisco) discontinued support for IPX in 2011. Thus, IPX won't be supported in FreeBSD 11.0-RELEASE. Notes: svn path=/head/; revision=263140
* Revert r257715. This breaks the case where devd isn't running. TheJohn Baldwin2013-11-121-0/+6
| | | | | | | | real solution to this is still being discussed and probably won't look quite like this. Notes: svn path=/head/; revision=258061
* Don't explicitly invoke ifn_start on new child interfaces (vaps andJohn Baldwin2013-11-051-6/+0
| | | | | | | | | | | | | | subinterfaces) after they are created. Interfaces are already started by devd invoking /etc/pccard_ether when they are created, so the explicit calls in childif_create() resulted in interfaces being started twice. Note that interfaces created via cloned_interfaces are not explicitly started but depend on the devd mechanism already. MFC after: 1 week Notes: svn path=/head/; revision=257715
* Remove more remnants of ng_fec(4).Gleb Smirnoff2013-10-281-48/+0
| | | | | | | | | | | The ng_create_one() and ng_mkpeer() functions in network.subr are now not used anywhere, but I left them, since they can be useful in future in netgraph scripting. Submitted by: pluknet Notes: svn path=/head/; revision=257261
* Add support for "vnet jname" argument in ifconfig_IF. The vnet keywordHiroki Sato2013-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) Notes: svn path=/head/; revision=256255
* Do not attempt to do AF-specific configurations on a interface whenHiroki Sato2013-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) Notes: svn path=/head/; revision=256040
* Add epair(4) support in $cloned_interfaces. One should be specifiedHiroki Sato2013-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) Notes: svn path=/head/; revision=256039
* Fix parsing lines of ifconfig output which include \t in the case ofHiroki Sato2013-09-171-7/+8
| | | | | | | | | inet and inet6. Approved by: re (delphij) Notes: svn path=/head/; revision=255653
* Correctly remove an interface's ipv4 address when the user callsAlan Somers2013-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 Notes: svn path=/head/; revision=254743
* - Reimplement $gif_interfaces as a variant of $cloned_interfaces.Hiroki Sato2013-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. Notes: svn path=/head/; revision=253924
* Do not set ND6_IFF_ACCEPT_RTADV on if_bridge(4) interfaces whenHiroki Sato2013-07-211-5/+23
| | | | | | | | | ipv6_enable=yes. MFC after: 3 days Notes: svn path=/head/; revision=253520
* Fix address range specification with ifconfig(8) options such as:Hiroki Sato2013-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 Notes: svn path=/head/; revision=253505
* - Fix a bug in ipv6_prefix_IF. It did not work with the 64-bit prefixHiroki Sato2013-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 Notes: svn path=/head/; revision=253444
* Add "ether" and "link" to ifconfig_alias{es,N}.Hiroki Sato2013-06-301-2/+15
| | | | Notes: svn path=/head/; revision=252426
* Don't attempt to do DHCP on certain interfaces, similar to what's done forXin LI2013-06-281-1/+10
| | | | | | | | | ipv6_autoconfif() in r212577. MFC after: 1 week Notes: svn path=/head/; revision=252360
* Implement ifconfig_wlanX="HOSTAP".Rui Paulo2013-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 Notes: svn path=/head/; revision=252230
* - Add CIDR notation support like 192.168.1-2.10-16/24 to $ifconfig_IF_aliasN.Hiroki Sato2013-06-201-234/+371
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=252015
* Fix an issue when ipv6_enable=YES && ipv6_gateway_enable=YES which couldHiroki Sato2012-10-271-1/+5
| | | | | | | | | | prevent rtadvd(8) from working as intended. Spotted by: brian Discussed with: brian Notes: svn path=/head/; revision=242181
* Fix several glitches in IPv6-related knobs:Hiroki Sato2012-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 Notes: svn path=/head/; revision=230453
* Spelling fixes for etc/Ulrich Spörlein2012-01-071-1/+1
| | | | Notes: svn path=/head/; revision=229783
* Add compatibility support for specifing IPv4 aliases inGleb Smirnoff2011-12-131-0/+7
| | | | | | | | | rc.conf without the "inet" keyword. Obtained from: hrs Notes: svn path=/head/; revision=228472
* Add support for removing addresses added by ipv6_prefix_hostid_addr_up()Hiroki Sato2011-10-231-7/+10
| | | | | | | upon rc.d/netif stop. Notes: svn path=/head/; revision=226652
* Fix an issue that 127/8 is not configured when $ifconfig_DEFAULT is not empty.Hiroki Sato2011-10-231-1/+1
| | | | | | | Spotted by: ume Notes: svn path=/head/; revision=226649
* Test if the interface is afif in dhcpif() and syncdhcpif(), asXin LI2011-09-281-0/+8
| | | | | | | | | | done in ipv6_autoconfif. Reviewed by: hrs (freebsd-rc@) MFC after: 1 week Notes: svn path=/head/; revision=225849
* Minor spelling, wording and punctuation fixes in comments.Christian Brueffer2011-09-141-6/+6
| | | | | | | | | | PR: 155984 Submitted by: gcooper Approved by: re (kib) MFC after: 1 week Notes: svn path=/head/; revision=225560
* - Add an warning when ifconfig_IF_ipv6 has no inet6 keyword in frontHiroki Sato2011-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) Notes: svn path=/head/; revision=225522
* Add $ipv6_cpe_wanif to enable functionality required for IPv6 CPEHiroki Sato2011-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) Notes: svn path=/head/; revision=225521
* Add support for string values with white spaces for ifconfig(8)Sergey Kandaurov2011-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 Notes: svn path=/head/; revision=223506
* Add a helper function to check kern.features.* sysctls.Hiroki Sato2011-06-111-5/+2
| | | | | | | Discussed with: dougb Notes: svn path=/head/; revision=222996
* Do not mark lo0 as IFDISABLED even if there is no $ifconfig_lo0_ipv6 line.Hiroki Sato2011-06-061-1/+1
| | | | Notes: svn path=/head/; revision=222746
* Remove "ifconfig IF inet6 -accept_rtadv" when ipv6_gateway_enable=YES becauseHiroki Sato2011-06-061-16/+10
| | | | | | | this is no longer needed. Notes: svn path=/head/; revision=222733
* No logner set an IPv4 loopback address by default in defaults/rc.conf.Bjoern A. Zeeb2011-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 Notes: svn path=/head/; revision=222515
* network.subr: Use printf(1) builtin for hexprint function.Jilles Tjoelker2011-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. Notes: svn path=/head/; revision=221884