[EMAIL PROTECTED] wrote:
> Hello again, 
> I am trying to trace the root-cause of a failure to execute
> "callback_func(rt_socket_context(sock), callback_arg);"
> source file: af_packet.c 
> RTNET v0.7
> 
> Through the use of my solution/tool I am working on, and some debug
> messages, I have reached the conclusion that this only happens when
> "ifindex != 0" and as a result the socketbuffer memory is de-allocated
> (kfree_rtskb(skb)). 
> 
> callback_func fails to execute because ifindex seems not to have been
> initialized and prints a random value. 

Right on the first invocation or only after some rounds? Is it cleanly
reproducible?

> Now this means that in ifindex=sock->prot.packet.ifindex,
> sock->prot.packet.ifindex is not initialized either, maybe due to the
> uncommon (hardcore would be more precise) way of typecasting
> "rtpacket_type pt" and initializing "sock"...here take a look:
> 
> struct rtsocket *sock = (struct rtsocket *)(((u8 *)pt) - 
> ((u8 *)&(struct rtsocket *)0)->prot.socket));

This translates to

struct rtsocket *sock = container_of(pt, struct rtsocket,
                                     prot.packet.packet_type);

as applied some months ago between 0.9.1 and 0.9.2. Anyway, I do not see
a problem here.

> 
> and it all comes down to "pt"...what goes so wrong with "pt" to
> (indirectly)contain a non-initialized pointer to ifindex???

Also initialisation happens before registration of the protocol with the
core. I rather suspect that /something/ overwrites the sock structure
during runtime (assuming that your application does not bind to a
specific interface or does this only correctly).

> 
> Thank you even reading through this mumbo-jumbo!
> 

If you could draft some test code for it, this may help to reproduce it
here - or at least test if later version are suffering from the same
issue. Even if this is an "ancient" version, I prefer to understand what
went wrong there to exclude that some bug just got hidden by recent changes.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to