summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-12-04 21:57:13 +0100
committerTom Gundersen <teg@jklm.no>2014-12-05 00:38:10 +0100
commitc106cc36b9b8e8998eb95299b02f1db9c1209122 (patch)
treef60a30744029dd69fb0ba47e5bc21c79d516b162 /src/network/networkd-link.c
parentc18c2a0ea15820c49226aa05f294f5d5c1417263 (diff)
networkd: add basic [Link] settings to .network files
This allows the default link settings (set in .link files) to be overridden per Network. Only MTU and MACAddress is supported for now.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 7cffcb48d0..d59a8192b0 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1074,6 +1074,7 @@ static int link_up(Link *link) {
int r;
assert(link);
+ assert(link->network);
assert(link->manager);
assert(link->manager->rtnl);
@@ -1093,6 +1094,22 @@ static int link_up(Link *link) {
return r;
}
+ if (link->network->mac) {
+ r = sd_rtnl_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
+ if (r < 0) {
+ log_link_error(link, "Could not set MAC address: %s", strerror(-r));
+ return r;
+ }
+ }
+
+ if (link->network->mtu) {
+ r = sd_rtnl_message_append_u32(req, IFLA_MTU, link->network->mtu);
+ if (r < 0) {
+ log_link_error(link, "Could not set MTU: %s", strerror(-r));
+ return r;
+ }
+ }
+
r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link,
0, NULL);
if (r < 0) {