summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-address.c9
-rw-r--r--src/network/networkd-bridge.c6
-rw-r--r--src/network/networkd-route.c20
3 files changed, 23 insertions, 12 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 8f16a8c6c1..63ba33ea24 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -95,7 +95,10 @@ int address_configure(Address *address, Link *link,
return r;
}
- r = sd_rtnl_message_append(req, IFA_LOCAL, &address->in_addr);
+ if (address->family == AF_INET)
+ r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
+ else if (address->family == AF_INET6)
+ r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0) {
log_error("Could not append IFA_LOCAL attribute: %s",
strerror(-r));
@@ -107,7 +110,7 @@ int address_configure(Address *address, Link *link,
broadcast.s_addr = address->in_addr.in.s_addr | address->netmask.s_addr;
- r = sd_rtnl_message_append(req, IFA_BROADCAST, &broadcast);
+ r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &broadcast);
if (r < 0) {
log_error("Could not append IFA_BROADCAST attribute: %s",
strerror(-r));
@@ -116,7 +119,7 @@ int address_configure(Address *address, Link *link,
}
if (address->label) {
- r = sd_rtnl_message_append(req, IFA_LABEL, address->label);
+ r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
if (r < 0) {
log_error("Could not append IFA_LABEL attribute: %s",
strerror(-r));
diff --git a/src/network/networkd-bridge.c b/src/network/networkd-bridge.c
index b764b7d593..2c541463ec 100644
--- a/src/network/networkd-bridge.c
+++ b/src/network/networkd-bridge.c
@@ -91,7 +91,7 @@ static int bridge_join_ready(Bridge *bridge, Link* link, sd_rtnl_message_handler
return r;
}
- r = sd_rtnl_message_append(req, IFLA_MASTER, &bridge->link->ifindex);
+ r = sd_rtnl_message_append_u32(req, IFLA_MASTER, bridge->link->ifindex);
if (r < 0) {
log_error("Could not append IFLA_MASTER attribute: %s",
strerror(-r));
@@ -162,7 +162,7 @@ static int bridge_create(Bridge *bridge) {
return r;
}
- r = sd_rtnl_message_append(req, IFLA_IFNAME, bridge->name);
+ r = sd_rtnl_message_append_string(req, IFLA_IFNAME, bridge->name);
if (r < 0) {
log_error("Could not append IFLA_IFNAME attribute: %s",
strerror(-r));
@@ -176,7 +176,7 @@ static int bridge_create(Bridge *bridge) {
return r;
}
- r = sd_rtnl_message_append(req, IFLA_INFO_KIND, "bridge");
+ r = sd_rtnl_message_append_string(req, IFLA_INFO_KIND, "bridge");
if (r < 0) {
log_error("Could not append IFLA_INFO_KIND attribute: %s",
strerror(-r));
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index f8580e93c8..22604b3afb 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -92,16 +92,24 @@ int route_configure(Route *route, Link *link,
return r;
}
- r = sd_rtnl_message_append(req, RTA_GATEWAY, &route->in_addr);
+ if (route->family == AF_INET)
+ r = sd_rtnl_message_append_in_addr(req, RTA_GATEWAY, &route->in_addr.in);
+ else if (route->family == AF_INET6)
+ r = sd_rtnl_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6);
if (r < 0) {
log_error("Could not append RTA_GATEWAY attribute: %s", strerror(-r));
return r;
}
- r = sd_rtnl_message_append(req, RTA_DST, &route->dst_addr);
- if (r < 0) {
- log_error("Could not append RTA_DST attribute: %s", strerror(-r));
- return r;
+ if (route->dst_prefixlen) {
+ if (route->family == AF_INET)
+ r = sd_rtnl_message_append_in_addr(req, RTA_DST, &route->dst_addr.in);
+ else if (route->family == AF_INET6)
+ r = sd_rtnl_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6);
+ if (r < 0) {
+ log_error("Could not append RTA_DST attribute: %s", strerror(-r));
+ return r;
+ }
}
r = sd_rtnl_message_route_set_dst_prefixlen(req, route->dst_prefixlen);
@@ -110,7 +118,7 @@ int route_configure(Route *route, Link *link,
return r;
}
- r = sd_rtnl_message_append(req, RTA_OIF, &link->ifindex);
+ r = sd_rtnl_message_append_u32(req, RTA_OIF, link->ifindex);
if (r < 0) {
log_error("Could not append RTA_OIF attribute: %s", strerror(-r));
return r;