Hello,
I cross-compiled barry (precisely pppob) in order to use it on a embedded ARM platform. Launching pppob resulted in SIGBUS caused by alignment trap. While the simple workaround of setting up the kernel to correct alignment worked fine (eg : echo 3 > /proc/cpu/alignment), as it wasn't a good solution, I tried to fix the problem on the source code.
You'll find attached the corresponding patch.
I manually do compute the size with a packet[2] + 256 * packet[3] rather than performing a cast on misaligned data. I must warn that I'm not at ease with such things as alignment, or endianness.

I hope that fix is correct and please be kind, it's my first submission ever !

--
Nicolas CARRIER - 6122 - 2ème centre

diff -ruN barry-0.17.1.orig//src/probe.cc barry-0.17.1.work//src/probe.cc
--- barry-0.17.1.orig//src/probe.cc	2011-03-01 23:49:16.000000000 +0100
+++ barry-0.17.1.work//src/probe.cc	2011-04-29 16:10:13.957304089 +0200
@@ -58,7 +58,7 @@
 
 	unsigned int GetSize(const unsigned char *packet)
 	{
-		uint16_t size = *((uint16_t *)&packet[2]);
+		uint16_t size = packet[2] + 256 * packet[3];
 		return btohs(size);
 	}
 
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to