Hello!

Picking up this, hoping that it is still relevant.

Is there a way we can easily trigger a protocol restart instead of crashing
all of bird with an assertion here if this does happen against all odds?

Hmm, no, I don't think there's any way that the protocol can signal to
the nest that it has gotten itself into an inconsistent state and needs
to be restarted. Not sure if it's better to just crash in this case, or
if we should add such a mechanism? Hopefully Ondrej has an opinion...

You can do this as the import/export limits in BGP do exactly this, yet the appropriate function

  void proto_schedule_down(struct proto *p, byte restart, byte code);

is currently marked static. There is no problem making this function static in case the protocol needs restart.

Another way to do this is to initiate the protocol shutdown yourself by calling proto_notify_state(p, PS_DOWN) which restarts the protocol unless you set disabled = 1 … or if you need to do some asynchronous work, you may call first proto_notify_state(p, PS_STOP), then do and schedule that work and after it is finally done, you call proto_notify_state(p, PS_DOWN).

Note that notifying DOWN is the last thing you want to do; your memory may get freed any time after that.

I should definitely put some time into writing a "how to write a protocol" guide.

Hope this helps you.
Maria

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to