/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <dhcpmsg.h>
#include <stdio.h>
#include <libnvpair.h>
#include "common.h"
#include "defaults.h"
struct dhcp_default {
};
/*
* note: keep in the same order as tunable parameter constants in defaults.h
*/
{ "RELEASE_ON_SIGTERM", "0", 0, 0 },
{ "IGNORE_FAILED_ARP", "1", 0, -1 },
{ "OFFER_WAIT", "3", 1, 20 },
{ "ARP_WAIT", "1000", 0, -1 },
{ "CLIENT_ID", NULL, 0, 0 },
{ "PARAM_REQUEST_LIST", NULL, 0, 0 },
{ "REQUEST_HOSTNAME", "1", 0, 0 },
{ "DEBUG_LEVEL", "0", 0, 3 },
{ "VERBOSE", "0", 0, 0 },
{ "VERIFIED_LEASE_ONLY", "0", 0, 0 },
{ "PARAM_IGNORE_LIST", NULL, 0, 0 }
};
/*
* df_build_cache(): builds the defaults nvlist cache
*
* input: void
* output: a pointer to an nvlist of the current defaults, or NULL on failure
*/
static nvlist_t *
df_build_cache(void)
{
int i;
return (NULL);
"using built-in defaults");
return (NULL);
}
for (i = 0; entry[i] == ' '; i++)
;
continue;
*end = '\0';
*value++ = '\0';
/*
* to be compatible with the old defread()-based code
* which ignored case, store the parameters (except for the
* leading interface name) in upper case.
*/
} else {
pastv6 += 3;
}
defp++) {
}
break;
}
}
" using built-in defaults");
break;
}
}
return (nvlist);
}
/*
* df_get_string(): gets the string value of a given user-tunable parameter
*
* input: const char *: the interface the parameter applies to
* boolean_t: B_TRUE for DHCPv6, B_FALSE for IPv4 DHCP
* uint_t: the parameter number to look up
* output: const char *: the parameter's value, or default if not set
* (must be copied by caller to be kept)
* NOTE: df_get_string() is both used by functions outside this source
* file to retrieve strings from the defaults file, *and*
* internally by other df_get_*() functions.
*/
const char *
{
char *value;
return (NULL);
if (!df_unavail_msg) {
"built-in defaults", DHCP_AGENT_DEFAULTS);
}
}
/*
* if our cached parameters are stale, rebuild.
*/
df_nvlist = df_build_cache();
}
if (isv6) {
name);
} else {
name);
}
/*
* first look for `if_name.[v6.]param', then `[v6.]param'. if neither
* has been set, use the built-in default.
*/
return (value);
}
/*
* df_get_int(): gets the integer value of a given user-tunable parameter
*
* input: const char *: the interface the parameter applies to
* boolean_t: B_TRUE for DHCPv6, B_FALSE for IPv4 DHCP
* uint_t: the parameter number to look up
* output: int: the parameter's value, or default if not set
*/
int
{
const char *value;
int value_int;
return (0);
goto failure;
goto failure;
return (value_int);
}
/*
* df_get_bool(): gets the boolean value of a given user-tunable parameter
*
* input: const char *: the interface the parameter applies to
* boolean_t: B_TRUE for DHCPv6, B_FALSE for IPv4 DHCP
* uint_t: the parameter number to look up
* output: boolean_t: B_TRUE if true, B_FALSE if false, default if not set
*/
{
const char *value;
return (0);
return (B_TRUE);
return (B_FALSE);
}
}