diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-07-12 13:22:32 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-07-12 13:22:34 +0200 |
commit | 813fa8e9304afbb927f6a545a32d42f32e9b8ca5 (patch) | |
tree | 53af3f74fa75bdf1167987e03365d75b23bfc12e /openbsc | |
parent | 3504f293f100f793b935933381130553b883dd0d (diff) |
nat: ctrl: Use ctrl_cmd_parse2 to obtain detailed error
Instead of always logging/sending same error, use the new
ctrl_cmd_parse2 API which always returns a cmd structure with a specific
error description.
Change-Id: I6ef2b6e309632ed9cb296e8a1e71f879007a36ae
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c index 61ac8870a..af110a204 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c @@ -103,20 +103,11 @@ int bsc_nat_handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg) struct bsc_cmd_list *pending; char *var; - cmd = ctrl_cmd_parse(bsc, msg); + cmd = ctrl_cmd_parse2(bsc, msg); msgb_free(msg); - if (!cmd) { - cmd = talloc_zero(bsc, struct ctrl_cmd); - if (!cmd) { - LOGP(DNAT, LOGL_ERROR, "OOM!\n"); - return -ENOMEM; - } - cmd->type = CTRL_TYPE_ERROR; - cmd->id = "err"; - cmd->reply = "Failed to parse command."; + if (cmd->type == CTRL_TYPE_ERROR) goto err; - } if (bsc->cfg && !llist_empty(&bsc->cfg->lac_list)) { if (cmd->variable) { |