[Swan-dev] // considered a warning sign

D. Hugh Redelmeier hugh at mimosa.com
Sun Oct 1 18:52:12 UTC 2017


I'm exploring the use of // in libreswan code.  It seems to get used for 
temporary edits, some of which are scary.

These temporary edits should eventually be resolved and eliminated
from the source.

The ones that scare me the most are those that change control flow.

I just fixed one with 07b03441a448079b23915d8ed2cb4d8775abd10d.  I
don't actually know if the case would ever be executed.  If not, the
original code (a bad_case call) would have been correct.  If so, the
code would have gone into the weeds.

I'm now looking at a // in ikev2_send_auth.  Seems to turn a failure
into an incorrect success.  Why is that a good idea?
programs/pluto/ikev2_parent.c:2801:			//return STF_FAIL + v2N_NO_PROPOSAL_CHOSEN;

// is used to describe fields in struct kernel_sa which are apparently
needed:
programs/pluto/kernel.h:135:	// uint32_t sa_priority;
programs/pluto/kernel.h:136:	// struct sa_marks *sa_marks;

Other suspicious uses:

programs/pluto/kernel_netlink.c:727:  // req.u.p.lft.soft_use_expires_seconds = deltasecs(use_lifetime);

programs/pluto/kernel_pfkey.c:1252:		//*allocations = sal->sadb_lifetime_allocations;
programs/pluto/kernel_pfkey.c:1255:		//*use_time = sal->sadb_lifetime_usetime;
programs/pluto/kernel_pfkey.c:1256:		//*packets = sal->sadb_x_lifetime_packets;

programs/pluto/myid.c:53:	// char tmpid[IDTOA_BUF];
programs/pluto/myid.c:55:	// idtoa(id, tmpid, sizeof(tmpid));
programs/pluto/myid.c:56:	// loglog(RC_LOG_SERIOUS,"resolve_myid() called for id:%s",tmpid);

Can whoever put the //s there work at resolving these?



More information about the Swan-dev mailing list