diff options
| author | Venugopal Iyer <Venu.Iyer@Sun.COM> | 2009-02-17 01:31:30 -0800 |
|---|---|---|
| committer | Venugopal Iyer <Venu.Iyer@Sun.COM> | 2009-02-17 01:31:30 -0800 |
| commit | ae6aa22afeb444ae208c287e7227a4a7c877f17a (patch) | |
| tree | 744dffd8856e6a2a16544575ca8773771051dada /usr/src/cmd/acctadm/main.c | |
| parent | d02310705313ee2fcefee164a4b26d1fa85e9d22 (diff) | |
| download | illumos-gate-ae6aa22afeb444ae208c287e7227a4a7c877f17a.tar.gz | |
PSARC/2009/099 dladm show-usage modifications
6726676 flow should not be seen by flowadm show-usage after the flow been removed by flowadm remove-flow
6766669 "dladm show-vnic -o" can't accept MACADDRESS
6773854 Per Tx ring flow control for UDP
6777547 mac_tx() should compute the hash if the passed hint is zero
6778557 nxge m_tx() should fanout to multiple rings for vnet scalability
6779356 sometimes packets are not classified to the correct flow
6783011 pre-existing subflows not initialized on a non-dls client when brought up
6786734 acctadm dladm_start_usagelog() calls need some work
6789760 mac perimeter deadlock due to dls_devnet_stat_update()
6789883 dladm show-link -s is adrift again.
6791099 mac_tx() frees the message but returns non-NULL cookie which causes panic
6791109 maxbw set on a link should not apply if this link is the underlying port of an aggregation
6791118 panic in mac_bcast_delete() unplumbing an IP interface
6791456 deleting last vnic interface causes bge interface to stop working
6791678 xvm guests don't communicate through vnics configured on vlan
6792164 race between mac_tx_is_flow_blocked() and mac_srs_group_teardown() could cause panic
6792546 paniced in bge_ring_tx()/freemsg() due to mp->b_next == NULL && mp->b_prev == NULL
6792555 paniced in mac_flow_walk_nolock() due to assertion failed: cnt == ft->ft_flow_count
6792871 multiple VLANs per MAC client cause hang in mac_flow_wait()
6792942 60% regression for Guest-to-Guest network throughput on snv106
6793278 the multicast addresses are not added to the aggregation port in certain scenarios
6793436 panic in mac_fini_macaddr() on mac_register() failure
6796850 SUNWcnetr postinstall script spews errors due to bad interface matching
6803378 need support for dls_bypass and rx fanout on non-ethernet media
Diffstat (limited to 'usr/src/cmd/acctadm/main.c')
| -rw-r--r-- | usr/src/cmd/acctadm/main.c | 105 |
1 files changed, 66 insertions, 39 deletions
diff --git a/usr/src/cmd/acctadm/main.c b/usr/src/cmd/acctadm/main.c index 580012ccc8..2c610bdc10 100644 --- a/usr/src/cmd/acctadm/main.c +++ b/usr/src/cmd/acctadm/main.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -41,6 +41,8 @@ #include "aconf.h" #include "res.h" +#define ACCTADM_NET_LOG_INTERVAL 20 + static const char USAGE[] = "\ Usage:\n\ acctadm [ {process | task | flow | net} ]\n\ @@ -126,6 +128,7 @@ main(int argc, char *argv[]) int optcnt = 0; int state; const char *fmri; /* FMRI for this instance */ + int err = 0; setup_privs(); @@ -309,10 +312,14 @@ main(int argc, char *argv[]) if (type & AC_NET) { (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_SYS_DL_CONFIG, NULL); - (void) dladm_stop_usagelog(dld_handle, + err = dladm_stop_usagelog(dld_handle, DLADM_LOGTYPE_FLOW); (void) priv_set(PRIV_OFF, PRIV_EFFECTIVE, PRIV_SYS_DL_CONFIG, NULL); + if (err != DLADM_STATUS_OK) { + die(gettext("failed to stop logging network " + "information, error %d\n"), errno); + } } state = AC_OFF; @@ -356,18 +363,44 @@ main(int argc, char *argv[]) if (type & AC_NET) { (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_SYS_DL_CONFIG, NULL); - (void) dladm_stop_usagelog(dld_handle, - strncmp(disabled, "basic", strlen("basic")) - == 0 ? DLADM_LOGTYPE_LINK : - DLADM_LOGTYPE_FLOW); + err = dladm_stop_usagelog(dld_handle, + strcmp(disabled, "basic") == 0 ? + DLADM_LOGTYPE_LINK : DLADM_LOGTYPE_FLOW); (void) priv_set(PRIV_OFF, PRIV_EFFECTIVE, PRIV_SYS_DL_CONFIG, NULL); + if (err != DLADM_STATUS_OK) { + die(gettext("failed to stop logging " + "network information, error %d\n"), + errno); + } } str2buf(buf, disabled, AC_OFF, type); } - if (enabled) + if (enabled) { + /* + * Lets us get network logging started. + */ + if (type & AC_NET) { + /* + * Default logging interval for AC_NET is + * ACCTADM_NET_LOG_INTERVAL. + */ + (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, + PRIV_SYS_DL_CONFIG, NULL); + err = dladm_start_usagelog(dld_handle, + strcmp(enabled, "basic") == 0 ? + DLADM_LOGTYPE_LINK : DLADM_LOGTYPE_FLOW, + ACCTADM_NET_LOG_INTERVAL); + (void) priv_set(PRIV_OFF, PRIV_EFFECTIVE, + PRIV_SYS_DL_CONFIG, NULL); + if (err != DLADM_STATUS_OK) { + die(gettext("failed to start logging " + "network information, error %d\n"), + errno); + } + } str2buf(buf, enabled, AC_ON, type); - + } (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_SYS_ACCT, NULL); if (acctctl(type | AC_RES_SET, buf, AC_BUFSIZE) == -1) { free(buf); @@ -384,24 +417,6 @@ main(int argc, char *argv[]) if (aconf_set_string(AC_PROP_UNTRACKED, untracked) == -1) die(gettext("cannot update %s property\n"), AC_PROP_UNTRACKED); - /* - * We will enable net logging after turning it on so that - * it can immediately start writing log. - */ - if (type & AC_NET && enabled != NULL) { - /* - * Default logging interval for AC_NET is 20. - * XXX need to find the right place to - * configure it. - */ - (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, - PRIV_SYS_DL_CONFIG, NULL); - (void) dladm_start_usagelog(dld_handle, - strncmp(enabled, "basic", strlen("basic")) == 0 ? - DLADM_LOGTYPE_LINK : DLADM_LOGTYPE_FLOW, 20); - (void) priv_set(PRIV_OFF, PRIV_EFFECTIVE, - PRIV_SYS_DL_CONFIG, NULL); - } free(tracked); free(untracked); free(buf); @@ -445,10 +460,14 @@ main(int argc, char *argv[]) if (type & AC_NET) { (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_SYS_DL_CONFIG, NULL); - (void) dladm_stop_usagelog(dld_handle, + err = dladm_stop_usagelog(dld_handle, DLADM_LOGTYPE_FLOW); (void) priv_set(PRIV_OFF, PRIV_EFFECTIVE, PRIV_SYS_DL_CONFIG, NULL); + if (err != DLADM_STATUS_OK) { + die(gettext("failed to stop logging " + "network information, error %d\n"), errno); + } } state = AC_OFF; @@ -468,6 +487,26 @@ main(int argc, char *argv[]) /* * Enable accounting */ + + /* + * Let's get network logging started. + */ + if (type & AC_NET) { + /* + * Default logging interval for AC_NET is + * ACCTADM_NET_LOG_INTERVAL. + */ + (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, + PRIV_SYS_DL_CONFIG, NULL); + err = dladm_start_usagelog(dld_handle, + DLADM_LOGTYPE_FLOW, ACCTADM_NET_LOG_INTERVAL); + (void) priv_set(PRIV_OFF, PRIV_EFFECTIVE, + PRIV_SYS_DL_CONFIG, NULL); + if (err != DLADM_STATUS_OK) { + die(gettext("failed to start logging " + "network information, error %d\n"), errno); + } + } state = AC_ON; (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_SYS_ACCT, NULL); @@ -480,18 +519,6 @@ main(int argc, char *argv[]) die(gettext("cannot update %s property\n"), AC_PROP_STATE); modified++; - if (type & AC_NET) { - /* - * Default logging interval for AC_NET is 20, - * XXX need to find the right place to configure it. - */ - (void) priv_set(PRIV_ON, PRIV_EFFECTIVE, - PRIV_SYS_DL_CONFIG, NULL); - (void) dladm_start_usagelog(dld_handle, - DLADM_LOGTYPE_FLOW, 20); - (void) priv_set(PRIV_OFF, PRIV_EFFECTIVE, - PRIV_SYS_DL_CONFIG, NULL); - } } (void) priv_set(PRIV_OFF, PRIV_PERMITTED, PRIV_SYS_ACCT, NULL); |
