diff options
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-bus.c | 23 | ||||
-rw-r--r-- | src/resolve/resolved-dns-packet.h | 4 | ||||
-rw-r--r-- | src/resolve/resolved-dns-query.h | 2 | ||||
-rw-r--r-- | src/resolve/resolved-dns-scope.c | 4 | ||||
-rw-r--r-- | src/resolve/resolved-dns-scope.h | 4 | ||||
-rw-r--r-- | src/resolve/resolved-dns-server.c | 2 | ||||
-rw-r--r-- | src/resolve/resolved-dns-server.h | 4 | ||||
-rw-r--r-- | src/resolve/resolved-link.c | 8 | ||||
-rw-r--r-- | src/resolve/resolved-link.h | 10 | ||||
-rw-r--r-- | src/resolve/resolved-manager.c | 9 | ||||
-rw-r--r-- | src/resolve/resolved.h | 4 |
11 files changed, 36 insertions, 38 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); diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h index 565c67c746..4fd2d408ce 100644 --- a/src/resolve/resolved-dns-packet.h +++ b/src/resolve/resolved-dns-packet.h @@ -70,9 +70,9 @@ struct DnsPacket { /* Packet reception meta data */ int ifindex; - unsigned char family; + int family; union in_addr_union sender, destination; - unsigned ttl; + uint32_t ttl; }; static inline uint8_t* DNS_PACKET_DATA(DnsPacket *p) { diff --git a/src/resolve/resolved-dns-query.h b/src/resolve/resolved-dns-query.h index aa205033af..2b814cca42 100644 --- a/src/resolve/resolved-dns-query.h +++ b/src/resolve/resolved-dns-query.h @@ -90,7 +90,7 @@ struct DnsQuery { /* Bus client information */ sd_bus_message *request; - unsigned char request_family; + int request_family; const char *request_hostname; union in_addr_union request_address; diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index 373f5c3205..38b64905a4 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -28,7 +28,7 @@ #define SEND_TIMEOUT_USEC (2*USEC_PER_SEC) -int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol protocol, unsigned char family) { +int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol protocol, int family) { DnsScope *s; assert(m); @@ -106,7 +106,7 @@ void dns_scope_next_dns_server(DnsScope *s) { int dns_scope_send(DnsScope *s, DnsPacket *p) { union in_addr_union addr; int ifindex = 0, r; - unsigned char family; + int family; uint16_t port; uint32_t mtu; int fd; diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/resolved-dns-scope.h index 32541f12ab..6c93fa80be 100644 --- a/src/resolve/resolved-dns-scope.h +++ b/src/resolve/resolved-dns-scope.h @@ -44,7 +44,7 @@ struct DnsScope { Manager *manager; DnsProtocol protocol; - unsigned char family; + int family; Link *link; @@ -57,7 +57,7 @@ struct DnsScope { LIST_FIELDS(DnsScope, scopes); }; -int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol p, unsigned char family); +int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol p, int family); DnsScope* dns_scope_free(DnsScope *s); int dns_scope_send(DnsScope *s, DnsPacket *p); diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c index 07754a0bdb..734441bccd 100644 --- a/src/resolve/resolved-dns-server.c +++ b/src/resolve/resolved-dns-server.c @@ -26,7 +26,7 @@ int dns_server_new( DnsServer **ret, DnsServerSource source, Link *l, - unsigned char family, + int family, const union in_addr_union *in_addr) { DnsServer *s, *tail; diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/resolved-dns-server.h index 781e237627..2b0b99649d 100644 --- a/src/resolve/resolved-dns-server.h +++ b/src/resolve/resolved-dns-server.h @@ -43,7 +43,7 @@ struct DnsServer { Link *link; - unsigned char family; + int family; union in_addr_union address; bool marked:1; @@ -56,7 +56,7 @@ int dns_server_new( DnsServer **s, DnsServerSource source, Link *l, - unsigned char family, + int family, const union in_addr_union *address); DnsServer* dns_server_free(DnsServer *s); diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index 804837c6e8..078301aa26 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -259,7 +259,7 @@ int link_update_monitor(Link *l) { return 0; } -bool link_relevant(Link *l, unsigned char family) { +bool link_relevant(Link *l, int family) { _cleanup_free_ char *state = NULL; LinkAddress *a; @@ -282,7 +282,7 @@ bool link_relevant(Link *l, unsigned char family) { return false; } -LinkAddress *link_find_address(Link *l, unsigned char family, union in_addr_union *in_addr) { +LinkAddress *link_find_address(Link *l, int family, union in_addr_union *in_addr) { LinkAddress *a; assert(l); @@ -294,7 +294,7 @@ LinkAddress *link_find_address(Link *l, unsigned char family, union in_addr_unio return NULL; } -DnsServer* link_find_dns_server(Link *l, DnsServerSource source, unsigned char family, union in_addr_union *in_addr) { +DnsServer* link_find_dns_server(Link *l, DnsServerSource source, int family, union in_addr_union *in_addr) { DnsServer *first, *s; assert(l); @@ -352,7 +352,7 @@ void link_next_dns_server(Link *l) { } } -int link_address_new(Link *l, LinkAddress **ret, unsigned char family, union in_addr_union *in_addr) { +int link_address_new(Link *l, LinkAddress **ret, int family, union in_addr_union *in_addr) { LinkAddress *a; assert(l); diff --git a/src/resolve/resolved-link.h b/src/resolve/resolved-link.h index d4e5c0a00d..bd32a702fc 100644 --- a/src/resolve/resolved-link.h +++ b/src/resolve/resolved-link.h @@ -36,7 +36,7 @@ typedef struct LinkAddress LinkAddress; struct LinkAddress { Link *link; - unsigned char family; + int family; union in_addr_union in_addr; unsigned char flags, scope; @@ -71,14 +71,14 @@ int link_new(Manager *m, Link **ret, int ifindex); Link *link_free(Link *l); int link_update_rtnl(Link *l, sd_rtnl_message *m); int link_update_monitor(Link *l); -bool link_relevant(Link *l, unsigned char family); -LinkAddress* link_find_address(Link *l, unsigned char family, union in_addr_union *in_addr); +bool link_relevant(Link *l, int family); +LinkAddress* link_find_address(Link *l, int family, union in_addr_union *in_addr); -DnsServer* link_find_dns_server(Link *l, DnsServerSource source, unsigned char family, union in_addr_union *in_addr); +DnsServer* link_find_dns_server(Link *l, DnsServerSource source, int family, union in_addr_union *in_addr); DnsServer* link_get_dns_server(Link *l); void link_next_dns_server(Link *l); -int link_address_new(Link *l, LinkAddress **ret, unsigned char family, union in_addr_union *in_addr); +int link_address_new(Link *l, LinkAddress **ret, int family, union in_addr_union *in_addr); LinkAddress *link_address_free(LinkAddress *a); int link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m); bool link_address_relevant(LinkAddress *l); diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index 9f44bf1204..96728433b3 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -94,9 +94,8 @@ fail: static int manager_process_address(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) { Manager *m = userdata; union in_addr_union address; - unsigned char family; uint16_t type; - int r, ifindex; + int r, ifindex, family; LinkAddress *a; Link *l; @@ -311,7 +310,7 @@ static int parse_dns_server_string(Manager *m, const char *string) { FOREACH_WORD_QUOTED(word, length, string, state) { char buffer[length+1]; - unsigned family; + int family; union in_addr_union addr; memcpy(buffer, word, length); @@ -860,7 +859,7 @@ static int manager_ipv6_send(Manager *m, int fd, int ifindex, struct in6_addr *a return sendmsg_loop(fd, &mh, 0); } -int manager_send(Manager *m, int fd, int ifindex, unsigned char family, union in_addr_union *addr, uint16_t port, DnsPacket *p) { +int manager_send(Manager *m, int fd, int ifindex, int family, union in_addr_union *addr, uint16_t port, DnsPacket *p) { assert(m); assert(fd >= 0); assert(addr); @@ -876,7 +875,7 @@ int manager_send(Manager *m, int fd, int ifindex, unsigned char family, union in } -DnsServer* manager_find_dns_server(Manager *m, unsigned char family, union in_addr_union *in_addr) { +DnsServer* manager_find_dns_server(Manager *m, int family, union in_addr_union *in_addr) { DnsServer *s; assert(m); diff --git a/src/resolve/resolved.h b/src/resolve/resolved.h index 0770bb5fce..35ef8bdea1 100644 --- a/src/resolve/resolved.h +++ b/src/resolve/resolved.h @@ -89,12 +89,12 @@ Manager* manager_free(Manager *m); int manager_parse_config_file(Manager *m); int manager_write_resolv_conf(Manager *m); -DnsServer* manager_find_dns_server(Manager *m, unsigned char family, union in_addr_union *in_addr); +DnsServer* manager_find_dns_server(Manager *m, int family, union in_addr_union *in_addr); DnsServer *manager_get_dns_server(Manager *m); void manager_next_dns_server(Manager *m); uint32_t manager_find_mtu(Manager *m); -int manager_send(Manager *m, int fd, int ifindex, unsigned char family, union in_addr_union *addr, uint16_t port, DnsPacket *p); +int manager_send(Manager *m, int fd, int ifindex, int family, union in_addr_union *addr, uint16_t port, DnsPacket *p); int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret); int manager_dns_ipv4_fd(Manager *m); |