FreeBSD/contrib/ntp/ntpd/ntp_io.c
/*
 * add_nic_rule() -- insert a rule entry at the head of nic_rule_list.
 */
- insert a rule entry at the head of nic_rule_list.
- insert a rule entry at the head of nic_rule_list .
void
add_nic_rule(
	nic_rule_match	match_type,
	const char *	if_name,	
	int		prefixlen,
	nic_rule_action	action
	)
{
	nic_rule *	rule;
	isc_boolean_t	is_ip;
	rule = emalloc_zero(sizeof(*rule));
	rule->match_type = match_type;
	rule->prefixlen = prefixlen;
	rule->action = action;
	if (MATCH_IFNAME == match_type) {
		REQUIRE(NULL != if_name);
		rule->if_name = estrdup(if_name);
	} else if (MATCH_IFADDR == match_type) {
		REQUIRE(NULL != if_name);
		is_ip = is_ip_address(if_name, AF_UNSPEC, &rule->addr);
		REQUIRE(is_ip);
	} else
		REQUIRE(NULL == if_name);
	LINK_SLIST(nic_rule_list, rule, next);
}
void add_nic_rule ( nic_rule_match match_type , const char * if_name , int prefixlen , nic_rule_action action ) { nic_rule * rule ; isc_boolean_t is_ip ; rule = emalloc_zero ( sizeof ( * rule ) ) ; rule -> match_type = match_type ; rule -> prefixlen = prefixlen ; rule -> action = action ; if ( MATCH_IFNAME == match_type ) { REQUIRE ( NULL != if_name ) ; rule -> if_name = estrdup ( if_name ) ; } else if ( MATCH_IFADDR == match_type ) { REQUIRE ( NULL != if_name ) ; is_ip = is_ip_address ( if_name , AF_UNSPEC , & rule -> addr ) ; REQUIRE ( is_ip ) ; } else REQUIRE ( NULL == if_name ) ; LINK_SLIST ( nic_rule_list , rule , next ) ; }
add_nic_rule() -- insert a rule entry at the head of nic_rule_list.
add_nic_rule () -- insert a rule entry at the head of nic_rule_list .
/* interface name or numeric address */ /* set rule->addr */