diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-12-14 13:13:47 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-12-14 13:13:47 +0000 |
commit | cfd45dc56a5903c63d99aba69aff2b978dcac4b6 (patch) | |
tree | e279dc697e4e4451784469aeb4e45a64ae2e7b96 /usr/src/lib/libbsm/common/adt.c | |
parent | a52dd1de494223aa5cbd41a0f9caa61a31da59cf (diff) | |
parent | 739415d128746863863f9005c1923d9f5dd397e4 (diff) | |
download | illumos-joyent-cfd45dc56a5903c63d99aba69aff2b978dcac4b6.tar.gz |
[illumos-gate merge]
commit 739415d128746863863f9005c1923d9f5dd397e4
8916 man pages should refer to our own Dynamic Tracing Guide
8915 remove reference to kgmon in lockstat(1m)
commit 435a78cc932ae710cfa076091a136712cf13ccf2
8885 64-bit libbsm:adt_do_ipv[46]_address creates non-compressible at_port.
commit f6969e9b236c140638ae16b1d5c8dff401e31465
8848 hbaapi: variable set but not used
commit 4c307623be8d9c2d69ed7e8622a1ab0a6348d0dd
8843 libnls: variable 'version' set but not used
commit 19700af4088d99a0f173873dcdfcf51fdb90335b
8830 libshell: variable set but not used
commit 1d6eba5f15dcb03614b687ec6ddaa6477b7baa41
8823 print: variable 'error' set but not used
commit a1a46df055863a267eb7a80b7961c9379bc457ec
8822 libsmbfs: variable set but not used
commit 8f33f62fe3b6ef9b5f9a849a5d2081f34e048be2
8819 x86 unix: variable set but not used
commit ea6a05275c5cbe13e3a79eb7efb3a0a097613149
8813 rdsv3: variable 'timeo' set but not used
commit 8b9a0f1ef5cee53073074965f0ea1d015d66926f
8812 xge: variable set but not used
commit a3907569cb648b92b09b4854131a106aafecab36
8911 loader: move ficl outb and inb into libi386
Diffstat (limited to 'usr/src/lib/libbsm/common/adt.c')
-rw-r--r-- | usr/src/lib/libbsm/common/adt.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/usr/src/lib/libbsm/common/adt.c b/usr/src/lib/libbsm/common/adt.c index 4cf0dd7566..20741efa75 100644 --- a/usr/src/lib/libbsm/common/adt.c +++ b/usr/src/lib/libbsm/common/adt.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2013, Joyent, Inc. All rights reserved. + * Copyright 2017 OmniOS Community Edition (OmniOSce) Association. */ #include <bsm/adt.h> @@ -589,12 +590,42 @@ adt_set_mask(const adt_session_data_t *session_data, const au_mask_t *mask) * helpers for adt_load_termid */ +static dev_t +adt_ports_to_at_port(in_port_t remote, in_port_t local) +{ + dev_t port; + +#ifdef _LP64 + dev_t tmp; + + /* + * In 64-bit, at_port is a 64-bit value encoding major/minor + * device numbers as 32-bits each. However when a 32-bit application + * subsequently requests the audit address via getaudit_addr(), this + * value must be capable of being compressed down to a 14-bit major and + * 18-bit minor number or the call will fail. + * + * In order to construct a 32-bit compatible value, the top 14-bits of + * the remote port are used for the major number and the remaining + * 2-bits + local port are used for the minor. + */ + + tmp = ((remote<<16) | (local)); + port = (tmp & MAXMIN32); + port |= (((tmp >> NBITSMINOR32) & MAXMAJ32) << NBITSMINOR64); +#else + port = ((remote<<16) | (local)); +#endif + + return (port); +} + static void adt_do_ipv6_address(struct sockaddr_in6 *peer, struct sockaddr_in6 *sock, au_tid_addr_t *termid) { - - termid->at_port = ((peer->sin6_port<<16) | (sock->sin6_port)); + termid->at_port = + adt_ports_to_at_port(peer->sin6_port, sock->sin6_port); termid->at_type = AU_IPv6; (void) memcpy(termid->at_addr, &peer->sin6_addr, 4 * sizeof (uint_t)); } @@ -603,9 +634,7 @@ static void adt_do_ipv4_address(struct sockaddr_in *peer, struct sockaddr_in *sock, au_tid_addr_t *termid) { - - termid->at_port = ((peer->sin_port<<16) | (sock->sin_port)); - + termid->at_port = adt_ports_to_at_port(peer->sin_port, sock->sin_port); termid->at_type = AU_IPv4; termid->at_addr[0] = (uint32_t)peer->sin_addr.s_addr; (void) memset(&(termid->at_addr[1]), 0, 3 * sizeof (uint_t)); |