summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_sockbuf.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1996-11-11 04:56:32 +0000
committerfenner <fenner@FreeBSD.org>1996-11-11 04:56:32 +0000
commit51fa6f0e6c383037d81db2731606bf56378e1128 (patch)
treea1e9ea181d1b4cfcc3feaf4440cf48d359494bea /sys/kern/uipc_sockbuf.c
parent3b0a2952693ec15704f4dc217c9363c79260c647 (diff)
downloadFreeBSD-src-51fa6f0e6c383037d81db2731606bf56378e1128.zip
FreeBSD-src-51fa6f0e6c383037d81db2731606bf56378e1128.tar.gz
Add the IP_RECVIF socket option, which supplies a packet's incoming interface
using a sockaddr_dl. Fix the other packet-information socket options (SO_TIMESTAMP, IP_RECVDSTADDR) to work for multicast UDP and raw sockets as well. (They previously only worked for unicast UDP).
Diffstat (limited to 'sys/kern/uipc_sockbuf.c')
-rw-r--r--sys/kern/uipc_sockbuf.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index 9548312..024ce99 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
- * $Id: uipc_socket2.c,v 1.15 1996/10/07 04:32:27 pst Exp $
+ * $Id: uipc_socket2.c,v 1.16 1996/10/11 19:26:35 pst Exp $
*/
#include <sys/param.h>
@@ -800,6 +800,32 @@ sbdroprecord(sb)
}
}
+/*
+ * Create a "control" mbuf containing the specified data
+ * with the specified type for presentation on a socket buffer.
+ */
+struct mbuf *
+sbcreatecontrol(p, size, type, level)
+ caddr_t p;
+ register int size;
+ int type, level;
+{
+ register struct cmsghdr *cp;
+ struct mbuf *m;
+
+ if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL)
+ return ((struct mbuf *) NULL);
+ cp = mtod(m, struct cmsghdr *);
+ /* XXX check size? */
+ (void)memcpy(CMSG_DATA(cp), p, size);
+ size += sizeof(*cp);
+ m->m_len = size;
+ cp->cmsg_len = size;
+ cp->cmsg_level = level;
+ cp->cmsg_type = type;
+ return (m);
+}
+
#ifdef PRU_OLDSTYLE
/*
* The following routines mediate between the old-style `pr_usrreq'
OpenPOWER on IntegriCloud