On Wed, Dec 14, 2016 at 09:12:00PM +0100, Sven Eckelmann wrote:
On Mittwoch, 14. Dezember 2016 21:03:05 CET Sven Eckelmann wrote:
On Donnerstag, 6. Oktober 2016 08:41:40 CET Linus Lüssing wrote:
void *ctx = batadv_tvlv_ogm_pack_ctx(orig_node);
const struct ethhdr *ethhdr = eth_hdr(skb);
unsigned int tvlv_offset = sizeof(*ogm2);
Haven't checked the complete code yet but isn't an increase of the reference counter for orig_node missing here? Things like batadv_gw_tvlv_ogm_handler would then have to take care of dropping the reference.
Ok, forget that. batadv_tvlv_containers_process2 (which is the only user of ctx) is directly calling the function and not delaying anything. I was under the impression that their might be an delay.
But I am really not sure why you are using batadv_tvlv_ogm_pack_ctx anyway. You should be able to use "void *ctx" in batadv_tvlv_ogm_pack_ctx parameter and then give it an struct batadv_orig_node *. Or is is just for the WARN_ON?
Hm, no, had nothing to do with the WARN_ON. The idea was to have the nasty (void *) casting at least at some well-defined place.
And didn't use "void *ctx" as a parameter of _pack_ctx() directly, to have at least some compile-time verification regarding the types.
I wanted to have something a little similar to the way icmp_hdr(), icmp6_hdr(), ipv6_hdr() etc. do the casting, for instance, hm.
(or maybe I should add something like a "struct batadv_tvlv_ctx { void *ctx };" then, to really get rid of the void pointers in the functions calling the _pack()/_unpack() ones?)