git: 1a305490732c - stable/13 - rc: network.subr improve network6_getladdr()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 29 Dec 2021 16:03:56 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=1a305490732cdd30d19627b49847ebe09009a8f7

commit 1a305490732cdd30d19627b49847ebe09009a8f7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-12-13 22:10:25 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-12-29 16:01:46 +0000

    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.
    
    (cherry picked from commit e448ff6f0e8035c3dd5b7bd0872f3f0d91c4e0d0)
---
 libexec/rc/network.subr | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libexec/rc/network.subr b/libexec/rc/network.subr
index 808e48532a13..2475841ffb40 100644
--- a/libexec/rc/network.subr
+++ b/libexec/rc/network.subr
@@ -1746,7 +1746,7 @@ network6_getladdr()
 	_if=$1
 	_flag=$2
 
-	${IFCONFIG_CMD} $_if 2>/dev/null | while read proto addr rest; do
+	${IFCONFIG_CMD} $_if inet6 2>/dev/null | while read proto addr rest; do
 		case "${proto}/${addr}/${_flag}/${rest}" in
 		inet6/fe80::*//*)
 			echo ${addr}