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.orgReview at https://gerrit.osmocom.org/4945 Fix various compiler warnings in hnb-gw code Since we finally started to use -Wall, the related warnings became visible. Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 --- M src/context_map.c M src/hnbgw.c M src/hnbgw_cn.c M src/hnbgw_hnbap.c M src/hnbgw_ranap.c M src/hnbgw_rua.c M src/hnbgw_vty.c M src/iu_client.c M src/ranap_common_cn.c 9 files changed, 61 insertions(+), 76 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/45/4945/1 diff --git a/src/context_map.c b/src/context_map.c index 0960cb9..b90f555 100644 --- a/src/context_map.c +++ b/src/context_map.c @@ -169,4 +169,6 @@ context_map_tmr.cb = context_map_tmr_cb; context_map_tmr.data = gw; osmo_timer_schedule(&context_map_tmr, EXPIRY_TIMER_SECS, 0); + + return 0; } diff --git a/src/hnbgw.c b/src/hnbgw.c index 97905b3..5c0570e 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -44,8 +44,11 @@ #include <osmocom/vty/telnet_interface.h> #include <osmocom/vty/logging.h> +#include <osmocom/vty/command.h> #include <osmocom/netif/stream.h> + +#include <osmocom/ranap/ranap_common.h> #include <osmocom/sigtran/protocol/m3ua.h> #include <osmocom/sigtran/sccp_sap.h> @@ -68,8 +71,6 @@ void *talloc_asn1_ctx; static struct hnb_gw *g_hnb_gw; - -static int listen_fd_cb(struct osmo_fd *fd, unsigned int what); static struct hnb_gw *hnb_gw_create(void *ctx) { @@ -175,13 +176,13 @@ } static int hnb_close_cb(struct osmo_stream_srv *conn) { + return 0; } static int hnb_read_cb(struct osmo_stream_srv *conn) { struct hnb_context *hnb = osmo_stream_srv_get_data(conn); struct msgb *msg = msgb_alloc(IUH_MSGB_SIZE, "Iuh rx"); - int flags = 0; int rc; if (!msg) @@ -222,12 +223,12 @@ case IUH_PPI_SABP: case IUH_PPI_RNA: case IUH_PPI_PUA: - LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; default: - LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; @@ -421,8 +422,6 @@ int main(int argc, char **argv) { - struct osmo_sccp_user *sccp_user; - struct osmo_sccp_link *sua_link; struct osmo_stream_srv_link *srv; int rc; diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c index 3238f00..a48b651 100644 --- a/src/hnbgw_cn.c +++ b/src/hnbgw_cn.c @@ -38,13 +38,12 @@ * Outbound RANAP RESET to CN ***********************************************************************/ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); static int transmit_rst(struct hnb_gw *gw, RANAP_CN_DomainIndicator_t domain, struct osmo_sccp_addr *remote_addr) { struct msgb *msg; - struct msgb *msgprim; RANAP_Cause_t cause = { .present = RANAP_Cause_PR_transmissionNetwork, .choice. transmissionNetwork = RANAP_CauseTransmissionNetwork_signalling_transport_resource_failure, @@ -71,7 +70,7 @@ } /* change the state of a CN Link */ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) { switch (state) { case CNLINK_S_NULL: @@ -127,9 +126,11 @@ struct hnb_gw *gw = cnlink->gw; struct hnb_context *hnb; RANAP_PagingIEs_t ies; - int rc = 0; + int rc; rc = ranap_decode_pagingies(&ies, &imsg->value); + if (rc < 0) + return rc; /* FIXME: determine which HNBs to send this Paging command, * rather than broadcasting to all HNBs */ @@ -145,8 +146,6 @@ RANAP_InitiatingMessage_t *imsg, const uint8_t *data, unsigned int len) { - int rc; - switch (imsg->procedureCode) { case RANAP_ProcedureCode_id_Reset: return cn_ranap_rx_reset_cmd(cnlink, imsg); @@ -161,11 +160,11 @@ case RANAP_ProcedureCode_id_DirectInformationTransfer: case RANAP_ProcedureCode_id_UplinkInformationExchange: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "Procedure %u from CN, ignoring\n", imsg->procedureCode); + "Procedure %ld from CN, ignoring\n", imsg->procedureCode); break; default: LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " - "Procedure %u from CN, ignoring\n", imsg->procedureCode); + "Procedure %ld from CN, ignoring\n", imsg->procedureCode); break; } return 0; @@ -174,8 +173,6 @@ static int cn_ranap_rx_successful_msg(struct hnbgw_cnlink *cnlink, RANAP_SuccessfulOutcome_t *omsg) { - int rc; - switch (omsg->procedureCode) { case RANAP_ProcedureCode_id_Reset: /* Reset acknowledge */ return cn_ranap_rx_reset_ack(cnlink, omsg); @@ -184,11 +181,11 @@ case RANAP_ProcedureCode_id_DirectInformationTransfer: case RANAP_ProcedureCode_id_UplinkInformationExchange: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "Procedure %u from CN, ignoring\n", omsg->procedureCode); + "Procedure %ld from CN, ignoring\n", omsg->procedureCode); break; default: LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " - "Procedure %u from CN, ignoring\n", omsg->procedureCode); + "Procedure %ld from CN, ignoring\n", omsg->procedureCode); break; } return 0; @@ -210,7 +207,7 @@ break; case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "unsuccessful outcome procedure %u from CN, ignoring\n", + "unsuccessful outcome procedure %ld from CN, ignoring\n", pdu->choice.unsuccessfulOutcome.procedureCode); break; default: @@ -218,6 +215,8 @@ "presence %u from CN, ignoring\n", pdu->present); break; } + + return rc; } static int handle_cn_ranap(struct hnbgw_cnlink *cnlink, const uint8_t *data, @@ -357,7 +356,7 @@ struct osmo_sccp_user *scu = ctx; struct hnbgw_cnlink *cnlink; struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph; - int rc; + int rc = 0; LOGP(DMAIN, LOGL_DEBUG, "sccp_sap_up(%s)\n", osmo_scu_prim_name(oph)); @@ -398,7 +397,7 @@ msgb_free(oph->msg); - return 0; + return rc; } static bool addr_has_pc_and_ssn(const struct osmo_sccp_addr *addr) @@ -453,7 +452,6 @@ struct hnbgw_cnlink *cnlink; struct osmo_ss7_instance *ss7; uint32_t local_pc; - int rc; OSMO_ASSERT(!gw->sccp.client); OSMO_ASSERT(!gw->sccp.cnlink); diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c index 0473482..f96c733 100644 --- a/src/hnbgw_hnbap.c +++ b/src/hnbgw_hnbap.c @@ -356,7 +356,7 @@ return rc; DEBUGP(DHNBAP, "HNB-DE-REGISTER cause=%ld\n", - ies.cause); + hnbap_cause_str(&ies.cause)); hnbap_free_hnbde_registeries(&ies); hnb_context_release(ctx); @@ -457,7 +457,7 @@ ctxid = asn1bitstr_to_u24(&ies.context_ID); - DEBUGP(DHNBAP, "UE-DE-REGISTER context=%ld cause=%s\n", + DEBUGP(DHNBAP, "UE-DE-REGISTER context=%u cause=%s\n", ctxid, hnbap_cause_str(&ies.cause)); ue = ue_context_by_id(ctx->gw, ctxid); @@ -486,7 +486,7 @@ static int hnbgw_rx_initiating_msg(struct hnb_context *hnb, InitiatingMessage_t *imsg) { - int rc; + int rc = 0; switch (imsg->procedureCode) { case ProcedureCode_id_HNBRegister: /* 8.2 */ @@ -517,6 +517,8 @@ imsg->procedureCode); break; } + + return rc; } static int hnbgw_rx_successful_outcome_msg(struct hnb_context *hnb, SuccessfulOutcome_t *msg) @@ -581,5 +583,5 @@ int hnbgw_hnbap_init(void) { - + return 0; } diff --git a/src/hnbgw_ranap.c b/src/hnbgw_ranap.c index 7fd6d0a..6822752 100644 --- a/src/hnbgw_ranap.c +++ b/src/hnbgw_ranap.c @@ -77,7 +77,7 @@ static int ranap_rx_error_ind(struct hnb_context *hnb, ANY_t *in) { RANAP_ErrorIndicationIEs_t ies; - int rc, is_ps = 0; + int rc; rc = ranap_decode_errorindicationies(&ies, in); if (rc < 0) @@ -92,35 +92,9 @@ return 0; } -static int ranap_rx_dt(struct hnb_context *hnb, ANY_t *in) -{ - RANAP_DirectTransferIEs_t ies; - int sapi = 0; - int rc; - - rc = ranap_decode_directtransferies(&ies, in); - if (rc < 0) - return rc; - - if (ies.presenceMask & DIRECTTRANSFERIES_RANAP_SAPI_PRESENT) - sapi = ies.sapi; - - if (ies.presenceMask & DIRECTTRANSFERIES_RANAP_LAI_PRESENT) { - /* FIXME: Update LAI associated with UE */ - } - - if (ies.presenceMask & DIRECTTRANSFERIES_RANAP_RAC_PRESENT) { - /* FIXME: Update RAC associated with UE */ - } - - DEBUGP(DRANAP, "DirectTransfer: %s\n", - osmo_hexdump(ies.nas_pdu.buf, ies.nas_pdu.size)); - /* FIXME: hand NAS PDU into MSC */ -} - static int ranap_rx_initiating_msg(struct hnb_context *hnb, RANAP_InitiatingMessage_t *imsg) { - int rc; + int rc = 0; /* according tot the spec, we can primarily receive Overload, * Reset, Reset ACK, Error Indication, reset Resource, Reset @@ -144,19 +118,19 @@ case RANAP_ProcedureCode_id_DirectInformationTransfer: case RANAP_ProcedureCode_id_UplinkInformationExchange: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "Procedure %u from HNB, ignoring\n", imsg->procedureCode); + "Procedure %lu from HNB, ignoring\n", imsg->procedureCode); break; default: LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " - "Procedure %u from HNB, ignoring\n", imsg->procedureCode); + "Procedure %lu from HNB, ignoring\n", imsg->procedureCode); break; } + + return rc; } static int ranap_rx_successful_msg(struct hnb_context *hnb, RANAP_SuccessfulOutcome_t *imsg) { - int rc; - /* according tot the spec, we can primarily receive Overload, * Reset, Reset ACK, Error Indication, reset Resource, Reset * Resurce Acknowledge as connecitonless RANAP. There are some @@ -172,20 +146,22 @@ case RANAP_ProcedureCode_id_DirectInformationTransfer: case RANAP_ProcedureCode_id_UplinkInformationExchange: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "Procedure %u from HNB, ignoring\n", imsg->procedureCode); + "Procedure %lu from HNB, ignoring\n", imsg->procedureCode); break; default: LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " - "Procedure %u from HNB, ignoring\n", imsg->procedureCode); + "Procedure %lu from HNB, ignoring\n", imsg->procedureCode); break; } + + return 0; } static int _hnbgw_ranap_rx(struct hnb_context *hnb, RANAP_RANAP_PDU_t *pdu) { - int rc; + int rc = 0; switch (pdu->present) { case RANAP_RANAP_PDU_PR_initiatingMessage: @@ -196,7 +172,7 @@ break; case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "unsuccessful outcome procedure %u from HNB, ignoring\n", + "unsuccessful outcome procedure %lu from HNB, ignoring\n", pdu->choice.unsuccessfulOutcome.procedureCode); break; default: @@ -204,6 +180,8 @@ "presence %u from HNB, ignoring\n", pdu->present); break; } + + return rc; } @@ -228,5 +206,5 @@ int hnbgw_ranap_init(void) { - + return 0; } diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c index 95979f5..305b8cc 100644 --- a/src/hnbgw_rua.c +++ b/src/hnbgw_rua.c @@ -24,6 +24,7 @@ #include <osmocom/netif/stream.h> #include <osmocom/sigtran/sccp_sap.h> +#include <osmocom/sigtran/sccp_helpers.h> #include <unistd.h> #include <errno.h> @@ -418,7 +419,6 @@ static int rua_rx_init_udt(struct msgb *msg, ANY_t *in) { RUA_ConnectionlessTransferIEs_t ies; - RUA_CN_DomainIndicator_t domain; int rc; rc = rua_decode_connectionlesstransferies(&ies, in); @@ -483,7 +483,7 @@ rc = 0; break; default: - LOGP(DRUA, LOGL_NOTICE, "Unknown RUA Procedure %u\n", + LOGP(DRUA, LOGL_NOTICE, "Unknown RUA Procedure %lu\n", imsg->procedureCode); rc = -1; } diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c index f504dd5..3d16970 100644 --- a/src/hnbgw_vty.c +++ b/src/hnbgw_vty.c @@ -18,6 +18,8 @@ * */ +#include <string.h> + #include <osmocom/vty/command.h> #include <osmocom/iuh/vty.h> @@ -233,9 +235,6 @@ static int config_write_hnbgw_iucs(struct vty *vty) { - const char *addr; - uint16_t port; - if (!g_hnb_gw->config.iucs_remote_addr_name) return CMD_SUCCESS; @@ -248,9 +247,6 @@ static int config_write_hnbgw_iups(struct vty *vty) { - const char *addr; - uint16_t port; - if (!g_hnb_gw->config.iups_remote_addr_name) return CMD_SUCCESS; diff --git a/src/iu_client.c b/src/iu_client.c index 17d955d..3ee900c 100644 --- a/src/iu_client.c +++ b/src/iu_client.c @@ -25,12 +25,16 @@ #include <string.h> #include <stdbool.h> +#include <asn1c/asn1helpers.h> + #include <osmocom/ranap/iu_client.h> #include <osmocom/core/logging.h> #include <osmocom/crypt/auth.h> #include <osmocom/gprs/gprs_msgb.h> #include <osmocom/sigtran/sccp_sap.h> +#include <osmocom/sigtran/sccp_helpers.h> +#include <osmocom/ranap/ranap_common_cn.h> #include <osmocom/ranap/ranap_ies_defs.h> #include <osmocom/ranap/ranap_msg_factory.h> diff --git a/src/ranap_common_cn.c b/src/ranap_common_cn.c index d02eb37..d2c875e 100644 --- a/src/ranap_common_cn.c +++ b/src/ranap_common_cn.c @@ -319,7 +319,7 @@ static int cn_ranap_rx_initiating_msg_cl(void *ctx, RANAP_InitiatingMessage_t *imsg, ranap_message *message) { - int rc; + int rc = 0; message->procedureCode = imsg->procedureCode; message->criticality = imsg->criticality; @@ -360,6 +360,8 @@ get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); break; } + + return rc; } static void cn_ranap_free_initiating_msg_cl(ranap_message *message) @@ -403,7 +405,7 @@ static int cn_ranap_rx_successful_msg_cl(void *ctx, RANAP_SuccessfulOutcome_t *imsg, ranap_message *message) { - int rc; + int rc = 0; message->procedureCode = imsg->procedureCode; message->criticality = imsg->criticality; @@ -433,6 +435,8 @@ get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); break; } + + return rc; } static void cn_ranap_free_successful_msg_cl(ranap_message *message) @@ -463,7 +467,7 @@ static int _cn_ranap_rx_cl(void *ctx, RANAP_RANAP_PDU_t *pdu, ranap_message *message) { - int rc; + int rc = 0; /* Extend _cn_ranap_free_cl as well when extending this function */ @@ -488,6 +492,8 @@ get_value_string(ranap_presence_vals, pdu->present)); break; } + + return rc; } static void _cn_ranap_free_cl(ranap_message *message) @@ -505,7 +511,7 @@ break; default: LOGP(DRANAP, LOGL_NOTICE, "Suspicious RANAP " - "presence %s (CL) from RNC, ignoring\n", message->direction); + "presence %d (CL) from RNC, ignoring\n", message->direction); break; } } -- To view, visit https://gerrit.osmocom.org/4945 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org>