summaryrefslogtreecommitdiff
path: root/sys/net/if_gif.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-05-04 15:00:25 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-05-04 15:00:25 +0000
commit7566c552e54be591cd5c3a70836b713a8da75698 (patch)
treea568cd9796fba6a3b2b906b3c9a85174e15890e0 /sys/net/if_gif.c
parent0450d91d05ec91d21cddc13adeb254bf2a27044a (diff)
Introduce sstosa() for converting sockaddr_storage with a type safe
inline function instead of casting it to sockaddr. While there, use inline instead of __inline for all these conversions. Some struct sockaddr casts can be avoided completely. OK dhill@ mpi@
Diffstat (limited to 'sys/net/if_gif.c')
-rw-r--r--sys/net/if_gif.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 71e7d5b25ea..c28a089d632 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.93 2017/04/14 20:50:35 bluhm Exp $ */
+/* $OpenBSD: if_gif.c,v 1.94 2017/05/04 15:00:24 bluhm Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -358,10 +358,8 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
#endif
case SIOCSLIFPHYADDR:
- src = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->addr);
- dst = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->dstaddr);
+ src = sstosa(&(((struct if_laddrreq *)data)->addr));
+ dst = sstosa(&(((struct if_laddrreq *)data)->dstaddr));
break;
default:
return (EINVAL);
@@ -557,8 +555,7 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* copy src */
src = sc->gif_psrc;
- dst = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->addr);
+ dst = sstosa(&(((struct if_laddrreq *)data)->addr));
size = sizeof(((struct if_laddrreq *)data)->addr);
if (src->sa_len > size)
return (EINVAL);
@@ -566,8 +563,7 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* copy dst */
src = sc->gif_pdst;
- dst = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->dstaddr);
+ dst = sstosa(&(((struct if_laddrreq *)data)->dstaddr));
size = sizeof(((struct if_laddrreq *)data)->dstaddr);
if (src->sa_len > size)
return (EINVAL);