Exemple #1
0
/* *
 * slotsmgrttagslot host port timeout slot
 * */
void
slotsmgrttagslotCommand(redisClient *c) {
    sds host = c->argv[1]->ptr;
    sds port = c->argv[2]->ptr;
    int timeout, slot;
    if (parse_timeout(c, c->argv[3], &timeout) != 0) {
        return;
    }
    if (parse_slot(c, c->argv[4], &slot) != 0) {
        return;
    }

    dict *d = c->db->hash_slots[slot];
    int succ = 0;
    do {
        const dictEntry *de = dictGetRandomKey(d);
        if (de == NULL) {
            break;
        }
        sds skey = dictGetKey(de);
        robj *key = createStringObject(skey, sdslen(skey));
        succ = slotsmgrttag_command(c, host, port, timeout, key);
        decrRefCount(key);
        if (succ < 0) {
            return;
        }
    } while (0);
    addReplyMultiBulkLen(c, 2);
    addReplyLongLong(c, succ);
    addReplyLongLong(c, dictSize(d));
}
/**
 * Add an entry to the cache. If it does exist, then set it.
 * 
 * @param argv key, value and timeout are passed in command line
 * @return 0 on success, otherwise failure
 **/
static int net_cache_add(int argc, const char **argv)
{
	const char *keystr, *datastr, *timeout_str;
	time_t timeout;
	
	if (argc < 3) {
		d_printf("\nUsage: net cache add <key string> <data string> <timeout>\n");
		return -1;
	}
	
	keystr = argv[0];
	datastr = argv[1];
	timeout_str = argv[2];
	
	/* parse timeout given in command line */
	timeout = parse_timeout(timeout_str);
	if (!timeout) {
		d_fprintf(stderr, "Invalid timeout argument.\n");
		return -1;
	}
	
	if (gencache_set(keystr, datastr, timeout)) {
		d_printf("New cache entry stored successfully.\n");
		gencache_shutdown();
		return 0;
	}
	
	d_fprintf(stderr, "Entry couldn't be added. Perhaps there's already such a key.\n");
	gencache_shutdown();
	return -1;
}
Exemple #3
0
/* Fill IPVS rule with root vs infos */
void
ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
{
    /* Clean up target rule */
    memset(urule, 0, sizeof (struct ip_vs_rule_user));

    strncpy(urule->sched_name, vs->sched, IP_VS_SCHEDNAME_MAXLEN);
    urule->weight = 1;
    urule->conn_flags = vs->loadbalancing_kind;
    urule->netmask = ((u_int32_t) 0xffffffff);
    urule->protocol = vs->service_type;

    if (!parse_timeout(vs->timeout_persistence, &urule->timeout))
        log_message(LOG_INFO,
                    "IPVS : Virtual service [%s:%d] illegal timeout.",
                    inet_ntop2(SVR_IP(vs)), ntohs(SVR_PORT(vs)));

    if (urule->timeout != 0 || vs->granularity_persistence)
        urule->vs_flags = IP_VS_SVC_F_PERSISTENT;

    if (cmd == IP_VS_SO_SET_ADD || cmd == IP_VS_SO_SET_DEL)
        if (vs->granularity_persistence)
            urule->netmask = vs->granularity_persistence;

    /* SVR specific */
    if (rs) {
        if (cmd == IP_VS_SO_SET_ADDDEST
                || cmd == IP_VS_SO_SET_DELDEST
                || cmd == IP_VS_SO_SET_EDITDEST) {
            urule->weight = rs->weight;
            urule->daddr = SVR_IP(rs);
            urule->dport = SVR_PORT(rs);
        }
    }
}
Exemple #4
0
/**
 * Add an entry to the cache. If it does exist, then set it.
 *
 * @param c	A net_context structure
 * @param argv key, value and timeout are passed in command line
 * @return 0 on success, otherwise failure
 **/
