diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-14 10:44:18 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-14 10:44:18 +0000 |
commit | 9d669a9248dd52dbd19697a39bafa7a6ab91097b (patch) | |
tree | 4f2bc52f38665dc4f18c1aa2adb6e33feddc7c38 /sys/net/if.c | |
parent | de1bfe625a7859ed41d56727dcf53699b13a410a (diff) |
It should be possible to create the default loopback interface.
Make rdomain's default loopback test pass again.
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 54f2cf7e1df..d5325745bfe 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.459 2016/11/14 10:32:46 mpi Exp $ */ +/* $OpenBSD: if.c,v 1.460 2016/11/14 10:44:17 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1609,12 +1609,16 @@ if_setrdomain(struct ifnet *ifp, int rdomain) unsigned int unit = rdomain; snprintf(loifname, sizeof(loifname), "lo%u", unit); - if ((error = if_clone_create(loifname, 0))) - return (error); + error = if_clone_create(loifname, 0); if ((loifp = ifunit(loifname)) == NULL) return (ENXIO); + /* Do not error out if creating the default lo(4) interface */ + if (error && (ifp != loifp || error != EEXIST)) + return (error); + + s = splsoftnet(); if ((error = rtable_add(rdomain)) == 0) rtable_l2set(rdomain, rdomain, loifp->if_index); |