[olsr-dev] questions on olsrd IPC protocol

Andreas Tønnesen (spam-protected)
Sat May 21 22:55:58 CEST 2005


Yes there seems to be something supsicious going on there. But the
whole IPC scheme is not maintained any longer as it is about to be
replaced. The whole IPC/GUI code is pretty awfull and was initially
just a hack to have something GUIihs to show non-tech people ;)
For a front-end the httpinfo plugin is recomended for now.

- Andreas

Yuri Karaban wrote:
> Hello
> 
> I'm learning olsrd IPC protocol and found some inconsistency (or most
> probably I missed something).
> 
> (I'm talking about olsrd distribution version 0.4.9)
> 
> In linux-gtk/src/ipc.c in function `ipc_read', line 176:
> 
> Packet length checked with the following expression:
> 
> <code>
>               while(ntohs(msg->v4.olsr_msgsize) < bytes)
>                 {
>                   ipc_evaluate_message(msg);
> </code>
> 
> 
> And passed to `ipc_evaluate_message'.
> 
> In `ipc_evaluate_message', `union olsr_message *' can be casted to
> `struct routemsg *' (line 321) or `struct netmsg *' (line 326).
> 
> If compare `union olsr_message' with `struct routemsg' or `struct
> netmsg' possible to notice that `message size' member located on different offsets:
> 
> struct olsrmsg
> {
>   olsr_u8_t     olsr_msgtype;
>   olsr_u8_t     olsr_vtime;
>   olsr_u16_t    olsr_msgsize;
> ...
> };
> 
> struct netmsg
> {
>   olsr_u8_t      msgtype;
>   olsr_u16_t     size;
> ...
> };
> 
> struct routemsg 
> {
>   olsr_u8_t      msgtype;
>   olsr_u16_t     size;
> ...
> };
> 
> In `struct olsrmsg` (which is the member of `union olsr_message`) size
> memeber is located on base + 2, and in `struct netmsg' and `struct
> routemsg' it located at base + 1. (This offsets are valid for packed
> structure).
> 
> linux-gtk gui works, I can suppouse because not specified that
> structure is packed gcc align uint16_t members on 2 byte boundary. But
> it is fortunity and it is not good to rely on it.
> 
> Please explain me where I can mistake or if I right please make more
> determinate specifications of this strucures (with __attribute__
> ((packed)) for gcc). And insert dummy one byte wide filler before
> `size' member in `netmsg' and `routemsg' structures.
> 
> PS. Please CC me your questions. Because I'm not subscriber and can
> only to watch archives of mailinglist.
> _______________________________________________
> olsr-dev mailing list
> (spam-protected)
> https://www.olsr.org/mailman/listinfo/olsr-dev

-- 
Andreas Tønnesen
http://www.olsr.org



More information about the Olsr-dev mailing list