History log of /src/libexec/rc/network.subr (Results 1 – 25 of 280)
Revision Date Author Comments
# 24e8ed53 01-Jul-2025 Eugene Grosbein <eugen@FreeBSD.org>

network.subr: correct return code in case of bad call to ifisup()

This is rather cosmetic correction.

PR: 287872
MFC-after: 2 weeks
X-MFC-With: 6d3bc576abbd84f736d917f5bfec4e3fe7e6c125


# 6d3bc576 01-Jul-2025 Eugene Grosbein <eugen@FreeBSD.org>

libexec/rc: improve performance of pccard_ether script

Replace "ifconfig -ul" with "ifconfig -n" because netlink-enabled
/sbin/ifconfig utility has sub-optimal performance for listing.

Combined wit

libexec/rc: improve performance of pccard_ether script

Replace "ifconfig -ul" with "ifconfig -n" because netlink-enabled
/sbin/ifconfig utility has sub-optimal performance for listing.

Combined with the commit b1b17432aa1be670564161232d110461a5dde4ce,
these changes mostly eliminate performance regression of the command
"service devd start" for a system having hundreds of network interfaces
created before devd starts, after FreeBSD 14+ switched
/sbin/ifconfig to netlink(4)

PR: 287872
MFC-after: 2 weeks

show more ...


# ed4d2a54 04-Sep-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

rc: network.subr update consitency with older change (v6/v4 order)

As of 1b5be7204eaeeaf58eefdebe5b308f90792c693b we setup parts of IPv6
before IPv4 if configured. For consistency change a case in

rc: network.subr update consitency with older change (v6/v4 order)

As of 1b5be7204eaeeaf58eefdebe5b308f90792c693b we setup parts of IPv6
before IPv4 if configured. For consistency change a case in ifn_start()
calling ipv6_up() before ipv4_up() and reverse in ifn_stop().

MFC after: 10 days
Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D33426

show more ...


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# de1dde5d 18-Apr-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

network.subr: adjust regex for wlans_xxxxx rc.conf entries

Drivers like ath1[012]k will not match the current wlans_*-regex as
they have digits followed by letters. Adjust the regex to allow
this c

network.subr: adjust regex for wlans_xxxxx rc.conf entries

Drivers like ath1[012]k will not match the current wlans_*-regex as
they have digits followed by letters. Adjust the regex to allow
this combination in order to be able to configure interfaces with
names like wlans_ath11k0="..."

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39674

show more ...


# e3e57edf 14-Dec-2022 Cy Schubert <cy@FreeBSD.org>

network.subr: Fix infinite loop

When setting up carp tunnel, using a password consisting of only the
characters used as hexadecimal characters, i.e. abc-def, there will be
an infinite loop in the sh

network.subr: Fix infinite loop

When setting up carp tunnel, using a password consisting of only the
characters used as hexadecimal characters, i.e. abc-def, there will be
an infinite loop in the shell function ifalias_af_common_handler().
To circumvent this we test for " pass ".

PR: 268378
Reported by: jyoung15@gmail.com
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37748

show more ...


# 87061d3b 14-Dec-2022 Cy Schubert <cy@FreeBSD.org>

network.subr: Add missing brace

PR: 268378
Submitted by: jyoung15@gmail.com
Reported by: jyoung15@gmail.com
MFC after: 3 days


# fef0e429 21-Dec-2022 Cy Schubert <cy@FreeBSD.org>

network.subr: Replace "\ " with "[[:space:]]"

"[[:space:]]" is easier to read than "\ " and is conisitent with
clone_up().

Reported by: eugen
MFC after: 1 month
Differential Revision: https://revie

network.subr: Replace "\ " with "[[:space:]]"

"[[:space:]]" is easier to read than "\ " and is conisitent with
clone_up().

Reported by: eugen
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D37748

show more ...


# e448ff6f 13-Dec-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

rc: network.subr improve network6_getladdr()

In network6_getladdr() we are iterating over inet6 lines and are not
interested in any others. So tell ifconfig to limit output to "inet6"
as much as po

rc: network.subr improve network6_getladdr()

In network6_getladdr() we are iterating over inet6 lines and are not
interested in any others. So tell ifconfig to limit output to "inet6"
as much as possible.
This is probably a micro-optimisation but was noticed while looking
at other IPv6-related boot-time improvements.

MFC after: 1 week

show more ...


