summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkctl.c84
-rw-r--r--src/network/networkd-address.c50
-rw-r--r--src/network/networkd-dhcp4.c8
-rw-r--r--src/network/networkd-dhcp6.c4
-rw-r--r--src/network/networkd-fdb.c14
-rw-r--r--src/network/networkd-ipv4ll.c8
-rw-r--r--src/network/networkd-link.c124
-rw-r--r--src/network/networkd-link.h10
-rw-r--r--src/network/networkd-manager.c52
-rw-r--r--src/network/networkd-netdev-bond.c48
-rw-r--r--src/network/networkd-netdev-ipvlan.c4
-rw-r--r--src/network/networkd-netdev-macvlan.c4
-rw-r--r--src/network/networkd-netdev-tunnel.c78
-rw-r--r--src/network/networkd-netdev-veth.c12
-rw-r--r--src/network/networkd-netdev-vlan.c4
-rw-r--r--src/network/networkd-netdev-vxlan.c32
-rw-r--r--src/network/networkd-netdev.c54
-rw-r--r--src/network/networkd-netdev.h10
-rw-r--r--src/network/networkd-network-gperf.gperf130
-rw-r--r--src/network/networkd-network.c34
-rw-r--r--src/network/networkd-route.c52
-rw-r--r--src/network/networkd-wait-online-link.c4
-rw-r--r--src/network/networkd-wait-online-link.h2
-rw-r--r--src/network/networkd-wait-online-manager.c30
-rw-r--r--src/network/networkd-wait-online.h4
-rw-r--r--src/network/networkd.h19
-rw-r--r--src/network/test-network-tables.c2
27 files changed, 460 insertions, 417 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 8e20f70aae..9d6c453dbc 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -24,7 +24,7 @@
#include <net/if.h>
#include "sd-network.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-hwdb.h"
#include "sd-device.h"
@@ -33,7 +33,7 @@
#include "util.h"
#include "pager.h"
#include "lldp.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "device-util.h"
#include "hwdb-util.h"
#include "arphrd-list.h"
@@ -112,19 +112,19 @@ static int link_info_compare(const void *a, const void *b) {
return x->ifindex - y->ifindex;
}
-static int decode_and_sort_links(sd_rtnl_message *m, LinkInfo **ret) {
+static int decode_and_sort_links(sd_netlink_message *m, LinkInfo **ret) {
_cleanup_free_ LinkInfo *links = NULL;
size_t size = 0, c = 0;
- sd_rtnl_message *i;
+ sd_netlink_message *i;
int r;
- for (i = m; i; i = sd_rtnl_message_next(i)) {
+ for (i = m; i; i = sd_netlink_message_next(i)) {
const char *name;
unsigned iftype;
uint16_t type;
int ifindex;
- r = sd_rtnl_message_get_type(i, &type);
+ r = sd_netlink_message_get_type(i, &type);
if (r < 0)
return r;
@@ -135,7 +135,7 @@ static int decode_and_sort_links(sd_rtnl_message *m, LinkInfo **ret) {
if (r < 0)
return r;
- r = sd_rtnl_message_read_string(i, IFLA_IFNAME, &name);
+ r = sd_netlink_message_read_string(i, IFLA_IFNAME, &name);
if (r < 0)
return r;
@@ -192,14 +192,14 @@ static void setup_state_to_color(const char *state, const char **on, const char
}
static int list_links(int argc, char *argv[], void *userdata) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
_cleanup_free_ LinkInfo *links = NULL;
int r, c, i;
pager_open_if_enabled();
- r = sd_rtnl_open(&rtnl);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -207,11 +207,11 @@ static int list_links(int argc, char *argv[], void *userdata) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
@@ -287,14 +287,14 @@ static int ieee_oui(sd_hwdb *hwdb, struct ether_addr *mac, char **ret) {
}
static int get_gateway_description(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
sd_hwdb *hwdb,
int ifindex,
int family,
union in_addr_union *gateway,
char **gateway_description) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *m;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *m;
int r;
assert(rtnl);
@@ -307,27 +307,27 @@ static int get_gateway_description(
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (m = reply; m; m = sd_rtnl_message_next(m)) {
+ for (m = reply; m; m = sd_netlink_message_next(m)) {
union in_addr_union gw = {};
struct ether_addr mac = {};
uint16_t type;
int ifi, fam;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0) {
log_error_errno(r, "got error: %m");
continue;
}
- r = sd_rtnl_message_get_type(m, &type);
+ r = sd_netlink_message_get_type(m, &type);
if (r < 0) {
log_error_errno(r, "could not get type: %m");
continue;
@@ -360,13 +360,13 @@ static int get_gateway_description(
switch (fam) {
case AF_INET:
- r = sd_rtnl_message_read_in_addr(m, NDA_DST, &gw.in);
+ r = sd_netlink_message_read_in_addr(m, NDA_DST, &gw.in);
if (r < 0)
continue;
break;
case AF_INET6:
- r = sd_rtnl_message_read_in6_addr(m, NDA_DST, &gw.in6);
+ r = sd_netlink_message_read_in6_addr(m, NDA_DST, &gw.in6);
if (r < 0)
continue;
@@ -378,7 +378,7 @@ static int get_gateway_description(
if (!in_addr_equal(fam, &gw, gateway))
continue;
- r = sd_rtnl_message_read_ether_addr(m, NDA_LLADDR, &mac);
+ r = sd_netlink_message_read_ether_addr(m, NDA_LLADDR, &mac);
if (r < 0)
continue;
@@ -393,7 +393,7 @@ static int get_gateway_description(
}
static int dump_gateways(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
sd_hwdb *hwdb,
const char *prefix,
int ifindex) {
@@ -442,7 +442,7 @@ static int dump_gateways(
}
static int dump_addresses(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
const char *prefix,
int ifindex) {
@@ -493,12 +493,12 @@ static void dump_list(const char *prefix, char **l) {
}
static int link_status_one(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
sd_hwdb *hwdb,
const char *name) {
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **domains = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL;
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
_cleanup_device_unref_ sd_device *d = NULL;
char devid[2 + DECIMAL_STR_MAX(int)];
_cleanup_free_ char *t = NULL, *network = NULL;
@@ -523,13 +523,13 @@ static int link_status_one(
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_append_string(req, IFLA_IFNAME, name);
+ r = sd_netlink_message_append_string(req, IFLA_IFNAME, name);
}
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to query link: %m");
@@ -537,7 +537,7 @@ static int link_status_one(
if (r < 0)
return rtnl_log_parse_error(r);
- r = sd_rtnl_message_read_string(reply, IFLA_IFNAME, &name);
+ r = sd_netlink_message_read_string(reply, IFLA_IFNAME, &name);
if (r < 0)
return rtnl_log_parse_error(r);
@@ -545,7 +545,7 @@ static int link_status_one(
if (r < 0)
return rtnl_log_parse_error(r);
- have_mac = sd_rtnl_message_read_ether_addr(reply, IFLA_ADDRESS, &e) >= 0;
+ have_mac = sd_netlink_message_read_ether_addr(reply, IFLA_ADDRESS, &e) >= 0;
if (have_mac) {
const uint8_t *p;
@@ -561,7 +561,7 @@ static int link_status_one(
have_mac = false;
}
- sd_rtnl_message_read_u32(reply, IFLA_MTU, &mtu);
+ sd_netlink_message_read_u32(reply, IFLA_MTU, &mtu);
sd_network_link_get_operational_state(ifindex, &operational_state);
operational_state_to_color(operational_state, &on_color_operational, &off_color_operational);
@@ -666,11 +666,11 @@ static int link_status_one(
static int link_status(int argc, char *argv[], void *userdata) {
_cleanup_hwdb_unref_ sd_hwdb *hwdb = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
char **name;
int r;
- r = sd_rtnl_open(&rtnl);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -711,7 +711,7 @@ static int link_status(int argc, char *argv[], void *userdata) {
pager_open_if_enabled();
if (arg_all) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
_cleanup_free_ LinkInfo *links = NULL;
int c, i;
@@ -719,11 +719,11 @@ static int link_status(int argc, char *argv[], void *userdata) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
@@ -897,8 +897,8 @@ static char *lldp_system_caps(uint16_t cap) {
}
static int link_lldp_status(int argc, char *argv[], void *userdata) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
_cleanup_free_ LinkInfo *links = NULL;
const char *state, *word;
@@ -910,7 +910,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
pager_open_if_enabled();
- r = sd_rtnl_open(&rtnl);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -918,11 +918,11 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 069ba3eccb..944da3f5b8 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -151,8 +151,8 @@ int address_release(Address *address, Link *link) {
}
int address_drop(Address *address, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(address);
@@ -174,13 +174,13 @@ int address_drop(Address *address, Link *link,
return log_error_errno(r, "Could not set prefixlen: %m");
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_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);
+ r = sd_netlink_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -190,8 +190,8 @@ int address_drop(Address *address, Link *link,
}
int address_update(Address *address, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(address);
@@ -216,7 +216,7 @@ int address_update(Address *address, Link *link,
return log_error_errno(r, "Could not set flags: %m");
if (address->flags & ~0xff && link->rtnl_extended_attrs) {
- r = sd_rtnl_message_append_u32(req, IFA_FLAGS, address->flags);
+ r = sd_netlink_message_append_u32(req, IFA_FLAGS, address->flags);
if (r < 0)
return log_error_errno(r, "Could not set extended flags: %m");
}
@@ -226,29 +226,29 @@ int address_update(Address *address, Link *link,
return log_error_errno(r, "Could not set scope: %m");
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_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);
+ r = sd_netlink_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
if (address->family == AF_INET) {
- r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
+ r = sd_netlink_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
if (r < 0)
return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
}
if (address->label) {
- r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
+ r = sd_netlink_message_append_string(req, IFA_LABEL, address->label);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
}
- r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo);
+ r = sd_netlink_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo);
if (r < 0)
return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -317,8 +317,8 @@ static int address_acquire(Link *link, Address *original, Address **ret) {
}
int address_configure(Address *address, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(address);
@@ -348,7 +348,7 @@ int address_configure(Address *address, Link *link,
return log_error_errno(r, "Could not set flags: %m");
if (address->flags & ~0xff) {
- r = sd_rtnl_message_append_u32(req, IFA_FLAGS, address->flags);
+ r = sd_netlink_message_append_u32(req, IFA_FLAGS, address->flags);
if (r < 0)
return log_error_errno(r, "Could not set extended flags: %m");
}
@@ -358,39 +358,39 @@ int address_configure(Address *address, Link *link,
return log_error_errno(r, "Could not set scope: %m");
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_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);
+ r = sd_netlink_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
if (!in_addr_is_null(address->family, &address->in_addr_peer)) {
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
+ r = sd_netlink_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
else if (address->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
+ r = sd_netlink_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
} else {
if (address->family == AF_INET) {
- r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
+ r = sd_netlink_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
if (r < 0)
return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
}
}
if (address->label) {
- r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
+ r = sd_netlink_message_append_string(req, IFA_LABEL, address->label);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
}
- r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO,
+ r = sd_netlink_message_append_cache_info(req, IFA_CACHEINFO,
&address->cinfo);
if (r < 0)
return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 71cc722bcc..d446bfa8b3 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -27,7 +27,7 @@
#include "network-internal.h"
#include "dhcp-lease-internal.h"
-static int dhcp4_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -37,7 +37,7 @@ static int dhcp4_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
link->dhcp4_messages --;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set DHCPv4 route: %s",
strerror(-r));
@@ -285,14 +285,14 @@ static int dhcp_lease_lost(Link *link) {
return 0;
}
-static int dhcp4_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set DHCPv4 address: %s",
strerror(-r));
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 33e18137d2..3a5ac1c39b 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -35,14 +35,14 @@ static int dhcp6_lease_information_acquired(sd_dhcp6_client *client,
return 0;
}
-static int dhcp6_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
if (link->rtnl_extended_attrs) {
log_link_warning(link, "Could not set extended netlink attributes, reverting to fallback mechanism");
diff --git a/src/network/networkd-fdb.c b/src/network/networkd-fdb.c
index 796d1117b6..0f2510e904 100644
--- a/src/network/networkd-fdb.c
+++ b/src/network/networkd-fdb.c
@@ -80,13 +80,13 @@ int fdb_entry_new_static(Network *const network,
return 0;
}
-static int set_fdb_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int set_fdb_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
Link *link = userdata;
int r;
assert(link);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
log_link_error_errno(link, r, "Could not add FDB entry: %m");
@@ -95,8 +95,8 @@ static int set_fdb_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
/* send a request to the kernel to add a FDB entry in its static MAC table. */
int fdb_entry_configure(Link *const link, FdbEntry *const fdb_entry) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
- sd_rtnl *rtnl;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
+ sd_netlink *rtnl;
int r;
assert(link);
@@ -120,19 +120,19 @@ int fdb_entry_configure(Link *const link, FdbEntry *const fdb_entry) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_append_ether_addr(req, NDA_LLADDR, fdb_entry->mac_addr);
+ r = sd_netlink_message_append_ether_addr(req, NDA_LLADDR, fdb_entry->mac_addr);
if (r < 0)
return rtnl_log_create_error(r);
/* VLAN Id is optional. We'll add VLAN Id only if it's specified. */
if (0 != fdb_entry->vlan_id) {
- r = sd_rtnl_message_append_u16(req, NDA_VLAN, fdb_entry->vlan_id);
+ r = sd_netlink_message_append_u16(req, NDA_VLAN, fdb_entry->vlan_id);
if (r < 0)
return rtnl_log_create_error(r);
}
/* send message to the kernel to update its internal static MAC table. */
- r = sd_rtnl_call_async(rtnl, req, set_fdb_handler, link, 0, NULL);
+ r = sd_netlink_call_async(rtnl, req, set_fdb_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index 14b8770429..0a27a30278 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -73,14 +73,14 @@ static int ipv4ll_address_lost(Link *link) {
return 0;
}
-static int ipv4ll_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int ipv4ll_route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
assert(!link->ipv4ll_route);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set ipv4ll route: %s", strerror(-r));
link_enter_failed(link);
@@ -94,14 +94,14 @@ static int ipv4ll_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdat
return 1;
}
-static int ipv4ll_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
assert(!link->ipv4ll_address);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set ipv4ll address: %s", strerror(-r));
link_enter_failed(link);
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 7841f69dab..16243a5352 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -121,7 +121,7 @@ static bool link_ipv6_forward_enabled(Link *link) {
? ((old & flag) ? (" -" string) : (" +" string)) \
: "")
-static int link_update_flags(Link *link, sd_rtnl_message *m) {
+static int link_update_flags(Link *link, sd_netlink_message *m) {
unsigned flags, unknown_flags_added, unknown_flags_removed, unknown_flags;
uint8_t operstate;
int r;
@@ -132,7 +132,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) {
if (r < 0)
return log_link_warning_errno(link, r, "Could not get link flags: %m");
- r = sd_rtnl_message_read_u8(m, IFLA_OPERSTATE, &operstate);
+ r = sd_netlink_message_read_u8(m, IFLA_OPERSTATE, &operstate);
if (r < 0)
/* if we got a message without operstate, take it to mean
the state was unchanged */
@@ -193,7 +193,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) {
return 0;
}
-static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
+static int link_new(Manager *manager, sd_netlink_message *message, Link **ret) {
_cleanup_link_unref_ Link *link = NULL;
uint16_t type;
const char *ifname;
@@ -203,7 +203,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
assert(message);
assert(ret);
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0)
return r;
else if (type != RTM_NEWLINK)
@@ -215,7 +215,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
else if (ifindex <= 0)
return -EINVAL;
- r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(message, IFLA_IFNAME, &ifname);
if (r < 0)
return r;
@@ -232,7 +232,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
if (!link->ifname)
return -ENOMEM;
- r = sd_rtnl_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
+ r = sd_netlink_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
if (r < 0)
log_link_debug(link, "MAC address not found for new device, continuing without");
@@ -497,7 +497,7 @@ void link_client_handler(Link *link) {
return;
}
-static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -511,7 +511,7 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
log_link_warning_errno(link, r, "%-*s: could not set route: %m", IFNAMSIZ, link->ifname);
@@ -554,7 +554,7 @@ static int link_enter_set_routes(Link *link) {
return 0;
}
-int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+int link_route_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -565,14 +565,14 @@ int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -ESRCH)
log_link_warning_errno(link, r, "%-*s: could not drop route: %m", IFNAMSIZ, link->ifname);
return 1;
}
-static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -589,7 +589,7 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
log_link_warning_errno(link, r, "%-*s: could not set address: %m", IFNAMSIZ, link->ifname);
else if (r >= 0)
@@ -682,7 +682,7 @@ static int link_enter_set_addresses(Link *link) {
return 0;
}
-int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+int link_address_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -693,7 +693,7 @@ int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EADDRNOTAVAIL)
log_link_warning_errno(link, r, "%-*s: could not drop address: %m", IFNAMSIZ, link->ifname);
@@ -715,13 +715,13 @@ static int link_set_bridge_fdb(Link *const link) {
return r;
}
-static int link_set_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
log_link_debug(link, "Set link");
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error_errno(link, r, "Could not join netdev: %m");
link_enter_failed(link);
@@ -784,7 +784,7 @@ int link_set_hostname(Link *link, const char *hostname) {
return 0;
}
-static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -795,7 +795,7 @@ static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
log_link_warning_errno(link, r, "%-*s: could not set MTU: %m", IFNAMSIZ, link->ifname);
@@ -803,7 +803,7 @@ static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
}
int link_set_mtu(Link *link, uint32_t mtu) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -816,11 +816,11 @@ int link_set_mtu(Link *link, uint32_t mtu) {
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
- r = sd_rtnl_message_append_u32(req, IFLA_MTU, mtu);
+ r = sd_netlink_message_append_u32(req, IFLA_MTU, mtu);
if (r < 0)
return log_link_error_errno(link, r, "Could not append MTU: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, set_mtu_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, set_mtu_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -830,7 +830,7 @@ int link_set_mtu(Link *link, uint32_t mtu) {
}
static int link_set_bridge(Link *link) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -847,21 +847,21 @@ static int link_set_bridge(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not set message family: %m");
- r = sd_rtnl_message_open_container(req, IFLA_PROTINFO);
+ r = sd_netlink_message_open_container(req, IFLA_PROTINFO);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_PROTINFO attribute: %m");
if(link->network->cost != 0) {
- r = sd_rtnl_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost);
+ r = sd_netlink_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_COST attribute: %m");
}
- r = sd_rtnl_message_close_container(req);
+ r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_LINKINFO attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, link_set_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, link_set_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -952,7 +952,7 @@ bool link_has_carrier(Link *link) {
return false;
}
-static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -961,7 +961,7 @@ static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
/* we warn but don't fail the link, as it may be
brought up later */
@@ -971,7 +971,7 @@ static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
}
static int link_up(Link *link) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
uint8_t ipv6ll_mode;
int r;
@@ -991,48 +991,48 @@ static int link_up(Link *link) {
return log_link_error_errno(link, r, "Could not set link flags: %m");
if (link->network->mac) {
- r = sd_rtnl_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
+ r = sd_netlink_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
if (r < 0)
return log_link_error_errno(link, r, "Could not set MAC address: %m");
}
if (link->network->mtu) {
- r = sd_rtnl_message_append_u32(req, IFLA_MTU, link->network->mtu);
+ r = sd_netlink_message_append_u32(req, IFLA_MTU, link->network->mtu);
if (r < 0)
return log_link_error_errno(link, r, "Could not set MTU: %m");
}
- r = sd_rtnl_message_open_container(req, IFLA_AF_SPEC);
+ r = sd_netlink_message_open_container(req, IFLA_AF_SPEC);
if (r < 0)
return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m");
if (socket_ipv6_is_supported()) {
/* if the kernel lacks ipv6 support setting IFF_UP fails if any ipv6 options are passed */
- r = sd_rtnl_message_open_container(req, AF_INET6);
+ r = sd_netlink_message_open_container(req, AF_INET6);
if (r < 0)
return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m");
ipv6ll_mode = link_ipv6ll_enabled(link) ? IN6_ADDR_GEN_MODE_EUI64 : IN6_ADDR_GEN_MODE_NONE;
- r = sd_rtnl_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
+ r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m");
if (!in_addr_is_null(AF_INET6, &link->network->ipv6_token)) {
- r = sd_rtnl_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
+ r = sd_netlink_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m");
}
- r = sd_rtnl_message_close_container(req);
+ r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m");
}
- r = sd_rtnl_message_close_container(req);
+ r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not close IFLA_AF_SPEC container: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -1041,7 +1041,7 @@ static int link_up(Link *link) {
return 0;
}
-static int link_down_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int link_down_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -1050,7 +1050,7 @@ static int link_down_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
log_link_warning_errno(link, r, "%-*s: could not bring down interface: %m", IFNAMSIZ, link->ifname);
@@ -1058,7 +1058,7 @@ static int link_down_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
}
static int link_down(Link *link) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -1076,7 +1076,7 @@ static int link_down(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not set link flags: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, link_down_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, link_down_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -1360,7 +1360,7 @@ static int link_joined(Link *link) {
return link_enter_set_addresses(link);
}
-static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -1373,7 +1373,7 @@ static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error_errno(link, r, "%-*s: could not join netdev: %m", IFNAMSIZ, link->ifname);
link_enter_failed(link);
@@ -1477,6 +1477,9 @@ static int link_set_ipv4_forward(Link *link) {
const char *p = NULL;
int r;
+ if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
+ return 0;
+
p = strjoina("/proc/sys/net/ipv4/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv4_forward_enabled(link)));
if (r < 0)
@@ -1493,6 +1496,9 @@ static int link_set_ipv6_forward(Link *link) {
if (!socket_ipv6_is_supported())
return 0;
+ if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
+ return 0;
+
p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv6_forward_enabled(link)));
if (r < 0)
@@ -1572,7 +1578,7 @@ static int link_configure(Link *link) {
return link_enter_join_netdev(link);
}
-static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int link_initialized_and_synced(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
Network *network;
@@ -1630,7 +1636,7 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
}
int link_initialized(Link *link, struct udev_device *device) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -1658,7 +1664,7 @@ int link_initialized(Link *link, struct udev_device *device) {
if (r < 0)
return r;
- r = sd_rtnl_call_async(link->manager->rtnl, req,
+ r = sd_netlink_call_async(link->manager->rtnl, req,
link_initialized_and_synced, link, 0, NULL);
if (r < 0)
return r;
@@ -1681,7 +1687,7 @@ static Address* link_get_equal_address(Link *link, Address *needle) {
return NULL;
}
-int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata) {
+int link_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message, void *userdata) {
Manager *m = userdata;
Link *link = NULL;
uint16_t type;
@@ -1696,15 +1702,15 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
assert(message);
assert(m);
- if (sd_rtnl_message_is_error(message)) {
- r = sd_rtnl_message_get_errno(message);
+ if (sd_netlink_message_is_error(message)) {
+ r = sd_netlink_message_get_errno(message);
if (r < 0)
log_warning_errno(r, "rtnl: failed to receive address: %m");
return 0;
}
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0) {
log_warning_errno(r, "rtnl: could not get message type: %m");
return 0;
@@ -1762,7 +1768,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
switch (address->family) {
case AF_INET:
- r = sd_rtnl_message_read_in_addr(message, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_message_read_in_addr(message, IFA_LOCAL, &address->in_addr.in);
if (r < 0) {
log_link_warning_errno(link, r, "rtnl: received address without valid address, ignoring: %m");
return 0;
@@ -1771,7 +1777,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
break;
case AF_INET6:
- r = sd_rtnl_message_read_in6_addr(message, IFA_ADDRESS, &address->in_addr.in6);
+ r = sd_netlink_message_read_in6_addr(message, IFA_ADDRESS, &address->in_addr.in6);
if (r < 0) {
log_link_warning_errno(link, r, "rtnl: received address without valid address, ignoring: %m");
return 0;
@@ -1788,7 +1794,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
return 0;
}
- r = sd_rtnl_message_read_cache_info(message, IFA_CACHEINFO, &address->cinfo);
+ r = sd_netlink_message_read_cache_info(message, IFA_CACHEINFO, &address->cinfo);
if (r >= 0) {
if (address->cinfo.ifa_valid == CACHE_INFO_INFINITY_LIFE_TIME)
valid_str = "ever";
@@ -1841,7 +1847,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
return 1;
}
-int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
+int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
Link *link;
_cleanup_udev_device_unref_ struct udev_device *device = NULL;
char ifindex_str[2 + DECIMAL_STR_MAX(int)];
@@ -1947,7 +1953,7 @@ int link_carrier_reset(Link *link) {
}
-int link_update(Link *link, sd_rtnl_message *m) {
+int link_update(Link *link, sd_netlink_message *m) {
struct ether_addr mac;
const char *ifname;
uint32_t mtu;
@@ -1968,7 +1974,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(m, IFLA_IFNAME, &ifname);
if (r >= 0 && !streq(ifname, link->ifname)) {
log_link_info(link, "Renamed to %s", ifname);
@@ -1984,7 +1990,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_read_u32(m, IFLA_MTU, &mtu);
+ r = sd_netlink_message_read_u32(m, IFLA_MTU, &mtu);
if (r >= 0 && mtu > 0) {
link->mtu = mtu;
if (!link->original_mtu) {
@@ -2004,7 +2010,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
/* The kernel may broadcast NEWLINK messages without the MAC address
set, simply ignore them. */
- r = sd_rtnl_message_read_ether_addr(m, IFLA_ADDRESS, &mac);
+ r = sd_netlink_message_read_ether_addr(m, IFLA_ADDRESS, &mac);
if (r >= 0) {
if (memcmp(link->mac.ether_addr_octet, mac.ether_addr_octet,
ETH_ALEN)) {
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index c599952c45..2dcbbda607 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -94,19 +94,19 @@ struct Link {
Link *link_unref(Link *link);
Link *link_ref(Link *link);
int link_get(Manager *m, int ifindex, Link **ret);
-int link_add(Manager *manager, sd_rtnl_message *message, Link **ret);
+int link_add(Manager *manager, sd_netlink_message *message, Link **ret);
void link_drop(Link *link);
-int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata);
-int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata);
+int link_address_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
+int link_route_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
void link_enter_failed(Link *link);
int link_initialized(Link *link, struct udev_device *device);
void link_client_handler(Link *link);
-int link_update(Link *link, sd_rtnl_message *message);
-int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata);
+int link_update(Link *link, sd_netlink_message *message);
+int link_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message, void *userdata);
int link_save(Link *link);
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 9936a8e7cd..a5c2351cf9 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -29,12 +29,12 @@
#include "networkd-link.h"
#include "libudev-private.h"
#include "udev-util.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "bus-util.h"
#include "def.h"
#include "virt.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-daemon.h"
/* use 8 MB for receive socket kernel queue. */
@@ -274,7 +274,7 @@ static int manager_connect_udev(Manager *m) {
return 0;
}
-static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata) {
+static int manager_rtnl_process_link(sd_netlink *rtnl, sd_netlink_message *message, void *userdata) {
Manager *m = userdata;
Link *link = NULL;
NetDev *netdev = NULL;
@@ -286,15 +286,15 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
assert(message);
assert(m);
- if (sd_rtnl_message_is_error(message)) {
- r = sd_rtnl_message_get_errno(message);
+ if (sd_netlink_message_is_error(message)) {
+ r = sd_netlink_message_get_errno(message);
if (r < 0)
log_warning_errno(r, "rtnl: could not receive link: %m");
return 0;
}
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0) {
log_warning_errno(r, "rtnl: could not get message type: %m");
return 0;
@@ -313,7 +313,7 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
} else
link_get(m, ifindex, &link);
- r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &name);
+ r = sd_netlink_message_read_string(message, IFLA_IFNAME, &name);
if (r < 0) {
log_warning_errno(r, "rtnl: received link message without ifname: %m");
return 0;
@@ -385,33 +385,33 @@ static int manager_connect_rtnl(Manager *m) {
fd = systemd_netlink_fd();
if (fd < 0)
- r = sd_rtnl_open(&m->rtnl);
+ r = sd_netlink_open(&m->rtnl);
else
- r = sd_rtnl_open_fd(&m->rtnl, fd);
+ r = sd_netlink_open_fd(&m->rtnl, fd);
if (r < 0)
return r;
- r = sd_rtnl_inc_rcvbuf(m->rtnl, RCVBUF_SIZE);
+ r = sd_netlink_inc_rcvbuf(m->rtnl, RCVBUF_SIZE);
if (r < 0)
return r;
- r = sd_rtnl_attach_event(m->rtnl, m->event, 0);
+ r = sd_netlink_attach_event(m->rtnl, m->event, 0);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWLINK, &manager_rtnl_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWLINK, &manager_rtnl_process_link, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELLINK, &manager_rtnl_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELLINK, &manager_rtnl_process_link, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWADDR, &link_rtnl_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWADDR, &link_rtnl_process_address, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELADDR, &link_rtnl_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELADDR, &link_rtnl_process_address, m);
if (r < 0)
return r;
@@ -498,7 +498,7 @@ void manager_free(Manager *m) {
while ((pool = m->address_pools))
address_pool_free(pool);
- sd_rtnl_unref(m->rtnl);
+ sd_netlink_unref(m->rtnl);
free(m);
}
@@ -570,8 +570,8 @@ bool manager_should_reload(Manager *m) {
}
int manager_rtnl_enumerate_links(Manager *m) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *link;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *link;
int r;
assert(m);
@@ -581,15 +581,15 @@ int manager_rtnl_enumerate_links(Manager *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (link = reply; link; link = sd_rtnl_message_next(link)) {
+ for (link = reply; link; link = sd_netlink_message_next(link)) {
int k;
m->enumerating = true;
@@ -605,8 +605,8 @@ int manager_rtnl_enumerate_links(Manager *m) {
}
int manager_rtnl_enumerate_addresses(Manager *m) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *addr;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *addr;
int r;
assert(m);
@@ -616,15 +616,15 @@ int manager_rtnl_enumerate_addresses(Manager *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (addr = reply; addr; addr = sd_rtnl_message_next(addr)) {
+ for (addr = reply; addr; addr = sd_netlink_message_next(addr)) {
int k;
m->enumerating = true;
diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c
index d7f9bb4f8e..6336ff58a7 100644
--- a/src/network/networkd-netdev-bond.c
+++ b/src/network/networkd-netdev-bond.c
@@ -24,8 +24,8 @@
#include <linux/if_bonding.h>
#include "conf-parser.h"
-#include "sd-rtnl.h"
-#include "rtnl-types.h"
+#include "sd-netlink.h"
+#include "netlink-types.h"
#include "networkd-netdev-bond.h"
#include "missing.h"
@@ -178,7 +178,7 @@ static uint8_t bond_xmit_hash_policy_to_kernel(BondXmitHashPolicy policy) {
}
}
-static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Bond *b = BOND(netdev);
ArpIpTarget *target = NULL;
int r, i = 0;
@@ -189,14 +189,14 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(m);
if (b->mode != _NETDEV_BOND_MODE_INVALID) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_MODE,
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_MODE,
bond_mode_to_kernel(b->mode));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_MODE attribute: %m");
}
if (b->xmit_hash_policy != _NETDEV_BOND_XMIT_HASH_POLICY_INVALID) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY,
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY,
bond_xmit_hash_policy_to_kernel(b->xmit_hash_policy));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_XMIT_HASH_POLICY attribute: %m");
@@ -204,38 +204,38 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (b->lacp_rate != _NETDEV_BOND_LACP_RATE_INVALID &&
b->mode == NETDEV_BOND_MODE_802_3AD) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate );
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate );
if (r < 0) {
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_LACP_RATE attribute: %m");
}
}
if (b->miimon != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC);
if (r < 0)
log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_BOND_MIIMON attribute: %m");
}
if (b->downdelay != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / USEC_PER_MSEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_DOWNDELAY attribute: %m");
}
if (b->updelay != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / USEC_PER_MSEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_UPDELAY attribute: %m");
}
if (b->arp_interval != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_INTERVAL, b->arp_interval / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_INTERVAL, b->arp_interval / USEC_PER_MSEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_INTERVAL attribute: %m");
if ((b->lp_interval >= LEARNING_PACKETS_INTERVAL_MIN_SEC) &&
(b->lp_interval <= LEARNING_PACKETS_INTERVAL_MAX_SEC)) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_LP_INTERVAL, b->lp_interval / USEC_PER_SEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_LP_INTERVAL, b->lp_interval / USEC_PER_SEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_LP_INTERVAL attribute: %m");
}
@@ -243,79 +243,79 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (b->ad_select != _NETDEV_BOND_AD_SELECT_INVALID &&
b->mode == NETDEV_BOND_MODE_802_3AD) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_AD_SELECT, b->ad_select);
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_SELECT, b->ad_select);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_SELECT attribute: %m");
}
if (b->fail_over_mac != _NETDEV_BOND_FAIL_OVER_MAC_INVALID &&
b->mode == NETDEV_BOND_MODE_ACTIVE_BACKUP) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_FAIL_OVER_MAC, b->fail_over_mac);
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_FAIL_OVER_MAC, b->fail_over_mac);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_FAIL_OVER_MAC attribute: %m");
}
if (b->arp_validate != _NETDEV_BOND_ARP_VALIDATE_INVALID) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_VALIDATE, b->arp_validate);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_VALIDATE, b->arp_validate);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_VALIDATE attribute: %m");
}
if (b->arp_all_targets != _NETDEV_BOND_ARP_ALL_TARGETS_INVALID) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->arp_all_targets);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->arp_all_targets);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_VALIDATE attribute: %m");
}
if (b->primary_reselect != _NETDEV_BOND_PRIMARY_RESELECT_INVALID) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->primary_reselect);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->primary_reselect);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
}
if (b->resend_igmp <= RESEND_IGMP_MAX) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_RESEND_IGMP, b->resend_igmp);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_RESEND_IGMP, b->resend_igmp);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_RESEND_IGMP attribute: %m");
}
if (b->packets_per_slave <= PACKETS_PER_SLAVE_MAX &&
b->mode == NETDEV_BOND_MODE_BALANCE_RR) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_PACKETS_PER_SLAVE, b->packets_per_slave);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_PACKETS_PER_SLAVE, b->packets_per_slave);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_PACKETS_PER_SLAVE attribute: %m");
}
if (b->num_grat_arp <= GRATUITOUS_ARP_MAX) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_NUM_PEER_NOTIF, b->num_grat_arp);
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_NUM_PEER_NOTIF, b->num_grat_arp);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_NUM_PEER_NOTIF attribute: %m");
}
if (b->min_links != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIN_LINKS, b->min_links);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_MIN_LINKS, b->min_links);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_MIN_LINKS attribute: %m");
}
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_ALL_SLAVES_ACTIVE, b->all_slaves_active);
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_ALL_SLAVES_ACTIVE, b->all_slaves_active);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ALL_SLAVES_ACTIVE attribute: %m");
if (b->arp_interval > 0) {
if (b->n_arp_ip_targets > 0) {
- r = sd_rtnl_message_open_container(m, IFLA_BOND_ARP_IP_TARGET);
+ r = sd_netlink_message_open_container(m, IFLA_BOND_ARP_IP_TARGET);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not open contaniner IFLA_BOND_ARP_IP_TARGET : %m");
LIST_FOREACH(arp_ip_target, target, b->arp_ip_targets) {
- r = sd_rtnl_message_append_u32(m, i++, target->ip.in.s_addr);
+ r = sd_netlink_message_append_u32(m, i++, target->ip.in.s_addr);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
}
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not close contaniner IFLA_BOND_ARP_IP_TARGET : %m");
}
diff --git a/src/network/networkd-netdev-ipvlan.c b/src/network/networkd-netdev-ipvlan.c
index f1c8e0ccdb..5eb4a1eb36 100644
--- a/src/network/networkd-netdev-ipvlan.c
+++ b/src/network/networkd-netdev-ipvlan.c
@@ -32,7 +32,7 @@ static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(ipvlan_mode, IPVlanMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_mode, ipvlan_mode, IPVlanMode, "Failed to parse ipvlan mode");
-static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
+static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
IPVlan *m = IPVLAN(netdev);
int r;
@@ -42,7 +42,7 @@ static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
assert(netdev->ifname);
if (m->mode != _NETDEV_IPVLAN_MODE_INVALID) {
- r = sd_rtnl_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
+ r = sd_netlink_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPVLAN_MODE attribute: %m");
}
diff --git a/src/network/networkd-netdev-macvlan.c b/src/network/networkd-netdev-macvlan.c
index a8bf6e6bb7..c2c564935c 100644
--- a/src/network/networkd-netdev-macvlan.c
+++ b/src/network/networkd-netdev-macvlan.c
@@ -34,7 +34,7 @@ static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(macvlan_mode, MacVlanMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, "Failed to parse macvlan mode");
-static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
+static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
MacVlan *m = MACVLAN(netdev);
int r;
@@ -44,7 +44,7 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtn
assert(netdev->ifname);
if (m->mode != _NETDEV_MACVLAN_MODE_INVALID) {
- r = sd_rtnl_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
+ r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MODE attribute: %m");
}
diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c
index 8af4be4974..5533fb5c7b 100644
--- a/src/network/networkd-netdev-tunnel.c
+++ b/src/network/networkd-netdev-tunnel.c
@@ -25,7 +25,7 @@
#include <linux/if_tunnel.h>
#include <linux/ip6_tunnel.h>
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "networkd-netdev-tunnel.h"
#include "networkd-link.h"
#include "util.h"
@@ -43,7 +43,7 @@ static const char* const ip6tnl_mode_table[_NETDEV_IP6_TNL_MODE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(ip6tnl_mode, Ip6TnlMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_ip6tnl_mode, ip6tnl_mode, Ip6TnlMode, "Failed to parse ip6 tunnel Mode");
-static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = IPIP(netdev);
int r;
@@ -53,30 +53,30 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(t);
assert(t->family == AF_INET);
- r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
return r;
}
-static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = SIT(netdev);
int r;
@@ -86,30 +86,30 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
assert(t);
assert(t->family == AF_INET);
- r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
return r;
}
-static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t;
int r;
@@ -125,34 +125,34 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
assert(link);
assert(m);
- r = sd_rtnl_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_GRE_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in);
if (r < 0)
log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TOS, t->tos);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_TOS, t->tos);
if (r < 0)
log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TOS attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_PMTUDISC attribute: %m");
return r;
}
-static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t;
int r;
@@ -168,26 +168,26 @@ static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
assert(link);
assert(m);
- r = sd_rtnl_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_GRE_LOCAL, &t->local.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_LOCAL, &t->local.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_GRE_REMOTE, &t->remote.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_REMOTE, &t->remote.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
return r;
}
-static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = VTI(netdev);
int r;
@@ -197,22 +197,22 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
assert(t);
assert(t->family == AF_INET);
- r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_VTI_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_VTI_REMOTE, &t->remote.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
return r;
}
-static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = VTI6(netdev);
int r;
@@ -222,22 +222,22 @@ static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(t);
assert(t->family == AF_INET6);
- r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_LOCAL, &t->local.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_VTI_LOCAL, &t->local.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_REMOTE, &t->remote.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_VTI_REMOTE, &t->remote.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
return r;
}
-static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = IP6TNL(netdev);
uint8_t proto;
int r;
@@ -248,19 +248,19 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
assert(t);
assert(t->family == AF_INET6);
- r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_IPTUN_LOCAL, &t->local.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_LOCAL, &t->local.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
@@ -277,7 +277,7 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
break;
}
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PROTO, proto);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PROTO, proto);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_MODE attribute: %m");
diff --git a/src/network/networkd-netdev-veth.c b/src/network/networkd-netdev-veth.c
index 7bb02d1ae1..e20f9f74e2 100644
--- a/src/network/networkd-netdev-veth.c
+++ b/src/network/networkd-netdev-veth.c
@@ -22,10 +22,10 @@
#include <net/if.h>
#include <linux/veth.h>
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "networkd-netdev-veth.h"
-static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Veth *v = VETH(netdev);
int r;
@@ -34,23 +34,23 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(v);
assert(m);
- r = sd_rtnl_message_open_container(m, VETH_INFO_PEER);
+ r = sd_netlink_message_open_container(m, VETH_INFO_PEER);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append VETH_INFO_PEER attribute: %m");
if (v->ifname_peer) {
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface name: %m");
}
if (v->mac_peer) {
- r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer);
+ r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
}
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
diff --git a/src/network/networkd-netdev-vlan.c b/src/network/networkd-netdev-vlan.c
index 0ed024b41d..d53e7beaac 100644
--- a/src/network/networkd-netdev-vlan.c
+++ b/src/network/networkd-netdev-vlan.c
@@ -23,7 +23,7 @@
#include "networkd-netdev-vlan.h"
-static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
+static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
VLan *v = VLAN(netdev);
int r;
@@ -33,7 +33,7 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(req);
if (v->id <= VLANID_MAX) {
- r = sd_rtnl_message_append_u16(req, IFLA_VLAN_ID, v->id);
+ r = sd_netlink_message_append_u16(req, IFLA_VLAN_ID, v->id);
if (r < 0) {
log_netdev_error(netdev,
"Could not append IFLA_VLAN_ID attribute: %s",
diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
index 01a1e5089c..2a5c5f0baa 100644
--- a/src/network/networkd-netdev-vxlan.c
+++ b/src/network/networkd-netdev-vxlan.c
@@ -21,13 +21,13 @@
#include <net/if.h>
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "networkd-netdev-vxlan.h"
#include "networkd-link.h"
#include "conf-parser.h"
#include "missing.h"
-static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
VxLan *v = VXLAN(netdev);
int r;
@@ -38,66 +38,66 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
if (v->id <= VXLAN_VID_MAX) {
- r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id);
+ r = sd_netlink_message_append_u32(m, IFLA_VXLAN_ID, v->id);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m");
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
if(v->ttl) {
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
}
if(v->tos) {
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
}
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LEARNING attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_RSC attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PROXY attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L2MISS attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
if(v->fdb_ageing) {
- r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
+ r = sd_netlink_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");
}
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_CSUM attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %m");
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 66fd0fac0a..ece9ecc251 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -77,7 +77,7 @@ DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind);
DEFINE_CONFIG_PARSE_ENUM(config_parse_netdev_kind, netdev_kind, NetDevKind, "Failed to parse netdev kind");
static void netdev_cancel_callbacks(NetDev *netdev) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
netdev_join_callback *callback;
if (!netdev)
@@ -180,8 +180,8 @@ static int netdev_enter_failed(NetDev *netdev) {
return 0;
}
-static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(netdev);
@@ -196,11 +196,11 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not allocate RTM_SETLINK message: %m");
- r = sd_rtnl_message_append_u32(req, IFLA_MASTER, netdev->ifindex);
+ r = sd_netlink_message_append_u32(req, IFLA_MASTER, netdev->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_MASTER attribute: %m");
- r = sd_rtnl_call_async(netdev->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(netdev->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_netdev_error(netdev, "Could not send rtnetlink message: %m");
@@ -241,13 +241,13 @@ static int netdev_enter_ready(NetDev *netdev) {
}
/* callback for netdev's created without a backing Link */
-static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_netdev_unref_ NetDev *netdev = userdata;
int r;
assert(netdev->state != _NETDEV_STATE_INVALID);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r == -EEXIST)
log_netdev_info(netdev, "netdev exists, using existing without changing its parameters");
else if (r < 0) {
@@ -262,7 +262,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda
return 1;
}
-int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) {
+int netdev_enslave(NetDev *netdev, Link *link, sd_netlink_message_handler_t callback) {
int r;
assert(netdev);
@@ -292,7 +292,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callbac
return 0;
}
-int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
+int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *message) {
uint16_t type;
const char *kind;
const char *received_kind;
@@ -302,7 +302,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
assert(netdev);
assert(message);
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get rtnl message type: %m");
@@ -333,7 +333,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
return 0;
}
- r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &received_name);
+ r = sd_netlink_message_read_string(message, IFLA_IFNAME, &received_name);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get IFNAME: %m");
@@ -343,15 +343,15 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
return r;
}
- r = sd_rtnl_message_enter_container(message, IFLA_LINKINFO);
+ r = sd_netlink_message_enter_container(message, IFLA_LINKINFO);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get LINKINFO: %m");
- r = sd_rtnl_message_read_string(message, IFLA_INFO_KIND, &received_kind);
+ r = sd_netlink_message_read_string(message, IFLA_INFO_KIND, &received_kind);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get KIND: %m");
- r = sd_rtnl_message_exit_container(message);
+ r = sd_netlink_message_exit_container(message);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not exit container: %m");
@@ -431,7 +431,7 @@ int netdev_get_mac(const char *ifname, struct ether_addr **ret) {
}
static int netdev_create(NetDev *netdev, Link *link,
- sd_rtnl_message_handler_t callback) {
+ sd_netlink_message_handler_t callback) {
int r;
assert(netdev);
@@ -447,39 +447,39 @@ static int netdev_create(NetDev *netdev, Link *link,
log_netdev_debug(netdev, "Created");
} else {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
r = sd_rtnl_message_new_link(netdev->manager->rtnl, &m, RTM_NEWLINK, 0);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not allocate RTM_NEWLINK message: %m");
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, netdev->ifname);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IFNAME, attribute: %m");
if (netdev->mac) {
- r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, netdev->mac);
+ r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, netdev->mac);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
}
if (netdev->mtu) {
- r = sd_rtnl_message_append_u32(m, IFLA_MTU, netdev->mtu);
+ r = sd_netlink_message_append_u32(m, IFLA_MTU, netdev->mtu);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_MTU attribute: %m");
}
if (link) {
- r = sd_rtnl_message_append_u32(m, IFLA_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINK attribute: %m");
}
- r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
+ r = sd_netlink_message_open_container(m, IFLA_LINKINFO);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
- r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, netdev_kind_to_string(netdev->kind));
+ r = sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, netdev_kind_to_string(netdev->kind));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
@@ -489,22 +489,22 @@ static int netdev_create(NetDev *netdev, Link *link,
return r;
}
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
if (link) {
- r = sd_rtnl_call_async(netdev->manager->rtnl, m, callback, link, 0, NULL);
+ r = sd_netlink_call_async(netdev->manager->rtnl, m, callback, link, 0, NULL);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not send rtnetlink message: %m");
link_ref(link);
} else {
- r = sd_rtnl_call_async(netdev->manager->rtnl, m, netdev_create_handler, netdev, 0, NULL);
+ r = sd_netlink_call_async(netdev->manager->rtnl, m, netdev_create_handler, netdev, 0, NULL);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not send rtnetlink message: %m");
@@ -520,7 +520,7 @@ static int netdev_create(NetDev *netdev, Link *link,
}
/* the callback must be called, possibly after a timeout, as otherwise the Link will hang */
-int netdev_join(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) {
+int netdev_join(NetDev *netdev, Link *link, sd_netlink_message_handler_t callback) {
int r;
assert(netdev);
diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h
index 1ded495e4a..a004f2fe5f 100644
--- a/src/network/networkd-netdev.h
+++ b/src/network/networkd-netdev.h
@@ -29,7 +29,7 @@ typedef struct NetDevVTable NetDevVTable;
typedef struct netdev_join_callback netdev_join_callback;
struct netdev_join_callback {
- sd_rtnl_message_handler_t callback;
+ sd_netlink_message_handler_t callback;
Link *link;
LIST_FIELDS(netdev_join_callback, callbacks);
@@ -129,7 +129,7 @@ struct NetDevVTable {
void (*done)(NetDev *n);
/* fill in message to create netdev */
- int (*fill_message_create)(NetDev *netdev, Link *link, sd_rtnl_message *message);
+ int (*fill_message_create)(NetDev *netdev, Link *link, sd_netlink_message *message);
/* specifies if netdev is independent, or a master device or a stacked device */
NetDevCreateType create_type;
@@ -187,10 +187,10 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
#define _cleanup_netdev_unref_ _cleanup_(netdev_unrefp)
int netdev_get(Manager *manager, const char *name, NetDev **ret);
-int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *newlink);
-int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback);
+int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *newlink);
+int netdev_enslave(NetDev *netdev, Link *link, sd_netlink_message_handler_t callback);
int netdev_get_mac(const char *ifname, struct ether_addr **ret);
-int netdev_join(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb);
+int netdev_join(NetDev *netdev, Link *link, sd_netlink_message_handler_t cb);
const char *netdev_kind_to_string(NetDevKind d) _const_;
NetDevKind netdev_kind_from_string(const char *d) _pure_;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 8abf5bcf2e..b05bc949f2 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -15,69 +15,69 @@ struct ConfigPerfItem;
%struct-type
%includes
%%
-Match.MACAddress, config_parse_hwaddr, 0, offsetof(Network, match_mac)
-Match.Path, config_parse_strv, 0, offsetof(Network, match_path)
-Match.Driver, config_parse_strv, 0, offsetof(Network, match_driver)
-Match.Type, config_parse_strv, 0, offsetof(Network, match_type)
-Match.Name, config_parse_ifnames, 0, offsetof(Network, match_name)
-Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, match_host)
-Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(Network, match_virt)
-Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, match_kernel)
-Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, match_arch)
-Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
-Link.MTUBytes, config_parse_iec_size, 0, offsetof(Network, mtu)
-Network.Description, config_parse_string, 0, offsetof(Network, description)
-Network.Bridge, config_parse_netdev, 0, offsetof(Network, bridge)
-Network.Bond, config_parse_netdev, 0, offsetof(Network, bond)
-Network.VLAN, config_parse_netdev, 0, 0
-Network.MACVLAN, config_parse_netdev, 0, 0
-Network.IPVLAN, config_parse_netdev, 0, 0
-Network.VXLAN, config_parse_netdev, 0, 0
-Network.Tunnel, config_parse_tunnel, 0, 0
-Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp)
-Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
-Network.LinkLocalAddressing, config_parse_address_family_boolean,0, offsetof(Network, link_local)
-Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route)
-Network.IPv6Token, config_parse_ipv6token, 0, offsetof(Network, ipv6_token)
-Network.LLDP, config_parse_bool, 0, offsetof(Network, lldp)
-Network.Address, config_parse_address, 0, 0
-Network.Gateway, config_parse_gateway, 0, 0
-Network.Domains, config_parse_domains, 0, offsetof(Network, domains)
-Network.DNS, config_parse_strv, 0, offsetof(Network, dns)
-Network.LLMNR, config_parse_llmnr, 0, offsetof(Network, llmnr)
-Network.NTP, config_parse_strv, 0, offsetof(Network, ntp)
-Network.IPForward, config_parse_address_family_boolean,0, offsetof(Network, ip_forward)
-Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade)
-Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier)
-Address.Address, config_parse_address, 0, 0
-Address.Peer, config_parse_address, 0, 0
-Address.Broadcast, config_parse_broadcast, 0, 0
-Address.Label, config_parse_label, 0, 0
-Route.Gateway, config_parse_gateway, 0, 0
-Route.Destination, config_parse_destination, 0, 0
-Route.Source, config_parse_destination, 0, 0
-Route.Metric, config_parse_route_priority, 0, 0
-Route.Scope, config_parse_route_scope, 0, 0
-DHCP.ClientIdentifier, config_parse_dhcp_client_identifier,0, offsetof(Network, dhcp_client_identifier)
-DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
-DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_ntp)
-DHCP.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
-DHCP.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
-DHCP.UseDomains, config_parse_bool, 0, offsetof(Network, dhcp_domains)
-DHCP.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_routes)
-DHCP.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_sendhost)
-DHCP.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast)
-DHCP.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
-DHCP.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier)
-DHCP.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric)
-Bridge.Cost, config_parse_unsigned, 0, offsetof(Network, cost)
-BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
-BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
+Match.MACAddress, config_parse_hwaddr, 0, offsetof(Network, match_mac)
+Match.Path, config_parse_strv, 0, offsetof(Network, match_path)
+Match.Driver, config_parse_strv, 0, offsetof(Network, match_driver)
+Match.Type, config_parse_strv, 0, offsetof(Network, match_type)
+Match.Name, config_parse_ifnames, 0, offsetof(Network, match_name)
+Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, match_host)
+Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(Network, match_virt)
+Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, match_kernel)
+Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, match_arch)
+Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
+Link.MTUBytes, config_parse_iec_size, 0, offsetof(Network, mtu)
+Network.Description, config_parse_string, 0, offsetof(Network, description)
+Network.Bridge, config_parse_netdev, 0, offsetof(Network, bridge)
+Network.Bond, config_parse_netdev, 0, offsetof(Network, bond)
+Network.VLAN, config_parse_netdev, 0, 0
+Network.MACVLAN, config_parse_netdev, 0, 0
+Network.IPVLAN, config_parse_netdev, 0, 0
+Network.VXLAN, config_parse_netdev, 0, 0
+Network.Tunnel, config_parse_tunnel, 0, 0
+Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp)
+Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
+Network.LinkLocalAddressing, config_parse_address_family_boolean, 0, offsetof(Network, link_local)
+Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route)
+Network.IPv6Token, config_parse_ipv6token, 0, offsetof(Network, ipv6_token)
+Network.LLDP, config_parse_bool, 0, offsetof(Network, lldp)
+Network.Address, config_parse_address, 0, 0
+Network.Gateway, config_parse_gateway, 0, 0
+Network.Domains, config_parse_domains, 0, offsetof(Network, domains)
+Network.DNS, config_parse_strv, 0, offsetof(Network, dns)
+Network.LLMNR, config_parse_llmnr, 0, offsetof(Network, llmnr)
+Network.NTP, config_parse_strv, 0, offsetof(Network, ntp)
+Network.IPForward, config_parse_address_family_boolean_with_kernel,0, offsetof(Network, ip_forward)
+Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade)
+Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier)
+Address.Address, config_parse_address, 0, 0
+Address.Peer, config_parse_address, 0, 0
+Address.Broadcast, config_parse_broadcast, 0, 0
+Address.Label, config_parse_label, 0, 0
+Route.Gateway, config_parse_gateway, 0, 0
+Route.Destination, config_parse_destination, 0, 0
+Route.Source, config_parse_destination, 0, 0
+Route.Metric, config_parse_route_priority, 0, 0
+Route.Scope, config_parse_route_scope, 0, 0
+DHCP.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
+DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
+DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_ntp)
+DHCP.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
+DHCP.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
+DHCP.UseDomains, config_parse_bool, 0, offsetof(Network, dhcp_domains)
+DHCP.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_routes)
+DHCP.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_sendhost)
+DHCP.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast)
+DHCP.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
+DHCP.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier)
+DHCP.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric)
+Bridge.Cost, config_parse_unsigned, 0, offsetof(Network, cost)
+BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
+BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
/* backwards compatibility: do not add new entries to this section */
-Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
-DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
-DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
-DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
-DHCP.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
-DHCPv4.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
-DHCPv4.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
+Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
+DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
+DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
+DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
+DHCP.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
+DHCPv4.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
+DHCPv4.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 6f32e5f4a4..ec95c8661e 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -717,3 +717,37 @@ int config_parse_ipv6token(
return 0;
}
+
+int config_parse_address_family_boolean_with_kernel(
+ 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) {
+
+ AddressFamilyBoolean *fwd = data, s;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ s = address_family_boolean_from_string(rvalue);
+ if (s < 0) {
+ if (streq(rvalue, "kernel"))
+ s = _ADDRESS_FAMILY_BOOLEAN_INVALID;
+ else {
+ log_syntax(unit, LOG_ERR, filename, line, s, "Failed to parse IPForwarding option, ignoring: %s", rvalue);
+ return 0;
+ }
+ }
+
+ *fwd = s;
+
+ return 0;
+}
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 7f110a5217..31b10c458d 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -97,8 +97,8 @@ void route_free(Route *route) {
}
int route_drop(Route *route, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -115,18 +115,18 @@ int route_drop(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->in_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_GATEWAY, &route->in_addr.in);
+ r = sd_netlink_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);
+ r = sd_netlink_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m");
}
if (route->dst_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_DST, &route->dst_addr.in);
+ r = sd_netlink_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);
+ r = sd_netlink_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_DST attribute: %m");
@@ -137,9 +137,9 @@ int route_drop(Route *route, Link *link,
if (route->src_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_DST attribute: %m");
@@ -150,9 +150,9 @@ int route_drop(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->prefsrc_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PREFSRC attribute: %m");
}
@@ -161,15 +161,15 @@ int route_drop(Route *route, Link *link,
if (r < 0)
return log_error_errno(r, "Could not set scope: %m");
- r = sd_rtnl_message_append_u32(req, RTA_PRIORITY, route->metrics);
+ r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->metrics);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m");
- r = sd_rtnl_message_append_u32(req, RTA_OIF, link->ifindex);
+ r = sd_netlink_message_append_u32(req, RTA_OIF, link->ifindex);
if (r < 0)
return log_error_errno(r, "Could not append RTA_OIF attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -179,8 +179,8 @@ int route_drop(Route *route, Link *link,
}
int route_configure(Route *route, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -197,18 +197,18 @@ int route_configure(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->in_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_GATEWAY, &route->in_addr.in);
+ r = sd_netlink_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);
+ r = sd_netlink_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m");
}
if (route->dst_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_DST, &route->dst_addr.in);
+ r = sd_netlink_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);
+ r = sd_netlink_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_DST attribute: %m");
@@ -219,9 +219,9 @@ int route_configure(Route *route, Link *link,
if (route->src_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_SRC attribute: %m");
@@ -232,9 +232,9 @@ int route_configure(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->prefsrc_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PREFSRC attribute: %m");
}
@@ -243,15 +243,15 @@ int route_configure(Route *route, Link *link,
if (r < 0)
return log_error_errno(r, "Could not set scope: %m");
- r = sd_rtnl_message_append_u32(req, RTA_PRIORITY, route->metrics);
+ r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->metrics);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m");
- r = sd_rtnl_message_append_u32(req, RTA_OIF, link->ifindex);
+ r = sd_netlink_message_append_u32(req, RTA_OIF, link->ifindex);
if (r < 0)
return log_error_errno(r, "Could not append RTA_OIF attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
diff --git a/src/network/networkd-wait-online-link.c b/src/network/networkd-wait-online-link.c
index 341bcae3fb..2d5123788c 100644
--- a/src/network/networkd-wait-online-link.c
+++ b/src/network/networkd-wait-online-link.c
@@ -82,7 +82,7 @@ Link *link_free(Link *l) {
return NULL;
}
-int link_update_rtnl(Link *l, sd_rtnl_message *m) {
+int link_update_rtnl(Link *l, sd_netlink_message *m) {
const char *ifname;
int r;
@@ -94,7 +94,7 @@ int link_update_rtnl(Link *l, sd_rtnl_message *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(m, IFLA_IFNAME, &ifname);
if (r < 0)
return r;
diff --git a/src/network/networkd-wait-online-link.h b/src/network/networkd-wait-online-link.h
index 90ea6b3405..068196622e 100644
--- a/src/network/networkd-wait-online-link.h
+++ b/src/network/networkd-wait-online-link.h
@@ -39,7 +39,7 @@ struct Link {
int link_new(Manager *m, Link **ret, int ifindex, const char *ifname);
Link *link_free(Link *l);
-int link_update_rtnl(Link *l, sd_rtnl_message *m);
+int link_update_rtnl(Link *l, sd_netlink_message *m);
int link_update_monitor(Link *l);
bool link_relevant(Link *l);
diff --git a/src/network/networkd-wait-online-manager.c b/src/network/networkd-wait-online-manager.c
index 39f3845633..1fc724f5a4 100644
--- a/src/network/networkd-wait-online-manager.c
+++ b/src/network/networkd-wait-online-manager.c
@@ -23,7 +23,7 @@
#include <linux/if.h>
#include <fnmatch.h>
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "network-internal.h"
#include "networkd-wait-online-link.h"
@@ -93,7 +93,7 @@ bool manager_all_configured(Manager *m) {
return one_ready;
}
-static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
+static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
Manager *m = userdata;
uint16_t type;
Link *l;
@@ -104,7 +104,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda
assert(m);
assert(mm);
- r = sd_rtnl_message_get_type(mm, &type);
+ r = sd_netlink_message_get_type(mm, &type);
if (r < 0)
goto fail;
@@ -112,7 +112,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda
if (r < 0)
goto fail;
- r = sd_rtnl_message_read_string(mm, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(mm, IFLA_IFNAME, &ifname);
if (r < 0)
goto fail;
@@ -155,7 +155,7 @@ fail:
return 0;
}
-static int on_rtnl_event(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
+static int on_rtnl_event(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
Manager *m = userdata;
int r;
@@ -170,26 +170,26 @@ static int on_rtnl_event(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
}
static int manager_rtnl_listen(Manager *m) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *i;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *i;
int r;
assert(m);
/* First, subscribe to interfaces coming and going */
- r = sd_rtnl_open(&m->rtnl);
+ r = sd_netlink_open(&m->rtnl);
if (r < 0)
return r;
- r = sd_rtnl_attach_event(m->rtnl, m->event, 0);
+ r = sd_netlink_attach_event(m->rtnl, m->event, 0);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWLINK, on_rtnl_event, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWLINK, on_rtnl_event, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELLINK, on_rtnl_event, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELLINK, on_rtnl_event, m);
if (r < 0)
return r;
@@ -198,15 +198,15 @@ static int manager_rtnl_listen(Manager *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (i = reply; i; i = sd_rtnl_message_next(i)) {
+ for (i = reply; i; i = sd_netlink_message_next(i)) {
r = manager_process_link(m->rtnl, i, m);
if (r < 0)
return r;
@@ -323,7 +323,7 @@ void manager_free(Manager *m) {
sd_network_monitor_unref(m->network_monitor);
sd_event_source_unref(m->rtnl_event_source);
- sd_rtnl_unref(m->rtnl);
+ sd_netlink_unref(m->rtnl);
sd_event_unref(m->event);
free(m);
diff --git a/src/network/networkd-wait-online.h b/src/network/networkd-wait-online.h
index 73d129699d..627c46be13 100644
--- a/src/network/networkd-wait-online.h
+++ b/src/network/networkd-wait-online.h
@@ -22,7 +22,7 @@
#pragma once
#include "sd-event.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-network.h"
#include "hashmap.h"
@@ -38,7 +38,7 @@ struct Manager {
char **interfaces;
char **ignore;
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
sd_event_source *rtnl_event_source;
sd_network_monitor *network_monitor;
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 4b13d4aed1..ac6e2c8a8e 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -24,7 +24,7 @@
#include <arpa/inet.h>
#include "sd-event.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-bus.h"
#include "sd-dhcp-client.h"
#include "sd-dhcp-server.h"
@@ -34,7 +34,7 @@
#include "udev.h"
#include "sd-lldp.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "hashmap.h"
#include "list.h"
#include "set.h"
@@ -218,7 +218,7 @@ struct AddressPool {
};
struct Manager {
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
sd_event *event;
sd_event_source *bus_retry_event_source;
sd_bus *bus;
@@ -342,8 +342,8 @@ const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, unsig
int route_new_static(Network *network, unsigned section, Route **ret);
int route_new_dynamic(Route **ret, unsigned char rtm_protocol);
void route_free(Route *route);
-int route_configure(Route *route, Link *link, sd_rtnl_message_handler_t callback);
-int route_drop(Route *route, Link *link, sd_rtnl_message_handler_t callback);
+int route_configure(Route *route, Link *link, sd_netlink_message_handler_t callback);
+int route_drop(Route *route, Link *link, sd_netlink_message_handler_t callback);
DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
@@ -368,9 +368,9 @@ int config_parse_route_scope(const char *unit, const char *filename, unsigned li
int address_new_static(Network *network, unsigned section, Address **ret);
int address_new_dynamic(Address **ret);
void address_free(Address *address);
-int address_configure(Address *address, Link *link, sd_rtnl_message_handler_t callback);
-int address_update(Address *address, Link *link, sd_rtnl_message_handler_t callback);
-int address_drop(Address *address, Link *link, sd_rtnl_message_handler_t callback);
+int address_configure(Address *address, Link *link, sd_netlink_message_handler_t callback);
+int address_update(Address *address, Link *link, sd_netlink_message_handler_t callback);
+int address_drop(Address *address, Link *link, sd_netlink_message_handler_t callback);
int address_establish(Address *address, Link *link);
int address_release(Address *address, Link *link);
bool address_equal(Address *a1, Address *a2);
@@ -448,6 +448,9 @@ AddressFamilyBoolean address_family_boolean_from_string(const char *s) _const_;
int config_parse_address_family_boolean(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);
+/* IPForwarding parser */
+int config_parse_address_family_boolean_with_kernel(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);
+
/* Operational State */
const char* link_operstate_to_string(LinkOperationalState s) _const_;
diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
index 67fcca2ac0..438214015d 100644
--- a/src/network/test-network-tables.c
+++ b/src/network/test-network-tables.c
@@ -3,7 +3,7 @@
#include "networkd-netdev-macvlan.h"
#include "dhcp6-internal.h"
#include "dhcp6-protocol.h"
-#include "rtnl-internal.h"
+#include "netlink-internal.h"
#include "ethtool-util.h"
#include "test-tables.h"