On Sun, Oct 12, 2008 at 21:55:54 +0100, Jose Calhariz wrote:

> xorp don't build because of a g++ error:
> 
> cc1plus: warnings being treated as errors
> io_link_pcap.cc: In member function 'int 
> IoLinkPcap::join_leave_multicast_group(bool, const Mac&, std::string&)':
> io_link_pcap.cc:419: warning: cast from 'uint8_t*' to 'ifreq*' increases 
> required alignment of target type
> 
The attached patch was build-tested on sparc and should fix this afaict.

Cheers,
Julien
diff -u xorp-1.5/debian/changelog xorp-1.5/debian/changelog
--- xorp-1.5/debian/changelog
+++ xorp-1.5/debian/changelog
@@ -1,3 +1,10 @@
+xorp (1.5-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Don't cast uint8t* to struct ifreq*.
+
+ -- Julien Cristau <[EMAIL PROTECTED]>  Sun, 12 Oct 2008 19:34:44 +0000
+
 xorp (1.5-4) unstable; urgency=low
 
   * Upload to unstable as requested by release team. Amongst 
--- xorp-1.5.orig/fea/data_plane/io/io_link_pcap.cc
+++ xorp-1.5/fea/data_plane/io/io_link_pcap.cc
@@ -415,11 +415,14 @@
     // On NetBSD and OpenBSD we need to use ifreq.ifr_addr with sa_family
     // of AF_UNSPEC.
     //
-    uint8_t buffer[sizeof(struct ifreq) + sizeof(struct sockaddr_storage)];
-    struct ifreq* ifreq_p = reinterpret_cast<struct ifreq *>(&buffer[0]);
+    struct {
+        struct ifreq r;
+       struct sockaddr_storage s;
+    } buffer;
+    struct ifreq* ifreq_p = &buffer.r;
     struct sockaddr* sa = NULL;
 
-    memset(buffer, 0, sizeof(buffer));
+    memset(&buffer, 0, sizeof(buffer));
     strlcpy(ifreq_p->ifr_name, vif_name().c_str(), sizeof(ifreq_p->ifr_name));
 #ifdef HAVE_STRUCT_IFREQ_IFR_HWADDR
     sa = &ifreq_p->ifr_hwaddr;

Reply via email to