diff -Nur olsrd-f52f9d22fd83.orig/src/lq_plugin.c olsrd-f52f9d22fd83/src/lq_plugin.c
--- olsrd-f52f9d22fd83.orig/src/lq_plugin.c	2008-05-27 12:38:03.000000000 +0200
+++ olsrd-f52f9d22fd83/src/lq_plugin.c	2008-05-28 09:56:01.000000000 +0200
@@ -51,6 +51,8 @@
 #include "lq_plugin_default_float.h"
 #include "lq_plugin_default_fpm.h"
 
+#include <assert.h>
+
 struct avl_tree lq_handler_tree;
 struct lq_handler *active_lq_handler = NULL;
 
@@ -131,6 +133,7 @@
 olsr_linkcost
 olsr_calc_tc_cost(const struct tc_edge_entry *tc_edge)
 {
+  assert((const char *)tc_edge + sizeof(*tc_edge) == tc_edge->linkquality);
   return active_lq_handler->calc_tc_cost(tc_edge->linkquality);
 }
 
@@ -164,6 +167,7 @@
 olsr_serialize_hello_lq_pair(unsigned char *buff,
 			     struct lq_hello_neighbor *neigh)
 {
+  assert((char *)neigh + sizeof(*neigh) == neigh->linkquality);
   return active_lq_handler->serialize_hello_lq(buff, neigh->linkquality);
 }
 
@@ -180,6 +184,7 @@
 olsr_deserialize_hello_lq_pair(const olsr_u8_t ** curr,
 			       struct hello_neighbor *neigh)
 {
+  assert((char *)neigh + sizeof(*neigh) == neigh->linkquality);
   active_lq_handler->deserialize_hello_lq(curr, neigh->linkquality);
   neigh->cost = active_lq_handler->calc_hello_cost(neigh->linkquality);
 }
@@ -197,6 +202,7 @@
 int
 olsr_serialize_tc_lq_pair(unsigned char *buff, struct tc_mpr_addr *neigh)
 {
+  assert((char *)neigh + sizeof(*neigh) == neigh->linkquality);
   return active_lq_handler->serialize_tc_lq(buff, neigh->linkquality);
 }
 
@@ -211,6 +217,7 @@
 void
 olsr_deserialize_tc_lq_pair(const olsr_u8_t ** curr, struct tc_edge_entry *edge)
 {
+  assert((char *)edge + sizeof(*edge) == edge->linkquality);
   active_lq_handler->deserialize_tc_lq(curr, edge->linkquality);
 }
 
@@ -228,6 +235,7 @@
 olsr_update_packet_loss_worker(struct link_entry *entry, olsr_bool lost)
 {
   olsr_linkcost lq;
+  assert((char *)entry + sizeof(*entry) == entry->linkquality);
   lq = active_lq_handler->packet_loss_handler(entry, entry->linkquality, lost);
 
   if (olsr_is_relevant_costchange(lq, entry->linkcost)) {
@@ -260,7 +268,9 @@
 olsr_memorize_foreign_hello_lq(struct link_entry *local,
 			       struct hello_neighbor *foreign)
 {
+  assert((char *)local + sizeof(*local) == local->linkquality);
   if (foreign) {
+    assert((char *)foreign + sizeof(*foreign) == foreign->linkquality);
     active_lq_handler->memorize_foreign_hello(local->linkquality,
 					      foreign->linkquality);
   } else {
@@ -282,6 +292,7 @@
 const char *
 get_link_entry_text(struct link_entry *entry, struct lqtextbuffer *buffer)
 {
+  assert((char *)entry + sizeof(*entry) == entry->linkquality);
   return active_lq_handler->print_hello_lq(entry->linkquality, buffer);
 }
 
@@ -299,6 +310,7 @@
 const char *
 get_tc_edge_entry_text(struct tc_edge_entry *entry, struct lqtextbuffer *buffer)
 {
+  assert((char *)entry + sizeof(*entry) == entry->linkquality);
   return active_lq_handler->print_tc_lq(entry->linkquality, buffer);
 }
 
@@ -343,6 +355,8 @@
 void
 olsr_copy_hello_lq(struct lq_hello_neighbor *target, struct link_entry *source)
 {
+  assert((char *)target + sizeof(*target) == target->linkquality);
+  assert((char *)source + sizeof(*source) == source->linkquality);
   memcpy(target->linkquality, source->linkquality,
 	 active_lq_handler->hello_lq_size);
 }
@@ -360,6 +374,8 @@
 olsr_copylq_link_entry_2_tc_mpr_addr(struct tc_mpr_addr *target,
 				     struct link_entry *source)
 {
+  assert((char *)target + sizeof(*target) == target->linkquality);
+  assert((char *)source + sizeof(*source) == source->linkquality);
   active_lq_handler->copy_link_lq_into_tc(target->linkquality,
 					  source->linkquality);
 }
@@ -377,6 +393,8 @@
 olsr_copylq_link_entry_2_tc_edge_entry(struct tc_edge_entry *target,
 				       struct link_entry *source)
 {
+  assert((char *)target + sizeof(*target) == target->linkquality);
+  assert((char *)source + sizeof(*source) == source->linkquality);
   active_lq_handler->copy_link_lq_into_tc(target->linkquality,
 					  source->linkquality);
 }
@@ -391,6 +409,7 @@
 void
 olsr_clear_tc_lq(struct tc_mpr_addr *target)
 {
+  assert((char *)target + sizeof(*target) == target->linkquality);
   active_lq_handler->clear_tc(target->linkquality);
 }
 
@@ -413,6 +432,7 @@
     olsr_malloc(sizeof(struct hello_neighbor) +
 		active_lq_handler->hello_lq_size, id);
 
+  assert((char *)h + sizeof(*h) == h->linkquality);
   active_lq_handler->clear_hello(h->linkquality);
   return h;
 }
@@ -435,6 +455,7 @@
   t =
     olsr_malloc(sizeof(struct tc_mpr_addr) + active_lq_handler->tc_lq_size, id);
 
+  assert((char *)t + sizeof(*t) == t->linkquality);
   active_lq_handler->clear_tc(t->linkquality);
   return t;
 }
@@ -458,6 +479,7 @@
     olsr_malloc(sizeof(struct lq_hello_neighbor) +
 		active_lq_handler->hello_lq_size, id);
 
+  assert((char *)h + sizeof(*h) == h->linkquality);
   active_lq_handler->clear_hello(h->linkquality);
   return h;
 }
@@ -481,6 +503,7 @@
     olsr_malloc(sizeof(struct link_entry) + active_lq_handler->hello_lq_size,
 		id);
 
+  assert((char *)h + sizeof(*h) == h->linkquality);
   active_lq_handler->clear_hello(h->linkquality);
   return h;
 }
