Source: mahimahi
Severity: normal
Tags: patch

Dear Maintainer,

The package mahimahi fails to build from source on ppc64el with the error

  netdevice.cc: In constructor 'TunDevice::TunDevice(const string&, const 
Address&, const Address&)':
  netdevice.cc:27:69: error: overflow in implicit constant conversion 
[-Werror=overflow]
                        [] ( ifreq &ifr ) { ifr.ifr_flags = IFF_TUN; } );

Full log at 
https://buildd.debian.org/status/fetch.php?pkg=mahimahi&arch=ppc64el&ver=0.91-1&stamp=1445122100

That is caused by the usage of macro TUNSETIFF defined in tun_if.h.
Its value is actually 8 bytes long, but it is being passed to a const int
within interface_ioctl function.
It fails because that value is greater than the range of a signed int on
ppc64el, which causes an overflow.

Changing the parameter of the function from const int request to unsigned
long request fixes it and it does not affect ioctl, since it also expects
an unsigned long value.

With the patch attached it builds with no errors.

Thanks.

Fernando
diff -Nru mahimahi-0.91/debian/changelog mahimahi-0.91/debian/changelog
--- mahimahi-0.91/debian/changelog	2015-10-17 12:55:49.000000000 +0000
+++ mahimahi-0.91/debian/changelog	2015-11-26 17:40:59.000000000 +0000
@@ -1,3 +1,12 @@
+mahimahi (0.91-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/patches/tunsetiff-long.patch: this patch changes the type of a variable
+    used in netdevice.cc to long, since it is causing the compilation to break due
+    to overflow
+
+ -- Fernando Seiti Furusato <ferse...@br.ibm.com>  Thu, 26 Nov 2015 17:40:00 +0000
+
 mahimahi (0.91-1) unstable; urgency=low
 
   * mm-webreplay now supports persistent HTTP connections (Deepak Narayanan)
diff -Nru mahimahi-0.91/debian/patches/series mahimahi-0.91/debian/patches/series
--- mahimahi-0.91/debian/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ mahimahi-0.91/debian/patches/series	2015-11-26 17:27:33.000000000 +0000
@@ -0,0 +1 @@
+tunsetiff-long.patch
diff -Nru mahimahi-0.91/debian/patches/tunsetiff-long.patch mahimahi-0.91/debian/patches/tunsetiff-long.patch
--- mahimahi-0.91/debian/patches/tunsetiff-long.patch	1970-01-01 00:00:00.000000000 +0000
+++ mahimahi-0.91/debian/patches/tunsetiff-long.patch	2015-11-26 17:29:17.000000000 +0000
@@ -0,0 +1,40 @@
+Index: mahimahi-0.91/src/util/netdevice.cc
+===================================================================
+--- mahimahi-0.91.orig/src/util/netdevice.cc
++++ mahimahi-0.91/src/util/netdevice.cc
+@@ -29,7 +29,7 @@ TunDevice::TunDevice( const string & nam
+     assign_address( name, addr, peer );
+ }
+ 
+-void interface_ioctl( FileDescriptor & fd, const int request,
++void interface_ioctl( FileDescriptor & fd, const unsigned long request,
+                       const string & name,
+                       function<void( ifreq &ifr )> ifr_adjustment)
+ {
+@@ -42,7 +42,7 @@ void interface_ioctl( FileDescriptor & f
+     SystemCall( "ioctl " + name, ioctl( fd.fd_num(), request, static_cast<void *>( &ifr ) ) );
+ }
+ 
+-void interface_ioctl( const int request,
++void interface_ioctl( const unsigned long request,
+                       const string & name,
+                       function<void( ifreq &ifr )> ifr_adjustment)
+ {
+Index: mahimahi-0.91/src/util/netdevice.hh
+===================================================================
+--- mahimahi-0.91.orig/src/util/netdevice.hh
++++ mahimahi-0.91/src/util/netdevice.hh
+@@ -13,11 +13,11 @@
+ #include "address.hh"
+ 
+ /* general helpers */
+-void interface_ioctl( FileDescriptor & fd, const int request,
++void interface_ioctl( FileDescriptor & fd, const unsigned long request,
+                       const std::string & name,
+                       std::function<void( ifreq &ifr )> ifr_adjustment);
+ 
+-void interface_ioctl( const int request,
++void interface_ioctl( const unsigned long request,
+                       const std::string & name,
+                       std::function<void( ifreq &ifr )> ifr_adjustment);
+ 

Reply via email to