gbproxy_ctrl: Fix crash in nsvc-state ctrl command
ctrl_nsvc_state_cb() expects us to pass a struct nsvc_cb_data so do that
instead of passing only the ctrl_cmd.
Related: OS#5200, SYS#5542
Change-Id: I8bc67cc9bc90dab9cfca30b062d1d78897aa1e51
diff --git a/src/gb_proxy_ctrl.c b/src/gb_proxy_ctrl.c
index 35ef81b..99dcbe1 100644
--- a/src/gb_proxy_ctrl.c
+++ b/src/gb_proxy_ctrl.c
@@ -64,15 +64,27 @@
/* NS-VCs for SGSN */
hash_for_each(cfg->sgsn_nses, i, nse_peer, list) {
nse = gprs_ns2_nse_by_nsei(nsi, nse_peer->nsei);
- if (nse)
- gprs_ns2_nse_foreach_nsvc(nse, &ctrl_nsvc_state_cb, cmd);
+ if (nse) {
+ struct nsvc_cb_data cb_data = {
+ .cmd = cmd,
+ .nsei = nse_peer->nsei,
+ .is_sgsn = true,
+ };
+ gprs_ns2_nse_foreach_nsvc(nse, &ctrl_nsvc_state_cb, &cb_data);
+ }
}
/* NS-VCs for BSS peers */
hash_for_each(cfg->bss_nses, i, nse_peer, list) {
nse = gprs_ns2_nse_by_nsei(nsi, nse_peer->nsei);
- if (nse)
- gprs_ns2_nse_foreach_nsvc(nse, &ctrl_nsvc_state_cb, cmd);
+ if (nse) {
+ struct nsvc_cb_data cb_data = {
+ .cmd = cmd,
+ .nsei = nse_peer->nsei,
+ .is_sgsn = true,
+ };
+ gprs_ns2_nse_foreach_nsvc(nse, &ctrl_nsvc_state_cb, &cb_data);
+ }
}
return CTRL_CMD_REPLY;