summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/raw_ip6.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2013-05-31 13:15:53 +0000
committerbluhm <bluhm@openbsd.org>2013-05-31 13:15:53 +0000
commit55851b2e3e09ff1e3467e680021396460ab6426f (patch)
tree4fe27da078f732e19ba1f994d3cfdfa71d84e5fa /sys/netinet6/raw_ip6.c
parentUse u_char for the send-keys string to avoid mangling top-bit-set (diff)
downloadwireguard-openbsd-55851b2e3e09ff1e3467e680021396460ab6426f.tar.xz
wireguard-openbsd-55851b2e3e09ff1e3467e680021396460ab6426f.zip
The function rip6_ctlinput() claims that sa6_src is constant to
allow the assingment of &sa6_any. But rip6_ctlinput() could not guarantee that as it casted away the const attribute when it passes the pointer to in6_pcbnotify(). Replace sockaddr with const sockaddr_in6 in the in6_pcbnotify() parameters. This reduces the number of casts. Also adjust in6_pcbhashlookup() to handle the const attribute correctly. Input and OK claudio@
Diffstat (limited to 'sys/netinet6/raw_ip6.c')
-rw-r--r--sys/netinet6/raw_ip6.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 21560676817..9b4936184cb 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.54 2013/05/02 11:54:10 mpi Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.55 2013/05/31 13:15:53 bluhm Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -240,6 +240,7 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
{
struct ip6_hdr *ip6;
struct ip6ctlparam *ip6cp = NULL;
+ struct sockaddr_in6 *sa6 = satosin6(sa);
const struct sockaddr_in6 *sa6_src = NULL;
void *cmdarg;
void (*notify)(struct in6pcb *, int) = in6_rtchange;
@@ -275,7 +276,6 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
}
if (ip6 && cmd == PRC_MSGSIZE) {
- struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa;
int valid = 0;
struct in6pcb *in6p;
@@ -288,7 +288,7 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
*/
in6p = NULL;
in6p = in6_pcbhashlookup(&rawin6pcbtable, &sa6->sin6_addr, 0,
- (struct in6_addr *)&sa6_src->sin6_addr, 0);
+ &sa6_src->sin6_addr, 0);
#if 0
if (!in6p) {
/*
@@ -326,8 +326,8 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
*/
}
- (void) in6_pcbnotify(&rawin6pcbtable, sa, 0,
- (struct sockaddr *)sa6_src, 0, cmd, cmdarg, notify);
+ (void) in6_pcbnotify(&rawin6pcbtable, sa6, 0,
+ sa6_src, 0, cmd, cmdarg, notify);
}
/*