summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/network-internal.c2
-rw-r--r--src/libsystemd-network/network-internal.h2
-rw-r--r--src/libsystemd/sd-rtnl/local-addresses.h4
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-message.c8
-rw-r--r--src/libsystemd/sd-rtnl/test-rtnl.c4
-rw-r--r--src/machine/machine-dbus.c10
-rw-r--r--src/machine/machinectl.c8
-rw-r--r--src/network/networkd-address-pool.c4
-rw-r--r--src/network/networkd-manager.c2
-rw-r--r--src/network/networkd-netdev.h2
-rw-r--r--src/network/networkd.h12
-rw-r--r--src/nss-mymachines/nss-mymachines.c22
-rw-r--r--src/nss-resolve/nss-resolve.c30
-rw-r--r--src/resolve/resolved-bus.c23
-rw-r--r--src/resolve/resolved-dns-packet.h4
-rw-r--r--src/resolve/resolved-dns-query.h2
-rw-r--r--src/resolve/resolved-dns-scope.c4
-rw-r--r--src/resolve/resolved-dns-scope.h4
-rw-r--r--src/resolve/resolved-dns-server.c2
-rw-r--r--src/resolve/resolved-dns-server.h4
-rw-r--r--src/resolve/resolved-link.c8
-rw-r--r--src/resolve/resolved-link.h10
-rw-r--r--src/resolve/resolved-manager.c9
-rw-r--r--src/resolve/resolved.h4
-rw-r--r--src/shared/in-addr-util.c14
-rw-r--r--src/shared/in-addr-util.h14
-rw-r--r--src/systemd/sd-rtnl.h8
27 files changed, 108 insertions, 112 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index e209b0f56e..3407537eb5 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -304,7 +304,7 @@ int config_parse_hwaddr(const char *unit,
return 0;
}
-int net_parse_inaddr(const char *address, unsigned char *family, void *dst) {
+int net_parse_inaddr(const char *address, int *family, void *dst) {
int r;
assert(address);
diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h
index 53c364a4c9..765dff4f3f 100644
--- a/src/libsystemd-network/network-internal.h
+++ b/src/libsystemd-network/network-internal.h
@@ -62,7 +62,7 @@ int config_parse_ifalias(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);
-int net_parse_inaddr(const char *address, unsigned char *family, void *dst);
+int net_parse_inaddr(const char *address, int *family, void *dst);
int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]);
const char *net_get_name(struct udev_device *device);
diff --git a/src/libsystemd/sd-rtnl/local-addresses.h b/src/libsystemd/sd-rtnl/local-addresses.h
index d3dff8b8b0..c6e3559bf1 100644
--- a/src/libsystemd/sd-rtnl/local-addresses.h
+++ b/src/libsystemd/sd-rtnl/local-addresses.h
@@ -29,8 +29,8 @@
#include "in-addr-util.h"
struct local_address {
- int ifindex;
- unsigned char family, scope;
+ int family, ifindex;
+ unsigned char scope;
union in_addr_union address;
};
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index c0a38e148b..7f2e398b74 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -133,7 +133,7 @@ int sd_rtnl_message_route_set_scope(sd_rtnl_message *m, unsigned char scope) {
}
int sd_rtnl_message_new_route(sd_rtnl *rtnl, sd_rtnl_message **ret,
- uint16_t nlmsg_type, unsigned char rtm_family) {
+ uint16_t nlmsg_type, int rtm_family) {
struct rtmsg *rtm;
int r;
@@ -275,7 +275,7 @@ int sd_rtnl_message_addr_set_scope(sd_rtnl_message *m, unsigned char scope) {
return 0;
}
-int sd_rtnl_message_addr_get_family(sd_rtnl_message *m, unsigned char *family) {
+int sd_rtnl_message_addr_get_family(sd_rtnl_message *m, int *family) {
struct ifaddrmsg *ifa;
assert_return(m, -EINVAL);
@@ -352,7 +352,7 @@ int sd_rtnl_message_addr_get_ifindex(sd_rtnl_message *m, int *ifindex) {
int sd_rtnl_message_new_addr(sd_rtnl *rtnl, sd_rtnl_message **ret,
uint16_t nlmsg_type, int index,
- unsigned char family) {
+ int family) {
struct ifaddrmsg *ifa;
int r;
@@ -383,7 +383,7 @@ int sd_rtnl_message_new_addr(sd_rtnl *rtnl, sd_rtnl_message **ret,
}
int sd_rtnl_message_new_addr_update(sd_rtnl *rtnl, sd_rtnl_message **ret,
- int index, unsigned char family) {
+ int index, int family) {
int r;
r = sd_rtnl_message_new_addr(rtnl, ret, RTM_NEWADDR, index, family);
diff --git a/src/libsystemd/sd-rtnl/test-rtnl.c b/src/libsystemd/sd-rtnl/test-rtnl.c
index cd81acae77..082c9e4a01 100644
--- a/src/libsystemd/sd-rtnl/test-rtnl.c
+++ b/src/libsystemd/sd-rtnl/test-rtnl.c
@@ -334,8 +334,8 @@ static void test_get_addresses(sd_rtnl *rtnl) {
for (m = reply; m; m = sd_rtnl_message_next(m)) {
uint16_t type;
- unsigned char family, scope, flags;
- int ifindex;
+ unsigned char scope, flags;
+ int family, ifindex;
assert_se(sd_rtnl_message_get_type(m, &type) >= 0);
assert_se(type == RTM_NEWADDR);
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index daa60d11e4..89c93779d3 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -233,12 +233,12 @@ int bus_machine_method_get_addresses(sd_bus *bus, sd_bus_message *message, void
if (r < 0)
return sd_bus_error_set_errno(error, r);
- r = sd_bus_message_open_container(reply, 'a', "(yay)");
+ r = sd_bus_message_open_container(reply, 'a', "(iay)");
if (r < 0)
return sd_bus_error_set_errno(error, r);
for (;;) {
- unsigned char family;
+ int family;
ssize_t n;
union in_addr_union in_addr;
struct iovec iov[2];
@@ -256,11 +256,11 @@ int bus_machine_method_get_addresses(sd_bus *bus, sd_bus_message *message, void
if ((size_t) n < sizeof(family))
break;
- r = sd_bus_message_open_container(reply, 'r', "yay");
+ r = sd_bus_message_open_container(reply, 'r', "iay");
if (r < 0)
return sd_bus_error_set_errno(error, r);
- r = sd_bus_message_append(reply, "y", family);
+ r = sd_bus_message_append(reply, "i", family);
if (r < 0)
return sd_bus_error_set_errno(error, r);
@@ -405,7 +405,7 @@ const sd_bus_vtable machine_vtable[] = {
SD_BUS_PROPERTY("State", "s", property_get_state, 0, 0),
SD_BUS_METHOD("Terminate", NULL, NULL, bus_machine_method_terminate, SD_BUS_VTABLE_CAPABILITY(CAP_KILL)),
SD_BUS_METHOD("Kill", "si", NULL, bus_machine_method_kill, SD_BUS_VTABLE_CAPABILITY(CAP_KILL)),
- SD_BUS_METHOD("GetAddresses", NULL, "a(yay)", bus_machine_method_get_addresses, SD_BUS_VTABLE_UNPRIVILEGED),
+ SD_BUS_METHOD("GetAddresses", NULL, "a(iay)", bus_machine_method_get_addresses, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("GetOSRelease", NULL, "a{ss}", bus_machine_method_get_os_release, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_VTABLE_END
};
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 04c7c7c670..cc3be98b53 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -188,17 +188,17 @@ static int print_addresses(sd_bus *bus, const char *name, int ifi, const char *p
if (r < 0)
return r;
- r = sd_bus_message_enter_container(reply, 'a', "(yay)");
+ r = sd_bus_message_enter_container(reply, 'a', "(iay)");
if (r < 0)
return bus_log_parse_error(r);
- while ((r = sd_bus_message_enter_container(reply, 'r', "yay")) > 0) {
- unsigned char family;
+ while ((r = sd_bus_message_enter_container(reply, 'r', "iay")) > 0) {
+ int family;
const void *a;
size_t sz;
char buffer[MAX(INET6_ADDRSTRLEN, INET_ADDRSTRLEN)];
- r = sd_bus_message_read(reply, "y", &family);
+ r = sd_bus_message_read(reply, "i", &family);
if (r < 0)
return bus_log_parse_error(r);
diff --git a/src/network/networkd-address-pool.c b/src/network/networkd-address-pool.c
index a5079add02..8abf82e18c 100644
--- a/src/network/networkd-address-pool.c
+++ b/src/network/networkd-address-pool.c
@@ -26,7 +26,7 @@
int address_pool_new(
Manager *m,
AddressPool **ret,
- unsigned family,
+ int family,
const union in_addr_union *u,
unsigned prefixlen) {
@@ -54,7 +54,7 @@ int address_pool_new(
int address_pool_new_from_string(
Manager *m,
AddressPool **ret,
- unsigned family,
+ int family,
const char *p,
unsigned prefixlen) {
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index e363fb0c1b..b0e3191a00 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -467,7 +467,7 @@ finish:
return r;
}
-int manager_address_pool_acquire(Manager *m, unsigned family, unsigned prefixlen, union in_addr_union *found) {
+int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found) {
AddressPool *p;
int r;
diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h
index a523522887..042e1601c6 100644
--- a/src/network/networkd-netdev.h
+++ b/src/network/networkd-netdev.h
@@ -104,7 +104,7 @@ struct NetDev {
unsigned ttl;
unsigned tos;
- unsigned char family;
+ int family;
union in_addr_union local;
union in_addr_union remote;
union in_addr_union group;
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 9abc0d46ec..f1c7f204ea 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -115,7 +115,7 @@ struct Address {
Network *network;
uint64_t section;
- unsigned char family;
+ int family;
unsigned char prefixlen;
unsigned char scope;
char *label;
@@ -133,7 +133,7 @@ struct Route {
Network *network;
uint64_t section;
- unsigned char family;
+ int family;
unsigned char dst_prefixlen;
unsigned char scope;
uint32_t metrics;
@@ -209,7 +209,7 @@ struct Link {
struct AddressPool {
Manager *manager;
- unsigned family;
+ int family;
unsigned prefixlen;
union in_addr_union in_addr;
@@ -255,7 +255,7 @@ int manager_bus_listen(Manager *m);
int manager_save(Manager *m);
-int manager_address_pool_acquire(Manager *m, unsigned family, unsigned prefixlen, union in_addr_union *found);
+int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
#define _cleanup_manager_free_ _cleanup_(manager_freep)
@@ -390,8 +390,8 @@ int config_parse_dhcp(const char *unit, const char *filename, unsigned line,
/* Address Pool */
-int address_pool_new(Manager *m, AddressPool **ret, unsigned family, const union in_addr_union *u, unsigned prefixlen);
-int address_pool_new_from_string(Manager *m, AddressPool **ret, unsigned family, const char *p, unsigned prefixlen);
+int address_pool_new(Manager *m, AddressPool **ret, int family, const union in_addr_union *u, unsigned prefixlen);
+int address_pool_new_from_string(Manager *m, AddressPool **ret, int family, const char *p, unsigned prefixlen);
void address_pool_free(AddressPool *p);
int address_pool_acquire(AddressPool *p, unsigned prefixlen, union in_addr_union *found);
diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
index 09c5d05f2e..985ebb7134 100644
--- a/src/nss-mymachines/nss-mymachines.c
+++ b/src/nss-mymachines/nss-mymachines.c
@@ -32,7 +32,7 @@
NSS_GETHOSTBYNAME_PROTOTYPES(mymachines);
-static int count_addresses(sd_bus_message *m, unsigned af, unsigned *ret) {
+static int count_addresses(sd_bus_message *m, int af, unsigned *ret) {
unsigned c = 0;
int r;
@@ -40,9 +40,9 @@ static int count_addresses(sd_bus_message *m, unsigned af, unsigned *ret) {
assert(ret);
while ((r = sd_bus_message_enter_container(m, 'r', "yay")) > 0) {
- unsigned char family;
+ int family;
- r = sd_bus_message_read(m, "y", &family);
+ r = sd_bus_message_read(m, "i", &family);
if (r < 0)
return r;
@@ -122,7 +122,7 @@ enum nss_status _nss_mymachines_gethostbyname4_r(
if (r < 0)
goto fail;
- r = sd_bus_message_enter_container(reply, 'a', "(yay)");
+ r = sd_bus_message_enter_container(reply, 'a', "(iay)");
if (r < 0)
goto fail;
@@ -151,12 +151,12 @@ enum nss_status _nss_mymachines_gethostbyname4_r(
/* Second, append addresses */
r_tuple_first = (struct gaih_addrtuple*) (buffer + idx);
- while ((r = sd_bus_message_enter_container(reply, 'r', "yay")) > 0) {
- unsigned char family;
+ while ((r = sd_bus_message_enter_container(reply, 'r', "iay")) > 0) {
+ int family;
const void *a;
size_t sz;
- r = sd_bus_message_read(reply, "y", &family);
+ r = sd_bus_message_read(reply, "i", &family);
if (r < 0)
goto fail;
@@ -267,7 +267,7 @@ enum nss_status _nss_mymachines_gethostbyname3_r(
if (r < 0)
goto fail;
- r = sd_bus_message_enter_container(reply, 'a', "(yay)");
+ r = sd_bus_message_enter_container(reply, 'a', "(iay)");
if (r < 0)
goto fail;
@@ -307,12 +307,12 @@ enum nss_status _nss_mymachines_gethostbyname3_r(
/* Third, append addresses */
r_addr = buffer + idx;
- while ((r = sd_bus_message_enter_container(reply, 'r', "yay")) > 0) {
- unsigned char family;
+ while ((r = sd_bus_message_enter_container(reply, 'r', "iay")) > 0) {
+ int family;
const void *a;
size_t sz;
- r = sd_bus_message_read(reply, "y", &family);
+ r = sd_bus_message_read(reply, "i", &family);
if (r < 0)
goto fail;
diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c
index c67f59e179..c172022d76 100644
--- a/src/nss-resolve/nss-resolve.c
+++ b/src/nss-resolve/nss-resolve.c
@@ -43,20 +43,20 @@ NSS_GETHOSTBYADDR_PROTOTYPES(resolve);
#define DNS_CALL_TIMEOUT_USEC (45*USEC_PER_SEC)
-static int count_addresses(sd_bus_message *m, unsigned af, const char **canonical) {
+static int count_addresses(sd_bus_message *m, int af, const char **canonical) {
int c = 0, r;
assert(m);
assert(canonical);
- r = sd_bus_message_enter_container(m, 'a', "(yayi)");
+ r = sd_bus_message_enter_container(m, 'a', "(iayi)");
if (r < 0)
return r;
- while ((r = sd_bus_message_enter_container(m, 'r', "yayi")) > 0) {
- unsigned char family;
+ while ((r = sd_bus_message_enter_container(m, 'r', "iayi")) > 0) {
+ int family;
- r = sd_bus_message_read(m, "y", &family);
+ r = sd_bus_message_read(m, "i", &family);
if (r < 0)
return r;
@@ -178,17 +178,16 @@ enum nss_status _nss_resolve_gethostbyname4_r(
/* Second, append addresses */
r_tuple_first = (struct gaih_addrtuple*) (buffer + idx);
- r = sd_bus_message_enter_container(reply, 'a', "(yayi)");
+ r = sd_bus_message_enter_container(reply, 'a', "(iayi)");
if (r < 0)
goto fail;
- while ((r = sd_bus_message_enter_container(reply, 'r', "yayi")) > 0) {
- unsigned char family;
+ while ((r = sd_bus_message_enter_container(reply, 'r', "iayi")) > 0) {
+ int family, ifindex;
const void *a;
- int ifindex;
size_t sz;
- r = sd_bus_message_read(reply, "y", &family);
+ r = sd_bus_message_read(reply, "i", &family);
if (r < 0)
goto fail;
@@ -356,17 +355,16 @@ enum nss_status _nss_resolve_gethostbyname3_r(
/* Third, append addresses */
r_addr = buffer + idx;
- r = sd_bus_message_enter_container(reply, 'a', "(yayi)");
+ r = sd_bus_message_enter_container(reply, 'a', "(iayi)");
if (r < 0)
goto fail;
- while ((r = sd_bus_message_enter_container(reply, 'r', "yayi")) > 0) {
- unsigned char family;
+ while ((r = sd_bus_message_enter_container(reply, 'r', "iayi")) > 0) {
+ int family, ifindex;
const void *a;
- int ifindex;
size_t sz;
- r = sd_bus_message_read(reply, "y", &family);
+ r = sd_bus_message_read(reply, "i", &family);
if (r < 0)
goto fail;
@@ -487,7 +485,7 @@ enum nss_status _nss_resolve_gethostbyaddr2_r(
if (r < 0)
goto fail;
- r = sd_bus_message_append(req, "y", af);
+ r = sd_bus_message_append(req, "i", af);
if (r < 0)
goto fail;
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);
diff --git a/src/shared/in-addr-util.c b/src/shared/in-addr-util.c
index 0c6ebec336..ffbaa74316 100644
--- a/src/shared/in-addr-util.c
+++ b/src/shared/in-addr-util.c
@@ -23,7 +23,7 @@
#include "in-addr-util.h"
-int in_addr_null(unsigned family, union in_addr_union *u) {
+int in_addr_null(int family, union in_addr_union *u) {
assert(u);
if (family == AF_INET)
@@ -40,7 +40,7 @@ int in_addr_null(unsigned family, union in_addr_union *u) {
}
-int in_addr_equal(unsigned family, union in_addr_union *a, union in_addr_union *b) {
+int in_addr_equal(int family, union in_addr_union *a, union in_addr_union *b) {
assert(a);
assert(b);
@@ -58,7 +58,7 @@ int in_addr_equal(unsigned family, union in_addr_union *a, union in_addr_union *
}
int in_addr_prefix_intersect(
- unsigned family,
+ int family,
const union in_addr_union *a,
unsigned aprefixlen,
const union in_addr_union *b,
@@ -114,7 +114,7 @@ int in_addr_prefix_intersect(
return -EAFNOSUPPORT;
}
-int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefixlen) {
+int in_addr_prefix_next(int family, union in_addr_union *u, unsigned prefixlen) {
assert(u);
/* Increases the network part of an address by one. Returns
@@ -167,7 +167,7 @@ int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefix
return -EAFNOSUPPORT;
}
-int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret) {
+int in_addr_to_string(int family, const union in_addr_union *u, char **ret) {
char *x;
size_t l;
@@ -195,7 +195,7 @@ int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret)
return 0;
}
-int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret) {
+int in_addr_from_string(int family, const char *s, union in_addr_union *ret) {
assert(s);
assert(ret);
@@ -210,7 +210,7 @@ int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret
return 0;
}
-int in_addr_from_string_auto(const char *s, unsigned *family, union in_addr_union *ret) {
+int in_addr_from_string_auto(const char *s, int *family, union in_addr_union *ret) {
int r;
assert(s);
diff --git a/src/shared/in-addr-util.h b/src/shared/in-addr-util.h
index 6cfdb14a89..d76ea9dc30 100644
--- a/src/shared/in-addr-util.h
+++ b/src/shared/in-addr-util.h
@@ -31,13 +31,13 @@ union in_addr_union {
struct in6_addr in6;
};
-int in_addr_null(unsigned family, union in_addr_union *u);
-int in_addr_equal(unsigned family, union in_addr_union *a, union in_addr_union *b);
-int in_addr_prefix_intersect(unsigned family, const union in_addr_union *a, unsigned aprefixlen, const union in_addr_union *b, unsigned bprefixlen);
-int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefixlen);
-int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret);
-int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret);
-int in_addr_from_string_auto(const char *s, unsigned *family, union in_addr_union *ret);
+int in_addr_null(int family, union in_addr_union *u);
+int in_addr_equal(int family, union in_addr_union *a, union in_addr_union *b);
+int in_addr_prefix_intersect(int family, const union in_addr_union *a, unsigned aprefixlen, const union in_addr_union *b, unsigned bprefixlen);
+int in_addr_prefix_next(int family, union in_addr_union *u, unsigned prefixlen);
+int in_addr_to_string(int family, const union in_addr_union *u, char **ret);
+int in_addr_from_string(int family, const char *s, union in_addr_union *ret);
+int in_addr_from_string_auto(const char *s, int *family, union in_addr_union *ret);
static inline size_t FAMILY_ADDRESS_SIZE(int family) {
assert(family == AF_INET || family == AF_INET6);
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index 497705d855..5cd26d98cd 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -68,11 +68,11 @@ int sd_rtnl_detach_event(sd_rtnl *nl);
/* messages */
int sd_rtnl_message_new_link(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t msg_type, int index);
-int sd_rtnl_message_new_addr_update(sd_rtnl *rtnl, sd_rtnl_message **ret, int index, unsigned char family);
+int sd_rtnl_message_new_addr_update(sd_rtnl *rtnl, sd_rtnl_message **ret, int index, int family);
int sd_rtnl_message_new_addr(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t msg_type, int index,
- unsigned char family);
+ int family);
int sd_rtnl_message_new_route(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t nlmsg_type,
- unsigned char rtm_family);
+ int rtm_family);
sd_rtnl_message *sd_rtnl_message_ref(sd_rtnl_message *m);
sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m);
@@ -85,7 +85,7 @@ int sd_rtnl_message_is_broadcast(sd_rtnl_message *m);
int sd_rtnl_message_addr_set_prefixlen(sd_rtnl_message *m, unsigned char prefixlen);
int sd_rtnl_message_addr_set_scope(sd_rtnl_message *m, unsigned char scope);
int sd_rtnl_message_addr_set_flags(sd_rtnl_message *m, unsigned char flags);
-int sd_rtnl_message_addr_get_family(sd_rtnl_message *m, unsigned char *family);
+int sd_rtnl_message_addr_get_family(sd_rtnl_message *m, int *family);
int sd_rtnl_message_addr_get_prefixlen(sd_rtnl_message *m, unsigned char *prefixlen);
int sd_rtnl_message_addr_get_scope(sd_rtnl_message *m, unsigned char *scope);
int sd_rtnl_message_addr_get_flags(sd_rtnl_message *m, unsigned char *flags);