diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-18 16:09:30 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-18 16:10:51 +0200 |
commit | 0dd25fb9f005d8ab7ac4bc10a609d00569f8c56a (patch) | |
tree | 2f253672d8a0a97c8c19ba1ce2cad26a5bef62a8 /src/resolve/resolved-bus.c | |
parent | f41925b4e442a34c93ad120ef1426c974a047ed1 (diff) |
change type for address family to "int"
Let's settle on a single type for all address family values, even if
UNIX is very inconsitent on the precise type otherwise. Given that
socket() is the primary entrypoint for the sockets API, and that uses
"int", and "int" is relatively simple and generic, we settle on "int"
for this.
Diffstat (limited to 'src/resolve/resolved-bus.c')
-rw-r--r-- | src/resolve/resolved-bus.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index f486fcdbcc..11d94afad2 100644 --- a/src/resolve/resolved-bus.c +++ b/src/resolve/resolved-bus.c @@ -98,18 +98,18 @@ static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifin assert(reply); assert(rr); - r = sd_bus_message_open_container(reply, 'r', "yayi"); + r = sd_bus_message_open_container(reply, 'r', "iayi"); if (r < 0) return r; if (rr->key.type == DNS_TYPE_A) { - r = sd_bus_message_append(reply, "y", AF_INET); + r = sd_bus_message_append(reply, "i", AF_INET); if (r < 0) return r; r = sd_bus_message_append_array(reply, 'y', &rr->a.in_addr, sizeof(struct in_addr)); } else { - r = sd_bus_message_append(reply, "y", AF_INET6); + r = sd_bus_message_append(reply, "i", AF_INET6); if (r < 0) return r; @@ -152,7 +152,7 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) { if (r < 0) goto finish; - r = sd_bus_message_open_container(reply, 'a', "(yayi)"); + r = sd_bus_message_open_container(reply, 'a', "(iayi)"); if (r < 0) goto finish; @@ -265,7 +265,7 @@ finish: static int bus_method_resolve_hostname(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { Manager *m = userdata; const char *hostname; - uint8_t family; + int family; DnsResourceKey keys[2]; DnsQuery *q; unsigned n = 0; @@ -275,12 +275,12 @@ static int bus_method_resolve_hostname(sd_bus *bus, sd_bus_message *message, voi assert(message); assert(m); - r = sd_bus_message_read(message, "sy", &hostname, &family); + r = sd_bus_message_read(message, "si", &hostname, &family); if (r < 0) return r; if (!IN_SET(family, AF_INET, AF_INET6, AF_UNSPEC)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown address family %u", family); + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown address family %i", family); if (!hostname_is_valid(hostname)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid hostname '%s'", hostname); @@ -389,7 +389,7 @@ finish: static int bus_method_resolve_address(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_(dns_resource_key_free) DnsResourceKey key = {}; Manager *m = userdata; - uint8_t family; + int family; const void *d; int ifindex; DnsQuery *q; @@ -400,19 +400,18 @@ static int bus_method_resolve_address(sd_bus *bus, sd_bus_message *message, void assert(message); assert(m); - r = sd_bus_message_read(message, "y", &family); + r = sd_bus_message_read(message, "i", &family); if (r < 0) return r; if (!IN_SET(family, AF_INET, AF_INET6)) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown address family %u", family); + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown address family %i", family); r = sd_bus_message_read_array(message, 'y', &d, &sz); if (r < 0) return r; - if ((family == AF_INET && sz != sizeof(struct in_addr)) || - (family == AF_INET6 && sz != sizeof(struct in6_addr))) + if (sz != FAMILY_ADDRESS_SIZE(family)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid address size"); r = sd_bus_message_read(message, "i", &ifindex); |