ndd.c revision 4ac67f0276a8313b5cefec38af347b94b7bfb526
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1990 Mentat Inc.
* ndd.c 2.1, last change 11/14/90
*/
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <stdarg.h>
#include <fcntl.h>
#include <unistd.h>
#include <stropts.h>
#include <string.h>
#include <stdlib.h>
#include <libdllink.h>
#include <libintl.h>
static void name_print(char *buf);
static void getset_interactive(int fd);
static int open_device(dladm_handle_t);
static char usage_str[] = "usage: ndd -set device_name name value\n"
" ndd [-get] device_name name [name ...]";
/*
* for administration of other datalink types, which makes it permissible
* to test for support of the flowctrl property.
*/
static void
{
char *link;
return;
if (status != DLADM_STATUS_OK)
return;
if (status != DLADM_STATUS_OK)
return;
"WARNING: The ndd commands for datalink administration "
"are obsolete and may be removed in a future release of "
"Solaris. Use dladm(1M) to manage datalink tunables.\n"));
}
/* ARGSUSED */
int
{
int cmd;
int fd;
fatal("failed to open dladm handle");
/* open_device() calls gldv3_warning() which needs handle */
}
return (EXIT_SUCCESS);
}
if (cp[0] == '-') {
}
return (EXIT_SUCCESS);
}
value, '\0');
return (EXIT_FAILURE);
} else {
do {
return (EXIT_FAILURE);
(void) putchar('\n');
} while (cp);
}
return (EXIT_SUCCESS);
}
static void
name_print(char *buf)
{
;
*rwtag++ = '\0';
rwtag++;
;
}
}
/*
* This function is vile, but it's better here than in the kernel.
*/
static boolean_t
is_obsolete(const char *param)
{
"by IP Multipathing.\nPlease see the IP Network "
"Multipathing Administration Guide for details.\n", param);
return (B_TRUE);
}
return (B_FALSE);
}
static boolean_t
{
char *cp;
if (is_obsolete(buf))
return (B_TRUE);
(void) printf("name is non-existent for this module\n"
"for a list of valid names, use name '?'\n");
else
return (B_FALSE);
}
if (is_name_get)
}
return (B_TRUE);
}
static int
{
int len;
else
len++;
return (len);
}
static void
getset_interactive(int fd)
{
int cmd;
char *cp;
char len_buf[10];
for (;;) {
return;
*cp = '\0';
}
if (gbuf[0] != '?' &&
(void) printf("invalid length\n");
continue;
}
} else
}
}
static void
{
(void) printf("*ERROR* ");
if (print_errno)
else
(void) printf("\n");
}
static int
{
char name[80];
for (;;) {
if (len <= 1 ||
return (-1);
continue;
}
return (fd);
}
}
static void
{
}
static char *
{
}