Lines Matching refs:config
494 struct dhcp_config *config; in config_find_by_address() local
496 for (config = configs; config; config = config->next) in config_find_by_address()
497 if ((config->flags & CONFIG_ADDR) && config->addr.s_addr == addr.s_addr) in config_find_by_address()
498 return config; in config_find_by_address()
635 static int is_addr_in_context(struct dhcp_context *context, struct dhcp_config *config) in is_addr_in_context() argument
639 if (!(config->flags & CONFIG_ADDR)) in is_addr_in_context()
642 if (is_same_net(config->addr, context->start, context->netmask)) in is_addr_in_context()
648 int config_has_mac(struct dhcp_config *config, unsigned char *hwaddr, int len, int type) in config_has_mac() argument
652 for (conf_addr = config->hwaddr; conf_addr; conf_addr = conf_addr->next) in config_has_mac()
669 struct dhcp_config *config, *candidate; in find_config() local
673 for (config = configs; config; config = config->next) in find_config()
674 if (config->flags & CONFIG_CLID) in find_config()
676 if (config->clid_len == clid_len && in find_config()
677 memcmp(config->clid, clid, clid_len) == 0 && in find_config()
678 is_addr_in_context(context, config)) in find_config()
679 return config; in find_config()
683 if (*clid == 0 && config->clid_len == clid_len-1 && in find_config()
684 memcmp(config->clid, clid+1, clid_len-1) == 0 && in find_config()
685 is_addr_in_context(context, config)) in find_config()
686 return config; in find_config()
690 for (config = configs; config; config = config->next) in find_config()
691 if (config_has_mac(config, hwaddr, hw_len, hw_type) && in find_config()
692 is_addr_in_context(context, config)) in find_config()
693 return config; in find_config()
696 for (config = configs; config; config = config->next) in find_config()
697 if ((config->flags & CONFIG_NAME) && in find_config()
698 hostname_isequal(config->hostname, hostname) && in find_config()
699 is_addr_in_context(context, config)) in find_config()
700 return config; in find_config()
703 for (candidate = NULL, count = 0, config = configs; config; config = config->next) in find_config()
704 if (is_addr_in_context(context, config)) in find_config()
705 for (conf_addr = config->hwaddr; conf_addr; conf_addr = conf_addr->next) in find_config()
712 candidate = config; in find_config()
727 struct dhcp_config *config; in dhcp_read_ethers() local
739 for (up = &daemon->dhcp_conf, config = daemon->dhcp_conf; config; config = tmp) in dhcp_read_ethers()
741 tmp = config->next; in dhcp_read_ethers()
742 if (config->flags & CONFIG_FROM_ETHERS) in dhcp_read_ethers()
746 if (config->flags & CONFIG_NAME) in dhcp_read_ethers()
747 free(config->hostname); in dhcp_read_ethers()
748 free(config->hwaddr); in dhcp_read_ethers()
749 free(config); in dhcp_read_ethers()
752 up = &config->next; in dhcp_read_ethers()
791 for (config = daemon->dhcp_conf; config; config = config->next) in dhcp_read_ethers()
792 if ((config->flags & CONFIG_ADDR) && config->addr.s_addr == addr.s_addr) in dhcp_read_ethers()
808 for (config = daemon->dhcp_conf; config; config = config->next) in dhcp_read_ethers()
809 if ((config->flags & CONFIG_NAME) && hostname_isequal(config->hostname, host)) in dhcp_read_ethers()
813 if (config && (config->flags & CONFIG_FROM_ETHERS)) in dhcp_read_ethers()
819 if (!config) in dhcp_read_ethers()
821 for (config = daemon->dhcp_conf; config; config = config->next) in dhcp_read_ethers()
823 struct hwaddr_config *conf_addr = config->hwaddr; in dhcp_read_ethers()
833 if (!config) in dhcp_read_ethers()
835 if (!(config = whine_malloc(sizeof(struct dhcp_config)))) in dhcp_read_ethers()
837 config->flags = CONFIG_FROM_ETHERS; in dhcp_read_ethers()
838 config->hwaddr = NULL; in dhcp_read_ethers()
839 config->domain = NULL; in dhcp_read_ethers()
840 config->next = daemon->dhcp_conf; in dhcp_read_ethers()
841 daemon->dhcp_conf = config; in dhcp_read_ethers()
844 config->flags |= flags; in dhcp_read_ethers()
848 config->hostname = host; in dhcp_read_ethers()
853 config->addr = addr; in dhcp_read_ethers()
856 config->flags |= CONFIG_NOCLID; in dhcp_read_ethers()
857 if (!config->hwaddr) in dhcp_read_ethers()
858 config->hwaddr = whine_malloc(sizeof(struct hwaddr_config)); in dhcp_read_ethers()
859 if (config->hwaddr) in dhcp_read_ethers()
861 memcpy(config->hwaddr->hwaddr, hwaddr, ETHER_ADDR_LEN); in dhcp_read_ethers()
862 config->hwaddr->hwaddr_len = ETHER_ADDR_LEN; in dhcp_read_ethers()
863 config->hwaddr->hwaddr_type = ARPHRD_ETHER; in dhcp_read_ethers()
864 config->hwaddr->wildcard_mask = 0; in dhcp_read_ethers()
865 config->hwaddr->next = NULL; in dhcp_read_ethers()
921 struct dhcp_config *config; in dhcp_update_configs() local
924 for (config = configs; config; config = config->next) in dhcp_update_configs()
925 if (config->flags & CONFIG_ADDR_HOSTS) in dhcp_update_configs()
926 config->flags &= ~(CONFIG_ADDR | CONFIG_ADDR_HOSTS); in dhcp_update_configs()
930 for (config = configs; config; config = config->next) in dhcp_update_configs()
931 if (!(config->flags & CONFIG_ADDR) && in dhcp_update_configs()
932 (config->flags & CONFIG_NAME) && in dhcp_update_configs()
933 (crec = cache_find_by_name(NULL, config->hostname, 0, F_IPV4)) && in dhcp_update_configs()
936 if (cache_find_by_name(crec, config->hostname, 0, F_IPV4)) in dhcp_update_configs()
940 crec = cache_find_by_name(crec, config->hostname, 0, F_IPV4); in dhcp_update_configs()
944 config->hostname, inet_ntoa(crec->addr.addr.addr.addr4)); in dhcp_update_configs()
949 inet_ntoa(crec->addr.addr.addr.addr4), config->hostname); in dhcp_update_configs()
952 config->addr = crec->addr.addr.addr.addr4; in dhcp_update_configs()
953 config->flags |= CONFIG_ADDR | CONFIG_ADDR_HOSTS; in dhcp_update_configs()