Bug#759534: [libapr1] apr_mcast_interface does not work for IPv6

2014-08-28 Thread Andre Naujoks
Package: libapr1
Version: 1.5.1-2
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

Hi.

When trying to set the mcast interface with apr_mcast_interface(), apr
goes through all interfaces and tries to match the given address to the
interfaces address. This does not work as it is currently implemented in
linux, since the match is tried by comparing (memcmp()) the sin6_addr
field of the given struct sockaddr_in6 and sa_data from a  generic
struct sockaddr, which do not line up.

The attached patch fix_ipv6_find_if_index.patch fixes this for me.

Also attached is a test program, that does not work correctly without
the patch applied. The program goes through all interfaces of a host,
chooses the ipv6 ones, that are not the loopback device, and tries to
send a multicast packet on each address.

There has to be a second ipv6 interface, for this error to actually have
any effect.

Regards
  nautsch


--- System information. ---
Architecture: amd64
Kernel:   Linux 3.14-2-amd64

Debian Release: jessie/sid
  500 unstableftp.de.debian.org   500 stable  ftp.uni-kl.de
--- Package information. ---
Depends   (Version) | Installed
===-+-===
libc6 (= 2.15) | libuuid1  (= 2.16) |

Package's Recommends field is empty.

Package's Suggests field is empty.

