Feature #5822 » bsnmpd-descr-ifAlias.diff
| contrib/bsnmp/lib/asn1.c | ||
|---|---|---|
|
err = ASN_ERR_RANGE;
|
||
|
}
|
||
|
if (oid->subs[0] > 2 ||
|
||
|
(oid->subs[0] < 2 && oid->subs[1] >= 40)) {
|
||
|
(oid->subs[0] < 2 && oid->subs[0] >= 40)) {
|
||
|
asn_error(NULL, "oid out of range (%u,%u)",
|
||
|
oid->subs[0], oid->subs[1]);
|
||
|
err = ASN_ERR_RANGE;
|
||
| contrib/bsnmp/lib/snmp.c | ||
|---|---|---|
|
memset(buf, 0, 256);
|
||
|
tb.asn_ptr = buf;
|
||
|
tb.asn_len = 256;
|
||
|
u_int len;
|
||
|
if (asn_get_octetstring(b, buf, &len) != ASN_ERR_OK) {
|
||
|
if (asn_get_octetstring(b, buf, &tb.asn_len) != ASN_ERR_OK) {
|
||
|
snmp_error("cannot parse usm header");
|
||
|
return (ASN_ERR_FAILED);
|
||
|
}
|
||
|
tb.asn_len = len;
|
||
|
if (asn_get_sequence(&tb, &octs_len) != ASN_ERR_OK) {
|
||
|
snmp_error("cannot decode usm header");
|
||
| ... | ... | |
|
return (SNMP_CODE_FAILED);
|
||
|
pdu->scoped_len = b->asn_ptr - pdu->scoped_ptr;
|
||
|
if (snmp_pdu_fix_padd(b, pdu) != ASN_ERR_OK)
|
||
|
if ((code = snmp_pdu_fix_padd(b, pdu))!= ASN_ERR_OK)
|
||
|
return (SNMP_CODE_FAILED);
|
||
|
if (pdu->security_model != SNMP_SECMODEL_USM)
|
||
| ... | ... | |
|
if ((err = snmp_pdu_encode_header(resp_b, pdu)) != SNMP_CODE_OK)
|
||
|
return (err);
|
||
|
for (idx = 0; idx < pdu->nbindings; idx++)
|
||
|
if (snmp_binding_encode(resp_b, &pdu->bindings[idx])
|
||
|
if ((err = snmp_binding_encode(resp_b, &pdu->bindings[idx]))
|
||
|
!= ASN_ERR_OK)
|
||
|
return (SNMP_CODE_FAILED);
|
||
| contrib/bsnmp/lib/snmp.h | ||
|---|---|---|
|
/* fixes for encoding */
|
||
|
size_t outer_len;
|
||
|
asn_len_t scoped_len;
|
||
|
size_t scoped_len;
|
||
|
u_char *outer_ptr;
|
||
|
u_char *digest_ptr;
|
||
|
u_char *encrypted_ptr;
|
||
| contrib/bsnmp/lib/snmpagent.c | ||
|---|---|---|
|
}
|
||
|
static void
|
||
|
snmp_pdu_create_response(const struct snmp_pdu *pdu, struct snmp_pdu *resp)
|
||
|
snmp_pdu_create_response(struct snmp_pdu *pdu, struct snmp_pdu *resp)
|
||
|
{
|
||
|
memset(resp, 0, sizeof(*resp));
|
||
|
strcpy(resp->community, pdu->community);
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
|
||
|
snmp_debug("get: failed to encode PDU");
|
||
|
return (SNMP_RET_ERR);
|
||
|
}
|
||
|
return (SNMP_RET_OK);
|
||
|
return (snmp_fix_encoding(resp_b, resp));
|
||
|
}
|
||
|
static struct snmp_node *
|
||
| ... | ... | |
|
return (SNMP_RET_ERR);
|
||
|
}
|
||
|
}
|
||
|
if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
|
||
|
snmp_debug("getnext: failed to encode PDU");
|
||
|
return (SNMP_RET_ERR);
|
||
|
}
|
||
|
return (SNMP_RET_OK);
|
||
|
return (snmp_fix_encoding(resp_b, resp));
|
||
|
}
|
||
|
enum snmp_ret
|
||
| ... | ... | |
|
}
|
||
|
done:
|
||
|
if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
|
||
|
snmp_debug("getnext: failed to encode PDU");
|
||
|
return (SNMP_RET_ERR);
|
||
|
}
|
||
|
return (SNMP_RET_OK);
|
||
|
return (snmp_fix_encoding(resp_b, resp));
|
||
|
}
|
||
|
/*
|
||
| ... | ... | |
|
snmp_make_errresp(const struct snmp_pdu *pdu, struct asn_buf *pdu_b,
|
||
|
struct asn_buf *resp_b)
|
||
|
{
|
||
|
u_char type;
|
||
|
asn_len_t len;
|
||
|
struct snmp_pdu resp;
|
||
|
enum asn_err err;
|
||
|
enum snmp_code code;
|
||
|
snmp_pdu_create_response(pdu, &resp);
|
||
|
memset(&resp, 0, sizeof(resp));
|
||
|
if ((code = snmp_pdu_decode_header(pdu_b, &resp)) != SNMP_CODE_OK)
|
||
|
return (SNMP_RET_IGN);
|
||
|
if (pdu->version == SNMP_V3) {
|
||
|
if (resp.user.priv_proto != SNMP_PRIV_NOPRIV &&
|
||
|
(asn_get_header(pdu_b, &type, &resp.scoped_len) != ASN_ERR_OK
|
||
|
|| type != ASN_TYPE_OCTETSTRING)) {
|
||
|
snmp_error("cannot decode encrypted pdu");
|
||
|
return (SNMP_RET_IGN);
|
||
|
}
|
||
|
if (asn_get_sequence(pdu_b, &len) != ASN_ERR_OK) {
|
||
|
snmp_error("cannot decode scoped pdu header");
|
||
|
return (SNMP_RET_IGN);
|
||
|
}
|
||
|
len = SNMP_ENGINE_ID_SIZ;
|
||
|
if (asn_get_octetstring(pdu_b, (u_char *)resp.context_engine,
|
||
|
&len) != ASN_ERR_OK) {
|
||
|
snmp_error("cannot decode msg context engine");
|
||
|
return (SNMP_RET_IGN);
|
||
|
}
|
||
|
resp.context_engine_len = len;
|
||
|
len = SNMP_CONTEXT_NAME_SIZ;
|
||
|
if (asn_get_octetstring(pdu_b, (u_char *)resp.context_name,
|
||
|
&len) != ASN_ERR_OK) {
|
||
|
snmp_error("cannot decode msg context name");
|
||
|
return (SNMP_RET_IGN);
|
||
|
}
|
||
|
resp.context_name[len] = '\0';
|
||
|
}
|
||
|
if (asn_get_header(pdu_b, &type, &len) != ASN_ERR_OK) {
|
||
|
snmp_error("cannot get pdu header");
|
||
|
return (SNMP_RET_IGN);
|
||
|
}
|
||
|
if ((type & ~ASN_TYPE_MASK) !=
|
||
|
(ASN_TYPE_CONSTRUCTED | ASN_CLASS_CONTEXT)) {
|
||
|
snmp_error("bad pdu header tag");
|
||
|
if (pdu_b->asn_len < len)
|
||
|
return (SNMP_RET_IGN);
|
||
|
}
|
||
|
pdu_b->asn_len = len;
|
||
|
err = snmp_parse_pdus_hdr(pdu_b, &resp, &len);
|
||
|
if (ASN_ERR_STOPPED(err))
|
||
| contrib/bsnmp/snmp_mibII/mibII.c | ||
|---|---|---|
|
size_t len;
|
||
|
void *newmib;
|
||
|
struct ifmibdata oldmib = ifp->mib;
|
||
|
struct ifreq irr;
|
||
|
if (fetch_generic_mib(ifp, &oldmib) == -1)
|
||
|
return (-1);
|
||
| ... | ... | |
|
}
|
||
|
out:
|
||
|
strncpy(irr.ifr_name, ifp->name, sizeof(irr.ifr_name));
|
||
|
irr.ifr_buffer.buffer = MIBIF_PRIV(ifp)->alias;
|
||
|
irr.ifr_buffer.length = sizeof(MIBIF_PRIV(ifp)->alias);
|
||
|
if (ioctl(mib_netsock, SIOCGIFDESCR, &irr) == -1) {
|
||
|
MIBIF_PRIV(ifp)->alias[0] = 0;
|
||
|
if (errno != ENOMSG)
|
||
|
syslog(LOG_WARNING, "SIOCGIFDESCR (%s): %m", ifp->name);
|
||
|
} else if (irr.ifr_buffer.buffer == NULL) {
|
||
|
MIBIF_PRIV(ifp)->alias[0] = 0;
|
||
|
syslog(LOG_WARNING, "SIOCGIFDESCR (%s): too long (%zu)",
|
||
|
ifp->name, irr.ifr_buffer.length);
|
||
|
}
|
||
|
ifp->mibtick = get_ticks();
|
||
|
return (0);
|
||
|
}
|
||
| contrib/bsnmp/snmp_mibII/mibII.h | ||
|---|---|---|
|
#include "snmp_mibII.h"
|
||
|
#include "mibII_tree.h"
|
||
|
/* maximum size of the interface alias */
|
||
|
#define MIBIF_ALIAS_SIZE (64 + 1)
|
||
|
/*
|
||
|
* Interface list and flags.
|
||
|
*/
|
||
| ... | ... | |
|
uint64_t hc_opackets;
|
||
|
uint64_t hc_imcasts;
|
||
|
uint64_t hc_ipackets;
|
||
|
/* this should be made public */
|
||
|
char alias[MIBIF_ALIAS_SIZE];
|
||
|
};
|
||
|
#define MIBIF_PRIV(IFP) ((struct mibif_private *)((IFP)->private))
|
||
| contrib/bsnmp/snmp_mibII/mibII_interfaces.c | ||
|---|---|---|
|
break;
|
||
|
case LEAF_ifAlias:
|
||
|
ret = string_get(value, MIBIF_PRIV(ifp)->alias, -1);
|
||
|
ret = string_get(value, "", -1);
|
||
|
break;
|
||
|
case LEAF_ifCounterDiscontinuityTime:
|
||
| contrib/bsnmp/snmp_mibII/mibII_ip.c | ||
|---|---|---|
|
op_ip(struct snmp_context *ctx, struct snmp_value *value,
|
||
|
u_int sub, u_int idx __unused, enum snmp_op op)
|
||
|
{
|
||
|
int old = 0;
|
||
|
int old;
|
||
|
switch (op) {
|
||
| contrib/bsnmp/snmp_mibII/mibII_tcp.c | ||
|---|---|---|
|
};
|
||
|
static uint64_t tcp_tick;
|
||
|
static uint64_t tcp_stats_tick;
|
||
|
static struct tcpstat tcpstat;
|
||
|
static struct xinpgen *xinpgen;
|
||
|
static size_t xinpgen_len;
|
||
|
static u_int tcp_count;
|
||
|
static u_int tcp_total;
|
||
|
static u_int oidnum;
|
||
| ... | ... | |
|
}
|
||
|
static int
|
||
|
fetch_tcp_stats(void)
|
||
|
fetch_tcp(void)
|
||
|
{
|
||
|
size_t len;
|
||
|
struct xinpgen *ptr;
|
||
|
struct xtcpcb *tp;
|
||
|
struct tcp_index *oid;
|
||
|
in_addr_t inaddr;
|
||
|
len = sizeof(tcpstat);
|
||
|
if (sysctlbyname("net.inet.tcp.stats", &tcpstat, &len, NULL, 0) == -1) {
|
||
| ... | ... | |
|
return (-1);
|
||
|
}
|
||
|
tcp_stats_tick = get_ticks();
|
||
|
return (0);
|
||
|
}
|
||
|
static int
|
||
|
fetch_tcp(void)
|
||
|
{
|
||
|
size_t len;
|
||
|
struct xinpgen *ptr;
|
||
|
struct xtcpcb *tp;
|
||
|
struct tcp_index *oid;
|
||
|
in_addr_t inaddr;
|
||
|
len = 0;
|
||
|
if (sysctlbyname("net.inet.tcp.pcblist", NULL, &len, NULL, 0) == -1) {
|
||
|
syslog(LOG_ERR, "net.inet.tcp.pcblist: %m");
|
||
| ... | ... | |
|
tcp_tick = get_ticks();
|
||
|
tcp_count = 0;
|
||
|
tcp_total = 0;
|
||
|
for (ptr = (struct xinpgen *)(void *)((char *)xinpgen + xinpgen->xig_len);
|
||
|
ptr->xig_len > sizeof(struct xinpgen);
|
||
| ... | ... | |
|
if (tp->xt_inp.inp_vflag & INP_IPV4)
|
||
|
tcp_total++;
|
||
|
if (tp->xt_tp.t_state == TCPS_ESTABLISHED ||
|
||
|
tp->xt_tp.t_state == TCPS_CLOSE_WAIT)
|
||
|
tcp_count++;
|
||
|
}
|
||
|
if (oidnum < tcp_total) {
|
||
| ... | ... | |
|
abort();
|
||
|
}
|
||
|
if (tcp_stats_tick < this_tick)
|
||
|
if (fetch_tcp_stats() == -1)
|
||
|
if (tcp_tick < this_tick)
|
||
|
if (fetch_tcp() == -1)
|
||
|
return (SNMP_ERR_GENERR);
|
||
|
switch (value->var.subs[sub - 1]) {
|
||
| ... | ... | |
|
break;
|
||
|
case LEAF_tcpCurrEstab:
|
||
|
#if __FreeBSD_version > 1003000
|
||
|
value->v.uint32 = tcpstat.tcps_states[TCPS_ESTABLISHED] +
|
||
|
tcpstat.tcps_states[TCPS_CLOSE_WAIT];
|
||
|
#else
|
||
|
value->v.uint32 = (uint32_t) -1;
|
||
|
#endif
|
||
|
value->v.uint32 = tcp_count;
|
||
|
break;
|
||
|
case LEAF_tcpInSegs:
|
||
| contrib/bsnmp/snmp_target/target_snmp.c | ||
|---|---|---|
|
default:
|
||
|
break;
|
||
|
}
|
||
|
return (SNMP_ERR_NOERROR);
|
||
|
default:
|
||
|
abort();
|
||
| ... | ... | |
|
default:
|
||
|
break;
|
||
|
}
|
||
|
return (SNMP_ERR_NOERROR);
|
||
|
default:
|
||
|
abort();
|
||
| ... | ... | |
|
static int
|
||
|
target_decode_index(const struct asn_oid *oid, uint sub, char *name)
|
||
|
{
|
||
|
uint32_t i;
|
||
|
uint32_t i, len;
|
||
|
if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >=
|
||
|
SNMP_ADM_STR32_SIZ)
|
||
|
if ((len = oid->len - sub) >= SNMP_ADM_STR32_SIZ)
|
||
|
return (-1);
|
||
|
for (i = 0; i < oid->subs[sub]; i++)
|
||
|
name[i] = oid->subs[sub + i + 1];
|
||
|
for (i = 0; i < len; i++)
|
||
|
name[i] = oid->subs[sub + i];
|
||
|
name[i] = '\0';
|
||
|
return (0);
|
||
| etc/netstart | ||
|---|---|---|
|
# the network by hand, this script will do it for you).
|
||
|
#
|
||
|
. /etc/rc.subr
|
||
|
load_rc_config 'XXX'
|
||
|
_start=quietstart
|
||
|
/etc/rc.d/devd ${_start}
|
||
| etc/periodic/daily/400.status-disks | ||
|---|---|---|
|
echo ""
|
||
|
echo "Disk status:"
|
||
|
df $daily_status_disks_df_flags && rc=1 || rc=3
|
||
|
if [ -n "${daily_status_disks_ignore}" ] ; then
|
||
|
ignore="egrep -v ${daily_status_disks_ignore}"
|
||
|
else
|
||
|
ignore="cat"
|
||
|
fi
|
||
|
(df $daily_status_disks_df_flags | ${ignore}) && rc=1 || rc=3
|
||
|
# display which filesystems need backing up
|
||
|
if [ -s /etc/dumpdates ]; then
|
||
| etc/rc.d/local_unbound | ||
|---|---|---|
|
: ${local_unbound_config:=${local_unbound_workdir}/unbound.conf}
|
||
|
: ${local_unbound_flags:="-c ${local_unbound_config}"}
|
||
|
: ${local_unbound_forwardconf:=${local_unbound_workdir}/forward.conf}
|
||
|
: ${local_unbound_controlconf:=${local_unbound_workdir}/control.conf}
|
||
|
: ${local_unbound_anchor:=${local_unbound_workdir}/root.key}
|
||
|
: ${local_unbound_forwarders:=}
|
||
| ... | ... | |
|
-w ${local_unbound_workdir} \
|
||
|
-c ${local_unbound_config} \
|
||
|
-f ${local_unbound_forwardconf} \
|
||
|
-o ${local_unbound_controlconf} \
|
||
|
-a ${local_unbound_anchor} \
|
||
|
${local_unbound_forwarders}
|
||
|
}
|
||
| etc/rc.d/othermta | ||
|---|---|---|
|
#
|
||
|
. /etc/rc.subr
|
||
|
load_rc_config 'XXX'
|
||
|
load_rc_config
|
||
|
if [ -n "${mta_start_script}" ]; then
|
||
|
[ "${mta_start_script}" != "/etc/rc.sendmail" ] && \
|
||
| etc/rc.shutdown | ||
|---|---|---|
|
. /etc/rc.subr
|
||
|
load_rc_config 'XXX'
|
||
|
load_rc_config
|
||
|
# reverse_list list
|
||
|
# print the list in reverse order
|
||
| lib/libc/net/sctp_sys_calls.c | ||
|---|---|---|
|
#ifdef SYS_sctp_generic_sendmsg
|
||
|
if (addrcnt == 1) {
|
||
|
socklen_t l;
|
||
|
ssize_t ret;
|
||
|
/*
|
||
|
* Quick way, we don't need to do a connectx so lets use the
|
||
|
* syscall directly.
|
||
|
*/
|
||
|
l = addrs->sa_len;
|
||
|
return (syscall(SYS_sctp_generic_sendmsg, sd,
|
||
|
msg, msg_len, addrs, l, sinfo, flags));
|
||
|
ret = syscall(SYS_sctp_generic_sendmsg, sd,
|
||
|
msg, msg_len, addrs, l, sinfo, flags);
|
||
|
if ((ret >= 0) && (sinfo != NULL)) {
|
||
|
sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs);
|
||
|
}
|
||
|
return (ret);
|
||
|
}
|
||
|
#endif
|
||
| ... | ... | |
|
struct sockaddr *addr;
|
||
|
struct sockaddr_in *addr_in;
|
||
|
struct sockaddr_in6 *addr_in6;
|
||
|
sctp_assoc_t *assoc_id;
|
||
|
if ((addrcnt < 0) ||
|
||
|
(iovcnt < 0) ||
|
||
| ... | ... | |
|
errno = ENOMEM;
|
||
|
return (-1);
|
||
|
}
|
||
|
assoc_id = NULL;
|
||
|
msg.msg_control = cmsgbuf;
|
||
|
msg.msg_controllen = 0;
|
||
|
cmsg = (struct cmsghdr *)cmsgbuf;
|
||
| ... | ... | |
|
memcpy(CMSG_DATA(cmsg), info, sizeof(struct sctp_sndinfo));
|
||
|
msg.msg_controllen += CMSG_SPACE(sizeof(struct sctp_sndinfo));
|
||
|
cmsg = (struct cmsghdr *)((caddr_t)cmsg + CMSG_SPACE(sizeof(struct sctp_sndinfo)));
|
||
|
assoc_id = &(((struct sctp_sndinfo *)info)->snd_assoc_id);
|
||
|
break;
|
||
|
case SCTP_SENDV_PRINFO:
|
||
|
if ((info == NULL) || (infolen < sizeof(struct sctp_prinfo))) {
|
||
| ... | ... | |
|
memcpy(CMSG_DATA(cmsg), &spa_info->sendv_sndinfo, sizeof(struct sctp_sndinfo));
|
||
|
msg.msg_controllen += CMSG_SPACE(sizeof(struct sctp_sndinfo));
|
||
|
cmsg = (struct cmsghdr *)((caddr_t)cmsg + CMSG_SPACE(sizeof(struct sctp_sndinfo)));
|
||
|
assoc_id = &(spa_info->sendv_sndinfo.snd_assoc_id);
|
||
|
}
|
||
|
if (spa_info->sendv_flags & SCTP_SEND_PRINFO_VALID) {
|
||
|
cmsg->cmsg_level = IPPROTO_SCTP;
|
||
| ... | ... | |
|
msg.msg_flags = 0;
|
||
|
ret = sendmsg(sd, &msg, flags);
|
||
|
free(cmsgbuf);
|
||
|
if ((ret >= 0) && (addrs != NULL) && (assoc_id != NULL)) {
|
||
|
*assoc_id = sctp_getassocid(sd, addrs);
|
||
|
}
|
||
|
return (ret);
|
||
|
}
|
||
| lib/libc/stdio/fopen.3 | ||
|---|---|---|
|
.St -isoC
|
||
|
and has effect only for
|
||
|
.Fn fmemopen
|
||
|
; otherwise the ``b'' is ignored.
|
||
|
; otherwise
|
||
|
.Dq Li b
|
||
|
is ignored.
|
||
|
.Pp
|
||
|
Any created files will have mode
|
||
|
.Do Dv S_IRUSR
|
||
| ... | ... | |
|
.Fa size
|
||
|
bytes of memory. This buffer is automatically freed when the
|
||
|
stream is closed. Buffers can be opened in text-mode (default) or binary-mode
|
||
|
(if ``b'' is present in the second or third position of the
|
||
|
(if
|
||
|
.Dq Li b
|
||
|
is present in the second or third position of the
|
||
|
.Fa mode
|
||
|
argument). Buffers opened in text-mode make sure that writes are terminated with
|
||
|
a NULL byte, if the last write hasn't filled up the whole buffer. Buffers
|
||
| ... | ... | |
|
function
|
||
|
conforms to
|
||
|
.St -p1003.1-2008 .
|
||
|
The ``b'' mode does not conform to any standard
|
||
|
The
|
||
|
.Dq Li b
|
||
|
mode does not conform to any standard
|
||
|
but is also supported by glibc.
|
||
| lib/libc/stdlib/tdelete.c | ||
|---|---|---|
|
/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */
|
||
|
/* $NetBSD: tdelete.c,v 1.8 2016/01/20 20:47:41 christos Exp $ */
|
||
|
/*
|
||
|
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
|
||
| ... | ... | |
|
#include <sys/cdefs.h>
|
||
|
#if 0
|
||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||
|
__RCSID("$NetBSD: tdelete.c,v 1.6 2012/06/25 22:32:45 abs Exp $");
|
||
|
__RCSID("$NetBSD: tdelete.c,v 1.8 2016/01/20 20:47:41 christos Exp $");
|
||
|
#endif /* LIBC_SCCS and not lint */
|
||
|
#endif
|
||
|
__FBSDID("$FreeBSD$");
|
||
| ... | ... | |
|
/*
|
||
|
* find a node with given key
|
||
|
* delete node with given key
|
||
|
*
|
||
|
* vkey: key to be found
|
||
|
* vkey: key to be deleted
|
||
|
* vrootp: address of the root of the tree
|
||
|
* compar: function to carry out node comparisons
|
||
|
*/
|
||
| ... | ... | |
|
q->rlink = (*rootp)->rlink;
|
||
|
}
|
||
|
}
|
||
|
if (p != *rootp)
|
||
|
free(*rootp); /* D4: Free node */
|
||
|
free(*rootp); /* D4: Free node */
|
||
|
*rootp = q; /* link parent to new node */
|
||
|
return p;
|
||
|
}
|
||
| lib/libdpv/dpv.c | ||
|---|---|---|
|
#include <dialog.h>
|
||
|
#include <err.h>
|
||
|
#include <limits.h>
|
||
|
#include <locale.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
| ... | ... | |
|
/* Reads: label_size pbar_size pprompt aprompt dpv_nfiles */
|
||
|
/* Inits: dheight and dwidth */
|
||
|
/* Default localeconv(3) settings for dialog(3) status */
|
||
|
setlocale(LC_NUMERIC,
|
||
|
getenv("LC_ALL") == NULL && getenv("LC_NUMERIC") == NULL ?
|
||
|
LC_NUMERIC_DEFAULT : "");
|
||
|
if (!debug) {
|
||
|
/* Internally create the initial `--gauge' prompt text */
|
||
|
dprompt_recreate(file_list, (struct dpv_file_node *)NULL, 0);
|
||
| lib/libdpv/dpv.h | ||
|---|---|---|
|
#define FALSE 0
|
||
|
#endif
|
||
|
/* localeconv(3) */
|
||
|
#define LC_NUMERIC_DEFAULT "en_US.ISO8859-1"
|
||
|
/* Data to process */
|
||
|
extern long long dpv_overall_read;
|
||
| release/doc/share/xml/security.xml | ||
|---|---|---|
|
<entry><para><application>OpenSSH</application> client
|
||
|
information leak</para></entry>
|
||
|
</row>
|
||
|
<row>
|
||
|
<entry><link
|
||
|
xlink:href="&security.url;/FreeBSD-SA-16:09.ntp.asc">FreeBSD-SA-16:09.ntp</link></entry>
|
||
|
<entry>27 January 2016</entry>
|
||
|
<entry><para>Multiple vulnerabilities.</para></entry>
|
||
|
</row>
|
||
|
<row>
|
||
|
<entry><link
|
||
|
xlink:href="&security.url;/FreeBSD-SA-16:10.linux.asc">FreeBSD-SA-16:10.linux</link></entry>
|
||
|
<entry>27 January 2016</entry>
|
||
|
<entry><para>&man.issetugid.2; system call
|
||
|
vulnerability.</para></entry>
|
||
|
</row>
|
||
|
</tbody>
|
||
|
</tgroup>
|
||
|
</informaltable>
|
||
| sbin/pfctl/pfctl.c | ||
|---|---|---|
|
printf(" [ Inserted: pid %u "
|
||
|
"State Creations: %-6ju]\n",
|
||
|
(unsigned)rule->cpid,
|
||
|
(uintmax_t)rule->states_tot);
|
||
|
(uintmax_t)rule->u_states_tot);
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
| share/dtrace/Makefile | ||
|---|---|---|
|
_toolkit= toolkit
|
||
|
.endif
|
||
|
SCRIPTS= nfsclienttime hotopen
|
||
|
SCRIPTS= nfsclienttime hotopen \
|
||
|
watch_execve \
|
||
|
watch_kill \
|
||
|
watch_vop_remove
|
||
|
SCRIPTSDIR= ${SHAREDIR}/dtrace
|
||
| share/dtrace/watch_execve | ||
|---|---|---|
|
#!/usr/sbin/dtrace -s
|
||
|
/* -
|
||
|
* Copyright (c) 2014 Devin Teske <dteske@FreeBSD.org>
|
||
|
* 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.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND 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 THE AUTHOR OR 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.
|
||
|
*
|
||
|
* $Title: dtrace(1) script to log process(es) entering syscall::execve $
|
||
|
* $FreeBSD$
|
||
|
*/
|
||
|
#pragma D option quiet
|
||
|
#pragma D option dynvarsize=16m
|
||
|
#pragma D option switchrate=10hz
|
||
|
/*********************************************************/
|
||
|
syscall::execve:entry /* probe ID 1 */
|
||
|
{
|
||
|
this->caller_execname = execname;
|
||
|
}
|
||
|
/*********************************************************/
|
||
|
syscall::execve:return /execname != this->caller_execname/ /* probe ID 2 */
|
||
|
{
|
||
|
/*
|
||
|
* Examine process, parent process, and grandparent process details
|
||
|
*/
|
||
|
/******************* CURPROC *******************/
|
||
|
this->proc = curthread->td_proc;
|
||
|
this->pid0 = this->proc->p_pid;
|
||
|
this->uid0 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid0 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc->p_args;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg0_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/******************* PPARENT *******************/
|
||
|
this->proc = this->proc->p_pptr;
|
||
|
this->pid1 = this->proc->p_pid;
|
||
|
this->uid1 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid1 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc ? this->proc->p_args : 0;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg1_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/******************* GPARENT *******************/
|
||
|
this->proc = this->proc->p_pptr;
|
||
|
this->pid2 = this->proc->p_pid;
|
||
|
this->uid2 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid2 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc ? this->proc->p_args : 0;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg2_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/******************* APARENT *******************/
|
||
|
this->proc = this->proc->p_pptr;
|
||
|
this->pid3 = this->proc->p_pid;
|
||
|
this->uid3 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid3 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc ? this->proc->p_args : 0;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg3_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/***********************************************/
|
||
|
/*
|
||
|
* Print process, parent, and grandparent details
|
||
|
*/
|
||
|
printf("%Y %s[%d]: ", timestamp + 1406598400000000000,
|
||
|
this->caller_execname, this->pid1);
|
||
|
printf("%s", this->arg0_0);
|
||
|
printf("%s%s", this->arg0_1 != "" ? " " : "", this->arg0_1);
|
||
|
printf("%s%s", this->arg0_2 != "" ? " " : "", this->arg0_2);
|
||
|
printf("%s%s", this->arg0_3 != "" ? " " : "", this->arg0_3);
|
||
|
printf("%s%s", this->arg0_4 != "" ? " " : "", this->arg0_4);
|
||
|
printf("\n");
|
||
|
printf(" -+= %05d %d.%d %s",
|
||
|
this->pid3, this->uid3, this->gid3, this->arg3_0);
|
||
|
printf("%s%s", this->arg3_1 != "" ? " " : "", this->arg3_1);
|
||
|
printf("%s%s", this->arg3_2 != "" ? " " : "", this->arg3_2);
|
||
|
printf("%s%s", this->arg3_3 != "" ? " " : "", this->arg3_3);
|
||
|
printf("%s%s", this->arg3_4 != "" ? " " : "", this->arg3_4);
|
||
|
printf("%s", this->arg3_0 != "" ? "\n" : "");
|
||
|
printf(" \-+= %05d %d.%d %s",
|
||
|
this->pid2, this->uid2, this->gid2, this->arg2_0);
|
||
|
printf("%s%s", this->arg2_1 != "" ? " " : "", this->arg2_1);
|
||
|
printf("%s%s", this->arg2_2 != "" ? " " : "", this->arg2_2);
|
||
|
printf("%s%s", this->arg2_3 != "" ? " " : "", this->arg2_3);
|
||
|
printf("%s%s", this->arg2_4 != "" ? " " : "", this->arg2_4);
|
||
|
printf("%s", this->arg2_0 != "" ? "\n" : "");
|
||
|
printf(" \-+= %05d %d.%d %s",
|
||
|
this->pid1, this->uid1, this->gid1, this->arg1_0);
|
||
|
printf("%s%s", this->arg1_1 != "" ? " " : "", this->arg1_1);
|
||
|
printf("%s%s", this->arg1_2 != "" ? " " : "", this->arg1_2);
|
||
|
printf("%s%s", this->arg1_3 != "" ? " " : "", this->arg1_3);
|
||
|
printf("%s%s", this->arg1_4 != "" ? " " : "", this->arg1_4);
|
||
|
printf("%s", this->arg1_0 != "" ? "\n" : "");
|
||
|
printf(" \-+= %05d %d.%d %s",
|
||
|
this->pid0, this->uid0, this->gid0, this->arg0_0);
|
||
|
printf("%s%s", this->arg0_1 != "" ? " " : "", this->arg0_1);
|
||
|
printf("%s%s", this->arg0_2 != "" ? " " : "", this->arg0_2);
|
||
|
printf("%s%s", this->arg0_3 != "" ? " " : "", this->arg0_3);
|
||
|
printf("%s%s", this->arg0_4 != "" ? " " : "", this->arg0_4);
|
||
|
printf("%s", this->arg0_0 != "" ? "\n" : "");
|
||
|
}
|
||
| share/dtrace/watch_kill | ||
|---|---|---|
|
#!/usr/sbin/dtrace -s
|
||
|
/* -
|
||
|
* Copyright (c) 2014-2016 Devin Teske <dteske@FreeBSD.org>
|
||
|
* 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.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND 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 THE AUTHOR OR 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.
|
||
|
*
|
||
|
* $Title: dtrace(1) script to log process(es) entering syscall::kill $
|
||
|
* $FreeBSD$
|
||
|
*/
|
||
|
#pragma D option quiet
|
||
|
#pragma D option dynvarsize=16m
|
||
|
#pragma D option switchrate=10hz
|
||
|
/*********************************************************/
|
||
|
syscall::execve:entry /* probe ID 1 */
|
||
|
{
|
||
|
this->caller_execname = execname;
|
||
|
}
|
||
|
/*********************************************************/
|
||
|
syscall::kill:entry /* probe ID 2 */
|
||
|
{
|
||
|
this->pid_to_kill = (pid_t)arg0;
|
||
|
this->kill_signal = (int)arg1;
|
||
|
/*
|
||
|
* Examine process, parent process, and grandparent process details
|
||
|
*/
|
||
|
/******************* CURPROC *******************/
|
||
|
this->proc = curthread->td_proc;
|
||
|
this->pid0 = this->proc->p_pid;
|
||
|
this->uid0 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid0 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc->p_args;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg0_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg0_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/******************* PPARENT *******************/
|
||
|
this->proc = this->proc->p_pptr;
|
||
|
this->pid1 = this->proc->p_pid;
|
||
|
this->uid1 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid1 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc ? this->proc->p_args : 0;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg1_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg1_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/******************* GPARENT *******************/
|
||
|
this->proc = this->proc->p_pptr;
|
||
|
this->pid2 = this->proc->p_pid;
|
||
|
this->uid2 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid2 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc ? this->proc->p_args : 0;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg2_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg2_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/******************* APARENT *******************/
|
||
|
this->proc = this->proc->p_pptr;
|
||
|
this->pid3 = this->proc->p_pid;
|
||
|
this->uid3 = this->proc->p_ucred->cr_uid;
|
||
|
this->gid3 = this->proc->p_ucred->cr_rgid;
|
||
|
this->p_args = this->proc ? this->proc->p_args : 0;
|
||
|
this->ar_length = this->p_args ? this->p_args->ar_length : 0;
|
||
|
this->ar_args = (char *)(this->p_args ? this->p_args->ar_args : 0);
|
||
|
this->arg3_0 = this->ar_length > 0 ?
|
||
|
this->ar_args : stringof(this->proc->p_comm);
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_1 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_2 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_3 = this->ar_length > 0 ? this->ar_args : "";
|
||
|
this->len = this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;
|
||
|
this->ar_args += this->len;
|
||
|
this->ar_length -= this->len;
|
||
|
this->arg3_4 = this->ar_length > 0 ? "..." : "";
|
||
|
/***********************************************/
|
||
|
/*
|
||
|
* Print process, parent, and grandparent details
|
||
|
*/
|
||
|
printf("%Y %s[%d]: ", timestamp + 1406598400000000000,
|
||
|
this->caller_execname, this->pid1);
|
||
|
printf("%s", this->arg0_0);
|
||
|
printf("%s%s", this->arg0_1 != "" ? " " : "", this->arg0_1);
|
||
|
printf("%s%s", this->arg0_2 != "" ? " " : "", this->arg0_2);
|
||
|
printf("%s%s", this->arg0_3 != "" ? " " : "", this->arg0_3);
|
||
|
printf("%s%s", this->arg0_4 != "" ? " " : "", this->arg0_4);
|
||
|
printf(" (sending signal %u to pid %u)",
|
||
|
this->kill_signal, this->pid_to_kill);
|
||
|
printf("\n");
|
||
|
printf(" -+= %05d %d.%d %s",
|
||
|
this->pid3, this->uid3, this->gid3, this->arg3_0);
|
||
|
printf("%s%s", this->arg3_1 != "" ? " " : "", this->arg3_1);
|
||
|
printf("%s%s", this->arg3_2 != "" ? " " : "", this->arg3_2);
|
||
|
printf("%s%s", this->arg3_3 != "" ? " " : "", this->arg3_3);
|
||
|
printf("%s%s", this->arg3_4 != "" ? " " : "", this->arg3_4);
|
||
|
printf("%s", this->arg3_0 != "" ? "\n" : "");
|
||
|
printf(" \-+= %05d %d.%d %s",
|
||
|
this->pid2, this->uid2, this->gid2, this->arg2_0);
|
||
|
printf("%s%s", this->arg2_1 != "" ? " " : "", this->arg2_1);
|
||
|
printf("%s%s", this->arg2_2 != "" ? " " : "", this->arg2_2);
|
||
|
printf("%s%s", this->arg2_3 != "" ? " " : "", this->arg2_3);
|
||
|
printf("%s%s", this->arg2_4 != "" ? " " : "", this->arg2_4);
|
||
|
printf("%s", this->arg2_0 != "" ? "\n" : "");
|
||
|
printf(" \-+= %05d %d.%d %s",
|
||
|
this->pid1, this->uid1, this->gid1, this->arg1_0);
|
||
|
printf("%s%s", this->arg1_1 != "" ? " " : "", this->arg1_1);
|
||
|
printf("%s%s", this->arg1_2 != "" ? " " : "", this->arg1_2);
|
||
|
printf("%s%s", this->arg1_3 != "" ? " " : "", this->arg1_3);
|
||
|
printf("%s%s", this->arg1_4 != "" ? " " : "", this->arg1_4);
|
||
|
printf("%s", this->arg1_0 != "" ? "\n" : "");
|
||
|
printf(" \-+= %05d %d.%d %s",
|
||
|
this->pid0, this->uid0, this->gid0, this->arg0_0);
|
||
|
printf("%s%s", this->arg0_1 != "" ? " " : "", this->arg0_1);
|
||
|
printf("%s%s", this->arg0_2 != "" ? " " : "", this->arg0_2);
|
||
|
printf("%s%s", this->arg0_3 != "" ? " " : "", this->arg0_3);
|
||
|
printf("%s%s", this->arg0_4 != "" ? " " : "", this->arg0_4);
|
||
|
printf("%s", this->arg0_0 != "" ? "\n" : "");
|
||
|
}
|
||
| share/dtrace/watch_vop_remove | ||
|---|---|---|
|
#!/usr/sbin/dtrace -s
|
||
|
/* -
|
||
|
* Copyright (c) 2014 Devin Teske <dteske@FreeBSD.org>
|
||
|
* 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.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND 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 THE AUTHOR OR 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.
|
||
|
*
|
||
|
* $Title: dtrace(1) script to log process(es) entering vfs::vop_remove $
|
||
|
* $FreeBSD$
|
||
|
*/
|
||
|
#pragma D option quiet
|
||
|
#pragma D option dynvarsize=16m
|
||
|
#pragma D option switchrate=10hz
|
||
|
/*********************************************************/
|
||
|
vfs::vop_remove:entry /* probe ID 1 */
|
||
|
{
|
||
|
this->vp = (struct vnode *)arg0;
|
||
|
this->ncp = &(this->vp->v_cache_dst) != NULL ?
|
||
|
this->vp->v_cache_dst.tqh_first : 0;
|
||
|
this->fi_name = args[1] ? (
|
||
|
args[1]->a_cnp != NULL ?
|
||
|
stringof(args[1]->a_cnp->cn_nameptr) : ""
|
||
|
) : "";
|
||
|
this->mount = this->vp->v_mount; /* ptr to vfs we are in */
|
||
|
this->fi_fs = this->mount != 0 ?
|
||
|
stringof(this->mount->mnt_stat.f_fstypename) : "";
|
||
|
this->fi_mount = this->mount != 0 ?
|
||
|
stringof(this->mount->mnt_stat.f_mntonname) : "";
|
||
|
this->d_name = args[0]->v_cache_dd != NULL ?
|
||
|
stringof(args[0]->v_cache_dd->nc_name) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->vp == 0 || this->fi_fs == 0 ||
|
||
|
this->fi_fs == "devfs" || this->fi_fs == "" ||
|
||
|
this->fi_name == ""/ /* probe ID 2 */
|
||
|
{
|
||
|
this->ncp = 0;
|
||
|
}
|
||
|
/*********************************************************/
|
||
|
vfs::vop_remove:entry /this->ncp/ /* probe ID 3 (depth 1) */
|
||
|
{
|
||
|
this->dvp = this->ncp->nc_dvp != NULL ? (
|
||
|
&(this->ncp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->ncp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name1 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->name1 == 0 || this->fi_fs == 0 ||
|
||
|
this->fi_fs == "devfs" || this->fi_fs == "" ||
|
||
|
this->name1 == "/" || this->name1 == ""/ /* probe ID 4 */
|
||
|
{
|
||
|
this->dvp = 0;
|
||
|
}
|
||
|
/*********************************************************/
|
||
|
/*
|
||
|
* BEGIN Pathname-depth iterators (copy/paste as many times as-desired)
|
||
|
*/
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 5 (depth 2) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name2 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 6 (depth 3) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name3 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 7 (depth 4) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name4 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 8 (depth 5) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name5 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 9 (depth 6) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name6 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 10 (depth 7) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name7 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 11 (depth 8) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name8 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 12 (depth 9) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name9 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 13 (depth 10) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name10 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 14 (depth 11) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name11 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 15 (depth 12) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name12 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 16 (depth 13) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name13 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 17 (depth 14) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name14 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 18 (depth 15) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name15 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 19 (depth 16) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name16 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 20 (depth 17) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name17 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 21 (depth 18) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name18 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 22 (depth 19) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name19 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
vfs::vop_remove:entry /this->dvp/ /* probe ID 23 (depth 20) */
|
||
|
{
|
||
|
this->dvp = this->dvp->nc_dvp != NULL ? (
|
||
|
&(this->dvp->nc_dvp->v_cache_dst) != NULL ?
|
||
|
this->dvp->nc_dvp->v_cache_dst.tqh_first : 0
|
||
|
) : 0;
|
||
|
this->name20 = this->dvp != 0 ? (
|
||
|
this->dvp->nc_name != 0 ? stringof(this->dvp->nc_name) : ""
|
||
|
) : "";
|
||
|
}
|
||
|
/*
|
||
|
* END Pathname-depth iterators
|
||
|
*/
|
||
|
/*********************************************************/
|
||
|
vfs::vop_remove:entry /this->fi_mount != 0/ /* probe ID 24 */
|
||
|
{
|
||
|
printf("%Y %s[%d]: ", timestamp + 1406598400000000000, execname, pid);
|
||
|
/*
|
||
|
* Print full path of file to delete
|
||
|
* NB: Up-to but not including the parent directory (printed below)
|
||
|
*/
|
||
|
printf("%s%s", this->fi_mount, this->fi_mount != 0 ? (
|
||
|
this->fi_mount == "/" ? "" : "/"
|
||
|
) : "/");
|
||
|
printf("%s%s", this->name = this->name20, this->name != "" ? "/" : "");
|
||
- « Previous
- 1
- 2
- Next »