aboutsummaryrefslogtreecommitdiff
path: root/sys/bsm
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2009-01-14 10:44:16 +0000
committerRobert Watson <rwatson@FreeBSD.org>2009-01-14 10:44:16 +0000
commitc74c7b73a005e689b922dfcfe5b94804669b595b (patch)
tree475d9112fa7258dc14e742448d0a7ccbc27a17ab /sys/bsm
parent620b9b80bcbedf1317a5b45dd5c777e455a69dce (diff)
parenta4bd134433fd2aaa1d814163ac7b29acc444654a (diff)
downloadsrc-c74c7b73a005e689b922dfcfe5b94804669b595b.tar.gz
src-c74c7b73a005e689b922dfcfe5b94804669b595b.zip
Merge OpenBSM alpha 5 from OpenBSM vendor branch to head, both
contrib/openbsm (svn merge) and src/sys/{bsm,security/audit} (manual merge). Hook up bsm_domain.c and bsm_socket_type.c to the libbsm build along with man pages, add audit_bsm_domain.c and audit_bsm_socket_type.c to the kernel environment. OpenBSM history for imported revisions below for reference. MFC after: 1 month Sponsored by: Apple Inc. Obtained from: TrustedBSD Project OpenBSM 1.1 alpha 5 - Stub libauditd(3) man page added. - All BSM error number constants with BSM_ERRNO_. - Interfaces to convert between local and BSM socket types and protocol families have been added: au_bsm_to_domain(3), au_bsm_to_socket_type(3), au_domain_to_bsm(3), and au_socket_type_to_bsm(3), along with definitions of constants in audit_domain.h and audit_socket_type.h. This improves interoperability by converting local constant spaces, which vary by OS, to and from Solaris constants (where available) or OpenBSM constants for protocol domains not present in Solaris (a fair number). These routines should be used when generating and interpreting extended socket tokens. - Fix build warnings with full gcc warnings enabled on most supported platforms. - Don't compile error strings into bsm_errno.c when building it in the kernel environment. - When started by launchd, use the label com.apple.auditd rather than org.trustedbsd.auditd.
Notes
Notes: svn path=/head/; revision=187214
Diffstat (limited to 'sys/bsm')
-rw-r--r--sys/bsm/audit.h6
-rw-r--r--sys/bsm/audit_domain.h115
-rw-r--r--sys/bsm/audit_errno.h314
-rw-r--r--sys/bsm/audit_internal.h2
-rw-r--r--sys/bsm/audit_kevents.h2
-rw-r--r--sys/bsm/audit_record.h11
-rw-r--r--sys/bsm/audit_socket_type.h47
7 files changed, 332 insertions, 165 deletions
diff --git a/sys/bsm/audit.h b/sys/bsm/audit.h
index 284b0bdf3bb2..53eeadb167ff 100644
--- a/sys/bsm/audit.h
+++ b/sys/bsm/audit.h
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#1
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#4
* $FreeBSD$
*/
@@ -280,8 +280,8 @@ typedef struct audit_stat au_stat_t;
* Structure for the audit file statistics.
*/
struct audit_fstat {
- u_quad_t af_filesz;
- u_quad_t af_currsz;
+ u_int64_t af_filesz;
+ u_int64_t af_currsz;
};
typedef struct audit_fstat au_fstat_t;
diff --git a/sys/bsm/audit_domain.h b/sys/bsm/audit_domain.h
new file mode 100644
index 000000000000..1c839dd848cd
--- /dev/null
+++ b/sys/bsm/audit_domain.h
@@ -0,0 +1,115 @@
+/*-
+ * Copyright (c) 2008 Apple Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_domain.h#1
+ * $FreeBSD$
+ */
+
+#ifndef _BSM_AUDIT_DOMAIN_H_
+#define _BSM_AUDIT_DOMAIN_H_
+
+/*
+ * BSM protocol domain constants - protocol domains defined in Solaris.
+ */
+#define BSM_PF_UNSPEC 0
+#define BSM_PF_LOCAL 1
+#define BSM_PF_INET 2
+#define BSM_PF_IMPLINK 3
+#define BSM_PF_PUP 4
+#define BSM_PF_CHAOS 5
+#define BSM_PF_NS 6
+#define BSM_PF_NBS 7 /* Solaris-specific. */
+#define BSM_PF_ECMA 8
+#define BSM_PF_DATAKIT 9
+#define BSM_PF_CCITT 10
+#define BSM_PF_SNA 11
+#define BSM_PF_DECnet 12
+#define BSM_PF_DLI 13
+#define BSM_PF_LAT 14
+#define BSM_PF_HYLINK 15
+#define BSM_PF_APPLETALK 16
+#define BSM_PF_NIT 17 /* Solaris-specific. */
+#define BSM_PF_802 18 /* Solaris-specific. */
+#define BSM_PF_OSI 19
+#define BSM_PF_X25 20 /* Solaris/Linux-specific. */
+#define BSM_PF_OSINET 21 /* Solaris-specific. */
+#define BSM_PF_GOSIP 22 /* Solaris-specific. */
+#define BSM_PF_IPX 23
+#define BSM_PF_ROUTE 24
+#define BSM_PF_LINK 25
+#define BSM_PF_INET6 26
+#define BSM_PF_KEY 27
+#define BSM_PF_NCA 28 /* Solaris-specific. */
+#define BSM_PF_POLICY 29 /* Solaris-specific. */
+#define BSM_PF_INET_OFFLOAD 30 /* Solaris-specific. */
+
+/*
+ * BSM protocol domain constants - protocol domains not defined in Solaris.
+ */
+#define BSM_PF_NETBIOS 500 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_ISO 501 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_XTP 502 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_COIP 503 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_CNT 504 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_RTIP 505 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_SIP 506 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_PIP 507 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_ISDN 508 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_E164 509 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_NATM 510 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_ATM 511 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_NETGRAPH 512 /* FreeBSD/Darwin-specific. */
+#define BSM_PF_SLOW 513 /* FreeBSD-specific. */
+#define BSM_PF_SCLUSTER 514 /* FreeBSD-specific. */
+#define BSM_PF_ARP 515 /* FreeBSD-specific. */
+#define BSM_PF_BLUETOOTH 516 /* FreeBSD-specific. */
+#define BSM_PF_IEEE80211 517 /* FreeBSD-specific. */
+#define BSM_PF_AX25 518 /* Linux-specific. */
+#define BSM_PF_ROSE 519 /* Linux-specific. */
+#define BSM_PF_NETBEUI 520 /* Linux-specific. */
+#define BSM_PF_SECURITY 521 /* Linux-specific. */
+#define BSM_PF_PACKET 522 /* Linux-specific. */
+#define BSM_PF_ASH 523 /* Linux-specific. */
+#define BSM_PF_ECONET 524 /* Linux-specific. */
+#define BSM_PF_ATMSVC 525 /* Linux-specific. */
+#define BSM_PF_IRDA 526 /* Linux-specific. */
+#define BSM_PF_PPPOX 527 /* Linux-specific. */
+#define BSM_PF_WANPIPE 528 /* Linux-specific. */
+#define BSM_PF_LLC 529 /* Linux-specific. */
+#define BSM_PF_CAN 530 /* Linux-specific. */
+#define BSM_PF_TIPC 531 /* Linux-specific. */
+#define BSM_PF_IUCV 532 /* Linux-specific. */
+#define BSM_PF_RXRPC 533 /* Linux-specific. */
+#define BSM_PF_PHONET 534 /* Linux-specific. */
+
+/*
+ * Used when there is no mapping from a local to BSM protocol domain.
+ */
+#define BSM_PF_UNKNOWN 700 /* OpenBSM-specific. */
+
+#endif /* !_BSM_AUDIT_DOMAIN_H_ */
diff --git a/sys/bsm/audit_errno.h b/sys/bsm/audit_errno.h
index 5fe2d3e41239..9a13bd9c3c94 100644
--- a/sys/bsm/audit_errno.h
+++ b/sys/bsm/audit_errno.h
@@ -26,7 +26,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#4
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#5
* $FreeBSD$
*/
@@ -42,128 +42,128 @@
*
* When adding constants here, also add them to bsm_errno.c.
*/
-#define BSM_ESUCCESS 0
-#define BSM_EPERM 1
-#define BSM_ENOENT 2
-#define BSM_ESRCH 3
-#define BSM_EINTR 4
-#define BSM_EIO 5
-#define BSM_ENXIO 6
-#define BSM_E2BIG 7
-#define BSM_ENOEXEC 8
-#define BSM_EBADF 9
-#define BSM_ECHILD 10
-#define BSM_EAGAIN 11
-#define BSM_ENOMEM 12
-#define BSM_EACCES 13
-#define BSM_EFAULT 14
-#define BSM_ENOTBLK 15
-#define BSM_EBUSY 16
-#define BSM_EEXIST 17
-#define BSM_EXDEV 18
-#define BSM_ENODEV 19
-#define BSM_ENOTDIR 20
-#define BSM_EISDIR 21
-#define BSM_EINVAL 22
-#define BSM_ENFILE 23
-#define BSM_EMFILE 24
-#define BSM_ENOTTY 25
-#define BSM_ETXTBSY 26
-#define BSM_EFBIG 27
-#define BSM_ENOSPC 28
-#define BSM_ESPIPE 29
-#define BSM_EROFS 30
-#define BSM_EMLINK 31
-#define BSM_EPIPE 32
-#define BSM_EDOM 33
-#define BSM_ERANGE 34
-#define BSM_ENOMSG 35
-#define BSM_EIDRM 36
-#define BSM_ECHRNG 37 /* Solaris/Linux-specific. */
-#define BSM_EL2NSYNC 38 /* Solaris/Linux-specific. */
-#define BSM_EL3HLT 39 /* Solaris/Linux-specific. */
-#define BSM_EL3RST 40 /* Solaris/Linux-specific. */
-#define BSM_ELNRNG 41 /* Solaris/Linux-specific. */
-#define BSM_EUNATCH 42 /* Solaris/Linux-specific. */
-#define BSM_ENOCSI 43 /* Solaris/Linux-specific. */
-#define BSM_EL2HLT 44 /* Solaris/Linux-specific. */
-#define BSM_EDEADLK 45
-#define BSM_ENOLCK 46
-#define BSM_ECANCELED 47
-#define BSM_ENOTSUP 48
-#define BSM_EDQUOT 49
-#define BSM_EBADE 50 /* Solaris/Linux-specific. */
-#define BSM_EBADR 51 /* Solaris/Linux-specific. */
-#define BSM_EXFULL 52 /* Solaris/Linux-specific. */
-#define BSM_ENOANO 53 /* Solaris/Linux-specific. */
-#define BSM_EBADRQC 54 /* Solaris/Linux-specific. */
-#define BSM_EBADSLT 55 /* Solaris/Linux-specific. */
-#define BSM_EDEADLOCK 56 /* Solaris-specific. */
-#define BSM_EBFONT 57 /* Solaris/Linux-specific. */
-#define BSM_EOWNERDEAD 58 /* Solaris/Linux-specific. */
-#define BSM_ENOTRECOVERABLE 59 /* Solaris/Linux-specific. */
-#define BSM_ENOSTR 60 /* Solaris/Darwin/Linux-specific. */
-#define BSM_ENODATA 61 /* Solaris/Darwin/Linux-specific. */
-#define BSM_ETIME 62 /* Solaris/Darwin/Linux-specific. */
-#define BSM_ENOSR 63 /* Solaris/Darwin/Linux-specific. */
-#define BSM_ENONET 64 /* Solaris/Linux-specific. */
-#define BSM_ENOPKG 65 /* Solaris/Linux-specific. */
-#define BSM_EREMOTE 66
-#define BSM_ENOLINK 67
-#define BSM_EADV 68 /* Solaris/Linux-specific. */
-#define BSM_ESRMNT 69 /* Solaris/Linux-specific. */
-#define BSM_ECOMM 70 /* Solaris/Linux-specific. */
-#define BSM_EPROTO 71
-#define BSM_ELOCKUNMAPPED 72 /* Solaris-specific. */
-#define BSM_ENOTACTIVE 73 /* Solaris-specific. */
-#define BSM_EMULTIHOP 74
-#define BSM_EBADMSG 77
-#define BSM_ENAMETOOLONG 78
-#define BSM_EOVERFLOW 79
-#define BSM_ENOTUNIQ 80 /* Solaris/Linux-specific. */
-#define BSM_EBADFD 81 /* Solaris/Linux-specific. */
-#define BSM_EREMCHG 82 /* Solaris/Linux-specific. */
-#define BSM_ELIBACC 83 /* Solaris/Linux-specific. */
-#define BSM_ELIBBAD 84 /* Solaris/Linux-specific. */
-#define BSM_ELIBSCN 85 /* Solaris/Linux-specific. */
-#define BSM_ELIBMAX 86 /* Solaris/Linux-specific. */
-#define BSM_ELIBEXEC 87 /* Solaris/Linux-specific. */
-#define BSM_EILSEQ 88
-#define BSM_ENOSYS 89
-#define BSM_ELOOP 90
-#define BSM_ERESTART 91
-#define BSM_ESTRPIPE 92 /* Solaris/Linux-specific. */
-#define BSM_ENOTEMPTY 93
-#define BSM_EUSERS 94
-#define BSM_ENOTSOCK 95
-#define BSM_EDESTADDRREQ 96
-#define BSM_EMSGSIZE 97
-#define BSM_EPROTOTYPE 98
-#define BSM_ENOPROTOOPT 99
-#define BSM_EPROTONOSUPPORT 120
-#define BSM_ESOCKTNOSUPPORT 121
-#define BSM_EOPNOTSUPP 122
-#define BSM_EPFNOSUPPORT 123
-#define BSM_EAFNOSUPPORT 124
-#define BSM_EADDRINUSE 125
-#define BSM_EADDRNOTAVAIL 126
-#define BSM_ENETDOWN 127
-#define BSM_ENETUNREACH 128
-#define BSM_ENETRESET 129
-#define BSM_ECONNABORTED 130
-#define BSM_ECONNRESET 131
-#define BSM_ENOBUFS 132
-#define BSM_EISCONN 133
-#define BSM_ENOTCONN 134
-#define BSM_ESHUTDOWN 143
-#define BSM_ETOOMANYREFS 144
-#define BSM_ETIMEDOUT 145
-#define BSM_ECONNREFUSED 146
-#define BSM_EHOSTDOWN 147
-#define BSM_EHOSTUNREACH 148
-#define BSM_EALREADY 149
-#define BSM_EINPROGRESS 150
-#define BSM_ESTALE 151
+#define BSM_ERRNO_ESUCCESS 0
+#define BSM_ERRNO_EPERM 1
+#define BSM_ERRNO_ENOENT 2
+#define BSM_ERRNO_ESRCH 3
+#define BSM_ERRNO_EINTR 4
+#define BSM_ERRNO_EIO 5
+#define BSM_ERRNO_ENXIO 6
+#define BSM_ERRNO_E2BIG 7
+#define BSM_ERRNO_ENOEXEC 8
+#define BSM_ERRNO_EBADF 9
+#define BSM_ERRNO_ECHILD 10
+#define BSM_ERRNO_EAGAIN 11
+#define BSM_ERRNO_ENOMEM 12
+#define BSM_ERRNO_EACCES 13
+#define BSM_ERRNO_EFAULT 14
+#define BSM_ERRNO_ENOTBLK 15
+#define BSM_ERRNO_EBUSY 16
+#define BSM_ERRNO_EEXIST 17
+#define BSM_ERRNO_EXDEV 18
+#define BSM_ERRNO_ENODEV 19
+#define BSM_ERRNO_ENOTDIR 20
+#define BSM_ERRNO_EISDIR 21
+#define BSM_ERRNO_EINVAL 22
+#define BSM_ERRNO_ENFILE 23
+#define BSM_ERRNO_EMFILE 24
+#define BSM_ERRNO_ENOTTY 25
+#define BSM_ERRNO_ETXTBSY 26
+#define BSM_ERRNO_EFBIG 27
+#define BSM_ERRNO_ENOSPC 28
+#define BSM_ERRNO_ESPIPE 29
+#define BSM_ERRNO_EROFS 30
+#define BSM_ERRNO_EMLINK 31
+#define BSM_ERRNO_EPIPE 32
+#define BSM_ERRNO_EDOM 33
+#define BSM_ERRNO_ERANGE 34
+#define BSM_ERRNO_ENOMSG 35
+#define BSM_ERRNO_EIDRM 36
+#define BSM_ERRNO_ECHRNG 37 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EL2NSYNC 38 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EL3HLT 39 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EL3RST 40 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ELNRNG 41 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EUNATCH 42 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ENOCSI 43 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EL2HLT 44 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EDEADLK 45
+#define BSM_ERRNO_ENOLCK 46
+#define BSM_ERRNO_ECANCELED 47
+#define BSM_ERRNO_ENOTSUP 48
+#define BSM_ERRNO_EDQUOT 49
+#define BSM_ERRNO_EBADE 50 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EBADR 51 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EXFULL 52 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ENOANO 53 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EBADRQC 54 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EBADSLT 55 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EDEADLOCK 56 /* Solaris-specific. */
+#define BSM_ERRNO_EBFONT 57 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EOWNERDEAD 58 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ENOTRECOVERABLE 59 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ENOSTR 60 /* Solaris/Darwin/Linux-specific. */
+#define BSM_ERRNO_ENODATA 61 /* Solaris/Darwin/Linux-specific. */
+#define BSM_ERRNO_ETIME 62 /* Solaris/Darwin/Linux-specific. */
+#define BSM_ERRNO_ENOSR 63 /* Solaris/Darwin/Linux-specific. */
+#define BSM_ERRNO_ENONET 64 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ENOPKG 65 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EREMOTE 66
+#define BSM_ERRNO_ENOLINK 67
+#define BSM_ERRNO_EADV 68 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ESRMNT 69 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ECOMM 70 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EPROTO 71
+#define BSM_ERRNO_ELOCKUNMAPPED 72 /* Solaris-specific. */
+#define BSM_ERRNO_ENOTACTIVE 73 /* Solaris-specific. */
+#define BSM_ERRNO_EMULTIHOP 74
+#define BSM_ERRNO_EBADMSG 77
+#define BSM_ERRNO_ENAMETOOLONG 78
+#define BSM_ERRNO_EOVERFLOW 79
+#define BSM_ERRNO_ENOTUNIQ 80 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EBADFD 81 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EREMCHG 82 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ELIBACC 83 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ELIBBAD 84 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ELIBSCN 85 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ELIBMAX 86 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ELIBEXEC 87 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_EILSEQ 88
+#define BSM_ERRNO_ENOSYS 89
+#define BSM_ERRNO_ELOOP 90
+#define BSM_ERRNO_ERESTART 91
+#define BSM_ERRNO_ESTRPIPE 92 /* Solaris/Linux-specific. */
+#define BSM_ERRNO_ENOTEMPTY 93
+#define BSM_ERRNO_EUSERS 94
+#define BSM_ERRNO_ENOTSOCK 95
+#define BSM_ERRNO_EDESTADDRREQ 96
+#define BSM_ERRNO_EMSGSIZE 97
+#define BSM_ERRNO_EPROTOTYPE 98
+#define BSM_ERRNO_ENOPROTOOPT 99
+#define BSM_ERRNO_EPROTONOSUPPORT 120
+#define BSM_ERRNO_ESOCKTNOSUPPORT 121
+#define BSM_ERRNO_EOPNOTSUPP 122
+#define BSM_ERRNO_EPFNOSUPPORT 123
+#define BSM_ERRNO_EAFNOSUPPORT 124
+#define BSM_ERRNO_EADDRINUSE 125
+#define BSM_ERRNO_EADDRNOTAVAIL 126
+#define BSM_ERRNO_ENETDOWN 127
+#define BSM_ERRNO_ENETUNREACH 128
+#define BSM_ERRNO_ENETRESET 129
+#define BSM_ERRNO_ECONNABORTED 130
+#define BSM_ERRNO_ECONNRESET 131
+#define BSM_ERRNO_ENOBUFS 132
+#define BSM_ERRNO_EISCONN 133
+#define BSM_ERRNO_ENOTCONN 134
+#define BSM_ERRNO_ESHUTDOWN 143
+#define BSM_ERRNO_ETOOMANYREFS 144
+#define BSM_ERRNO_ETIMEDOUT 145
+#define BSM_ERRNO_ECONNREFUSED 146
+#define BSM_ERRNO_EHOSTDOWN 147
+#define BSM_ERRNO_EHOSTUNREACH 148
+#define BSM_ERRNO_EALREADY 149
+#define BSM_ERRNO_EINPROGRESS 150
+#define BSM_ERRNO_ESTALE 151
/*
* OpenBSM constants for error numbers not defined in Solaris. In the event
@@ -172,44 +172,44 @@
*
* ELAST doesn't get a constant in the BSM space.
*/
-#define BSM_EPROCLIM 190 /* FreeBSD/Darwin-specific. */
-#define BSM_EBADRPC 191 /* FreeBSD/Darwin-specific. */
-#define BSM_ERPCMISMATCH 192 /* FreeBSD/Darwin-specific. */
-#define BSM_EPROGUNAVAIL 193 /* FreeBSD/Darwin-specific. */
-#define BSM_EPROGMISMATCH 194 /* FreeBSD/Darwin-specific. */
-#define BSM_EPROCUNAVAIL 195 /* FreeBSD/Darwin-specific. */
-#define BSM_EFTYPE 196 /* FreeBSD/Darwin-specific. */
-#define BSM_EAUTH 197 /* FreeBSD/Darwin-specific. */
-#define BSM_ENEEDAUTH 198 /* FreeBSD/Darwin-specific. */
-#define BSM_ENOATTR 199 /* FreeBSD/Darwin-specific. */
-#define BSM_EDOOFUS 200 /* FreeBSD-specific. */
-#define BSM_EJUSTRETURN 201 /* FreeBSD-specific. */
-#define BSM_ENOIOCTL 202 /* FreeBSD-specific. */
-#define BSM_EDIRIOCTL 203 /* FreeBSD-specific. */
-#define BSM_EPWROFF 204 /* Darwin-specific. */
-#define BSM_EDEVERR 205 /* Darwin-specific. */
-#define BSM_EBADEXEC 206 /* Darwin-specific. */
-#define BSM_EBADARCH 207 /* Darwin-specific. */
-#define BSM_ESHLIBVERS 208 /* Darwin-specific. */
-#define BSM_EBADMACHO 209 /* Darwin-specific. */
-#define BSM_EPOLICY 210 /* Darwin-specific. */
-#define BSM_EDOTDOT 211 /* Linux-specific. */
-#define BSM_EUCLEAN 212 /* Linux-specific. */
-#define BSM_ENOTNAM 213 /* Linux(Xenix?)-specific. */
-#define BSM_ENAVAIL 214 /* Linux(Xenix?)-specific. */
-#define BSM_EISNAM 215 /* Linux(Xenix?)-specific. */
-#define BSM_EREMOTEIO 216 /* Linux-specific. */
-#define BSM_ENOMEDIUM 217 /* Linux-specific. */
-#define BSM_EMEDIUMTYPE 218 /* Linux-specific. */
-#define BSM_ENOKEY 219 /* Linux-specific. */
-#define BSM_EKEYEXPIRED 220 /* Linux-specific. */
-#define BSM_EKEYREVOKED 221 /* Linux-specific. */
-#define BSM_EKEYREJECTED 222 /* Linux-specific. */
+#define BSM_ERRNO_EPROCLIM 190 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_EBADRPC 191 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_ERPCMISMATCH 192 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_EPROGUNAVAIL 193 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_EPROGMISMATCH 194 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_EPROCUNAVAIL 195 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_EFTYPE 196 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_EAUTH 197 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_ENEEDAUTH 198 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_ENOATTR 199 /* FreeBSD/Darwin-specific. */
+#define BSM_ERRNO_EDOOFUS 200 /* FreeBSD-specific. */
+#define BSM_ERRNO_EJUSTRETURN 201 /* FreeBSD-specific. */
+#define BSM_ERRNO_ENOIOCTL 202 /* FreeBSD-specific. */
+#define BSM_ERRNO_EDIRIOCTL 203 /* FreeBSD-specific. */
+#define BSM_ERRNO_EPWROFF 204 /* Darwin-specific. */
+#define BSM_ERRNO_EDEVERR 205 /* Darwin-specific. */
+#define BSM_ERRNO_EBADEXEC 206 /* Darwin-specific. */
+#define BSM_ERRNO_EBADARCH 207 /* Darwin-specific. */
+#define BSM_ERRNO_ESHLIBVERS 208 /* Darwin-specific. */
+#define BSM_ERRNO_EBADMACHO 209 /* Darwin-specific. */
+#define BSM_ERRNO_EPOLICY 210 /* Darwin-specific. */
+#define BSM_ERRNO_EDOTDOT 211 /* Linux-specific. */
+#define BSM_ERRNO_EUCLEAN 212 /* Linux-specific. */
+#define BSM_ERRNO_ENOTNAM 213 /* Linux(Xenix?)-specific. */
+#define BSM_ERRNO_ENAVAIL 214 /* Linux(Xenix?)-specific. */
+#define BSM_ERRNO_EISNAM 215 /* Linux(Xenix?)-specific. */
+#define BSM_ERRNO_EREMOTEIO 216 /* Linux-specific. */
+#define BSM_ERRNO_ENOMEDIUM 217 /* Linux-specific. */
+#define BSM_ERRNO_EMEDIUMTYPE 218 /* Linux-specific. */
+#define BSM_ERRNO_ENOKEY 219 /* Linux-specific. */
+#define BSM_ERRNO_EKEYEXPIRED 220 /* Linux-specific. */
+#define BSM_ERRNO_EKEYREVOKED 221 /* Linux-specific. */
+#define BSM_ERRNO_EKEYREJECTED 222 /* Linux-specific. */
/*
* In the event that OpenBSM doesn't have a file representation of a local
* error number, use this.
*/
-#define BSM_UNKNOWNERR 250 /* OpenBSM-specific. */
+#define BSM_ERRNO_UNKNOWN 250 /* OpenBSM-specific. */
#endif /* !_BSM_AUDIT_ERRNO_H_ */
diff --git a/sys/bsm/audit_internal.h b/sys/bsm/audit_internal.h
index e4ad35371674..b25c47f71dae 100644
--- a/sys/bsm/audit_internal.h
+++ b/sys/bsm/audit_internal.h
@@ -30,7 +30,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#2
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#5
* $FreeBSD$
*/
diff --git a/sys/bsm/audit_kevents.h b/sys/bsm/audit_kevents.h
index 950462a06f06..3276cacd4cea 100644
--- a/sys/bsm/audit_kevents.h
+++ b/sys/bsm/audit_kevents.h
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_kevents.h#3
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_kevents.h#4
* $FreeBSD$
*/
diff --git a/sys/bsm/audit_record.h b/sys/bsm/audit_record.h
index 2bb78bcbedcf..5d9306a3e5ae 100644
--- a/sys/bsm/audit_record.h
+++ b/sys/bsm/audit_record.h
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#3
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#9
* $FreeBSD$
*/
@@ -282,10 +282,15 @@ token_t *au_to_trailer(int rec_size);
token_t *au_to_zonename(const char *zonename);
/*
- * BSM library routines for manipulating errno values.
+ * BSM library routines for converting between local and BSM constant spaces.
*/
+int au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
int au_bsm_to_errno(u_char bsm_error, int *errorp);
-u_char au_errno_to_bsm(int error);
+int au_bsm_to_socket_type(u_short bsm_socket_type,
+ int *local_socket_typep);
+u_short au_domain_to_bsm(int local_domain);
+u_char au_errno_to_bsm(int local_errno);
+u_short au_socket_type_to_bsm(int local_socket_type);
__END_DECLS
diff --git a/sys/bsm/audit_socket_type.h b/sys/bsm/audit_socket_type.h
new file mode 100644
index 000000000000..6b6bac1b74c6
--- /dev/null
+++ b/sys/bsm/audit_socket_type.h
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 2008 Apple Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_socket_type.h#1
+ * $FreeBSD$
+ */
+
+#ifndef _BSM_AUDIT_SOCKET_TYPE_H_
+#define _BSM_AUDIT_SOCKET_TYPE_H_
+
+/*
+ * BSM socket type constants.
+ */
+#define BSM_SOCK_DGRAM 1
+#define BSM_SOCK_STREAM 2
+#define BSM_SOCK_RAW 4
+#define BSM_SOCK_RDM 5
+#define BSM_SOCK_SEQPACKET 6
+
+#define BSM_SOCK_UNKNOWN 500
+
+#endif /* !_BSM_AUDIT_SOCKET_TYPE_H_ */