summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-18 00:10:08 +0100
committerTom Gundersen <teg@jklm.no>2014-02-18 11:21:22 +0100
commit4fb7242cbbed0d865eb343548b8f0ee0fee71d85 (patch)
treeb85d087cd059d195e0796cc0cda94140067d8c49 /src/network
parentc0c5af00bec95567435bdfb818c69b2b669adfed (diff)
sd-rtnl-message: store reference to the bus in the message
This mimics the sd-bus api, as we may need it in the future.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-address.c7
-rw-r--r--src/network/networkd-link.c9
-rw-r--r--src/network/networkd-netdev.c10
-rw-r--r--src/network/networkd-route.c3
4 files changed, 19 insertions, 10 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index edae62c802..560605408f 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -105,7 +105,8 @@ int address_drop(Address *address, Link *link,
assert(link->manager);
assert(link->manager->rtnl);
- r = sd_rtnl_message_new_addr(RTM_DELADDR, link->ifindex, address->family, &req);
+ r = sd_rtnl_message_new_addr(link->manager->rtnl, RTM_DELADDR,
+ link->ifindex, address->family, &req);
if (r < 0) {
log_error("Could not allocate RTM_DELADDR message: %s",
strerror(-r));
@@ -149,8 +150,8 @@ int address_configure(Address *address, Link *link,
assert(link->manager);
assert(link->manager->rtnl);
- r = sd_rtnl_message_new_addr(RTM_NEWADDR, link->ifindex,
- address->family, &req);
+ r = sd_rtnl_message_new_addr(link->manager->rtnl, RTM_NEWADDR,
+ link->ifindex, address->family, &req);
if (r < 0) {
log_error("Could not allocate RTM_NEWADDR message: %s",
strerror(-r));
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 9aca1b6477..ec283d5b7b 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -435,7 +435,8 @@ static int link_set_mtu(Link *link, uint32_t mtu) {
log_debug_link(link, "setting MTU: %" PRIu32, mtu);
- r = sd_rtnl_message_new_link(RTM_SETLINK, link->ifindex, &req);
+ r = sd_rtnl_message_new_link(link->manager->rtnl, RTM_SETLINK,
+ link->ifindex, &req);
if (r < 0) {
log_error_link(link, "Could not allocate RTM_SETLINK message");
return r;
@@ -794,7 +795,8 @@ static int link_up(Link *link) {
log_debug_link(link, "bringing link up");
- r = sd_rtnl_message_new_link(RTM_SETLINK, link->ifindex, &req);
+ r = sd_rtnl_message_new_link(link->manager->rtnl, RTM_SETLINK,
+ link->ifindex, &req);
if (r < 0) {
log_error_link(link, "Could not allocate RTM_SETLINK message");
return r;
@@ -961,7 +963,8 @@ static int link_get(Link *link) {
log_debug_link(link, "requesting link status");
- r = sd_rtnl_message_new_link(RTM_GETLINK, link->ifindex, &req);
+ r = sd_rtnl_message_new_link(link->manager->rtnl, RTM_GETLINK,
+ link->ifindex, &req);
if (r < 0) {
log_error_link(link, "Could not allocate RTM_GETLINK message");
return r;
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 30eb77d4bc..01ea8f68bc 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -89,10 +89,13 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
assert(netdev);
assert(netdev->state == NETDEV_STATE_READY);
+ assert(netdev->manager);
+ assert(netdev->manager->rtnl);
assert(link);
assert(callback);
- r = sd_rtnl_message_new_link(RTM_SETLINK, link->ifindex, &req);
+ r = sd_rtnl_message_new_link(netdev->manager->rtnl, RTM_SETLINK,
+ link->ifindex, &req);
if (r < 0) {
log_error_netdev(netdev,
"Could not allocate RTM_SETLINK message: %s",
@@ -163,12 +166,13 @@ static int netdev_create(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c
int r;
assert(netdev);
- assert(!(netdev->kind == NETDEV_KIND_VLAN) || (link && callback && netdev->vlanid <= VLANID_MAX));
+ assert(!(netdev->kind == NETDEV_KIND_VLAN) ||
+ (link && callback && netdev->vlanid <= VLANID_MAX));
assert(netdev->name);
assert(netdev->manager);
assert(netdev->manager->rtnl);
- r = sd_rtnl_message_new_link(RTM_NEWLINK, 0, &req);
+ r = sd_rtnl_message_new_link(netdev->manager->rtnl, RTM_NEWLINK, 0, &req);
if (r < 0) {
log_error_netdev(netdev,
"Could not allocate RTM_NEWLINK message: %s",
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 098539ed19..5896c4a4ac 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -105,7 +105,8 @@ int route_configure(Route *route, Link *link,
assert(link->ifindex > 0);
assert(route->family == AF_INET || route->family == AF_INET6);
- r = sd_rtnl_message_new_route(RTM_NEWROUTE, route->family, &req);
+ r = sd_rtnl_message_new_route(link->manager->rtnl, RTM_NEWROUTE,
+ route->family, &req);
if (r < 0) {
log_error("Could not create RTM_NEWROUTE message: %s", strerror(-r));
return r;