You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bfdd, lib: extend ZEBRA_BFD_DEST_REGISTER with SBFD/SRv6 fields
Append an optional flag-gated tail to the ZEBRA_BFD_DEST_REGISTER /
DEST_UPDATE / DEST_DEREGISTER ZAPI payload so external BFD clients
(e.g. pathd) can register S-BFD sessions over ZAPI without introducing
a new opcode.
Modeled on the ZAPI_MESSAGE_* pattern in lib/zclient.h: a leading
uint16 flags word in the optional tail indicates which optional fields
follow, so "field absent" and "field set to zero" remain
distinguishable (remote_discr == 0 on sbfd_init is a legitimate value)
and new optional fields can be added by claiming a new bit without
reshuffling positional probing.
The wire-format extension is backward compatible:
* lib/bfd.c::zclient_bfd_command emits the flags word + flagged
fields iff `bfd_regext_flags != 0`. Includes deregister frames so
a named session (whose key includes `bfd_name`) can be located for
deletion; classical-BFD callers leave `bfd_regext_flags` zero and
produce byte-identical wire frames. Rejects nonsensical flag
combinations (FLAG_REMOTE_DISCR without FLAG_BFD_MODE,
FLAG_BFD_MODE with mode 0) at the encoder boundary.
* bfdd/ptm_adapter.c::_ptm_msg_read detects the no-tail case via
STREAM_READABLE; on a non-empty tail, reads the flags word into
`bpc->bfd_regext_flags` and conditionally reads each flagged field.
Bounds-checks `seg_num` and `bfd_name_len` on tail-present frames.
* ptm_bfd_sess_new propagates the new fields onto the freshly-
allocated bfd_session before bs_registrate (because bs_registrate
-> bfd_session_enable dispatches on bs->bfd_mode and bs_peer_find
keys on bfd_name). Gating is on `bpc->bfd_regext_flags` bits so an
explicit `remote_discr == 0` is honoured.
* _bfd_session_update propagates `out_sip6`, `seg_list[]`, and
`remote_discr` on re-register, also gated by flag bits. `bfd_mode`
and `bfd_name` are deliberately not mutated on update (changing
either requires socket re-open / key re-hash, which only the
initial-create path performs).
Only the S-BFD echo path is exercised end-to-end. The wire layout
reserves room for SBFD_INIT but the init-session path is not driven
by this change.
0 commit comments