diff options
author | 2014-05-05 11:44:33 +0000 | |
---|---|---|
committer | 2014-05-05 11:44:33 +0000 | |
commit | 7da1c79582926d7bf5db9de050dc83d671827eff (patch) | |
tree | 5c1627412f4f4e380453d1eba9a17c2633b291b4 /sys/net/if_tun.c | |
parent | Add two more regression tests to relayd, these cover "digest" and "file" (diff) | |
download | wireguard-openbsd-7da1c79582926d7bf5db9de050dc83d671827eff.tar.xz wireguard-openbsd-7da1c79582926d7bf5db9de050dc83d671827eff.zip |
Use a custom ifa_rtrequest function for point-to-point interfaces
instead of relying on hacks in nd6_rtrequest() to add a route to
loopback for each address configured on such interfaces.
While here document that abusing lo0 for local traffic is not safe
for interfaces in a non-default rdomain.
Tested by claudio@, jca@ and sthen@, ok sthen@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 3e9a6500972..7d705463df4 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.124 2014/04/22 14:41:03 mpi Exp $ */ +/* $OpenBSD: if_tun.c,v 1.125 2014/05/05 11:44:33 mpi Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -469,6 +469,7 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct tun_softc *tp = (struct tun_softc *)(ifp->if_softc); struct ifreq *ifr = (struct ifreq *)data; + struct ifaddr *ifa = (struct ifaddr *)data; int error = 0, s; s = splnet(); @@ -477,16 +478,19 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFADDR: tuninit(tp); TUNDEBUG(("%s: address set\n", ifp->if_xname)); - if (tp->tun_flags & TUN_LAYER2) - switch (((struct ifaddr *)data)->ifa_addr->sa_family) { + if (tp->tun_flags & TUN_LAYER2) { + switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - arp_ifinit(&tp->arpcom, (struct ifaddr *)data); + arp_ifinit(&tp->arpcom, ifa); break; #endif default: break; } + } else { + ifa->ifa_rtrequest = p2p_rtrequest; + } break; case SIOCSIFDSTADDR: tuninit(tp); |