Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 May 2011 17:28:33 +0300
From:      Nikos Vassiliadis <nvass@gmx.com>
To:        freebsd-net@freebsd.org
Subject:   STP and if_epair, ngeth
Message-ID:  <4DC55711.7010003@gmx.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi,

The STP code in bridgestp.c uses ifmedia to check duplex status.
if_epair and ng_eiface interfaces commonly used in VIMAGE enabled
jails do not support ifmedia and thus stay forever disabled when
STP is enabled on such interfaces. Could you review the patch?

Thanks, Nikos


[-- Attachment #2 --]
Index: sys/net/bridgestp.c
===================================================================
--- sys/net/bridgestp.c	(revision 221584)
+++ sys/net/bridgestp.c	(working copy)
@@ -1804,12 +1804,19 @@
 	bzero((char *)&ifmr, sizeof(ifmr));
 	error = (*ifp->if_ioctl)(ifp, SIOCGIFMEDIA, (caddr_t)&ifmr);
 
-	if ((error == 0) && (ifp->if_flags & IFF_UP)) {
-		if (ifmr.ifm_status & IFM_ACTIVE) {
+	if (ifp->if_flags & IFF_UP) {
+		if (ifp->if_link_state == LINK_STATE_UP) {
 			/* A full-duplex link is assumed to be point to point */
 			if (bp->bp_flags & BSTP_PORT_AUTOPTP) {
-				bp->bp_ptp_link =
-				    ifmr.ifm_active & IFM_FDX ? 1 : 0;
+				/* Interfaces that do not support ifmedia,
+				 * are assumed to be full-duplex. if_epair
+				 * and ng_eiface fall into this category.
+				 */
+				if (error == 0)
+					bp->bp_ptp_link =
+					    ifmr.ifm_active & IFM_FDX ? 1 : 0;
+				else if (error == EINVAL)
+					bp->bp_ptp_link = 1;
 			}
 
 			/* Calc the cost if the link was down previously */




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