Date: Mon, 5 Mar 2012 20:14:22 +1300 From: Andrew Thompson <thompsa@FreeBSD.org> To: hiren panchasara <hiren.panchasara@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: bridge interface type Message-ID: <CAFAOGNR7jGCrBQqyiR4oBu8C8MKDCV1tCSu0fgx_Uk=rYTY=xQ@mail.gmail.com> In-Reply-To: <CALCpEUEgFO_b8r4sA==a1MM4LEvQN5d%2BGxZ7yS-z665yw1q_ag@mail.gmail.com> References: <CALCpEUGQ-3tci4EXrTA8yroydWxPoUpnH4sxtQn0uti9cP=P1Q@mail.gmail.com> <CALCpEUEgFO_b8r4sA==a1MM4LEvQN5d%2BGxZ7yS-z665yw1q_ag@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> From: hiren panchasara <hiren.panchasara@gmail.com> > > I created bridge1 this way: > > $ sudo ifconfig bridge create > Password: > bridge1 > > $ ifconfig bridge1 > bridge1: flags=3D8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 > =A0 =A0ether 02:32:c8:92:b6:01 > =A0 =A0nd6 options=3D29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> > =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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFAOGNR7jGCrBQqyiR4oBu8C8MKDCV1tCSu0fgx_Uk=rYTY=xQ>