Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Feb 2023 12:12:19 GMT
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c169fb625ee0 - stable/13 - netlink: use ifmedia to provide vlan interface operstate.
Message-ID:  <202302181212.31ICCJdk097717@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by melifaro:

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

commit c169fb625ee0800ad1e6046440d67eef598581c2
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-02-15 20:22:47 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-02-18 11:56:39 +0000

    netlink: use ifmedia to provide vlan interface operstate.
    
    Netlink customers rely on admin and operational state when
     working with interfaces. The current implementation retuns
     "unknown" operstate for all interface types except IFT_ETHER
     and IFT_LOOP.
    
    This change updates the code to fetch vlan operstate in the same way
     as for the ether interfaces. For the rest of the interface types,
     operstate is now mapped to the admin state.
    
    Reported by:    Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
    MFC after:      3 days
    
    (cherry picked from commit 5dd48f718433959c283a8a4d6e46512426f1e200)
---
 sys/netlink/route/iface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c
index f4936bb2c35b..9cd7e6e80f3c 100644
--- a/sys/netlink/route/iface.c
+++ b/sys/netlink/route/iface.c
@@ -174,9 +174,11 @@ get_operstate(struct ifnet *ifp, struct if_state *pstate)
 
 	switch (ifp->if_type) {
 	case IFT_ETHER:
+	case IFT_L2VLAN:
 		get_operstate_ether(ifp, pstate);
 		break;
-	case IFT_LOOP:
+	default:
+		/* Map admin state to the operstate */
 		if (ifp->if_flags & IFF_UP) {
 			pstate->ifla_operstate = IF_OPER_UP;
 			pstate->ifla_carrier = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302181212.31ICCJdk097717>