static int net_cache_add(struct net_context *c, int argc, const char **argv)
{
	const char *keystr, *datastr, *timeout_str;
	time_t timeout;

	if (argc < 3 || c->display_usage) {
		d_printf("%s\n%s",
			 _("Usage:"),
			 _("net cache add <key string> <data string> "
			   "<timeout>\n"));
		return -1;
	}

	keystr = argv[0];
	datastr = argv[1];
	timeout_str = argv[2];

	/* parse timeout given in command line */
	timeout = parse_timeout(timeout_str);
	if (!timeout) {
		d_fprintf(stderr, _("Invalid timeout argument.\n"));
		return -1;
	}

	if (gencache_set(keystr, datastr, timeout)) {
		d_printf(_("New cache entry stored successfully.\n"));
		return 0;
	}

	d_fprintf(stderr, _("Entry couldn't be added. Perhaps there's already such a key.\n"));
	return -1;
}
Exemple #5
0
/**
 * Set new value of an existing entry in the cache. Fail If the entry doesn't
 * exist.
 * 
 * @param argv key being searched and new value and timeout to set in the entry
 * @return 0 on success, otherwise failure
 **/
static int net_cache_set(int argc, const char **argv)
{
	const char *keystr, *datastr, *timeout_str;
	time_t timeout;
	
	if (argc < 3) {
		d_printf("\nUsage: net cache set <key string> <data string> <timeout>\n");
		return -1;
	}
	
	keystr = argv[0];
	datastr = argv[1];
	timeout_str = argv[2];
	
	/* parse timeout given in command line */
	timeout = parse_timeout(timeout_str);
	if (!timeout) {
		d_printf("Invalid timeout argument.\n");
		return -1;
	}
	
	if (gencache_set_only(keystr, datastr, timeout)) {
		d_printf("Cache entry set successfully.\n");
		gencache_shutdown();
		return 0;
	}

	d_printf("Entry couldn't be set. Perhaps there's no such a key.\n");
	gencache_shutdown();
	return -1;
}
Exemple #6
0
/* *
 * slotsmgrttagone host port timeout key
 * */
