_cleanup_address_free_ Address *address = NULL;
if (section) {
- uint64_t key = section;
- address = hashmap_get(network->addresses_by_section, &key);
+ address = hashmap_get(network->addresses_by_section, UINT_TO_PTR(section));
if (address) {
*ret = address;
address = NULL;
if (section) {
address->section = section;
- hashmap_put(network->addresses_by_section, &address->section, address);
+ hashmap_put(network->addresses_by_section,
+ UINT_TO_PTR(address->section), address);
}
*ret = address;
if (address->section)
hashmap_remove(address->network->addresses_by_section,
- &address->section);
+ UINT_TO_PTR(address->section));
}
free(address);
assert(ret);
/* Something useful was configured? just use it */
- if (in_addr_null(original->family, &original->in_addr) <= 0)
+ if (in_addr_is_null(original->family, &original->in_addr) <= 0)
return 0;
/* The address is configured to be 0.0.0.0 or [::] by the user?
return r;
}
- if (!in_addr_null(address->family, &address->in_addr_peer)) {
+ if (!in_addr_is_null(address->family, &address->in_addr_peer)) {
if (address->family == AF_INET)
r = sd_rtnl_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
else if (address->family == AF_INET6)
return 0;
}
-int config_parse_dns(const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
- Network *network = userdata;
- Address *tail;
- _cleanup_address_free_ Address *n = NULL;
- int r;
-
- assert(filename);
- assert(section);
- assert(lvalue);
- assert(rvalue);
- assert(network);
-
- r = address_new_dynamic(&n);
- if (r < 0)
- return r;
-
- r = net_parse_inaddr(rvalue, &n->family, &n->in_addr);
- if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "DNS address is invalid, ignoring assignment: %s", rvalue);
- return 0;
- }
-
- if (streq(lvalue, "DNS")) {
- LIST_FIND_TAIL(addresses, network->dns, tail);
- LIST_INSERT_AFTER(addresses, network->dns, tail, n);
- } else if (streq(lvalue, "NTP")) {
- LIST_FIND_TAIL(addresses, network->ntp, tail);
- LIST_INSERT_AFTER(addresses, network->ntp, tail, n);
- } else {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Key is invalid, ignoring assignment: %s=%s", lvalue, rvalue);
- return 0;
- }
-
- n = NULL;
-
- return 0;
-}
-
int config_parse_broadcast(const char *unit,
const char *filename,
unsigned line,