[Click] Passing a structure pointer to some element (handler)?

Markku Savela Markku.Savela at vtt.fi
Tue Mar 13 07:28:55 EDT 2012


Hi,

I cannot seem to figure out the "correct" way to solve my problem:

- I'm considering element pipeline doing encrypt or decrypt

- when packet goes through pipe, the pipe needs to have the keys
(the existing Click has this sadatatuple in annotation).

- however this is too inflexible, as key info is result of key
negotiation, and the key formats themselves really depend on the
pipeline and contained algorithm(s).

So, I'm looking something like

    - have setkey handler in the pipeline element,
    - call it with keyinfo and sadatatuple
    - handler should unpack and preprocess the keyinfo and attach
      the result into sadatatuple (void *)

However, I cannot figure out how to pass address of the sadatuple (or
equivalent) to a handler from another element (one that gets the key
from negotiation and decides which satadatuple potentially out of
thousands will be updated...)

  1) Ugly solution: translate key and sadatuple address into string
   and pass it, setkey parses the addres from string into pointer]

  2) less ugly, but not Click philopsophy? Require the pipeline element
     to provide direct IPsec support api with "setkey(keydata, sa)"
     function.


[sadatatuple is example, I really need to revise it a bit, into
real SA structure...]


More information about the click mailing list