On Thu, Jun 14, 2018 at 02:38:04PM +0200, Martin Pieuchot wrote:
> Thanks for the report, could you try the diff below?
>
> Index: net/if.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if.c,v
> retrieving revision 1.554
> diff -u -p -r1.554 if.c
> --- net/if.c 30 May 2018 22:20:41 -0000 1.554
> +++ net/if.c 14 Jun 2018 12:36:20 -0000
> @@ -1765,9 +1765,11 @@ if_setrdomain(struct ifnet *ifp, int rdo
> if (rdomain != rtable_l2(rdomain))
> return (EINVAL);
>
> - /* remove all routing entries when switching domains */
> - /* XXX this is a bit ugly */
> if (rdomain != ifp->if_rdomain) {
> + if ((ifp->if_flags & IFF_LOOPBACK) &&
> + (ifp->if_index == rtable_loindex(ifp->if_rdomain)))
> + return (EPERM);
> +
> s = splnet();
> /*
> * We are tearing down the world.
The diff prevents the deletion of the first (and default) lo(4) device
created within any rdomain. (Any subsequently created loopback devices
can still be removed.) This fixes the issue I reported.
As a supplementary question, is it intended that (non-default) rdomains
cannot be "deleted" at runtime after they have been created?