summaryrefslogtreecommitdiff
path: root/src/network/networkd-netdev.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-03-28 18:20:31 +0100
committerTom Gundersen <teg@jklm.no>2014-03-28 19:16:21 +0100
commitba5596ec2ed65943b66d42fbe6e9ef7ebc79216c (patch)
treed342b5d187dd255956542be0ca9f768a94e6d2a9 /src/network/networkd-netdev.c
parentd8e538ecd9e62f841242f07e3df5c835c1ba6313 (diff)
networkd: netdev - improve logging when setting ifindex
Diffstat (limited to 'src/network/networkd-netdev.c')
-rw-r--r--src/network/networkd-netdev.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 15a5d7cdff..762eff2f62 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -146,6 +146,9 @@ static int netdev_enter_ready(NetDev *netdev) {
assert(netdev);
assert(netdev->name);
+ if (netdev->state != NETDEV_STATE_CREATING)
+ return 0;
+
netdev->state = NETDEV_STATE_READY;
log_info_netdev(netdev, "netdev ready");
@@ -385,11 +388,15 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
assert(message);
r = sd_rtnl_message_get_type(message, &type);
- if (r < 0)
+ if (r < 0) {
+ log_error_netdev(netdev, "Could not get rtnl message type");
return r;
+ }
- if (type != RTM_NEWLINK)
+ if (type != RTM_NEWLINK) {
+ log_error_netdev(netdev, "Can not set ifindex from unexpected rtnl message type");
return -EINVAL;
+ }
r = sd_rtnl_message_enter_container(message, IFLA_LINKINFO);
if (r < 0) {
@@ -427,11 +434,11 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
return r;
}
- if (netdev->ifindex > 0) {
- if (netdev->ifindex == ifindex)
- return 0;
- else
- return -EEXIST;
+ if (netdev->ifindex > 0 && netdev->ifindex != ifindex) {
+ log_error_netdev(netdev, "Could not set ifindex to %d, already set to %d",
+ ifindex, netdev->ifindex);
+ netdev_enter_failed(netdev);
+ return -EEXIST;
}
netdev->ifindex = ifindex;