clean up and fix system-dummy addr/route messages
[project/netifd.git] / system.h
index 701e44a89ca7c2357d8b96556bcfa865a846ed26..7716fbd029ab86b0ebe8834fb7b8523faab16ec0 100644 (file)
--- a/system.h
+++ b/system.h
@@ -16,6 +16,7 @@
 
 #include <sys/time.h>
 #include <sys/socket.h>
+#include <arpa/inet.h>
 #include "device.h"
 #include "interface-ip.h"
 
@@ -49,6 +50,22 @@ struct bridge_config {
        int max_age;
 };
 
+static inline int system_get_addr_family(unsigned int flags)
+{
+       if ((flags & DEVADDR_FAMILY) == DEVADDR_INET6)
+               return AF_INET6;
+       else
+               return AF_INET;
+}
+
+static inline int system_get_addr_len(unsigned int flags)
+{
+       if ((flags & DEVADDR_FAMILY) == DEVADDR_INET6)
+               return sizeof(struct in_addr);
+       else
+               return sizeof(struct in6_addr);
+}
+
 int system_init(void);
 
 int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg);