feat(config-repl): wire handle_upgrade_config() via raw packet interception

Pre-decode opcode peek in myreq_handler() captures raw packet bytes for
OP_upgradeConfig before xce_decode() frees the capnp segment. Passes
raw bytes to xce_upgrade_config_req_extract_raw() to extract sha256 and
config blob, then delegates to do_upgrade_config_with_bytes().

Removes Task 11 dependency. Phase 2 still gated by CONF_ENABLE_UPGRADE_CONFIG.
This commit is contained in:
Rongsong Shen 2026-05-21 13:51:52 +00:00
parent 2aae45f046
commit 5053c8d42f
3 changed files with 66 additions and 27 deletions

View file

@ -115,10 +115,13 @@ int push_config_to_standbys(cluster_t *c, const uint8_t *bytes, size_t blen,
/*
* handle_upgrade_config: handle an OP_upgradeConfig request from an admin tool.
* Validates, stores, and fans out the new config blob; triggers restart.
* raw_pkt/raw_pkt_sz are the on-wire capnp bytes captured before xce_decode()
* freed the capnp segment; xce_upgrade_config_req_extract_raw() uses them to
* recover sha256 and the config blob.
* Only callable when CONF_ENABLE_UPGRADE_CONFIG is set.
*/
int handle_upgrade_config(cluster_t *c, endpoint_t *ep, xce_request_t *req);
int handle_upgrade_config(cluster_t *c, endpoint_t *ep, xce_request_t *req,
const uint8_t *raw_pkt, size_t raw_pkt_sz);
/*
* sanitise_cn: copy at most maxlen printable ASCII chars from src to a