From owner-freebsd-net@FreeBSD.ORG Sat May 7 14:28:41 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D26D1065670 for ; Sat, 7 May 2011 14:28:41 +0000 (UTC) (envelope-from nvass@gmx.com) Received: from mailout-eu.gmx.com (mailout-eu.gmx.com [213.165.64.42]) by mx1.freebsd.org (Postfix) with SMTP id DF51C8FC16 for ; Sat, 7 May 2011 14:28:40 +0000 (UTC) Received: (qmail invoked by alias); 07 May 2011 14:28:39 -0000 Received: from adsl-179.79.107.81.tellas.gr (EHLO [192.168.73.193]) [79.107.81.179] by mail.gmx.com (mp-eu005) with SMTP; 07 May 2011 16:28:39 +0200 X-Authenticated: #46156728 X-Provags-ID: V01U2FsdGVkX1+6+ZoFIp+6la2JTUp2YVhjLrQg5h7uHYyuCTjZ27 7i0NKWux3p25oy Message-ID: <4DC55711.7010003@gmx.com> Date: Sat, 07 May 2011 17:28:33 +0300 From: Nikos Vassiliadis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: multipart/mixed; boundary="------------090002030702080708060609" X-Y-GMX-Trusted: 0 Subject: STP and if_epair, ngeth X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 May 2011 14:28:41 -0000 This is a multi-part message in MIME format. --------------090002030702080708060609 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------090002030702080708060609 Content-Type: text/plain; name="bridgestp.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bridgestp.c.diff" 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 */ --------------090002030702080708060609--