Print this page
OS-276 global zone duplicate kstat when two zones have same vnic name
*** 19,28 ****
--- 19,29 ----
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
#include <locale.h>
#include <stdarg.h>
*** 188,200 ****
* specific function is called.
*/
static dladm_handle_t handle = NULL;
const char *usage_ermsg = "flowstat [-r | -t] [-i interval] "
! "[-l link] [flow]\n"
" flowstat [-S] [-A] [-i interval] [-p] [ -o field[,...]]\n"
! " [-u R|K|M|G|T|P] [-l link] [flow]\n"
" flowstat -h [-a] [-d] [-F format]"
" [-s <DD/MM/YYYY,HH:MM:SS>]\n"
" [-e <DD/MM/YYYY,HH:MM:SS>] -f <logfile> "
"[<flow>]";
--- 189,201 ----
* specific function is called.
*/
static dladm_handle_t handle = NULL;
const char *usage_ermsg = "flowstat [-r | -t] [-i interval] "
! "[-l link] [-z zonename] [flow]\n"
" flowstat [-S] [-A] [-i interval] [-p] [ -o field[,...]]\n"
! " [-u R|K|M|G|T|P] [-l link] [-z zonename] [flow]\n"
" flowstat -h [-a] [-d] [-F format]"
" [-s <DD/MM/YYYY,HH:MM:SS>]\n"
" [-e <DD/MM/YYYY,HH:MM:SS>] -f <logfile> "
"[<flow>]";
*** 554,563 ****
--- 555,565 ----
uint32_t interval = 0;
char unit = '\0';
show_flow_state_t state;
char *fields_str = NULL;
char *o_fields_str = NULL;
+ char *zonename = NULL;
char *total_stat_fields =
"flow,ipkts,rbytes,ierrs,opkts,obytes,oerrs";
char *rx_stat_fields =
"flow,ipkts,rbytes,ierrs";
*** 580,593 ****
/* Open the libdladm handle */
if ((status = dladm_open(&handle)) != DLADM_STATUS_OK)
die_dlerr(status, "could not open /dev/dld");
bzero(&state, sizeof (state));
opterr = 0;
! while ((option = getopt_long(argc, argv, ":rtApSi:o:u:l:h",
NULL, NULL)) != -1) {
switch (option) {
case 'r':
if (r_arg)
die_optdup(option);
--- 582,596 ----
/* Open the libdladm handle */
if ((status = dladm_open(&handle)) != DLADM_STATUS_OK)
die_dlerr(status, "could not open /dev/dld");
+ linkname[0] = '\0';
bzero(&state, sizeof (state));
opterr = 0;
! while ((option = getopt_long(argc, argv, ":rtApSi:o:u:l:hz:",
NULL, NULL)) != -1) {
switch (option) {
case 'r':
if (r_arg)
die_optdup(option);
*** 640,652 ****
break;
case 'l':
if (strlcpy(linkname, optarg, MAXLINKNAMELEN)
>= MAXLINKNAMELEN)
die("link name too long\n");
- if (dladm_name2info(handle, linkname, &linkid, NULL,
- NULL, NULL) != DLADM_STATUS_OK)
- die("invalid link '%s'", linkname);
break;
case 'h':
if (r_arg || t_arg || p_arg || o_arg || u_arg ||
i_arg || S_arg || A_arg) {
die("the option -h is not compatible with "
--- 643,652 ----
*** 653,662 ****
--- 653,665 ----
"-r, -t, -p, -o, -u, -i, -S, -A");
}
do_show_history(argc, argv);
return (0);
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, usage_ermsg);
break;
}
}
*** 681,690 ****
--- 684,699 ----
if (A_arg &&
(r_arg || t_arg || p_arg || o_arg || u_arg || i_arg))
die("the option -A is not compatible with "
"-r, -t, -p, -o, -u, -i");
+ if (linkname[0] != '\0') {
+ if (dladm_zname2info(handle, zonename, linkname, &linkid, NULL,
+ NULL, NULL) != DLADM_STATUS_OK)
+ die("invalid link '%s'", linkname);
+ }
+
/* get flow name (optional last argument) */
if (optind == (argc-1)) {
if (strlcpy(flowname, argv[optind], MAXFLOWNAMELEN)
>= MAXFLOWNAMELEN)
die("flow name too long");