summaryrefslogtreecommitdiff
path: root/src/network/networkd-address.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-12-15 14:00:20 +0100
committerTom Gundersen <teg@jklm.no>2013-12-16 17:28:18 +0100
commit0a0dc69b655cfb10cab39133f5d521e7b35ce3d5 (patch)
tree44c13edb1a91579d14e044c1b5f712ef379b8276 /src/network/networkd-address.c
parent0fc7531b40225475fed4ca8219b075bbdb54c5e0 (diff)
rtnl: replace message_append by typesafe versions
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r--src/network/networkd-address.c9
1 files changed, 6 insertions, 3 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));