Found while reading the code and testing ifconfig(8)'s `tunneldomain' in
order to document MPLS ioctls (see other thread on tech@).
mpe(4) consistently uses the softc's rdomain which is tracked
consistently across the various ioctls.
mpip(4) always adds and deletes routes in rdomain 0 regardless of the
`tunneldomain', i.e. the `sc_rdomain' value.
mpw(4) adds routes with the specified rdomain but always deletes them
in rdomain 0.
I'm not a MPLS user on OpenBSD, hence I've only tested this by manually
creating mpe/mpip/mpw interfaces in order to change their `tunneldomain'
and/or destroy them again while watching routing messages with
`route monitor' and verifying routes with `route -nT... show -mpls'.
Feedback? Objections? OK?
Index: if_mpip.c
===================================================================
RCS file: /cvs/src/sys/net/if_mpip.c,v
retrieving revision 1.13
diff -u -p -r1.13 if_mpip.c
--- if_mpip.c 20 Feb 2021 05:03:37 -0000 1.13
+++ if_mpip.c 16 Mar 2021 22:22:34 -0000
@@ -145,7 +145,7 @@ mpip_clone_destroy(struct ifnet *ifp)
if (sc->sc_smpls.smpls_label) {
rt_ifa_del(&sc->sc_ifa, RTF_LOCAL | RTF_MPLS,
- smplstosa(&sc->sc_smpls), 0);
+ smplstosa(&sc->sc_smpls), sc->sc_rdomain);
}
NET_UNLOCK();
@@ -165,13 +165,13 @@ mpip_set_route(struct mpip_softc *sc, ui
int error;
rt_ifa_del(&sc->sc_ifa, RTF_MPLS | RTF_LOCAL,
- smplstosa(&sc->sc_smpls), 0);
+ smplstosa(&sc->sc_smpls), sc->sc_rdomain);
sc->sc_smpls.smpls_label = shim;
sc->sc_rdomain = rdomain;
error = rt_ifa_add(&sc->sc_ifa, RTF_MPLS | RTF_LOCAL,
- smplstosa(&sc->sc_smpls), 0);
+ smplstosa(&sc->sc_smpls), sc->sc_rdomain);
if (error) {
sc->sc_smpls.smpls_label = MPLS_LABEL2SHIM(0);
return (error);
@@ -221,7 +221,7 @@ mpip_del_label(struct mpip_softc *sc)
{
if (sc->sc_smpls.smpls_label != MPLS_LABEL2SHIM(0)) {
rt_ifa_del(&sc->sc_ifa, RTF_MPLS | RTF_LOCAL,
- smplstosa(&sc->sc_smpls), 0);
+ smplstosa(&sc->sc_smpls), sc->sc_rdomain);
}
sc->sc_smpls.smpls_label = MPLS_LABEL2SHIM(0);
Index: if_mpw.c
===================================================================
RCS file: /cvs/src/sys/net/if_mpw.c,v
retrieving revision 1.59
diff -u -p -r1.59 if_mpw.c
--- if_mpw.c 21 Aug 2020 22:59:27 -0000 1.59
+++ if_mpw.c 16 Mar 2021 22:22:33 -0000
@@ -323,7 +323,7 @@ mpw_del_label(struct mpw_softc *sc)
if (sc->sc_smpls.smpls_label != MPLS_LABEL2SHIM(0)) {
rt_ifa_del(&sc->sc_ifa, RTF_MPLS | RTF_LOCAL,
- smplstosa(&sc->sc_smpls), 0);
+ smplstosa(&sc->sc_smpls), sc->sc_rdomain);
}
sc->sc_smpls.smpls_label = MPLS_LABEL2SHIM(0);