ndd.c revision 7663b81667fda05833f609eceac713f0a83c2347
/*
* Copyright (C) 2003 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <netinet/in_systm.h>
#include "compat.h"
#include "qif.h"
#include "pfil.h"
#else
#endif
/* ------------------------------------------------------------------------ */
/* Function: pfil_nd_get */
/* Returns: int - 0 == success */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* ptr(I) - pointer to value to retrieve */
/* cred(I) - pointer to credential information */
/* */
/* Given a pointer "ptr" to some data to return, copy it into the mblk that */
/* has been provided. */
/* ------------------------------------------------------------------------ */
/*ARGSUSED*/
#else
/*ARGSUSED*/
#endif
{
int *ip;
/* LINTED: E_CONSTANT_CONDITION */
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_nd_set */
/* Returns: int - 0 == success, > 0 error occurred */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* str(I) - pointer to new value as a string */
/* ptr(I) - pointer to value to be stored */
/* cred(I) - pointer to credential information */
/* */
/* Given a pointer "ptr" to a location to store the new value represented */
/* by the string "str", check to see if we allow setting that variable and */
/* if the new value is within the definable ranges understood for it. */
/* ------------------------------------------------------------------------ */
/*ARGSUSED*/
#else
/*ARGSUSED*/
#endif
{
char *end;
long i;
/* LINTED: E_CONSTANT_CONDITION */
(void *)ptr));
return (EINVAL);
#ifdef PFILDEBUG
#endif
return EINVAL;
if (i < 0 || i > 1)
return EINVAL;
}
*((int *)ptr) = i;
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_ioctl_nd */
/* Returns: int - B_TRUE == success, B_FALSE == getset error */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* */
/* Handle both incoming ndd set and get requests but only if they're not */
/* destined for another STREAMS module (ie. there is no next queue for this */
/* message.) */
/* ------------------------------------------------------------------------ */
{
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_nd_init */
/* Returns: int - 0 == success, -1 == error */
/* Parameters: None. */
/* */
/* Perform any initialisation required for processing ndd ioctl messages. */
/* ------------------------------------------------------------------------ */
int pfil_nd_init()
{
return -1;
}
(caddr_t)&pfil_delayed_copy)) {
return -1;
}
(caddr_t)&pfilinterface)) {
return -1;
}
return -1;
}
return -1;
}
NULL)) {
return -1;
}
return -1;
}
(caddr_t)&qif_verbose)) {
return -1;
}
(void *)&pfh_inet4)) {
return -1;
}
(void *)&pfh_inet6)) {
return -1;
}
(void *)&pfh_sync)) {
return -1;
}
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_nd_fini */
/* Returns: void */
/* Parameters: None. */
/* */
/* Clean up any data structures related to ndd processing in preparation */
/* for the module being unloaded. */
/* ------------------------------------------------------------------------ */
void pfil_nd_fini()
{
}
/* ------------------------------------------------------------------------ */
/* Function: qif_report */
/* Returns: int */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* ptr(I) - pointer to value to retrieve */
/* cred(I) - pointer to credential information */
/* */
/* Fills the mblk with any qif data that happens to be currently available. */
/* ------------------------------------------------------------------------ */
/*ARGSUSED*/
#else
/*ARGSUSED*/
#endif
{
(void) mi_mpprintf(mp,
"ifname ill q OTHERQ ipmp num sap hl nr nw bad copy copyfail drop notip nodata notdata");
(void) mi_mpprintf(mp,
"%s %p %p %p %p %d %x %d %lu %lu %lu %lu %lu %lu %lu %lu %lu",
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: sill_report */
/* Returns: int */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* ptr(I) - pointer to value to retrieve */
/* cred(I) - pointer to credential information */
/* */
/* Fills the mblk with any shadow ill (s_illt) data that happens to be */
/* currently available. */
/* ------------------------------------------------------------------------ */
/*ARGSUSED*/
#else
/*ARGSUSED*/
#endif
{
(void) mi_mpprintf(mp,
"sill name sap mtu localaddr netmask broadaddr dstaddr");
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: qif_ipmp_report */
/* Returns: int */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* ptr(I) - pointer to value to retrieve */
/* cred(I) - pointer to credential information */
/* */
/* Fills the mblk with any qif data that happens to be currently available. */
/* ------------------------------------------------------------------------ */
/*ARGSUSED*/
#else
/*ARGSUSED*/
#endif
{
continue;
}
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: qif_ipmp_set */
/* Returns: int - 0 == success, > 0 error occurred */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* str(I) - pointer to new value as a string */
/* ptr(I) - pointer to value to be stored */
/* cred(I) - pointer to credential information */
/* */
/* This function is a wrapper for qif_ipmp_update(), providing a run-time */
/* interactive way to configure the IPMP configuration for pfil without */
/* a way to do that once loaded, anyway?) */
/* ------------------------------------------------------------------------ */
/*ARGSUSED*/
#else
/*ARGSUSED*/
#endif
{
char *s, *t;
/* LINTED: E_CONSTANT_CONDITION */
t = NULL;
s = str;
do {
if (t != NULL)
s = t + 1;
t = strchr(s, ';');
if (t != NULL)
*t = '\0';
qif_ipmp_update(s);
} while (t != NULL);
return 0;
}