Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/ctld/uclparse.c
Show All 33 Lines | |||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <ucl.h> | #include <ucl.h> | ||||
#include <netinet/in.h> | |||||
#include <netinet/ip.h> | |||||
#include "ctld.h" | #include "ctld.h" | ||||
static struct conf *conf = NULL; | static struct conf *conf = NULL; | ||||
static int uclparse_toplevel(const ucl_object_t *); | static int uclparse_toplevel(const ucl_object_t *); | ||||
static int uclparse_chap(struct auth_group *, const ucl_object_t *); | static int uclparse_chap(struct auth_group *, const ucl_object_t *); | ||||
static int uclparse_chap_mutual(struct auth_group *, const ucl_object_t *); | static int uclparse_chap_mutual(struct auth_group *, const ucl_object_t *); | ||||
▲ Show 20 Lines • Show All 550 Lines • ▼ Show 20 Lines | if (!strcmp(key, "options")) { | ||||
return (1); | return (1); | ||||
} | } | ||||
while ((tmp = ucl_iterate_object(obj, &it2, | while ((tmp = ucl_iterate_object(obj, &it2, | ||||
true))) { | true))) { | ||||
option_new(&portal_group->pg_options, | option_new(&portal_group->pg_options, | ||||
ucl_object_key(tmp), | ucl_object_key(tmp), | ||||
ucl_object_tostring_forced(tmp)); | ucl_object_tostring_forced(tmp)); | ||||
} | |||||
} | |||||
if (!strcmp(key, "dscp")) { | |||||
if ((obj->type != UCL_STRING) && (obj->type != UCL_INT)) { | |||||
log_warnx("\"dscp\" property of portal group " | |||||
"\"%s\" is not a string or integer", portal_group->pg_name); | |||||
return(1); | |||||
} | |||||
if (obj->type == UCL_INT) | |||||
portal_group->pg_dscp = ucl_object_toint(obj); | |||||
else { | |||||
key = ucl_object_tostring(obj); | |||||
if (strcmp(key, "be") || strcmp(key, "cs0")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS0; | |||||
else if (strcmp(key, "ef")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_EF; | |||||
else if (strcmp(key, "cs0")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS0; | |||||
else if (strcmp(key, "cs1")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS1; | |||||
else if (strcmp(key, "cs2")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS2; | |||||
else if (strcmp(key, "cs3")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS3; | |||||
else if (strcmp(key, "cs4")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS4; | |||||
else if (strcmp(key, "cs5")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS5; | |||||
else if (strcmp(key, "cs6")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS6; | |||||
else if (strcmp(key, "cs7")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_CS7; | |||||
else if (strcmp(key, "af11")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF11; | |||||
else if (strcmp(key, "af12")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF12; | |||||
else if (strcmp(key, "af13")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF13; | |||||
else if (strcmp(key, "af21")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF21; | |||||
else if (strcmp(key, "af22")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF22; | |||||
else if (strcmp(key, "af23")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF23; | |||||
else if (strcmp(key, "af31")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF31; | |||||
else if (strcmp(key, "af32")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF32; | |||||
else if (strcmp(key, "af33")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF33; | |||||
else if (strcmp(key, "af41")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF41; | |||||
else if (strcmp(key, "af42")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF42; | |||||
else if (strcmp(key, "af43")) | |||||
portal_group->pg_dscp = IPTOS_DSCP_AF43; | |||||
else { | |||||
log_warnx("\"dscp\" property value is not a supported textual value"); | |||||
return (1); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
uclparse_target(const char *name, const ucl_object_t *top) | uclparse_target(const char *name, const ucl_object_t *top) | ||||
{ | { | ||||
struct target *target; | struct target *target; | ||||
▲ Show 20 Lines • Show All 318 Lines • Show Last 20 Lines |