On Mon, Jun 1, 2009 at 2:35 PM, Sven Eckelmann sven.eckelmann@gmx.de wrote:
Ok, I think I see the problem. The malloc returned a valid aligned adress. list_add_tail will get a pointer to an element in hna_global_entry. This structure is packed and all operations on it should be non-alignment safe. If you look at it further you will notice that orig_list is at position 9 (assuming 4 bytes for a pointer) - which will not be aligned to 4 bytes of course..... And here comes the problem: the compiler will only do the safe operations on non-aligned data if it knows that it is not alignent. Since a cast is done by calling list_add_tail it will not know that this parameter is not aligned and the non-alignment bug will occur.
So my question to marek: Is it really needed to have "struct hna_global_entry" packed in hna.h:57? If not then we should remove it and this problem should be gone. And what is with "struct hna_element".
Thank you for your work, Nathan :)
You are welcome, thanks for your help.
The crashing of batgat on unloading turns out to be socket 4306 not being ready to be reused yet. I worked around this by using: batmand -c -r 0 ; sleep 1 ; batmand -c -g 11000 and batmand -c -g 0 ; sleep 1 ; batmand -c -r 2
Marek helped figure that out on irc.