On Wed, 21 Nov 2018, Andrew Cagney wrote:
- move the function to demux.[hc] The function, while currently IKEv2 specific, belongs in demux.[hc] as it operates on the msg_digest; and like the commit points out, several strange #includes were eliminated
Don't all functions that pull the list of payloads work on md? And those are all in ikev[12]* ?
- rename v2_msg_role() to msg_role() This one I umed and arhd over a bit. It makes code like: switch (msg_role(md)) { case MESSAGE_REQUEST: ... slightly less verbose.
but now it is completely unclear this is an IKEv2 only function, and someone accidentally might use it in ikev1 code. So for files in programs/pluto that have no ikev* prefix, if the functions in those files (demux.c, hostpair.c initiate.c etc) are specific to one version of ike, the function name MUST reflect that.
However, to your point, it seems that only IKEv2 can easily figure out if a message is a request or a response (which really scares me). Given this, should MESSAGE_{REQUEST,RESPONSE} also get the V2_* treatment vis: switch(v2_msg_role(md)) { case V2_MESSAGE_REQUEST: ... but that is really looking cumbersome.
I think that is better, but I'm happy to also hear from Hugh, Paul _______________________________________________ Swan-dev mailing list Swan-dev@lists.libreswan.org https://lists.libreswan.org/mailman/listinfo/swan-dev