void
slotsmgrttagoneCommand(redisClient *c) {
    sds host = c->argv[1]->ptr;
    sds port = c->argv[2]->ptr;
    int timeout;
    if (parse_timeout(c, c->argv[3], &timeout) != 0) {
        return;
    }

    robj *key = c->argv[4];
    int succ = slotsmgrttag_command(c, host, port, timeout, key);
    if (succ < 0) {
        return;
    }
    addReplyLongLong(c, succ);
}
Exemple #7
0
/* Fill IPVS rule with root vs infos */
void
ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
{
	/* Clean target rule */
	memset(drule, 0, sizeof(ipvs_dest_t));

	drule->weight = 1;
	drule->u_threshold = 0;
	drule->l_threshold = 0;
	drule->conn_flags = vs->loadbalancing_kind;
	strncpy(srule->sched_name, vs->sched, IP_VS_SCHEDNAME_MAXLEN);
	srule->netmask = (vs->addr.ss_family == AF_INET6) ? 128 : ((u_int32_t) 0xffffffff);
	srule->protocol = vs->service_type;

	if (!parse_timeout(vs->timeout_persistence, &srule->timeout))
		log_message(LOG_INFO, "IPVS : Virtual service [%s]:%d illegal timeout."
				    , inet_ntop2(inet_sockaddrip4(&vs->addr))
				    , ntohs(inet_sockaddrport(&vs->addr)));

	srule->est_timeout = atoi(vs->est_timeout);

	if (srule->timeout != 0 || vs->granularity_persistence)
		srule->flags = IP_VS_SVC_F_PERSISTENT;

	if (cmd == IP_VS_SO_SET_ADD || cmd == IP_VS_SO_SET_DEL)
		if (vs->granularity_persistence)
			srule->netmask = vs->granularity_persistence;

	if(vs->syn_proxy)
		srule->flags |= IP_VS_SVC_F_SYNPROXY;

	/* SVR specific */
	if (rs) {
		if (cmd == IP_VS_SO_SET_ADDDEST || cmd == IP_VS_SO_SET_DELDEST ||
		    cmd == IP_VS_SO_SET_EDITDEST) {
			drule->af = rs->addr.ss_family;
			if (rs->addr.ss_family == AF_INET6)
				inet_sockaddrip6(&rs->addr, &drule->addr.in6);
			else
				drule->addr.ip = inet_sockaddrip4(&rs->addr);
			drule->port = inet_sockaddrport(&rs->addr);
			drule->weight = rs->weight;	
			drule->u_threshold = rs->u_threshold;
			drule->l_threshold = rs->l_threshold;
		}
	}
}
Exemple #8
0
static int 
end_element_common(struct ne_lock *l, int state, const char *cdata)
{
    switch (state) { 
    case ELM_write:
	l->type = ne_locktype_write;
	break;
    case ELM_exclusive:
	l->scope = ne_lockscope_exclusive;
	break;
    case ELM_shared:
	l->scope = ne_lockscope_shared;
	break;
    case ELM_depth:
	NE_DEBUG(NE_DBG_LOCKS, "Got depth: %s", cdata);
	l->depth = parse_depth(cdata);
	if (l->depth == -1) {
	    return -1;
	}
	break;
    case ELM_timeout:
	NE_DEBUG(NE_DBG_LOCKS, "Got timeout: %s", cdata);
	l->timeout = parse_timeout(cdata);
	if (l->timeout == NE_TIMEOUT_INVALID) {
	    return -1;
	}
	break;
    case ELM_owner:
	l->owner = strdup(cdata);
	break;
    case ELM_href:
	l->token = strdup(cdata);
	break;
    }
    return 0;
}
Exemple #9
0
int
ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
{
    struct ip_masq_ctl ctl;
    int result = 0;
    int sockfd;

    memset(&ctl, 0, sizeof (struct ip_masq_ctl));

    ctl.m_target = IP_MASQ_TARGET_VS;
    ctl.m_cmd = cmd;
    strncpy(ctl.m_tname, vs->sched, IP_MASQ_TNAME_MAX);
    ctl.u.vs_user.weight = -1;
    ctl.u.vs_user.masq_flags = vs->loadbalancing_kind;
    ctl.u.vs_user.netmask = ((u_int32_t) 0xffffffff);
    ctl.u.vs_user.protocol = vs->service_type;

    if (!parse_timeout(vs->timeout_persistence, &ctl.u.vs_user.timeout))
        log_message(LOG_INFO,
                    "IPVS : Virtual service [%s:%d] illegal timeout.",
                    inet_ntop2(SVR_IP(vs))
                    , ntohs(SVR_PORT(vs)));
    if (ctl.u.vs_user.timeout != 0 || vs->granularity_persistence)
        ctl.u.vs_user.vs_flags = IP_VS_SVC_F_PERSISTENT;

    /* VS specific */
    if (vs->vfwmark) {
        ctl.u.vs_user.vfwmark = vs->vfwmark;
    } else {
        ctl.u.vs_user.vaddr = SVR_IP(vs);
        ctl.u.vs_user.vport = SVR_PORT(vs);
    }

    if (ctl.m_cmd == IP_MASQ_CMD_ADD || ctl.m_cmd == IP_MASQ_CMD_DEL)
        if (vs->granularity_persistence)
            ctl.u.vs_user.netmask = vs->granularity_persistence;

    /* SVR specific */
    if (ctl.m_cmd == IP_MASQ_CMD_ADD_DEST
            || ctl.m_cmd == IP_MASQ_CMD_DEL_DEST
            || ctl.m_cmd == IP_MASQ_CMD_SET_DEST) {
        ctl.u.vs_user.weight = rs->weight;
        ctl.u.vs_user.daddr = SVR_IP(rs);
        ctl.u.vs_user.dport = SVR_PORT(rs);
    }

    /* Does the service use inhibit flag ? */
    if (ctl.m_cmd == IP_MASQ_CMD_DEL_DEST && rs->inhibit) {
        ctl.m_cmd = IP_MASQ_CMD_SET_DEST;
        ctl.u.vs_user.weight = 0;
    }
    if (ctl.m_cmd == IP_MASQ_CMD_ADD_DEST && rs->inhibit && !rs->alive)
        ctl.m_cmd = IP_MASQ_CMD_SET_DEST;

    sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
    if (sockfd == -1) {
        log_message(LOG_INFO,
                    "IPVS : Can not initialize SOCK_RAW descriptor.");
        return IPVS_ERROR;
    }

    result =
        setsockopt(sockfd, IPPROTO_IP, IP_FW_MASQ_CTL, (char *) &ctl,
                   sizeof (ctl));

    if (errno == ESRCH) {
        log_message(LOG_INFO, "IPVS : Virtual service [%s:%d] not defined.",
                    inet_ntop2(SVR_IP(vs))
                    , ntohs(SVR_PORT(vs)));
        close(sockfd);
        return IPVS_ERROR;
    } else if (errno == EEXIST) {
        if (rs)
            log_message(LOG_INFO,
                        "IPVS : Destination already exists [%s:%d].",
                        inet_ntop2(SVR_IP(rs))
                        , ntohs(SVR_PORT(rs)));
    } else if (errno == ENOENT) {
        if (rs)
            log_message(LOG_INFO, "IPVS : No such destination [%s:%d].",
                        inet_ntop2(SVR_IP(rs))
                        , ntohs(SVR_PORT(rs)));
    }

    close(sockfd);
    return IPVS_SUCCESS;
}
Exemple #10
0
int
main(int argc, char **argv)
{
	const char	*opt_configfile = ISNS_DEFAULT_ISNSADM_CONFIG;
	isns_client_t	*clnt;
	isns_attr_list_t *attrs;
	isns_simple_t	*reg;
	isns_portal_info_t portal_info;
	uint32_t	status;
	int		opt_replace = 1;
	int		c, n, timeout;

	while ((c = getopt(argc, argv, "c:d:n")) != -1) {
		switch (c) {
		case 'c':
			opt_configfile = optarg;
			break;

		case 'd':
			isns_enable_debugging(optarg);
			break;

		case 'n':
			opt_replace = 0;
			break;

		default:
			isns_fatal("Unknown option\n");
		}
	}

	if (optind != argc - 1)
		isns_fatal("Need timeout argument\n");
	timeout = parse_timeout(argv[optind]);

	isns_read_config(opt_configfile);

	/*
	    ---DevAttrReg[REPLACE]---
	    Source:
	      0020  string      : iSCSI name = "iqn.2005-03.org.open-iscsi:blue"
	    Message attributes:
	      0001  string      : Entity identifier = "blue.pauw.homeunix.net"
	    Operating attributes:
	      0001  string      : Entity identifier = "blue.pauw.homeunix.net"
	      0002  uint32      : Entity protocol = iSCSI (2)
	      0010  ipaddr      : Portal IP address = 192.168.1.2
	      0011  uint32      : Portal TCP/UDP port = 33849/tcp
	      0014  uint32      : ESI port = 56288/tcp
	      0020  string      : iSCSI name = "iqn.2005-03.org.open-iscsi:blue"
	      0021  uint32      : iSCSI node type = Initiator
	      0022  string      : iSCSI alias = "blue.pauw.homeunix.net"

	      [...]
    	      response status 0x0003 (Invalid registration)

	   This would fail because we got confused about EID in
	   the replace case.
	 */
	isns_assign_string(&isns_config.ic_source_name,
			"iqn.2005-03.org.open-iscsi:blue");

	for (n = 0; n < 2; ++n) {
		clnt = isns_create_default_client(NULL);
		reg = isns_simple_create(ISNS_DEVICE_ATTRIBUTE_REGISTER,
				clnt->ic_source, NULL);
		reg->is_replace = opt_replace;

		/* Message attributes */
		attrs = &reg->is_message_attrs;
		STR(ENTITY_IDENTIFIER,	"blue.pauw.homeunix.net");

		/* Operating attributes */
		attrs = &reg->is_operating_attrs;

		STR(ENTITY_IDENTIFIER,	"blue.pauw.homeunix.net");
		U32(ENTITY_PROTOCOL,	2);

		isns_portal_parse(&portal_info, "192.168.1.2:33849/tcp", NULL);
		isns_portal_to_attr_list(&portal_info,
				ISNS_TAG_PORTAL_IP_ADDRESS,
				ISNS_TAG_PORTAL_TCP_UDP_PORT,
				attrs);

		U32(ESI_PORT,		56288);
		STR(ISCSI_NAME,		"iqn.2005-03.org.open-iscsi:blue");
		U32(ISCSI_NODE_TYPE,	ISNS_ISCSI_INITIATOR_MASK);
		STR(ISCSI_ALIAS,	"blue.pauw.homeunix.net");
		isns_simple_print(reg, isns_print_stdout);

		status = isns_client_call(clnt, &reg);

		if (status != ISNS_SUCCESS)
			isns_fatal("Unable to register object: %s\n",
					isns_strerror(status));

		printf("Successfully registered object\n");
		// isns_simple_print(reg, isns_print_stdout);
		isns_simple_free(reg);
		isns_client_destroy(clnt);

		if (n == 0) {
			printf("Sleeping for %d seconds\n", timeout);
			sleep(timeout);
		}
	}

	return 0;
}
Exemple #11
0
int
main(int argc, char *argv[])
{
	extern int optind;
	char **prgargs, *options = "sqn:";
	char *timeoutarg;
	int quiet = 0;		/* suppress (some) printing of jnl lines */
	int suspend = 0;	/* set so that a hung process is not killed */
	int child_pid, child_status, c;
	int tmp_status;
	pid_t mypid;
	time_t duration;
	hrtime_t end_time;
	char *name = NULL;
	char *tempname;
	int nflag = 0;		/* use name for the testcase in jnl */
	timed_out = 0;

	if (argc < 2) {
		usage();
		exit(1);
	}

	suspend = (getenv("STF_SUSPEND") != NULL);

	while ((c = getopt(argc, argv, options)) != EOF) {
		switch (c) {

			case 's':
				suspend = 1;
				break;
			case 'q':
				quiet = 1;
				break;
			case 'n':
				nflag = 1;
				name = optarg;
				break;
		}
	}
	/* get timeout value */
	timeoutarg = argv[optind];
	parse_timeout(timeoutarg, &duration);
	++optind;

	/* program name and args pointer */
	if (optind < argc) {
		prgargs = &(argv[optind]);
		tempname = prgargs[0];
	} else {
		usage();
		(void) fprintf(stderr, "	missing command name\n");
		exit(1);
	}


	/* for timeout value */
	end_time = gethrtime() + (duration * (hrtime_t)NANOSEC);
	(void) signal(SIGHUP, goodbye);
	(void) signal(SIGINT, goodbye);
	(void) signal(SIGQUIT, goodbye);
	(void) signal(SIGTERM, goodbye);

	if ((test_pid = fork1()) == 0) {	/* this is the child */
		/*
		 * Set the child to be the process group leader.
		 * The session id is left the same.
		 */
		mypid = getpid();
		(void) setpgid(mypid, mypid);
		if (quiet == 0) {
			if (nflag == 1)
				prgargs[0] = name;
			stf_jnl_testcase_start(prgargs);
			if (nflag == 1)
				prgargs[0] = tempname;
		}

		(void) execvp(prgargs[0], &prgargs[0]);
		perror("timeout: exec failed");
		(void) fprintf(stderr, "exec file is: %s\n", prgargs[0]);
		exit(1);
	}
	if (test_pid == -1) {
		perror("Fork failed");
		exit(1);
	}
	(void) sprintf(process_file, "%s%d", process_file, test_pid);
	if ((process_fd = open(process_file, O_RDONLY, 0666)) == -1) {
		perror("timeout: proc file open");
		exit(1);
	}

	(void) poll_process(end_time, suspend);
	child_pid = waitpid(test_pid, &child_status, 0);

	/* A time out defaults to an exit status of 0, */
	/* here we force a time out status, while retaining the sig */
	if (timed_out == 1) {  /* fake a time_out status for time out */
		tmp_status = child_status;
		/* mask in an exit status, make sure it's set to zero first */
		child_status = (tmp_status & 0xffff00ff) |
		    (TIMED_OUT_INDEX << 8);
	}

	if (quiet == 0) {
		if (nflag == 1)
			prgargs[0] = name;
		stf_jnl_testcase_end(name, child_pid, child_status);
		if (nflag == 1)
			prgargs[0] = tempname;
	}
	return (WEXITSTATUS(child_status));
}
Exemple #12
0
static int32_t
snmptool_parse_options(struct snmp_toolinfo *snmptoolctx, int argc, char **argv)
{
	int32_t count, optnum = 0;
	int ch;
	const char *opts;

	switch (program) {
		case BSNMPWALK:
			opts = "dhnKA:b:C:I:i:l:M:N:o:P:p:r:s:t:U:v:";
			break;
		case BSNMPGET:
			opts = "aDdehnKA:b:C:I:i:l:M:N:o:P:p:r:s:t:U:v:";
			break;
		case BSNMPSET:
			opts = "adehnKA:b:C:I:i:l:o:P:r:s:t:U:v:";
			break;
		default:
			return (-1);
	}

	while ((ch = getopt(argc, argv, opts)) != EOF) {
		switch (ch) {
		case 'A':
			count = parse_authentication(snmptoolctx, optarg);
			break;
		case 'a':
			count = parse_skip_access(snmptoolctx);
			break;
		case 'b':
			count = parse_buflen(optarg);
			break;
		case 'D':
			count = parse_discovery(snmptoolctx);
			break;
		case 'd':
			count = parse_debug();
			break;
		case 'e':
			count = parse_errors(snmptoolctx);
			break;
		case 'h':
			usage();
			return (-2);
		case 'C':
			count = parse_context(snmptoolctx, optarg);
			break;
		case 'I':
			count = parse_include(snmptoolctx, optarg);
			break;
		case 'i':
			count = parse_file(snmptoolctx, optarg);
			break;
		case 'K':
			count = parse_local_key(snmptoolctx);
			break;
		case 'l':
			count = parse_local_path(optarg);
			break;
		case 'M':
			count = parse_max_repetitions(snmptoolctx, optarg);
			break;
		case 'N':
			count = parse_non_repeaters(snmptoolctx, optarg);
			break;
		case 'n':
			count = parse_num_oids(snmptoolctx);
			break;
		case 'o':
			count = parse_output(snmptoolctx, optarg);
			break;
		case 'P':
			count = parse_privacy(snmptoolctx, optarg);
			break;
		case 'p':
			count = parse_pdu_type(snmptoolctx, optarg);
			break;
		case 'r':
			count = parse_retry(optarg);
			break;
		case 's':
			count = parse_server(optarg);
			break;
		case 't':
			count = parse_timeout(optarg);
			break;
		case 'U':
			count = parse_user_security(snmptoolctx, optarg);
			break;
		case 'v':
			count = parse_version(optarg);
			break;
		case '?':
		default:
			usage();
			return (-1);
		}
		if (count < 0)
			return (-1);
	    optnum += count;
	}

	return (optnum);
}
Exemple #13
0
int
isns_config_set(const char *name, char *pos)
{
	char	*value;

	value = parser_get_rest_of_line(&pos);
	if (value)
		while (isspace(*value) || *value == '=')
			++value;
	if (!strcasecmp(name, "HostName")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_host_name, value);
	} else if (!strcasecmp(name, "SourceName")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_source_name, value);
	} else if (!strcasecmp(name, "AuthName")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_auth_name, value);
	} else if (!strcasecmp(name, "IQNPrefix")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_iqn_prefix, value);
	} else if (!strcasecmp(name, "Database")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_database, value);
	} else if (!strcasecmp(name, "ServerAddress")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_server_name, value);
	} else if (!strcasecmp(name, "BindAddress")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_bind_address, value);
	} else if (!strcasecmp(name, "ControlSocket")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_control_socket, value);
	} else if (!strcasecmp(name, "PIDFile")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_pidfile, value);
	} else if (!strcasecmp(name, "LocalRegistry")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_local_registry_file, value);
	} else if (!strcasecmp(name, "RegistrationPeriod")) {
		if (!value)
			goto no_value;
		isns_config.ic_registration_period = parse_timeout(value);
	} else if (!strcasecmp(name, "SCNTimeout")) {
		if (!value)
			goto no_value;
		isns_config.ic_scn_timeout = parse_timeout(value);
	} else if (!strcasecmp(name, "SCNRetries")) {
		if (!value)
			goto no_value;
		isns_config.ic_scn_retries = parse_int(value);
	} else if (!strcasecmp(name, "SCNCallout")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_scn_callout, value);
	} else if (!strcasecmp(name, "ESIMinInterval")) {
		if (!value)
			goto no_value;
		isns_config.ic_esi_min_interval = parse_timeout(value);
	} else if (!strcasecmp(name, "ESIMaxInterval")) {
		if (!value)
			goto no_value;
		isns_config.ic_esi_max_interval = parse_timeout(value);
	} else if (!strcasecmp(name, "ESIRetries")) {
		if (!value)
			goto no_value;
		isns_config.ic_esi_retries = parse_int(value);
	} else if (!strcasecmp(name, "DefaultDiscoveryDomain")) {
		if (!value)
			goto no_value;
		isns_config.ic_use_default_domain = parse_int(value);
	} else if (!strcasecmp(name, "SLPRegister")) {
		if (!value)
			goto no_value;
		isns_config.ic_slp_register = parse_int(value);
	} else if (!strcasecmp(name, "Security")) {
		if (!value)
			goto no_value;
		isns_config.ic_security = parse_int(value);
	} else if (!strcasecmp(name, "AuthKeyFile")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_auth_key_file, value);
	} else if (!strcasecmp(name, "ServerKeyFile")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_server_key_file, value);
	} else if (!strcasecmp(name, "ClientKeyStore")
		|| !strcasecmp(name, "KeyStore")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_client_keystore, value);
	} else if (!strcasecmp(name, "Control.SourceName")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_control_name, value);
	} else if (!strcasecmp(name, "Control.AuthKeyFile")) {
		if (!value)
			goto no_value;
		isns_assign_string(&isns_config.ic_control_key_file, value);
	} else if (!strcasecmp(name, "Auth.ReplayWindow")) {
		if (!value)
			goto no_value;
		isns_config.ic_auth.replay_window = parse_timeout(value);
	} else if (!strcasecmp(name, "Auth.TimestampJitter")) {
		if (!value)
			goto no_value;
		isns_config.ic_auth.timestamp_jitter = parse_timeout(value);
	} else if (!strcasecmp(name, "Network.MaxSockets")) {
		if (!value)
			goto no_value;
		isns_config.ic_network.max_sockets = parse_timeout(value);
	} else if (!strcasecmp(name, "Network.ConnectTimeout")) {
		if (!value)
			goto no_value;
		isns_config.ic_network.connect_timeout = parse_timeout(value);
	} else if (!strcasecmp(name, "Network.ReconnectTimeout")) {
		if (!value)
			goto no_value;
		isns_config.ic_network.reconnect_timeout = parse_timeout(value);
	} else if (!strcasecmp(name, "Network.CallTimeout")) {
		if (!value)
			goto no_value;
		isns_config.ic_network.call_timeout = parse_timeout(value);
	} else {
		fprintf(stderr, "Unknown config item %s=%s\n", name, value);
	}
	return 0;

no_value:
	fprintf(stderr,
		"*** Missing value in configuration assignment for %s ***\n",
		name);
	return -1;
}