From owner-freebsd-net@FreeBSD.ORG Mon Mar 5 07:38:01 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 605C5106566B for ; Mon, 5 Mar 2012 07:38:01 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 291078FC12 for ; Mon, 5 Mar 2012 07:38:00 +0000 (UTC) Received: by iahk25 with SMTP id k25so7063835iah.13 for ; Sun, 04 Mar 2012 23:38:00 -0800 (PST) Received-SPF: pass (google.com: domain of andy@fud.org.nz designates 10.50.34.164 as permitted sender) client-ip=10.50.34.164; Authentication-Results: mr.google.com; spf=pass (google.com: domain of andy@fud.org.nz designates 10.50.34.164 as permitted sender) smtp.mail=andy@fud.org.nz Received: from mr.google.com ([10.50.34.164]) by 10.50.34.164 with SMTP id a4mr5869898igj.14.1330933080707 (num_hops = 1); Sun, 04 Mar 2012 23:38:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.34.164 with SMTP id a4mr4833630igj.14.1330931662336; Sun, 04 Mar 2012 23:14:22 -0800 (PST) Sender: andy@fud.org.nz Received: by 10.231.28.225 with HTTP; Sun, 4 Mar 2012 23:14:22 -0800 (PST) In-Reply-To: References: Date: Mon, 5 Mar 2012 20:14:22 +1300 X-Google-Sender-Auth: 8wqdXqO8OcJrtT8sRGahvsS-UoQ Message-ID: From: Andrew Thompson To: hiren panchasara Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmJhGdH0i4i2psyVonp6N1Mh5Vu5xYoKLqT4JQbtIItJAGu1iKu20gy/AMNEO+AP5HUUk3K Cc: freebsd-net@freebsd.org Subject: Re: bridge interface type 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: Mon, 05 Mar 2012 07:38:01 -0000 > From: hiren panchasara > > I created bridge1 this way: > > $ sudo ifconfig bridge create > Password: > bridge1 > > $ ifconfig bridge1 > bridge1: flags=3D8802 metric 0 mtu 1500 > =A0 =A0ether 02:32:c8:92:b6:01 > =A0 =A0nd6 options=3D29 > =A0 =A0id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 > =A0 =A0maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200 > =A0 =A0root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0 > > but when I try to look at the interface via "struct sockaddr_dl", > sdl =3D (struct sockaddr_dl *) ifa->ifa_addr; > > sdl->sdl_type is "IFT_ETHER" for that interface. > > Shouldn't it be "IFT_BRIDGE"? What am I missing here? The address type is set in ether_ifattach() and the bridge does not overwrite it, this means sdl_type will always be IFT_ETHER (see if_ethersubr.c line 1003). Here is a patch that changes it but I do not know what may break. Index: if_bridge.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- if_bridge.c (revision 232321) +++ if_bridge.c (working copy) @@ -568,6 +568,7 @@ bridge_clone_create(struct if_clone *ifc, int unit { struct bridge_softc *sc, *sc2; struct ifnet *bifp, *ifp; + struct sockaddr_dl *sdl; int fb, retry; unsigned long hostid; @@ -642,6 +643,8 @@ bridge_clone_create(struct if_clone *ifc, int unit /* Now undo some of the damage... */ ifp->if_baudrate =3D 0; ifp->if_type =3D IFT_BRIDGE; + sdl =3D (struct sockaddr_dl *)ifp->if_addr->ifa_addr; + sdl->sdl_type =3D IFT_BRIDGE; mtx_lock(&bridge_list_mtx); LIST_INSERT_HEAD(&bridge_list, sc, sc_list);