netifd: Check interface state only when main device is set during interface_change_config
[project/netifd.git] / macvlan.c
index bf81340..9c03cd8 100644 (file)
--- a/macvlan.c
+++ b/macvlan.c
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
+#include <net/ethernet.h>
+
+#ifdef linux
 #include <netinet/ether.h>
+#endif
 
 #include "netifd.h"
 #include "device.h"
@@ -65,6 +69,12 @@ macvlan_base_cb(struct device_user *dev, enum device_event ev)
        case DEV_EVENT_REMOVE:
                device_set_present(&mvdev->dev, false);
                break;
+       case DEV_EVENT_LINK_UP:
+               device_set_link(&mvdev->dev, true);
+               break;
+       case DEV_EVENT_LINK_DOWN:
+               device_set_link(&mvdev->dev, false);
+               break;
        default:
                return;
        }