On 23/10/15(Fri) 13:21, David Gwynne wrote: > > > On 23 Oct 2015, at 09:00, Reyk Floeter <r...@openbsd.org> wrote: > > > > Hi, > > > > this diff allows to interconnect routing domains. > > > > It is very useful to route traffic from one routing domain to another, > > without using the pf "rtable" hack (tested in production for a long > > time). > > > > eg., > > # ifconfig vether0 10.0.1.1/24 > > # ifconfig vether1 rdomain 1 10.0.1.2/24 > > # ping 10.1.1.2 > > # route -T 1 add default 10.0.1.1 > > # ifconfig bridge0 add vether0 add em0 > > > > for hacking/testing, you can do thing like: > > # dhcpd vether0 > > # dhclient vether1 > > > > It has been discussed in much detail if this is possible with > > bridge(4). It is not. The bridge is not designed for it and explain > > on request. > > the diff implements a crossover option, but the example above doesnt use > them. does that mean you can use a bridge to build crossovers without the > extra code, or the example is wrong?
As said yesterday an alternative would be to use the bridge(4) as below: Index: net/if_bridge.c =================================================================== RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revision 1.268 diff -u -p -r1.268 if_bridge.c --- net/if_bridge.c 12 Oct 2015 10:03:25 -0000 1.268 +++ net/if_bridge.c 23 Oct 2015 11:52:13 -0000 @@ -1218,10 +1218,12 @@ bridgeintr_frame(struct bridge_softc *sc if (m == NULL) return; /* - * If the packet is a multicast or broadcast OR if we don't - * know any better, forward it to all interfaces. + * If the packet is a multicast/broadcast, if we don't know + * any better or if the destination is in a different routing + * domain, forward it to all interfaces. */ - if ((m->m_flags & (M_BCAST | M_MCAST)) || dst_if == NULL) { + if ((m->m_flags & (M_BCAST | M_MCAST)) || dst_if == NULL || + (dst_if->if_rdomain != src_if->if_rdomain)) { sc->sc_if.if_imcasts++; bridge_broadcast(sc, src_if, &eh, m); return;