/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright (c) 2012 Joyent, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <values.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stropts.h>
#include <zone.h>
#include <libgen.h>
#include <assert.h>
#include <libipd.h>
static char *g_pname;
#define E_SUCCESS 0
typedef int (*idc_cmd_func_t)(int, char *[]);
typedef struct ipdadm_cmd {
} ipdadm_cmd_t;
static int ipdadm_list(int, char *[]);
static int ipdadm_info(int, char *[]);
static int ipdadm_corrupt(int, char *[]);
static int ipdadm_delay(int, char *[]);
static int ipdadm_drop(int, char *[]);
static int ipdadm_remove(int, char *[]);
};
static int
{
int ii;
"[subcommand opts]\n\n", g_pname);
}
return (E_USAGE);
}
static void
{
(void) printf("%ld", z);
else
if (!opt_v) {
(void) printf("\n");
return;
}
}
static int
{
int opt_v = 0;
if (argc > 1)
if (argc == 1) {
++opt_v;
else
}
if (fd < 0) {
return (E_ERROR);
}
if (rval != 0) {
return (E_ERROR);
}
return (E_SUCCESS);
}
/*ARGSUSED*/
static int
{
if (argc != 0)
if (fd < 0) {
return (E_ERROR);
}
if (rval != 0) {
return (E_ERROR);
}
if (ipd_errno == EIPD_ZC_NOENT) {
(void) printf("zone %s does not exist or has no "
"ipd actions enabled\n", g_zonename);
return (E_SUCCESS);
}
return (E_ERROR);
}
(void) printf("ipd information for zone %s:\n",
(void) printf("\tcorrupt:\t%u%% chance of packet corruption\n",
icp->ic_corrupt);
(void) printf("\tdrop:\t\t%u%% chance of packet drop\n",
(void) printf("\tdelay:\t\t%u microsecond delay per packet\n",
return (E_SUCCESS);
}
static long
{
long val;
char *end;
errno = 0;
if (errno != 0) {
}
/*
* We want to make sure that we got the whole string. If not that's an
* error. e.g. 23.42 should not be valid.
*/
if (*end != '\0') {
}
}
return (val);
}
static int
{
long val;
if (argc != 1) {
g_pname);
}
if (fd < 0) {
return (E_ERROR);
}
if (rval != 0) {
return (E_ERROR);
}
return (E_SUCCESS);
}
static int
{
long val;
if (argc != 1) {
g_pname);
}
if (fd < 0) {
return (E_ERROR);
}
if (rval != 0) {
return (E_ERROR);
}
return (E_SUCCESS);
}
static int
{
long val;
if (argc != 1) {
g_pname);
}
if (fd < 0) {
return (E_ERROR);
}
if (rval != 0) {
return (E_ERROR);
}
return (E_SUCCESS);
}
static int
{
return (IPDM_CORRUPT);
return (IPDM_DROP);
return (IPDM_DELAY);
}
return (0);
}
static int
{
if (argc < 1) {
g_pname);
}
if (argc > 1) {
"comma seperated\n", g_pname);
return (E_ERROR);
}
*res = '\0';
return (E_ERROR);
}
}
return (E_ERROR);
}
if (fd < 0) {
return (E_ERROR);
}
if (rval == -1) {
return (E_ERROR);
}
return (E_SUCCESS);
}
int
{
int ii;
if (argc < 2)
argc--;
argv++;
argc--;
argv++;
if (argc < 1) {
g_pname);
}
if (g_zid != GLOBAL_ZONEID) {
"in global zone\n", g_pname);
}
if (g_zid == -1) {
return (E_ERROR);
}
argc--;
argv++;
}
return (E_ERROR);
}
if (argc < 1)
argv++;
argc--;
}
}
}