git: e448ff6f0e80 - main - rc: network.subr improve network6_getladdr()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 13 Dec 2021 22:18:58 UTC
The branch main has been updated by bz:

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

commit e448ff6f0e8035c3dd5b7bd0872f3f0d91c4e0d0
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-13 22:12:44 +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.
    
    MFC after:      1 week
---
 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}