On 2015/10/30 11:34, Reyk Floeter wrote: > Hi, > > as documented below, pairs in bridges can lead to a loop. > > I looked at "fixing" it but came to the conclusion a) there is no > satisfying way with mbuf flags/tags to prevent the loop, b) it would > limit the use cases of pair(4) for network testing in many ways, c) > the bridge loop causes heavy load but does not lock the system (our > stack is already preventing this), and d) it can be documented - > so it is a feature, and not a bug ;) > > Thoughts? OK?
pair(4) should behave as much like a wire as possible, so I think this is the correct approach. OK. > Reyk > > Index: share/man/man4/pair.4 > =================================================================== > RCS file: /cvs/src/share/man/man4/pair.4,v > retrieving revision 1.3 > diff -u -p -u -p -r1.3 pair.4 > --- share/man/man4/pair.4 24 Oct 2015 15:46:10 -0000 1.3 > +++ share/man/man4/pair.4 30 Oct 2015 10:09:34 -0000 > @@ -47,6 +47,25 @@ Set up a pair of interfaces where each o > # ifconfig pair1 patch pair2 > # route -T 1 exec ping 10.1.1.2 > .Ed > +.Pp > +When adding multiple > +.Nm > +to multiple > +.Xr bridge 4 > +interfaces, it is possible to create a loop; > +the system load will go up while it is busy sending packets from one > +bridge to another and back. > +By design, the driver does not prevent such loops by itself, but it is > +possible to use the Spanning Tree Protocol (STP) to detect and remove > +loops in the virtual network topology: > +.Bd -literal -offset indent > +# ifconfig pair0 up > +# ifconfig pair1 rdomain 1 patch pair0 up > +# ifconfig pair2 up > +# ifconfig pair3 rdomain 1 patch pair2 up > +# ifconfig bridge0 add pair0 add pair2 stp pair0 stp pair2 up > +# ifconfig bridge1 add pair1 add pair3 stp pair1 stp pair3 up > +.Ed > .Sh SEE ALSO > .Xr bridge 4 , > .Xr inet 4 , >
