diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-02-05 00:40:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-02-05 00:40:24 +0000 |
commit | a53e6b94f4676dbce0267ea909bc0f6c9de4fca0 (patch) | |
tree | 60e48a416698d86657d3b789f5f8d2c5118663b3 | |
parent | 6e853b95086671b7a50fe5c07435fd0761975973 (diff) |
support MSG_BCAST and MSG_MCAST
-rw-r--r-- | lib/libc/sys/recv.2 | 27 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 9 | ||||
-rw-r--r-- | sys/sys/socket.h | 4 |
3 files changed, 26 insertions, 14 deletions
diff --git a/lib/libc/sys/recv.2 b/lib/libc/sys/recv.2 index 9fb35195a2a..cc078d5180e 100644 --- a/lib/libc/sys/recv.2 +++ b/lib/libc/sys/recv.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: recv.2,v 1.10 1998/08/17 17:35:14 deraadt Exp $ +.\" $OpenBSD: recv.2,v 1.11 1999/02/05 00:40:23 deraadt Exp $ .\" $NetBSD: recv.2,v 1.6 1995/02/27 12:36:08 cgd Exp $ .\" .\" Copyright (c) 1983, 1990, 1991, 1993 @@ -206,21 +206,28 @@ set to .Pp The .Fa msg_flags -field is set on return according to the message received. -.Dv MSG_EOR -indicates end-of-record; +field is set on return according to the message received. It will contain +zero or more of the following values: +.Bl -column MSG_CTRUNC -offset indent +.It Dv MSG_EOR Ta +Indicates end-of-record; the data returned completed a record (generally used with sockets of type .Dv SOCK_SEQPACKET ) . -.Dv MSG_TRUNC -indicates that +.It Dv MSG_TRUNC Ta +Indicates that the trailing portion of a datagram was discarded because the datagram was larger than the buffer supplied. -.Dv MSG_CTRUNC -indicates that some +.It Dv MSG_CTRUNC Ta +Indicates that some control data were discarded due to lack of space in the buffer for ancillary data. -.Dv MSG_OOB -is returned to indicate that expedited or out-of-band data were received. +.It Dv MSG_OOB Ta +Returned to indicate that expedited or out-of-band data was received. +.It Dv MSG_BCAST Ta +Indicates that the packet was received as broadcast. +.It Dv MSG_MCAST Ta +Indicates that the packet was received as multicast. +.El .Pp .Sh RETURN VALUES These calls return the number of bytes received, or -1 diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 17931e7a0b6..d805d5ce018 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.23 1999/01/21 03:27:42 millert Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.24 1999/02/05 00:40:22 deraadt Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -545,8 +545,7 @@ soreceive(so, paddr, uio, mp0, controlp, flagsp) if (flags & MSG_OOB) { m = m_get(M_WAIT, MT_DATA); error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m, - (struct mbuf *)(long)(flags & MSG_PEEK), - NULL); + (struct mbuf *)(long)(flags & MSG_PEEK), NULL); if (error) goto bad; do { @@ -688,6 +687,10 @@ dontblock: type = m->m_type; if (type == MT_OOBDATA) flags |= MSG_OOB; + if (m->m_flags & M_BCAST) + flags |= MSG_BCAST; + if (m->m_flags & M_MCAST) + flags |= MSG_MCAST; } moff = 0; offset = 0; diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 25c3ef5698d..150a596d284 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socket.h,v 1.20 1999/01/10 02:44:33 deraadt Exp $ */ +/* $OpenBSD: socket.h,v 1.21 1999/02/05 00:40:22 deraadt Exp $ */ /* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */ /* @@ -286,6 +286,8 @@ struct msghdr { #define MSG_CTRUNC 0x20 /* control data lost before delivery */ #define MSG_WAITALL 0x40 /* wait for full request or error */ #define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ +#define MSG_BCAST 0x100 /* this message rec'd as broadcast */ +#define MSG_MCAST 0x200 /* this message rec'd as multicast */ /* * Header for ancillary data objects in msg_control buffer. |