# dd4d5a5f 25-Nov-2020 Bjoern A. Zeeb <bz@FreeBSD.org>

IPv6: set ifdisabled in the kernel rather than in rc

Enable ND6_IFF_IFDISABLED when the interface is created in the
kernel before return to user space.

This avoids a race when an interface is creat

IPv6: set ifdisabled in the kernel rather than in rc

Enable ND6_IFF_IFDISABLED when the interface is created in the
kernel before return to user space.

This avoids a race when an interface is create by a program which
also calls ifconfig IF inet6 -ifdisabled and races with the
devd -> /etc/pccard_ether -> .. netif start IF -> ifdisabled
calls (the devd/rc framework disabling IPv6 again after the program
had enabled it already).

In case the global net.inet6.ip6.accept_rtadv was turned on,
we also default to enabling IPv6 on the interfaces, rather than
disabling them.

PR: 248172
Reported by: Gert Doering (gert greenie.muc.de)
Reviewed by: glebius (, phk)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27324

show more ...


# 064dde3e 22-Jun-2020 Eugene Grosbein <eugen@FreeBSD.org>

network.subr: unobsolete gif_interfaces

There are cases when gif_interfaces cannot be replaced
with cloned_interfaces, such as tunnels with external IPv6 addresses
and internal IPv4 or vice versa. S

network.subr: unobsolete gif_interfaces

There are cases when gif_interfaces cannot be replaced
with cloned_interfaces, such as tunnels with external IPv6 addresses
and internal IPv4 or vice versa. Such configuration requires
extra invocation of ifconfig(8) and supported with gif_interfaces only.

MFC after: 1 week

show more ...


# 734b726d 05-Apr-2019 Eugene Grosbein <eugen@FreeBSD.org>

network.subr: improve configuration of cloned gif(4) interfaces

ifconfig(8) syntax allows to specify only single address_family,
so we need additional invocation of ifconfig to support configuration

network.subr: improve configuration of cloned gif(4) interfaces

ifconfig(8) syntax allows to specify only single address_family,
so we need additional invocation of ifconfig to support configuration
of cloned gif interface that may use different address families
for its internal and external addresses.

Also, ifconfig(8) does not allow to omit "inet6" keyword for address family
specifying IPv6 addresses as outer addresses of the interface.

Also, address_family is not "parameter" and it has to go before parameters
including "tunnel" keyword, so "ifconfig gif0 tunnel inet6 $oip1 $oip2" would be
wrong syntax and only "ifconfig gif0 inet6 tunnel $oip1 $oip2" is right.

With this change, the following works:

gifconfig_gif0="inet6 2a00::1 2a01::1"
ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252"

MFC after: 2 weeks

show more ...


# 76d32f04 17-Mar-2019 Bjoern A. Zeeb <bz@FreeBSD.org>

Fix legacy IP autoconfiguration.

It seems my subconcious plan in r345088 to not only prefer IPv6 autoconf
but to also slowly deteriorate legacy IP auto-configuration was uncovered
way too early.

In

Fix legacy IP autoconfiguration.

It seems my subconcious plan in r345088 to not only prefer IPv6 autoconf
but to also slowly deteriorate legacy IP auto-configuration was uncovered
way too early.

In case IPv6 is a thing yet ipv6_autoconfif was not true, we would not
bring up the interface yet tell the follow-up DHCPv4 configuration in
ifconfig_up() that we did. So unless you were doing SYNCDHCP or IPv6
you would not get legacy-IP DHCPv4 configuration.

I see multiple problems here: (a) people not yet using IPv6 (obviously a
problem), and (b) the dhclient startup script not running dhclient in
that case despite configured to do so (needs to be investigated seperately).

Reported by: Pawel Biernacki (pawel.biernacki gmail.com)
Tested by: Pawel Biernacki
Differential Revision: https://reviews.freebsd.org/D19488
Pointyhat to: bz (not sure if it is for breaking or
for letting them notice it so easily)

show more ...


# 1b5be720 13-Mar-2019 Bjoern A. Zeeb <bz@FreeBSD.org>

Enhance IPv6 autoconf startup.

Before this change we would only run rtsol on an interface which was
set to accept_rtadv and did not have rtsold enabled. This change
removes the latter condition and

Enhance IPv6 autoconf startup.

Before this change we would only run rtsol on an interface which was
set to accept_rtadv and did not have rtsold enabled. This change
removes the latter condition and always runs rtsol (rather than the
deferred rtsold) to reduce the delay until we send the first RS.

