diff options
| author | 2015-10-22 15:37:47 +0000 | |
|---|---|---|
| committer | 2015-10-22 15:37:47 +0000 | |
| commit | c7b7b779a1a65d391467ec9504adbab88ccea96d (patch) | |
| tree | 2fd4870ad35da77bf29098637713164b2a6380e8 /sys/net/if_ethersubr.c | |
| parent | Final removal of EXTERN. (diff) | |
| download | wireguard-openbsd-c7b7b779a1a65d391467ec9504adbab88ccea96d.tar.xz wireguard-openbsd-c7b7b779a1a65d391467ec9504adbab88ccea96d.zip | |
Inspired by satosin(), use inline functions to convert sockaddr dl.
Instead of casts they check wether the incoming object has the
expected type. So introduce satosdl() and sdltosa() in the kernel.
OK mpi@
Diffstat (limited to 'sys/net/if_ethersubr.c')
| -rw-r--r-- | sys/net/if_ethersubr.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index ee86161095f..0274d0009a1 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.228 2015/09/29 10:11:40 deraadt Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.229 2015/10/22 15:37:47 bluhm Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -222,10 +222,9 @@ ether_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, switch (dst->sa_family) { case AF_LINK: - if (((struct sockaddr_dl *)dst)->sdl_alen < - sizeof(edst)) + if (satosdl(dst)->sdl_alen < sizeof(edst)) senderr(EHOSTUNREACH); - memcpy(edst, LLADDR((struct sockaddr_dl *)dst), + memcpy(edst, LLADDR(satosdl(dst)), sizeof(edst)); break; case AF_INET: |
