[MERGED] libosmo-sccp[master]: sccp vty: be fatal for addressbook entry errors

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Nov 8 04:17:25 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: sccp vty: be fatal for addressbook entry errors
......................................................................


sccp vty: be fatal for addressbook entry errors

So far, the config would log an error upon config parsing, and then continue to
use defaults, which is super easy to miss. On errors, return CMD_ERR_INCOMPLETE
to abort the program in a config parsing error.

Be fatal for re-using an already defined addressbook entry in another cs7
instance, and for having a too long addressbook entry name.

Though it is mixing in cosmetic changes, add "Error:" to the output and arrange
the erratic name to the end of the message, as is customary for error messages.

Related: osmo-bsc Ia4e58902a2d3757b266cf35ac89f256cfb8f0eec
Change-Id: I2f71b9c4dd30f919d2054da81283dd7035f44f60
---
M src/osmo_ss7_vty.c
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 2c3d78e..890fec8 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1246,8 +1246,9 @@
 	const char *name = argv[0];
 
 	if (strlen(name) >= sizeof(entry->name)) {
-		vty_out(vty, "sccp address name to long!%s", VTY_NEWLINE);
-		return CMD_WARNING;
+		vty_out(vty, "Error: SCCP address name to long: '%s'%s",
+			name, VTY_NEWLINE);
+		return CMD_ERR_INCOMPLETE;
 	}
 
 	/* Ensure that we do not use address names that
@@ -1255,9 +1256,9 @@
 	entry = addr_entry_by_name_global(name);
 	if (entry != NULL) {
 		vty_out(vty,
-			"address name (%s) already used in ss7 instance %u%s",
-			entry->name, entry->inst->cfg.id, VTY_NEWLINE);
-		return CMD_WARNING;
+			"Error: SCCP address name already used in ss7 instance %u: '%s'%s",
+			entry->inst->cfg.id, entry->name, VTY_NEWLINE);
+		return CMD_ERR_INCOMPLETE;
 	}
 
 	entry = addr_entry_by_name_local(name, inst);

-- 
To view, visit https://gerrit.osmocom.org/4725
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2f71b9c4dd30f919d2054da81283dd7035f44f60
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list