This change will also handle the accept_rtadv before dhcp hence
starting IPv6 auto-configuration before IPV4 DHCP.

This change is intended for FreeBSD 13 and later only and will not be MFCed.

Reviewed by: hrs
Differential Revision: https://reviews.freebsd.org/D19488

show more ...


# 1a7c1b2c 27-Jan-2019 Andriy Voskoboinyk <avos@FreeBSD.org>

rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used

They will stop it automatically ('Interface wlan0 is down,
dhclient exiting'); use /etc/rc.d/dhclient stop command only whe

rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used

They will stop it automatically ('Interface wlan0 is down,
dhclient exiting'); use /etc/rc.d/dhclient stop command only when
none of them is used.

MFC after: 5 days

show more ...


# 90809c67 24-Oct-2018 Gleb Smirnoff <glebius@FreeBSD.org>

Remove code that is dead since r287197. Today wlan(4) interfaces aren't
children of some other interface. Creation happens only in wlan_up().


# 3c36368a 20-Oct-2018 Eugene Grosbein <eugen@FreeBSD.org>

Make upgrade from previous FreeBSD versions less painful
and make previously working configuration like this work again:

gif_interfaces="gif0"
gifconfig_gif0="1.1.1.1 2.2.2.2"
ifconfig_gif0="inet 19

Make upgrade from previous FreeBSD versions less painful
and make previously working configuration like this work again:

gif_interfaces="gif0"
gifconfig_gif0="1.1.1.1 2.2.2.2"
ifconfig_gif0="inet 192.168.1.1 192.168.1.2 netmask 255.255.255.252"

PR: 204700
MFC after: 1 month

show more ...


# 0696600c 17-Oct-2018 Bjoern A. Zeeb <bz@FreeBSD.org>

Move the rc framework out of sbin/init into libexec/rc.

The reasons for this are forward looking to pkgbase:
* /sbin/init is a special binary; try not to replace it with
every package update bec

Move the rc framework out of sbin/init into libexec/rc.

The reasons for this are forward looking to pkgbase:
* /sbin/init is a special binary; try not to replace it with
every package update because an rc script was touched.
(a follow-up commit will make init its own package)
* having rc in its own place will allow more easy replacement
of the rc framework with alternatives, such as openrc.

Discussed with: brd (during BSDCam), kmoore
Requested by: cem, bz
PR: 231522
Approved by: re (gjb)

show more ...


# df89e317 28-Jul-2018 Brad Davis <brd@FreeBSD.org>

Opps, I missed moving a couple of files in r336845.

Approved by: will (mentor)
Differential Revision: https://reviews.freebsd.org/D16466


# c92451ae 19-Nov-2017 Andriy Voskoboinyk <avos@FreeBSD.org>

Reduce code duplication for wlan(4) interface creation in network.subr.

Since wlandebug(8) can accept any (original or changed) interface name
this part may be simplified a bit.


# cedc7c58 08-Nov-2017 Eugene Grosbein <eugen@FreeBSD.org>

Add suitable knob ifconfig_<interface>_descr for static interface description.
Document availability of interface descriptions within rc.conf(5).

Approved by: avg (mentor), mav (mentor)
MFC after: 3

Add suitable knob ifconfig_<interface>_descr for static interface description.
Document availability of interface descriptions within rc.conf(5).

Approved by: avg (mentor), mav (mentor)
MFC after: 3 days

show more ...


# b4e2ab78 25-Apr-2017 Brooks Davis <brooks@FreeBSD.org>

Remove NATM configuration bits and assorted NATM and ATM remnants.

Reported by: ak
Reviewed by: ngie (first version)
Differential Revision: https://reviews.freebsd.org/D10497


# d546378b 29-Feb-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

network.subr: avoid unnecessary reinitialization

Do not start interface when wpa_supplicant or hostapd is used;
they will restart it anyway

Tested with:
* Intel 3945BG, STA mode (wpa_supplicant)

network.subr: avoid unnecessary reinitialization

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

show more ...


# 7a79cebf 27-Aug-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.

Historical background: originally wireless devices created an interface,
just li

Replay r286410. Change KPI of how device drivers that provide wireless
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.

show more ...


# 3bce8364 10-Aug-2015 Adrian Chadd <adrian@FreeBSD.org>

Commit more of the reversion of r286410 . Sorry.


12345678910>>...12