summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-04-18 10:28:42 +0200
committerTom Gundersen <teg@jklm.no>2014-04-19 18:41:58 +0200
commitc6315a7afc905c0b41901cf8e204306296ebb640 (patch)
tree597fd7352056b32e43e4ae907253e6873dfd5fe5 /src
parentcdc85c875b842b9309f72caefc51c262f521cf92 (diff)
networkd: netdev - verify name of newlink messages
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-netdev.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 075a8790a0..30cb74b8b7 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -375,6 +375,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
uint16_t type;
const char *kind;
char *received_kind;
+ char *received_name;
int r, ifindex;
assert(netdev);
@@ -391,6 +392,19 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
return -EINVAL;
}
+ r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &received_name);
+ if (r < 0) {
+ log_error_netdev(netdev, "Could not get IFNAME");
+ return r;
+ }
+
+ if (!streq(netdev->name, received_name)) {
+ log_error_netdev(netdev, "Received newlink with wrong IFNAME %s",
+ received_name);
+ netdev_enter_failed(netdev);
+ return r;
+ }
+
r = sd_rtnl_message_enter_container(message, IFLA_LINKINFO);
if (r < 0) {
log_error_netdev(netdev, "Could not get LINKINFO");
@@ -417,7 +431,8 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
}
if (!streq(kind, received_kind)) {
- log_error_netdev(netdev, "Received newlink with wrong KIND");
+ log_error_netdev(netdev, "Received newlink with wrong KIND %s, "
+ "expected %s", received_kind, kind);
netdev_enter_failed(netdev);
return r;
}