add functions for setting v4 addresses
authorFelix Fietkau <nbd@openwrt.org>
Wed, 13 Apr 2011 21:13:11 +0000 (23:13 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 13 Apr 2011 21:13:11 +0000 (23:13 +0200)
system-dummy.c
system.h

index aadb64fc0b0f4a09727c6c84058704e1d67a7a35..7e009ba4fc50a6b77efa31fd96b14d9f446fe69d 100644 (file)
@@ -61,3 +61,31 @@ int system_if_check(struct device *dev)
 
        return 0;
 }
+
+int system_add_address(struct device *dev, int family, void *addr, int prefixlen)
+{
+       uint8_t *a = addr;
+
+       if (family == AF_INET) {
+               DPRINTF("ifconfig %s add %d.%d.%d.%d/%d\n",
+                       dev->ifname, a[0], a[1], a[2], a[3], prefixlen);
+       } else {
+               return -1;
+       }
+
+       return 0;
+}
+
+int system_del_address(struct device *dev, int family, void *addr)
+{
+       uint8_t *a = addr;
+
+       if (family == AF_INET) {
+               DPRINTF("ifconfig %s del %d.%d.%d.%d\n",
+                       dev->ifname, a[0], a[1], a[2], a[3]);
+       } else {
+               return -1;
+       }
+
+       return 0;
+}
index f8428ccbe6fee423616c3da8bfb6b3b4c6a38ab1..35f09713f79c0edc31ec2df89e4c40307deda861 100644 (file)
--- a/system.h
+++ b/system.h
@@ -1,6 +1,7 @@
 #ifndef __NETIFD_SYSTEM_H
 #define __NETIFD_SYSTEM_H
 
+#include <sys/socket.h>
 #include "device.h"
 
 int system_bridge_addbr(struct device *bridge);
@@ -15,4 +16,7 @@ int system_if_up(struct device *dev);
 int system_if_down(struct device *dev);
 int system_if_check(struct device *dev);
 
+int system_add_address(struct device *dev, int family, void *addr, int prefixlen);
+int system_del_address(struct device *dev, int family, void *addr);
+
 #endif