summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-03-18 22:31:22 +0000
committermpi <mpi@openbsd.org>2015-03-18 22:31:22 +0000
commit1fcea1a594926ea1767eded56f56845917d60444 (patch)
tree66a104f3eb9e0638542450e726b4df087d0b494c
parentremove ambiguity from the COMMANDS section, after discussion with zhuk; (diff)
downloadwireguard-openbsd-1fcea1a594926ea1767eded56f56845917d60444.tar.xz
wireguard-openbsd-1fcea1a594926ea1767eded56f56845917d60444.zip
Instead of embedding interface names in a sockaddr use their indexes
when adding route entries with the -link option. This prevent the ARP layer to take the name of your interface for an Ethernet address. If you still want to add stupid content to your routing table, please write your own tool. Thanks to Henk Jan Agteresch for reporting the original issue and testing this diff. ok mikeb@, deraadt@, benno@, claudio@
-rw-r--r--sbin/route/route.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index c3607844622..c1445db89f6 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.172 2015/02/06 03:22:00 reyk Exp $ */
+/* $OpenBSD: route.c,v 1.173 2015/03/18 22:31:22 mpi Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -896,8 +896,8 @@ getaddr(int which, char *s, struct hostent **hpp)
}
case AF_LINK:
- su->sa.sa_len = sizeof(struct sockaddr_dl);
- link_addr(s, &su->sdl);
+ su->sdl.sdl_index = if_nametoindex(s);
+ memset(&su->sdl.sdl_data, 0, sizeof(su->sdl.sdl_data));
return (1);
case AF_MPLS:
errx(1, "mpls labels require -in or -out switch");