[OLSR-users] Plugin development: how to avoid buffer/packet size overrun when olsr message is of dynamic length.

Christoffer Andersson (spam-protected)
Tue Jul 13 14:44:31 CEST 2004

I am making a plugin where I am adding a packet transform function (add_ptf) to check a packet and add an extra olsr messge at the end.

This ekstra olsr message checks the messages in the packet to build its own message.

This olsr message is therefore dynamic in size.  So far I have come up with the following solution:

Assume that I have to add data from every olsr message in the packet.
Find out how much space my new olsr message needs if the packet contains the maximum possible number of the smallest messages in olsr (which is HELLO?).
Limit the packet size so that I can always add my message in this scenario, hence never exceeding the packet size.

1. Is this a valid approach?

2. I am struggling a bit in the code of the secure plugin to find out how you limited the packet size 
to make sure that you always have room for the signature at the end of the packet.  I can tell that you 
have defined a MAXMESSAGESIZE of 512, but I cannot see where or how you use this to tell olsr that it
has to leave room for the signature to avoid packet buffer overrun, or max packet size overrun.

Any help concerning how to make olsr limit the packet size so that I will always have room for my max-size dynamic message
would be appreciated.

Christoffer Andersson,
Thales Communications Norway

More information about the Olsr-users mailing list