summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_socket2.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-02-18 05:21:02 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-02-18 05:21:02 +0000
commit6bf59c8f3cc3be79556729edd687770035126c1e (patch)
treebcbd66543525aa3814aeccfa744245d84177fe2a /sys/kern/uipc_socket2.c
parentefd9b5b2701001e506716293d6c7e6bb16e9999c (diff)
fix alignment problem in ancillary data (alpha).
only ipv6 tools (which touches ancillary data) are affected. From: =?iso-8859-1?Q?G=F6ran_Bengtson?= <goeran@cdg.chalmers.se>
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r--sys/kern/uipc_socket2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 32fb9072e47..e7f6587a859 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.12 2000/02/04 20:32:04 angelos Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.13 2000/02/18 05:21:01 itojun Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -792,14 +792,14 @@ sbcreatecontrol(p, size, type, level)
register struct cmsghdr *cp;
struct mbuf *m;
- if (size + sizeof(*cp) > MCLBYTES) {
+ if (CMSG_LEN(size) > MCLBYTES) {
printf("sbcreatecontrol: message too large %d\n", size);
return NULL;
}
if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL)
return ((struct mbuf *) NULL);
- if (size + sizeof(*cp) > MLEN) {
+ if (CMSG_LEN(size) > MLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_free(m);
@@ -808,7 +808,7 @@ sbcreatecontrol(p, size, type, level)
}
cp = mtod(m, struct cmsghdr *);
bcopy(p, CMSG_DATA(cp), size);
- size += sizeof(*cp);
+ size = CMSG_LEN(size);
m->m_len = size;
cp->cmsg_len = size;
cp->cmsg_level = level;