Bug#385018: racoon: patch for sigbus on sparc platform

2010-02-23 Thread Stefan Bauer
William,

a new version just entered unstable. Could you please test if your
problem still persists as there have been many changes by upstream
in the past years.

If you still have the problem on your sparc system, i will check
with upstream howto integrate your patch (thanks!) in the latest
version.

Stefan
-- 
Stefan Bauer -
PGP: E80A 50D5 2D46 341C A887 F05D 5C81 5858 DCEF 8C34
 plzk.de - Linux - because it works --



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#385018: racoon: patch for sigbus on sparc platform

2007-07-25 Thread William
I found it was caused by a struct from the kernel's netlink code being
copied into a char buffer causing it to be unaligned.

I have attached a fix.

-- William
--- old/ipsec-tools-0.6.6/src/racoon/grabmyaddr.c	2007-07-25 17:42:41.0 -0700
+++ new/ipsec-tools-0.6.6/src/racoon/grabmyaddr.c	2007-07-25 18:06:08.0 -0700
@@ -124,16 +124,23 @@
 
 static void recvaddrs(int fd, struct ifaddrs **ifa, __u32 seq)
 {
-	char	buf[8192];
+#define NL_BUFFER_SIZE NLMSG_SPACE(8192)
+	struct nlmsghdr *nlh = NULL;
 	struct sockaddr_nl nladdr;
-	struct iovec iov = { buf, sizeof(buf) };
+	struct iovec iov;
 	struct ifaddrmsg *m;
 	struct rtattr * rta_tb[IFA_MAX+1];
 	struct ifaddrs *I;
 
+	nlh = (struct nlmsghdr*)malloc(NL_BUFFER_SIZE);
+	memset(nlh, 0, NL_BUFFER_SIZE);
+
+	iov.iov_base = (void*)nlh;
+	iov.iov_len = NL_BUFFER_SIZE;
+
 	while (1) {
 		int status;
-		struct nlmsghdr *h;
+		struct nlmsghdr *h = nlh;
 
 		struct msghdr msg = {
 			(void*)nladdr, sizeof(nladdr),
@@ -153,7 +160,6 @@
 		if (nladdr.nl_pid) /* Message not from kernel */
 			continue;
 
-		h = (struct nlmsghdr*)buf;
 		while (NLMSG_OK(h, status)) {
 			if (h-nlmsg_seq != seq)
 goto skip_it;
@@ -210,6 +216,7 @@
 		if (msg.msg_flags  MSG_TRUNC)
 			continue;
 	}
+	free(nlh);
 	return;
 }