From nobody Sat May 4 16:45:49 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VWtpP6xHlz5J98l; Sat, 4 May 2024 16:45:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VWtpP6BV0z4jdb; Sat, 4 May 2024 16:45:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714841149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WYmJtXFA6Ht1fYD5WkzR6OT4rWNreul1lOaMYla3MOM=; b=OUeS3/4+7EOxJQBjIl/LUt7JcEIGWgkmIqywFdZpq5IscdS1reUJXzWiCDvk1nhKivCcR7 Ii9AX5bX6x6T5XRNjBXp+9xs8q4QCvN9CYuR9lLE2EYm/wPBfytHrLGadfPzhXybPd1OM3 mE4cV+QxpmyR5E+s5gRAFMBFVK1IUxoMfax+1YACErvMBagyBmEpDEqQRzPZ8TBVfnK9Ab 15hYFQvF96wB3fPLXScWbzCQtfpLsSNEXRJZGS4fNRKJWEhKlVouSnDHgNydFBPUM6e2jR rqInTvR6bbLE5BK/x57wCE+aYllqvOcO7MaDn3bGcY41bYdiSO5x/aMTBgu6Xg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714841149; a=rsa-sha256; cv=none; b=K1vCSdjQMnBBDC61U8GJ1z0IXUP+aDy65K/bed0R8DCi4FneuFpB2EMJfiDTfY/90HWdtN OGCn/Hka5jWkQi1v5rXKxpLENsVo+HEsRsxp/4h0JoOIznHJ7bVlV0LIU3kWFG8MMKvvfl Rr/LJEeNyKNe6STyT7TXnK8CfZOvSYM37SUSUSB8m1hUV2I3HAOPyzBsoPrkLPwBfKTs1k 7hgD8enlyQ4mgld6XwSzhwXaS+JE8USNYx0ynROHijDNPJ2Okfm90HbUO9+CIjAgZoCaZ4 R6/7usCzlcl9Dpji2IKeDlS2kuXbiq0ZUhxaxFf9gAD8OOvDjn56TWP5EPmWwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714841149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WYmJtXFA6Ht1fYD5WkzR6OT4rWNreul1lOaMYla3MOM=; b=U64P9y+SBGnZx8Am8254TYBC03Fgu79rcugD/SR5M1w2rESaEDafs3jIyrJxh2ODNsCJXk ZiLNS/0KE006DECg4PRn4fnpiq2Kawi2/QQaxBqCRdb0gx4E2dWvkL6YDxf+7oKKdc5Xr+ nJJV5ZfMZuZCGlpoExMw2KmemHhLJAQ82gseIo2T1Xad06HCacTwzG3ti7Ng6rKCkV7U0S cMRpZA4LDVxaQxbPYeZxHx+e6m4YPsAEgD5dJbN99ccFAOpSEodnD36xiElgvRgk71ehj5 VgVcpXMSrf0jpCsGm/PtIJ5wInLBKzSiGKYBrO6rrhgw+DCKMsyGnV8PrBZgqw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VWtpP5nhRzdKT; Sat, 4 May 2024 16:45:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 444GjnNW099624; Sat, 4 May 2024 16:45:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 444Gjn2b099621; Sat, 4 May 2024 16:45:49 GMT (envelope-from git) Date: Sat, 4 May 2024 16:45:49 GMT Message-Id: <202405041645.444Gjn2b099621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: cb808de400c7 - main - rc.conf.5: modernise network_interfaces List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb808de400c798302177ea2b8ef6d1c7870baf57 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cb808de400c798302177ea2b8ef6d1c7870baf57 commit cb808de400c798302177ea2b8ef6d1c7870baf57 Author: Lexi Winter AuthorDate: 2024-05-04 16:42:40 +0000 Commit: Warner Losh CommitDate: 2024-05-04 16:43:22 +0000 rc.conf.5: modernise network_interfaces It's not 1996 anymore, and we use CIDR nowadays. Update the various ifconfig_ examples to use CIDR notation instead of netmasks, and also add an example of a basic ifconfig_ entry that most users will be interested in. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1217 --- share/man/man5/rc.conf.5 | 57 +++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index ad84bcbd576c..91da91691756 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 13, 2023 +.Dd May 4, 2024 .Dt RC.CONF 5 .Os .Sh NAME @@ -1420,13 +1420,18 @@ variables as described below. .Pp An .Va ifconfig_ Ns Aq Ar interface -variable is also assumed to exist for each value of +variable is assumed to exist for each value of .Ar interface . When an interface name contains any of the characters .Dq Li .-/+ they are translated to .Dq Li _ before lookup. +For example, the interface +.Va em0.102 +would be configured using the variable +.Va ifconfig_em0_102 . +.Pp The variable can contain arguments to .Xr ifconfig 8 , as well as special case-insensitive keywords described below. @@ -1434,6 +1439,18 @@ Such keywords are removed before passing the value to .Xr ifconfig 8 while the order of the other arguments is preserved. .Pp +For example, to assign the IPv4 address 192.0.2.1/24 to the interface em0: +.Bd -literal +ifconfig_em0="inet 192.0.2.1/24 up" +.Ed +.Pp +If the variable +.Va ifconfig_ Ns Ao Ar interface Ac Ns Pa _ipv6 +is set, then +.Va ifconfig_ Ns Aq Ar interface +does not need to be set unless an IPv4 address should also be assigned to +the interface. +.Pp It is possible to add IP alias entries using .Xr ifconfig 8 syntax with the address family keyword such as @@ -1442,8 +1459,8 @@ Assuming that the interface in question was .Li em0 , it might look something like this: .Bd -literal -ifconfig_em0_alias0="inet 127.0.0.253 netmask 0xffffffff" -ifconfig_em0_alias1="inet 127.0.0.254 netmask 0xffffffff" +ifconfig_em0_alias0="inet 127.0.0.253/32" +ifconfig_em0_alias1="inet 127.0.0.254/32" .Ed .Pp It also possible to configure multiple IP addresses in Classless @@ -1472,12 +1489,12 @@ netif_ipexpand_max="4096" .Pp In the case of .Li 192.0.2.5-23/24 , -the address 192.0.2.5 will be configured with the -netmask /24 and the addresses 192.0.2.6 to 192.0.2.23 with -the non-conflicting netmask /32 as explained in the +the address 192.0.2.5 will be configured with the prefix length /24 and the +addresses 192.0.2.6 to 192.0.2.23 with the non-conflicting prefix length /32 as +explained in the .Xr ifconfig 8 alias section. -Note that this special netmask handling is only for +Note that this special CIDR handling is only for .Li inet , not for the other address families such as .Li inet6 . @@ -1509,10 +1526,10 @@ its contents are passed to Execution stops at the first unsuccessful access, so if something like this is present: .Bd -literal -ifconfig_em0_alias0="inet 127.0.0.251 netmask 0xffffffff" -ifconfig_em0_alias1="inet 127.0.0.252 netmask 0xffffffff" -ifconfig_em0_alias2="inet 127.0.0.253 netmask 0xffffffff" -ifconfig_em0_alias4="inet 127.0.0.254 netmask 0xffffffff" +ifconfig_em0_alias0="inet 127.0.0.251/32" +ifconfig_em0_alias1="inet 127.0.0.252/32" +ifconfig_em0_alias2="inet 127.0.0.253/32" +ifconfig_em0_alias4="inet 127.0.0.254/32" .Ed .Pp Then note that alias4 would @@ -1529,13 +1546,13 @@ variable, which has the same functionality as and can have all of the entries in a variable like the following: .Bd -literal ifconfig_em0_aliases="\\ - inet 127.0.0.251 netmask 0xffffffff \\ - inet 127.0.0.252 netmask 0xffffffff \\ - inet 127.0.0.253 netmask 0xffffffff \\ - inet 127.0.0.254 netmask 0xffffffff" + inet 127.0.0.251/32 \\ + inet 127.0.0.252/32 \\ + inet 127.0.0.253/32 \\ + inet 127.0.0.254/32" .Ed .Pp -It also supports CIDR notation. +It also supports netmask notation for backward compatibility. .Pp If the .Pa /etc/start_if . Ns Aq Ar interface @@ -1688,7 +1705,7 @@ variable. It is also possible to rename an interface by doing: .Bd -literal ifconfig_em0_name="net0" -ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00" +ifconfig_net0="inet 192.0.2.1/24" .Ed .It Va ipv6_enable .Pq Vt bool @@ -2045,9 +2062,9 @@ interfaces with: .Bd -literal gif_interfaces="gif0 gif1" gifconfig_gif0="100.64.0.1 100.64.0.2" -ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252" +ifconfig_gif0="inet 10.0.0.1/32 10.0.0.2" gifconfig_gif1="inet6 2a00::1 2a01::1" -ifconfig_gif1="inet 10.1.0.1 10.1.0.2 netmask 255.255.255.252" +ifconfig_gif1="inet 10.1.0.1/32 10.1.0.2" .Ed .It Va ppp_enable .Pq Vt bool