[Swan-dev] pluto: rename and remodularize emit_v2N*

Andrew Cagney andrew.cagney at gmail.com
Thu Jan 3 05:03:48 UTC 2019


On Wed, 2 Jan 2019 at 15:55, D. Hugh Redelmeier <hugh at vault.libreswan.fi> wrote:
>
> New commits:
> commit 20f4002247ba4540cdc3b4ebe6f7c73828682649
> Author: D. Hugh Redelmeier <hugh at mimosa.com>
> Date:   Wed Jan 2 15:54:08 2019 -0500
>
>     pluto: rename and remodularize emit_v2N*

Why?   We had emit_v2V() emit_v2N() emit_v2UNKNOWN() et.al., now we don't?

My best guess is that it was motivated by the comment and code:

/*
* XXX: can this share code with emit_v2N() above?
*/
struct ikev2_notify n = {
.isan_critical = build_ikev2_critical(false),
.isan_protoid = PROTO_v2_RESERVED,
.isan_type = v2N_SIGNATURE_HASH_ALGORITHMS,
};
pb_stream n_pbs;
if (!out_struct(&n, &ikev2_notify_desc, outs, &n_pbs)) {

but that could have all been done by adding a static out_v2N(...,
nested_pbs, ...) and having just the above and emit_v2N() call it?

These assertions were removed.  Why?

passert((protoid == PROTO_v2_RESERVED) == (spi == NULL));
passert((protoid == PROTO_v2_AH || protoid == PROTO_v2_ESP) == (spi != NULL));

>     - new names specify what should be included in the payload
>       "sa": an SA (i.e. protoid and SPI)
>       "chunk": a chunk
>       "pl": a sub-payload will be added by the caller.
>
>     - changed emit_* to out_* so uncommited change won't silently fail

I've no clue what this even means?

>     - provide for callers to emit sub-payloads after the call.
>       This will be exploited later.

Er, it's used above?

>     - eliminated a leak in add_redirect_payload

That sounds serious enough to deserve a separate commit.

> _______________________________________________
> Swan-commit mailing list
> Swan-commit at lists.libreswan.org
> https://lists.libreswan.org/mailman/listinfo/swan-commit


More information about the Swan-dev mailing list