struct sockaddr_in* sin = p;
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = addr;
+#ifdef NMRPFLASH_BSD
+ ((struct sockaddr*)p)->sa_len = sizeof(struct sockaddr_in);
+#endif
}
#ifndef NMRPFLASH_WINDOWS
}
#else // NMRPFLASH_OSX (or any other BSD)
struct ifaliasreq ifra;
+ memset(&ifra, 0, sizeof(ifra));
strncpy(ifra.ifra_name, sock->intf, IFNAMSIZ);
set_addr(&ifra.ifra_addr, ipaddr);
set_addr(&ifra.ifra_mask, ipmask);
//set_addr(&ifra.ifra_broadaddr, (ipaddr & ipmask) | ~ipmask);
- memset(&ifra.ifra_broadaddr, 0, sizeof(ifra.ifra_broadaddr));
if (ioctl(fd, add ? SIOCAIFADDR : SIOCDIFADDR, &ifra) != 0) {
perror(add ? "ioctl(SIOCAIFADDR)" : "ioctl(SIOCDIFADDR)");
#include <stdbool.h>
#if defined(_WIN32) || defined(_WIN64)
-#define NMRPFLASH_WINDOWS
-#elif defined(__linux__)
-#define NMRPFLASH_LINUX
-#elif defined(__APPLE__) && defined(__MACH__)
-#define NMRPFLASH_OSX
-#elif defined(__unix__)
-#define NMRPFLASH_UNIX
-#warning "nmrpflash is not fully supported on your operating system"
+# define NMRPFLASH_WINDOWS
+#else
+# define NMRPFLASH_UNIX
+# if defined(__linux__)
+# define NMRPFLASH_LINUX
+# elif defined(__APPLE__) && defined(__MACH__)
+# define NMRPFLASH_OSX
+# define NMRPFLASH_BSD
+# elif defined(__unix__)
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
+# define NMRPFLASH_BSD
+# else
+# warning "nmrpflash is not fully supported on your operating system"
+# endif
+# endif
#endif
#ifndef NMRPFLASH_WINDOWS