FORT-validator icon indicating copy to clipboard operation
FORT-validator copied to clipboard

Atomize output files (`--output.roa` and `--output.bgpsec`)

Open ydahhrk opened this issue 1 year ago • 1 comments

These files were originally created for debugging reasons, so Fort handles them somewhat carelessly.

But --output.roa has turned out to be useful, so it would be nice if it were more script-friendly. It sometimes contains less information than it's supposed to, presumably while Fort is writing it.

Workaround: Try rtrclient from rtrlib:

rtrclient -e -t csv -o roas.csv tcp localhost 323

ydahhrk avatar Apr 21 '24 18:04 ydahhrk

Indeed the issue is that the program writes into a file while another program might be reading from it.

I recommend copying some code from OpenBSD/FreeBSD:

  • first write into a temp file 1
  • when done writing, rename() the temp file to the final destination 1
  • use a sighandler so that upon crash/exit the temp files get removed 1 and 2

Source: https://github.com/openbsd/src/blob/master/usr.sbin/rpki-client/output.c

job avatar Aug 27 '24 10:08 job