Index: apr-1.5.1/network_io/unix/multicast.c
===
--- apr-1.5.1.orig/network_io/unix/multicast.c
+++ apr-1.5.1/network_io/unix/multicast.c
@@ -62,7 +62,7 @@ static unsigned int find_if_index(const
 for (ifp = ifs; ifp; ifp = ifp-ifa_next) {
 if (ifp-ifa_addr != NULL  ifp-ifa_addr-sa_family == AF_INET6) {
 if (memcmp(iface-sa.sin6.sin6_addr,
-   ifp-ifa_addr-sa_data[0],
+   ((struct sockaddr_in6*)ifp-ifa_addr)-sin6_addr,
sizeof(iface-sa.sin6.sin6_addr)) == 0) {
 index = if_nametoindex(ifp-ifa_name);
 break;

#include stdlib.h
#include stdio.h
#include unistd.h

#include netdb.h
#include sys/ioctl.h
#include net/if.h
#include ifaddrs.h
#include sys/socket.h
#include sys/types.h
#include arpa/inet.h

#include apr.h
#include apr_errno.h
#include apr_network_io.h

#define BCADDR_SITE ff15::1234

#define MC_PORT 3

int main(int argc, char **argv)
{
	apr_socket_t *s;
	apr_sockaddr_t *addr;
	apr_pool_t *pool;
	apr_status_t err;
	char buffer[1024];

	apr_initialize();
	atexit(apr_terminate);

	apr_pool_create(pool, NULL);

	if ((err = apr_socket_create(s, APR_INET6, SOCK_DGRAM, 0, pool)) != APR_SUCCESS) {
		fprintf(stderr, failed to create socket\n);
		return 1;
	}

	if ((err = apr_sockaddr_info_get(addr, BCADDR_SITE, APR_INET6, MC_PORT, 0, pool)) != APR_SUCCESS) {
		fprintf(stderr, could not create mcast addrinfo %s\n, apr_strerror(err, buffer, 1024));
		return 1;
	}

	{
		struct ifaddrs *ifaddrs;
		struct ifaddrs *ia;
		getifaddrs(ifaddrs);

		for (ia = ifaddrs; ia; ia = ia-ifa_next) {
			apr_sockaddr_t *src_addr;
			char addr_str[INET6_ADDRSTRLEN + 1];
			apr_size_t len = 6;
			apr_status_t ret;

			if (!ia-ifa_addr) {
continue;
			}

			switch (ia-ifa_addr-sa_family) {
case AF_INET6:
	// we cannot send multicasts on the loopback interface
	if (IN6_IS_ADDR_LOOPBACK(((struct sockaddr_in6*)ia-ifa_addr)-sin6_addr)) {
		continue;
	}
	if (inet_ntop(AF_INET6, ((struct sockaddr_in6*)ia-ifa_addr)-sin6_addr, addr_str, INET6_ADDRSTRLEN) == NULL) {
		fprintf(stderr, failed to create string v6 address: %s\n, strerror(errno));
		return 1;
	}
	fprintf(stderr, v6 addr: %s belongs to device %d\n, addr_str, if_nametoindex(ia-ifa_name));
	break;
default:
	continue;
			}

			if ((ret = apr_sockaddr_info_get(src_addr, addr_str, APR_INET6, MC_PORT, 0, pool)) != APR_SUCCESS) {
fprintf(stderr, could no create sockaddr for mcast_interface %s\n, apr_strerror(ret, buffer, 1024));
return 1;
			}

			if (apr_mcast_interface(s, src_addr) != APR_SUCCESS) {
fprintf(stderr, could not set mcast interface);
return 1;
			}

			if ((err = apr_socket_sendto(s, addr, 0, hallo\n, len)) != APR_SUCCESS) {
fprintf(stderr, failed to send %s\n, apr_strerror(err, buffer, 1024));
return 1;
			}
			fprintf(stderr, sent\n);
		}

		freeifaddrs(ifaddrs);
	}

	return 0;
}


Bug#718789: marked as done (apache2: upgrade wheezy - testing (2.4.6-2) wiped out all of my log files)

2014-08-28 Thread Debian Bug Tracking System
Your message dated Thu, 28 Aug 2014 21:34:56 +0200
with message-id 2592698.1AEn6E1TGf@k
and subject line Bug#718789: apache2: upgrade wheezy - testing (2.4.6-2) wiped 
out all of my log files
has caused the Debian Bug report #718789,
regarding apache2: upgrade wheezy - testing (2.4.6-2) wiped out all of my log 
files
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
718789: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718789
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
---BeginMessage---
Package: apache2
Version: 2.4.6-2
Severity: serious
Justification: causes data loss

I discovered that on upgrading from wheezy to the current testing,
which has just had 2.4.6-2 migrating to it, the entire contents of
/var/log/apache2 were blitzed.  I'm guessing that what I did was to
purge apache2.2-common, not realising the effects of this.  Although
there is the protection in it about not purging if upgrading to 2.4,
it seems that somehow the timings didn't work out correctly and the
purge took place anyway.

There's no simple or obvious solution to this, I guess, except to
provide a transitional apache2.2-common package with apache2 which
doesn't purge the log files on purge, now that this task has been
taken over by a different package.  The description would presumably
say: This package may be purged after apache2 version 2.4.6 or higher
has been installed; purging prior to this may result in the loss of
historical log files.

   Julian
---End Message---
---BeginMessage---
version: 2.4.10-1

This should be fixed now that a transitional apache2.2-common package 
has been introduced.---End Message---


Bug#719097: marked as done (apache2-bin: removes most local configuration and logs on update)

2014-08-28 Thread Debian Bug Tracking System
Your message dated Thu, 28 Aug 2014 21:34:56 +0200
with message-id 2592698.1AEn6E1TGf@k
and subject line Bug#718789: apache2: upgrade wheezy - testing (2.4.6-2) wiped 
out all of my log files
has caused the Debian Bug report #718789,
regarding apache2-bin: removes most local configuration and logs on update
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
718789: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718789
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
---BeginMessage---
Package: apache2-bin
Version: 2.4.6-2
Severity: important

Dear Maintainer,

upon upgrading, most of my local configuration and logs were removed!

There are two problems here, both serious ones.

First,I cannot recover the logs that were recorded from the moment of
the backup to the moment of the installation.

Second, I found myself with a nonfunctional web site which requires a
significant amount of work to be on line again.  While I understand that
this perhaps may be necessary due to the major revision upgrade, I
received no notice that I was going to put my web server offline.  This
is not what is expected upon upgrade.

Moreover, I had to recover many configuration files and symbolic links
from a backup.  This is not expected from an upgrade either.


-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'testing-proposed-updates'), (101, 
'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apache2-bin depends on:
ii  libapr11.4.8-1
ii  libaprutil11.5.2-1
ii  libaprutil1-dbd-mysql  1.5.2-1
ii  libaprutil1-ldap   1.5.2-1
ii  libc6  2.17-7
ii  libcap21:2.22-1.2
ii  libldap-2.4-2  2.4.31-1+nmu2
ii  liblua5.1-05.1.5-4
ii  libpcre3   1:8.31-2
ii  libssl1.0.01.0.1e-3
ii  libxml22.9.1+dfsg1-2
ii  perl   5.14.2-21
ii  zlib1g 1:1.2.8.dfsg-1

apache2-bin recommends no packages.

Versions of packages apache2-bin suggests:
ii  apache2-doc 2.4.6-2
ii  apache2-suexec-custom   2.4.6-2
ii  elinks [www-browser]0.12~pre6-1
ii  epiphany-browser [www-browser]  3.4.2-2.1
ii  galeon [www-browser]2.0.7-2.1+b1
ii  iceweasel [www-browser] 10.0.12esr-1+nmu1
ii  lynx-cur [www-browser]  2.8.8dev.12-2
ii  w3m [www-browser]   0.5.3-8

Versions of packages apache2 depends on:
ii  apache2-data  2.4.6-2
ii  lsb-base  4.1+Debian12
ii  mime-support  3.54
ii  perl  5.14.2-21
ii  procps1:3.3.4-2

Versions of packages apache2 recommends:
ii  ssl-cert  1.0.32

Versions of packages apache2 suggests:
ii  apache2-doc 2.4.6-2
ii  apache2-suexec-custom   2.4.6-2
ii  apache2-utils   2.4.6-2
ii  elinks [www-browser]0.12~pre6-1
ii  epiphany-browser [www-browser]  3.4.2-2.1
ii  galeon [www-browser]2.0.7-2.1+b1
ii  iceweasel [www-browser] 10.0.12esr-1+nmu1
ii  lynx-cur [www-browser]  2.8.8dev.12-2
ii  w3m [www-browser]   0.5.3-8

Versions of packages apache2-bin is related to:
ii  apache2  2.4.6-2
ii  apache2-bin  2.4.6-2

-- no debconf information
---End Message---
---BeginMessage---
version: 2.4.10-1

This should be fixed now that a transitional apache2.2-common package 
has been introduced.---End Message---