jacobstanley/network-info

Builing on hurd

nomeata opened this issue · 4 comments

I just received this patch from Samuel Thibault at http://bugs.debian.org/749047 that makes it build on hurd-i386:

--- haskell-network-info-0.2.0.3/cbits/network-unix.c.original  2014-05-23 13:33:44.000000000 +0200
+++ haskell-network-info-0.2.0.3/cbits/network-unix.c   2014-05-23 13:36:24.000000000 +0200
@@ -12,8 +12,10 @@
 #else
 #   include <sys/socket.h>
 #   include <net/if.h>
+#   ifndef __GNU__
 #   include <net/if_dl.h>
-#   define AF_PACKET AF_LINK
+#       define AF_PACKET AF_LINK
+#   endif
 #endif

 #ifdef __FreeBSD__
@@ -24,6 +26,7 @@
 #include "common.h"


+#ifdef AF_PACKET
 void maccopy(unsigned char *dst, struct sockaddr *addr)
 {
 #ifdef __linux__
@@ -35,6 +38,7 @@
     memcpy(dst, sdl->sdl_data + sdl->sdl_nlen, MAC_SIZE);
 #endif
 }
+#endif

 struct network_interface *add_interface(struct network_interface *ns, const wchar_t *name, int max_ns)
 {
@@ -98,8 +102,10 @@
             ipv4copy(&n->ip_address, addr);
         } else if (family == AF_INET6) {
             ipv6copy(&n->ip6_address, addr);
+#ifdef AF_PACKET
         } else if (family == AF_PACKET) {
             maccopy(n->mac_address, addr);
+#endif
         }
     }

Please consider including it in the next release.

Thanks for the patch, I have some time off this week so I'll a look on
Wednesday or so.

On Friday, 23 May 2014, Joachim Breitner notifications@github.com wrote:

I just received this patch from Samuel Thibault at
http://bugs.debian.org/749047 that makes it build on hurd-i386:

--- haskell-network-info-0.2.0.3/cbits/network-unix.c.original 2014-05-23 13:33:44.000000000 +0200
+++ haskell-network-info-0.2.0.3/cbits/network-unix.c 2014-05-23 13:36:24.000000000 +0200
@@ -12,8 +12,10 @@
#else

include <sys/socket.h>

include <net/if.h>

+# ifndef GNU

include <net/if_dl.h>

-# define AF_PACKET AF_LINK
+# define AF_PACKET AF_LINK
+# endif
#endif

#ifdef FreeBSD
@@ -24,6 +26,7 @@
#include "common.h"

+#ifdef AF_PACKET
void maccopy(unsigned char *dst, struct sockaddr *addr)
{
#ifdef linux
@@ -35,6 +38,7 @@
memcpy(dst, sdl->sdl_data + sdl->sdl_nlen, MAC_SIZE);
#endif
}
+#endif

struct network_interface *add_interface(struct network_interface *ns, const wchar_t *name, int max_ns)
{
@@ -98,8 +102,10 @@
ipv4copy(&n->ip_address, addr);
} else if (family == AF_INET6) {
ipv6copy(&n->ip6_address, addr);
+#ifdef AF_PACKET
} else if (family == AF_PACKET) {
maccopy(n->mac_address, addr);
+#endif
}
}

Please consider including it in the next release.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9
.

@jystic I'm testing a slight variation on this combining @nomeata's and @rmustacc's patches that should also fix Solaris and the Illumos distros like SmartOS, OmniOS, OpenIndiana, etc.

Here's the WIP:
https://gist.github.com/AlainODea/038944c0786eeed19917

I'll test this and get a proper PR attached.

Thank you! I'll hold off on the other issues and wait for this one.

Fixed in 0.2.0.4