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/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgHello Harald Welte, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/1394
to look at the new patch set (#2).
oap_client_test: show bug: disabled state does not reject message
There is a hole in OAP where a disabled OAP still accepts at least a
Registration Reject message, after which it will do things it shouldn't. Show
this by expecting the bugs, to be adjusted with the upcoming fix.
Related: OS#1592
Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136
---
M openbsc/tests/oap/oap_client_test.c
M openbsc/tests/oap/oap_client_test.err
2 files changed, 41 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/94/1394/2
diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c
index 919bbb7..4acbbe1 100644
--- a/openbsc/tests/oap/oap_client_test.c
+++ b/openbsc/tests/oap/oap_client_test.c
@@ -37,6 +37,12 @@
struct oap_client_state _state;
struct oap_client_state *state = &_state;
+ struct osmo_oap_message oap_rx;
+ struct msgb *msg_rx;
+
+ struct osmo_oap_message oap_tx;
+ struct msgb *msg_tx;
+
memset(config, 0, sizeof(*config));
memset(state, 0, sizeof(*state));
@@ -46,7 +52,38 @@
fprintf(stderr, "- make sure filling with zeros means uninitialized\n");
OSMO_ASSERT(state->state == OAP_UNINITIALIZED);
+ fprintf(stderr, "- reject messages in uninitialized state EXPECTING BUGS\n");
+ memset(&oap_rx, 0, sizeof(oap_rx));
+ state->client_id = 1;
+ oap_rx.message_type = OAP_MSGT_REGISTER_ERROR;
+ msg_rx = oap_client_encoded(&oap_rx);
+ /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP
+ * happily accepts this message and breaks the uninitialized state. The
+ * expected rc, state and msg_tx will be fixed along with the fix. */
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */);
+ OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_UNINITIALIZED */);
+ msgb_free(msg_rx);
+ OSMO_ASSERT(msg_tx /* BUG, expecting NULL */);
+ msgb_free(msg_tx);
+
+ fprintf(stderr, "- reject messages in disabled state\n");
+ memset(state, 0, sizeof(*state));
+ memset(&oap_rx, 0, sizeof(oap_rx));
+ state->state = OAP_DISABLED;
+ state->client_id = 1;
+ oap_rx.message_type = OAP_MSGT_REGISTER_ERROR;
+ msg_rx = oap_client_encoded(&oap_rx);
+ /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP
+ * happily accepts this message and breaks the uninitialized state. The
+ * expected rc, state and msg_tx will be fixed along with the fix. */
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */);
+ OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_DISABLED */);
+ msgb_free(msg_rx);
+ OSMO_ASSERT(msg_tx /* BUG, expecting NULL */);
+ msgb_free(msg_tx);
+
fprintf(stderr, "- invalid client_id and shared secret\n");
+ memset(state, 0, sizeof(*state));
config->client_id = 0;
config->secret_k_present = 0;
config->secret_opc_present = 0;
@@ -92,10 +129,6 @@
OSMO_ASSERT( oap_client_init(config, state) == 0 );
OSMO_ASSERT(state->state == OAP_INITIALIZED);
- struct osmo_oap_message oap_rx;
- struct osmo_oap_message oap_tx;
- struct msgb *msg_rx;
- struct msgb *msg_tx;
fprintf(stderr, "- Missing challenge data\n");
memset(&oap_rx, 0, sizeof(oap_rx));
diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err
index 362105c..69eb103 100644
--- a/openbsc/tests/oap/oap_client_test.err
+++ b/openbsc/tests/oap/oap_client_test.err
@@ -1,4 +1,8 @@
- make sure filling with zeros means uninitialized
+- reject messages in uninitialized state EXPECTING BUGS
+DLOAP OAP registration failed
+- reject messages in disabled state
+DLOAP OAP registration failed
- invalid client_id and shared secret
- reset state
- only client_id is invalid
--
To view, visit https://gerrit.osmocom.org/1394
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder