History log of /freebsd-current/libexec/rc/network.subr
Revision Date Author Comments
# 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 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


# 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 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


# 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://reviews.freebsd.org/D37748


# 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 possible.
This is probably a micro-optimisation but was noticed while looking
at other IPv6-related boot-time improvements.

MFC after: 1 week


# 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 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


# 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. Such configuration requires
extra invocation of ifconfig(8) and supported with gif_interfaces only.

MFC after: 1 week


# 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
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


# 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 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)


# 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 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


# 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 when
none of them is used.

MFC after: 5 days


# 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 192.168.1.1 192.168.1.2 netmask 255.255.255.252"

PR: 204700
MFC after: 1 month


# 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 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)