Print this page
7388 Support DHCP Client FQDN. Allow IAID/DUID for all v4.


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.

  24  */
  25 
  26 #include <sys/types.h>
  27 #include <stdlib.h>
  28 #include <string.h>
  29 #include <ctype.h>
  30 #include <dhcpmsg.h>
  31 #include <stdio.h>
  32 #include <sys/stat.h>
  33 #include <libnvpair.h>
  34 
  35 #include "common.h"
  36 #include "defaults.h"
  37 
  38 struct dhcp_default {
  39 
  40         const char      *df_name;       /* parameter name */
  41         const char      *df_default;    /* default value */
  42         int             df_min;         /* min value if type DF_INTEGER */
  43         int             df_max;         /* max value if type DF_INTEGER */
  44 };
  45 
  46 /*
  47  * note: keep in the same order as tunable parameter constants in defaults.h
  48  */
  49 
  50 static struct dhcp_default defaults[] = {
  51 
  52         { "RELEASE_ON_SIGTERM",  "0",    0,   0   },
  53         { "IGNORE_FAILED_ARP",   "1",    0,   -1  },
  54         { "OFFER_WAIT",          "3",    1,   20  },
  55         { "ARP_WAIT",            "1000", 0,   -1  },
  56         { "CLIENT_ID",           NULL,   0,   0   },
  57         { "PARAM_REQUEST_LIST",  NULL,   0,   0   },
  58         { "REQUEST_HOSTNAME",    "1",    0,   0   },
  59         { "DEBUG_LEVEL",         "0",    0,   3   },
  60         { "VERBOSE",             "0",    0,   0   },
  61         { "VERIFIED_LEASE_ONLY", "0",    0,   0   },
  62         { "PARAM_IGNORE_LIST",   NULL,   0,   0   }


  63 };
  64 
  65 /*
  66  * df_build_cache(): builds the defaults nvlist cache
  67  *
  68  *   input: void
  69  *  output: a pointer to an nvlist of the current defaults, or NULL on failure
  70  */
  71 
  72 static nvlist_t *
  73 df_build_cache(void)
  74 {
  75         char            entry[1024];
  76         int             i;
  77         char            *param, *pastv6, *value, *end;
  78         FILE            *fp;
  79         nvlist_t        *nvlist;
  80         struct dhcp_default *defp;
  81 
  82         if ((fp = fopen(DHCP_AGENT_DEFAULTS, "r")) == NULL)




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
  25  */
  26 
  27 #include <sys/types.h>
  28 #include <stdlib.h>
  29 #include <string.h>
  30 #include <ctype.h>
  31 #include <dhcpmsg.h>
  32 #include <stdio.h>
  33 #include <sys/stat.h>
  34 #include <libnvpair.h>
  35 
  36 #include "common.h"
  37 #include "defaults.h"
  38 
  39 struct dhcp_default {
  40 
  41         const char      *df_name;       /* parameter name */
  42         const char      *df_default;    /* default value */
  43         int             df_min;         /* min value if type DF_INTEGER */
  44         int             df_max;         /* max value if type DF_INTEGER */
  45 };
  46 
  47 /*
  48  * note: keep in the same order as tunable parameter constants in defaults.h
  49  */
  50 
  51 static struct dhcp_default defaults[] = {
  52 
  53         { "RELEASE_ON_SIGTERM",  "0",    0,   0   },
  54         { "IGNORE_FAILED_ARP",   "1",    0,   -1  },
  55         { "OFFER_WAIT",          "3",    1,   20  },
  56         { "ARP_WAIT",            "1000", 0,   -1  },
  57         { "CLIENT_ID",           NULL,   0,   0   },
  58         { "PARAM_REQUEST_LIST",  NULL,   0,   0   },
  59         { "REQUEST_HOSTNAME",    "1",    0,   0   },
  60         { "DEBUG_LEVEL",         "0",    0,   3   },
  61         { "VERBOSE",             "0",    0,   0   },
  62         { "VERIFIED_LEASE_ONLY", "0",    0,   0   },
  63         { "PARAM_IGNORE_LIST",   NULL,   0,   0   },
  64         { "REQUEST_FQDN",        "1",    0,   0   },
  65         { "V4_DEFAULT_IAID_DUID",  "0",  0,   0   },
  66 };
  67 
  68 /*
  69  * df_build_cache(): builds the defaults nvlist cache
  70  *
  71  *   input: void
  72  *  output: a pointer to an nvlist of the current defaults, or NULL on failure
  73  */
  74 
  75 static nvlist_t *
  76 df_build_cache(void)
  77 {
  78         char            entry[1024];
  79         int             i;
  80         char            *param, *pastv6, *value, *end;
  81         FILE            *fp;
  82         nvlist_t        *nvlist;
  83         struct dhcp_default *defp;
  84 
  85         if ((fp = fopen(DHCP_AGENT_DEFAULTS, "r")) == NULL)