Home | History | Annotate | Download | only in src

Lines Matching defs:config

494   struct dhcp_config *config;
496 for (config = configs; config; config = config->next)
497 if ((config->flags & CONFIG_ADDR) && config->addr.s_addr == addr.s_addr)
498 return config;
635 static int is_addr_in_context(struct dhcp_context *context, struct dhcp_config *config)
639 if (!(config->flags & CONFIG_ADDR))
642 if (is_same_net(config->addr, context->start, context->netmask))
648 int config_has_mac(struct dhcp_config *config, unsigned char *hwaddr, int len, int type)
652 for (conf_addr = config->hwaddr; conf_addr; conf_addr = conf_addr->next)
669 struct dhcp_config *config, *candidate;
673 for (config = configs; config; config = config->next)
674 if (config->flags & CONFIG_CLID)
676 if (config->clid_len == clid_len &&
677 memcmp(config->clid, clid, clid_len) == 0 &&
678 is_addr_in_context(context, config))
679 return config;
683 if (*clid == 0 && config->clid_len == clid_len-1 &&
684 memcmp(config->clid, clid+1, clid_len-1) == 0 &&
685 is_addr_in_context(context, config))
686 return config;
690 for (config = configs; config; config = config->next)
691 if (config_has_mac(config, hwaddr, hw_len, hw_type) &&
692 is_addr_in_context(context, config))
693 return config;
696 for (config = configs; config; config = config->next)
697 if ((config->flags & CONFIG_NAME) &&
698 hostname_isequal(config->hostname, hostname) &&
699 is_addr_in_context(context, config))
700 return config;
703 for (candidate = NULL, count = 0, config = configs; config; config = config->next)
704 if (is_addr_in_context(context, config))
705 for (conf_addr = config->hwaddr; conf_addr; conf_addr = conf_addr->next)
712 candidate = config;
727 struct dhcp_config *config;
739 for (up = &daemon->dhcp_conf, config = daemon->dhcp_conf; config; config = tmp)
741 tmp = config->next;
742 if (config->flags & CONFIG_FROM_ETHERS)
746 if (config->flags & CONFIG_NAME)
747 free(config->hostname);
748 free(config->hwaddr);
749 free(config);
752 up = &config->next;
791 for (config = daemon->dhcp_conf; config; config = config->next)
792 if ((config->flags & CONFIG_ADDR) && config->addr.s_addr == addr.s_addr)
808 for (config = daemon->dhcp_conf; config; config = config->next)
809 if ((config->flags & CONFIG_NAME) && hostname_isequal(config->hostname, host))
813 if (config && (config->flags & CONFIG_FROM_ETHERS))
819 if (!config)
821 for (config = daemon->dhcp_conf; config; config = config->next)
823 struct hwaddr_config *conf_addr = config->hwaddr;
833 if (!config)
835 if (!(config = whine_malloc(sizeof(struct dhcp_config))))
837 config->flags = CONFIG_FROM_ETHERS;
838 config->hwaddr = NULL;
839 config->domain = NULL;
840 config->next = daemon->dhcp_conf;
841 daemon->dhcp_conf = config;
844 config->flags |= flags;
848 config->hostname = host;
853 config->addr = addr;
856 config->flags |= CONFIG_NOCLID;
857 if (!config->hwaddr)
858 config->hwaddr = whine_malloc(sizeof(struct hwaddr_config));
859 if (config->hwaddr)
861 memcpy(config->hwaddr->hwaddr, hwaddr, ETHER_ADDR_LEN);
862 config->hwaddr->hwaddr_len = ETHER_ADDR_LEN;
863 config->hwaddr->hwaddr_type = ARPHRD_ETHER;
864 config->hwaddr->wildcard_mask = 0;
865 config->hwaddr->next = NULL;
880 /* If the same IP appears in more than one host config, then DISCOVER
897 die(_("duplicate IP address %s in dhcp-config directive."),
915 This goes through /etc/hosts and sets static addresses for any DHCP config
921 struct dhcp_config *config;
924 for (config = configs; config; config = config->next)
925 if (config->flags & CONFIG_ADDR_HOSTS)
926 config->flags &= ~(CONFIG_ADDR | CONFIG_ADDR_HOSTS);
930 for (config = configs; config; config = config->next)
931 if (!(config->flags & CONFIG_ADDR) &&
932 (config->flags & CONFIG_NAME) &&
933 (crec = cache_find_by_name(NULL, config->hostname, 0, F_IPV4)) &&
936 if (cache_find_by_name(crec, config->hostname, 0, F_IPV4))
940 crec = cache_find_by_name(crec, config->hostname, 0, F_IPV4);
944 config->hostname, inet_ntoa(crec->addr.addr.addr.addr4));
948 my_syslog(MS_DHCP | LOG_WARNING, _("duplicate IP address %s (%s) in dhcp-config directive"),
949 inet_ntoa(crec->addr.addr.addr.addr4), config->hostname);
952 config->addr = crec->addr.addr.addr.addr4;
953 config->flags |= CONFIG_ADDR | CONFIG_ADDR_HOSTS;