[Pkg-haskell-commits] darcs: haskell-network-info: Add patch by Alain O'Dea to increase hurd compatibitliy (Closes: #749047)
Joachim Breitner
mail at joachim-breitner.de
Fri Jun 13 04:26:43 UTC 2014
Fri Jun 13 04:03:10 UTC 2014 Joachim Breitner <mail at joachim-breitner.de>
* Add patch by Alain O'Dea to increase hurd compatibitliy (Closes: #749047)
M ./changelog +1
A ./patches/
A ./patches/hurd-af-packet.patch
A ./patches/series
Fri Jun 13 04:03:10 UTC 2014 Joachim Breitner <mail at joachim-breitner.de>
* Add patch by Alain O'Dea to increase hurd compatibitliy (Closes: #749047)
diff -rN -u old-haskell-network-info/changelog new-haskell-network-info/changelog
--- old-haskell-network-info/changelog 2014-06-13 04:26:43.104038976 +0000
+++ new-haskell-network-info/changelog 2014-06-13 04:26:43.112038979 +0000
@@ -1,6 +1,7 @@
haskell-network-info (0.2.0.3-3) UNRELEASED; urgency=low
* Adjust watch file to new hackage layout
+ * Add patch by Alain O'Dea to increase hurd compatibitliy (Closes: #749047)
-- Joachim Breitner <nomeata at debian.org> Sat, 05 Oct 2013 18:21:09 +0200
diff -rN -u old-haskell-network-info/patches/hurd-af-packet.patch new-haskell-network-info/patches/hurd-af-packet.patch
--- old-haskell-network-info/patches/hurd-af-packet.patch 1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-network-info/patches/hurd-af-packet.patch 2014-06-13 04:26:43.112038979 +0000
@@ -0,0 +1,80 @@
+From 85eef5009bf7f4629abe9289efa86357bf39dff2 Mon Sep 17 00:00:00 2001
+From: Alain O'Dea <alain.odea at verafin.com>
+Date: Wed, 11 Jun 2014 12:20:39 +0000
+Subject: [PATCH] PORTABILITY: Hurd, Illumos (Fixes #8, #9, #10)
+
+The core of the issue with building on non-GNU/Linux Unix platforms is
+redefining **AF_PACKET** or using APIs it indicates exist on platforms where
+they are absent.
+
+Hurd has no underlying **AF_PACKET** dependent pieces so **maccopy()** can't
+work out of the box on that platform.
+
+Illumos (captured here by `__sun__`) does not define `__GNU__` because it
+isn't a GNU platform, but does define **AF_PACKET** and provide compatible
+backing APIs.
+
+This represents a merge of two existing works and is not original work on its
+own.
+
+Credit for original work:
+
+ - @rmustacc provided Illumos/SmartOS aspects
+ - @nomeata provided @sthibaul's Hurd aspects: http://bugs.debian.org/749047
+---
+ cbits/network-unix.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/cbits/network-unix.c b/cbits/network-unix.c
+index eb6310c..f406269 100644
+--- a/cbits/network-unix.c
++++ b/cbits/network-unix.c
+@@ -12,8 +12,12 @@
+ #else
+ # include <sys/socket.h>
+ # include <net/if.h>
+-# include <net/if_dl.h>
+-# define AF_PACKET AF_LINK
++# ifndef __GNU__
++# include <net/if_dl.h>
++# ifndef __sun__
++# define AF_PACKET AF_LINK
++# endif
++# endif
+ #endif
+
+ #ifdef __FreeBSD__
+@@ -24,9 +28,10 @@
+ #include "common.h"
+
+
++#ifdef AF_PACKET
+ void maccopy(unsigned char *dst, struct sockaddr *addr)
+ {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__sun__)
+ /* TODO check that sll_halen is equal to 6 (MAC_SIZE) */
+ memcpy(dst, ((struct sockaddr_ll *)addr)->sll_addr, MAC_SIZE);
+ #else
+@@ -35,6 +40,7 @@ void maccopy(unsigned char *dst, struct sockaddr *addr)
+ 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 +104,10 @@ int c_get_network_interfaces(struct network_interface *ns, int max_ns)
+ 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
+ }
+ }
+
+--
+1.9.3
+
diff -rN -u old-haskell-network-info/patches/series new-haskell-network-info/patches/series
--- old-haskell-network-info/patches/series 1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-network-info/patches/series 2014-06-13 04:26:43.112038979 +0000
@@ -0,0 +1 @@
+hurd-af-packet.patch
More information about the Pkg-haskell-commits
mailing list