[PATCH] osmo-bsc[master]: drop unused files

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.org
Mon Sep 4 01:31:39 UTC 2017


Review at  https://gerrit.osmocom.org/3795

drop unused files

These either remain from openbsc.git or slipped in while applying recent
patches from openbsc.git and do not belong in osmo-bsc.

Change-Id: Ib20064f35e623d99c7d59496a3156e84b8a0d07a
---
D include/openbsc/gsm_04_14.h
D src/libcommon/oap_client.c
D src/libmsc/gsm_04_14.c
D tools/hlrstat.pl
4 files changed, 0 insertions(+), 501 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/95/3795/1

diff --git a/include/openbsc/gsm_04_14.h b/include/openbsc/gsm_04_14.h
deleted file mode 100644
index 3cdbe04..0000000
--- a/include/openbsc/gsm_04_14.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#include <osmocom/gsm/protocol/gsm_04_14.h>
-
-int gsm0414_tx_close_tch_loop_cmd(struct gsm_subscriber_connection *conn,
-				  enum gsm414_tch_loop_mode loop_mode);
-int gsm0414_tx_open_loop_cmd(struct gsm_subscriber_connection *conn);
-int gsm0414_tx_act_emmi_cmd(struct gsm_subscriber_connection *conn);
-int gsm0414_tx_test_interface(struct gsm_subscriber_connection *conn,
-			      uint8_t tested_devs);
-int gsm0414_tx_reset_ms_pos_store(struct gsm_subscriber_connection *conn,
-				  uint8_t technology);
-
-int gsm0414_rcv_test(struct gsm_subscriber_connection *conn,
-		     struct msgb *msg);
diff --git a/src/libcommon/oap_client.c b/src/libcommon/oap_client.c
deleted file mode 100644
index 5128ac1..0000000
--- a/src/libcommon/oap_client.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* Osmocom Authentication Protocol API */
-
-/* (C) 2015 by Sysmocom s.f.m.c. GmbH
- * All Rights Reserved
- *
- * Author: Neels Hofmeyr
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <string.h>
-#include <errno.h>
-
-#include <osmocom/core/utils.h>
-#include <osmocom/crypt/auth.h>
-#include <osmocom/gsm/oap.h>
-
-#include <openbsc/oap_client.h>
-#include <openbsc/debug.h>
-
-int oap_client_init(struct oap_client_config *config,
-		    struct oap_client_state *state)
-{
-	OSMO_ASSERT(state->state == OAP_UNINITIALIZED);
-
-	if (!config)
-		goto disable;
-
-	if (config->client_id == 0)
-		goto disable;
-
-	if (config->secret_k_present == 0) {
-		LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n");
-		goto disable;
-	}
-
-	if (config->secret_opc_present == 0) {
-		LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n");
-		goto disable;
-	}
-
-	state->client_id = config->client_id;
-	memcpy(state->secret_k, config->secret_k, sizeof(state->secret_k));
-	memcpy(state->secret_opc, config->secret_opc, sizeof(state->secret_opc));
-	state->state = OAP_INITIALIZED;
-	return 0;
-
-disable:
-	state->state = OAP_DISABLED;
-	return 0;
-}
-
-/* From the given state and received RAND and AUTN octets, validate the
- * server's authenticity and formulate the matching milenage reply octets in
- * *tx_xres. The state is not modified.
- * On success, and if tx_res is not NULL, exactly 8 octets will be written to
- * *tx_res. If not NULL, tx_res must point at allocated memory of at least 8
- * octets. The caller will want to send XRES back to the server in a challenge
- * response message and update the state.
- * Return 0 on success; -1 if OAP is disabled; -2 if rx_random and rx_autn fail
- * the authentication check; -3 for any other errors. */
-static int oap_evaluate_challenge(const struct oap_client_state *state,
-				  const uint8_t *rx_random,
-				  const uint8_t *rx_autn,
-				  uint8_t *tx_xres)
-{
-	struct osmo_auth_vector vec;
-
-	struct osmo_sub_auth_data auth = {
-		.type		= OSMO_AUTH_TYPE_UMTS,
-		.algo		= OSMO_AUTH_ALG_MILENAGE,
-	};
-
-	osmo_static_assert(sizeof(((struct osmo_sub_auth_data*)0)->u.umts.k)
-			   == sizeof(state->secret_k), _secret_k_size_match);
-	osmo_static_assert(sizeof(((struct osmo_sub_auth_data*)0)->u.umts.opc)
-			   == sizeof(state->secret_opc), _secret_opc_size_match);
-
-	switch (state->state) {
-	case OAP_UNINITIALIZED:
-	case OAP_DISABLED:
-		return -1;
-	default:
-		break;
-	}
-
-	memcpy(auth.u.umts.k, state->secret_k, sizeof(auth.u.umts.k));
-	memcpy(auth.u.umts.opc, state->secret_opc, sizeof(auth.u.umts.opc));
-	memset(auth.u.umts.amf, '\0', sizeof(auth.u.umts.amf));
-	auth.u.umts.sqn = 41; /* TODO use incrementing sequence nr */
-
-	memset(&vec, 0, sizeof(vec));
-	osmo_auth_gen_vec(&vec, &auth, rx_random);
-
-	if (vec.res_len != 8) {
-		LOGP(DLOAP, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n",
-		     vec.res_len);
-		return -3;
-	}
-
-	if (osmo_constant_time_cmp(vec.autn, rx_autn, sizeof(vec.autn)) != 0) {
-		LOGP(DLOAP, LOGL_ERROR, "OAP: AUTN mismatch!\n");
-		LOGP(DLOAP, LOGL_INFO, "OAP: AUTN from server: %s\n",
-		     osmo_hexdump_nospc(rx_autn, sizeof(vec.autn)));
-		LOGP(DLOAP, LOGL_INFO, "OAP: AUTN expected:    %s\n",
-		     osmo_hexdump_nospc(vec.autn, sizeof(vec.autn)));
-		return -2;
-	}
-
-	if (tx_xres != NULL)
-		memcpy(tx_xres, vec.res, 8);
-	return 0;
-}
-
-struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_msg)
-{
-	struct msgb *msg = msgb_alloc_headroom(1000, 64, __func__);
-	OSMO_ASSERT(msg);
-	osmo_oap_encode(msg, oap_msg);
-	return msg;
-}
-
-/* Create a new msgb containing an OAP registration message.
- * On error, return NULL. */
-static struct msgb* oap_msg_register(uint16_t client_id)
-{
-	struct osmo_oap_message oap_msg = {0};
-
-	if (client_id < 1) {
-		LOGP(DLOAP, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id);
-		return NULL;
-	}
-
-	oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST;
-	oap_msg.client_id = client_id;
-	return oap_client_encoded(&oap_msg);
-}
-
-int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx)
-{
-	*msg_tx = oap_msg_register(state->client_id);
-	if (!(*msg_tx))
-		return -1;
-
-	state->state = OAP_REQUESTED_CHALLENGE;
-	return 0;
-}
-
-/* Create a new msgb containing an OAP challenge response message.
- * xres must point at 8 octets to return as challenge response.
- * On error, return NULL. */
-static struct msgb* oap_msg_challenge_response(uint8_t *xres)
-{
-	struct osmo_oap_message oap_reply = {0};
-
-	oap_reply.message_type = OAP_MSGT_CHALLENGE_RESULT;
-	memcpy(oap_reply.xres, xres, sizeof(oap_reply.xres));
-	oap_reply.xres_present = 1;
-	return oap_client_encoded(&oap_reply);
-}
-
-static int handle_challenge(struct oap_client_state *state,
-			    struct osmo_oap_message *oap_rx,
-			    struct msgb **msg_tx)
-{
-	int rc;
-	uint8_t xres[8];
-
-	if (!(oap_rx->rand_present && oap_rx->autn_present)) {
-		LOGP(DLOAP, LOGL_ERROR,
-		     "OAP challenge incomplete (rand_present: %d, autn_present: %d)\n",
-		     oap_rx->rand_present, oap_rx->autn_present);
-		rc = -2;
-		goto failure;
-	}
-
-	rc = oap_evaluate_challenge(state,
-				    oap_rx->rand,
-				    oap_rx->autn,
-				    xres);
-	if (rc < 0)
-		goto failure;
-
-	*msg_tx = oap_msg_challenge_response(xres);
-	if ((*msg_tx) == NULL) {
-		rc = -1;
-		goto failure;
-	}
-
-	state->state = OAP_SENT_CHALLENGE_RESULT;
-	return 0;
-
-failure:
-	OSMO_ASSERT(rc < 0);
-	state->state = OAP_INITIALIZED;
-	return rc;
-}
-
-int oap_client_handle(struct oap_client_state *state,
-		      const struct msgb *msg_rx, struct msgb **msg_tx)
-{
-	uint8_t *data = msgb_l2(msg_rx);
-	size_t data_len = msgb_l2len(msg_rx);
-	struct osmo_oap_message oap_msg = {0};
-	int rc = 0;
-
-	*msg_tx = NULL;
-
-	OSMO_ASSERT(data);
-
-	rc = osmo_oap_decode(&oap_msg, data, data_len);
-	if (rc < 0) {
-		LOGP(DLOAP, LOGL_ERROR,
-		     "Decoding OAP message failed with error '%s' (%d)\n",
-		     get_value_string(gsm48_gmm_cause_names, -rc), -rc);
-		return -10;
-	}
-
-	switch (state->state) {
-	case OAP_UNINITIALIZED:
-		LOGP(DLOAP, LOGL_ERROR,
-		     "Received OAP message %d, but the OAP client is"
-		     " not initialized\n", oap_msg.message_type);
-		return -ENOTCONN;
-	case OAP_DISABLED:
-		LOGP(DLOAP, LOGL_ERROR,
-		     "Received OAP message %d, but the OAP client is"
-		     " disabled\n", oap_msg.message_type);
-		return -ENOTCONN;
-	default:
-		break;
-	}
-
-	switch (oap_msg.message_type) {
-	case OAP_MSGT_CHALLENGE_REQUEST:
-		return handle_challenge(state, &oap_msg, msg_tx);
-
-	case OAP_MSGT_REGISTER_RESULT:
-		/* successfully registered */
-		state->state = OAP_REGISTERED;
-		break;
-
-	case OAP_MSGT_REGISTER_ERROR:
-		LOGP(DLOAP, LOGL_ERROR,
-		     "OAP registration failed\n");
-		state->state = OAP_INITIALIZED;
-		if (state->registration_failures < 3) {
-			state->registration_failures ++;
-			return oap_client_register(state, msg_tx);
-		}
-		return -11;
-
-	case OAP_MSGT_REGISTER_REQUEST:
-	case OAP_MSGT_CHALLENGE_RESULT:
-		LOGP(DLOAP, LOGL_ERROR,
-		     "Received invalid OAP message type for OAP client side: %d\n",
-		     (int)oap_msg.message_type);
-		return -12;
-
-	default:
-		LOGP(DLOAP, LOGL_ERROR,
-		     "Unknown OAP message type: %d\n",
-		     (int)oap_msg.message_type);
-		return -13;
-	}
-
-	return 0;
-}
diff --git a/src/libmsc/gsm_04_14.c b/src/libmsc/gsm_04_14.c
deleted file mode 100644
index b529f4c..0000000
--- a/src/libmsc/gsm_04_14.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* GSM MS Testing  Layer 3 messages
- * 3GPP TS 44.014 / GSM TS 04.14 */
-
-/* (C) 2017 by Harald Welte <laforge at gnumonks.org>
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "bscconfig.h"
-
-#include <openbsc/debug.h>
-#include <openbsc/gsm_data.h>
-#include <openbsc/gsm_subscriber.h>
-#include <openbsc/gsm_04_08.h>
-#include <openbsc/bsc_api.h>
-#include <openbsc/msc_ifaces.h>
-
-#include <osmocom/gsm/gsm48.h>
-#include <osmocom/gsm/gsm_utils.h>
-#include <osmocom/gsm/protocol/gsm_04_14.h>
-#include <osmocom/gsm/tlv.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
-#include <osmocom/core/utils.h>
-
-static struct msgb *create_gsm0414_msg(uint8_t msg_type)
-{
-	struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.14");
-	struct gsm48_hdr *gh;
-
-	gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
-	gh->proto_discr = GSM48_PDISC_TEST;
-	gh->msg_type = msg_type;
-	return msg;
-}
-
-static int gsm0414_conn_sendmsg(struct gsm_subscriber_connection *conn, struct msgb *msg)
-{
-	return msc_tx_dtap(conn, msg);
-}
-
-static int gsm0414_tx_simple(struct gsm_subscriber_connection *conn, uint8_t msg_type)
-{
-	struct msgb *msg = create_gsm0414_msg(msg_type);
-
-	return gsm0414_conn_sendmsg(conn, msg);
-}
-
-
-/* Send a CLOSE_TCH_LOOOP_CMD according to Section 8.1 */
-int gsm0414_tx_close_tch_loop_cmd(struct gsm_subscriber_connection *conn,
-				  enum gsm414_tch_loop_mode loop_mode)
-{
-	struct msgb *msg = create_gsm0414_msg(GSM414_MT_CLOSE_TCH_LOOP_CMD);
-	uint8_t subch;
-
-	subch = (loop_mode << 1);
-	msgb_put_u8(msg, subch);
-
-	msg->lchan = conn->lchan;
-	return gsm0414_conn_sendmsg(conn, msg);
-}
-
-/* Send a OPEN_LOOP_CMD according to Section 8.3 */
-int gsm0414_tx_open_loop_cmd(struct gsm_subscriber_connection *conn)
-{
-	return gsm0414_tx_simple(conn, GSM414_MT_OPEN_LOOP_CMD);
-}
-
-/* Send a ACT_EMMI_CMD according to Section 8.8 */
-int gsm0414_tx_act_emmi_cmd(struct gsm_subscriber_connection *conn)
-{
-	return gsm0414_tx_simple(conn, GSM414_MT_ACT_EMMI_CMD);
-}
-
-/* Send a DEACT_EMMI_CMD according to Section 8.10 */
-int gsm0414_tx_deact_emmi_cmd(struct gsm_subscriber_connection *conn)
-{
-	return gsm0414_tx_simple(conn, GSM414_MT_DEACT_EMMI_CMD);
-}
-
-/* Send a TEST_INTERFACE according to Section 8.11 */
-int gsm0414_tx_test_interface(struct gsm_subscriber_connection *conn,
-			      uint8_t tested_devs)
-{
-	struct msgb *msg = create_gsm0414_msg(GSM414_MT_TEST_INTERFACE);
-	msgb_put_u8(msg, tested_devs);
-	return gsm0414_conn_sendmsg(conn, msg);
-}
-
-/* Send a RESET_MS_POSITION_STORED according to Section 8.11 */
-int gsm0414_tx_reset_ms_pos_store(struct gsm_subscriber_connection *conn,
-				  uint8_t technology)
-{
-	struct msgb *msg = create_gsm0414_msg(GSM414_MT_RESET_MS_POS_STORED);
-	msgb_put_u8(msg, technology);
-	return gsm0414_conn_sendmsg(conn, msg);
-}
-
-
-
-/* Entry point for incoming GSM48_PDISC_TEST received from MS */
-int gsm0414_rcv_test(struct gsm_subscriber_connection *conn,
-		     struct msgb *msg)
-{
-	struct gsm48_hdr *gh = msgb_l3(msg);
-
-	if (msgb_l3len(msg) < sizeof(*gh))
-		return -1;
-
-	LOGP(DMM, LOGL_NOTICE, "%s: Received TEST class message '%s'\n", "FIXME",
-		get_value_string(gsm414_msgt_names, gh->msg_type));
-
-	return 0;
-}
diff --git a/tools/hlrstat.pl b/tools/hlrstat.pl
deleted file mode 100755
index 668fc9a..0000000
--- a/tools/hlrstat.pl
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-my $dbh = DBI->connect("dbi:SQLite:dbname=hlr.sqlite3","","");
-
-
-my %mcc_names;
-my %mcc_mnc_names;
-
-sub get_mcc_mnc_name($)
-{
-	my $mcc_mnc = shift;
-	my $ret = $mcc_mnc;
-
-	if ($mcc_mnc_names{$mcc_mnc} ne '') {
-		$ret = $mcc_mnc_names{$mcc_mnc};
-	}
-
-	return $ret;
-}
-
-sub read_networks($)
-{
-	my $filename = shift;
-	my $cur_name;
-
-	open(INFILE, $filename);
-	while (my $l = <INFILE>) {
-		chomp($l);
-		if ($l =~ /^#/) {
-			next;
-		}
-		if ($l =~ /^\t/) {
-			my ($mcc, $mnc, $brand, $r) = split(' ', $l, 4);
-			#printf("%s|%s|%s\n", $mcc, $mnc, $brand);
-			$mcc_mnc_names{"$mcc-$mnc"} = $brand;
-			$mcc_names{$mcc} = $cur_name;
-		} elsif ($l =~ /^(\w\w)\t(.*)/) {
-			#printf("%s|%s\n", $1, $2);
-			$cur_name = $2;
-		}
-	}
-	close(INFILE);
-}
-
-read_networks("networks.tab");
-
-my %oper_count;
-my %country_count;
-
-#my $sth = $dbh->prepare("SELECT imsi FROM subscriber where authorized=1");
-my $sth = $dbh->prepare("SELECT imsi FROM subscriber");
-
-$sth->execute();
-
-while (my $href = $sth->fetchrow_hashref) {
-	my ($mcc, $mnc) = $$href{imsi} =~ /(\d{3})(\d{2}).*/;
-	#printf("%s %s-%s \n", $$href{imsi}, $mcc, $mnc);
-	$oper_count{"$mcc-$mnc"}++;
-	$country_count{$mcc}++;
-}
-
-
-foreach my $c (sort{$country_count{$b} <=> $country_count{$a}} keys %country_count) {
-	printf("%s: %d\n", $mcc_names{$c}, $country_count{$c});
-
-	foreach my $k (sort{$oper_count{$b} <=> $oper_count{$a}} keys %oper_count) {
-		if ($k =~ /^$c-/) {
-			printf("\t%s: %d\n", get_mcc_mnc_name($k), $oper_count{$k});
-		}
-	}
-}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib20064f35e623d99c7d59496a3156e84b8a0d07a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list