From 2da47f1d6bf4b335c26d96f082d0a48a5cf7f8e6 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 22 Oct 2012 19:31:54 +0200 Subject: logging: Don't forget to save "logging filter all 1" Prior to this fix, a persistent file or syslog log configuration didn't work across an application re-start, as the "logging filter all 1" was never saved and thus no messages were logged. --- src/vty/logging_vty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index 6166f1f2..971ec3b6 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -535,6 +535,10 @@ static int config_write_log_single(struct vty *vty, struct log_target *tgt) break; } + vty_out(vty, " logging filter all %u%s", + tgt->filter_map & LOG_FILTER_ALL ? 1 : 0, VTY_NEWLINE); + /* FIXME: how to do this for filters outside of libosmocore? */ + vty_out(vty, " logging color %u%s", tgt->use_color ? 1 : 0, VTY_NEWLINE); vty_out(vty, " logging timestamp %u%s", tgt->print_timestamp ? 1 : 0, -- cgit v1.2.3 From 8ec7f901bb1843b7c29335d5ea0531e7a1527210 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 22 Oct 2012 19:43:26 +0200 Subject: logging: Make sure to install standard "end" command in VTY node When you are in the config-log VTY node, you expect "end" to work like in any other sub-node of config. --- include/osmocom/vty/command.h | 1 + src/vty/logging_vty.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h index caafdeb5..8fbb4824 100644 --- a/include/osmocom/vty/command.h +++ b/include/osmocom/vty/command.h @@ -361,6 +361,7 @@ void cmd_init(int); extern struct cmd_element config_exit_cmd; extern struct cmd_element config_help_cmd; extern struct cmd_element config_list_cmd; +extern struct cmd_element config_end_cmd; char *host_config_file(); void host_config_set(const char *); diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index 971ec3b6..d473f129 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -592,6 +592,8 @@ void logging_vty_add_cmds(const struct log_info *cat) install_element_ve(&show_logging_vty_cmd); install_node(&cfg_log_node, config_write_log); + install_default(CFG_LOG_NODE); + install_element(CFG_LOG_NODE, &config_end_cmd); install_element(CFG_LOG_NODE, &logging_fltr_all_cmd); install_element(CFG_LOG_NODE, &logging_use_clr_cmd); install_element(CFG_LOG_NODE, &logging_prnt_timestamp_cmd); -- cgit v1.2.3 From 2db368ee8d440312dd0a7481e9b9e30d2921096c Mon Sep 17 00:00:00 2001 From: Tobias Engel Date: Wed, 24 Oct 2012 17:52:51 +0200 Subject: Define struct iphdr for OSX Use FreeBSD struct iphdr definition for OSX also. From the commentary in the source file: On BSD the IPv4 struct is called struct ip and instead of iXX the members are called ip_XX. One could change this code to use struct ip but that would require to define _BSD_SOURCE and that might have other complications. Instead make sure struct iphdr is present on FreeBSD. --- src/gb/gprs_ns_frgre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gb/gprs_ns_frgre.c b/src/gb/gprs_ns_frgre.c index 23443812..e557c7e8 100644 --- a/src/gb/gprs_ns_frgre.c +++ b/src/gb/gprs_ns_frgre.c @@ -48,7 +48,7 @@ struct gre_hdr { uint16_t ptype; } __attribute__ ((packed)); -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__APPLE__) /** * On BSD the IPv4 struct is called struct ip and instead of iXX * the members are called ip_XX. One could change this code to use -- cgit v1.2.3 From 597460fd97f485abd5bc61f6718ddc8e6b9a0f25 Mon Sep 17 00:00:00 2001 From: Tobias Engel Date: Wed, 24 Oct 2012 17:52:52 +0200 Subject: Do not use --version-script linker flag on OSX Add a check to not use --version-script linker flag if compiled on OSX since it doesn't exist there --- configure.ac | 12 ++++++++++++ src/gb/Makefile.am | 2 +- src/gsm/Makefile.am | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f119c90d..24ddd0c7 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,18 @@ LT_INIT([pic-only]) AC_CONFIG_MACRO_DIR([m4]) +dnl check os: some linker flags not available on osx +case $host in +*-darwin*) + ;; +*) + LTLDFLAGS_OSMOGB='-Wl,--version-script=$(srcdir)/libosmogb.map' + LTLDFLAGS_OSMOGSM='-Wl,--version-script=$(srcdir)/libosmogsm.map' + ;; +esac +AC_SUBST(LTLDFLAGS_OSMOGB) +AC_SUBST(LTLDFLAGS_OSMOGSM) + dnl checks for header files AC_HEADER_STDC AC_CHECK_HEADERS(execinfo.h sys/select.h sys/socket.h syslog.h ctype.h) diff --git a/src/gb/Makefile.am b/src/gb/Makefile.am index c1377665..04d21085 100644 --- a/src/gb/Makefile.am +++ b/src/gb/Makefile.am @@ -11,7 +11,7 @@ noinst_HEADERS = common_vty.h if ENABLE_GB lib_LTLIBRARIES = libosmogb.la -libosmogb_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libosmogb.map -version-info $(LIBVERSION) +libosmogb_la_LDFLAGS = $(LTLDFLAGS_OSMOGB) -version-info $(LIBVERSION) libosmogb_la_LIBADD = \ $(top_builddir)/src/libosmocore.la \ $(top_builddir)/src/vty/libosmovty.la \ diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index b72a8d43..0544e0a1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -21,7 +21,7 @@ libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c gsm_utils.c \ milenage/aes-encblock.c milenage/aes-internal.c \ milenage/aes-internal-enc.c milenage/milenage.c gan.c -libosmogsm_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libosmogsm.map -version-info $(LIBVERSION) +libosmogsm_la_LDFLAGS = $(LTLDFLAGS_OSMOGSM) -version-info $(LIBVERSION) libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la EXTRA_DIST = libosmogsm.map -- cgit v1.2.3 From 6ad25f290e8cb697115a4170d6fbff66f3128528 Mon Sep 17 00:00:00 2001 From: Tobias Engel Date: Wed, 24 Oct 2012 17:52:53 +0200 Subject: Add "extern" keywords Without the "extern" keyword the variables in this header file will be seen as empty definitions when compiled on OSX. --- include/osmocom/gsm/abis_nm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/osmocom/gsm/abis_nm.h b/include/osmocom/gsm/abis_nm.h index cc017650..320ac3e5 100644 --- a/include/osmocom/gsm/abis_nm.h +++ b/include/osmocom/gsm/abis_nm.h @@ -14,10 +14,10 @@ enum abis_nm_msgtype; enum gsm_phys_chan_config; -const enum abis_nm_msgtype abis_nm_reports[4]; -const enum abis_nm_msgtype abis_nm_no_ack_nack[3]; -const enum abis_nm_msgtype abis_nm_sw_load_msgs[9]; -const enum abis_nm_msgtype abis_nm_nacks[33]; +extern const enum abis_nm_msgtype abis_nm_reports[4]; +extern const enum abis_nm_msgtype abis_nm_no_ack_nack[3]; +extern const enum abis_nm_msgtype abis_nm_sw_load_msgs[9]; +extern const enum abis_nm_msgtype abis_nm_nacks[33]; extern const struct value_string abis_nm_obj_class_names[]; extern const struct value_string abis_nm_adm_state_names[]; @@ -26,7 +26,7 @@ const char *abis_nm_nack_cause_name(uint8_t cause); const char *abis_nm_nack_name(uint8_t nack); const char *abis_nm_event_type_name(uint8_t cause); const char *abis_nm_severity_name(uint8_t cause); -const struct tlv_definition abis_nm_att_tlvdef; +extern const struct tlv_definition abis_nm_att_tlvdef; const char *abis_nm_opstate_name(uint8_t os); const char *abis_nm_avail_name(uint8_t avail); const char *abis_nm_test_name(uint8_t test); -- cgit v1.2.3 From d430ef443acf02d52ed4945ef272c9f49066647c Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Mon, 5 Nov 2012 10:47:59 +0100 Subject: GSM48: Avoid unaligned access in gsm48_construct_ra This avoids an unaligned access on platforms that don't support them, such as ARMv4/ARMv5. --- src/gsm/gsm48.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index fe62dee7..ea05d450 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -416,6 +416,7 @@ int gsm48_construct_ra(uint8_t *buf, const struct gprs_ra_id *raid) { uint16_t mcc = raid->mcc; uint16_t mnc = raid->mnc; + uint16_t _lac; buf[0] = ((mcc / 100) % 10) | (((mcc / 10) % 10) << 4); buf[1] = (mcc % 10); @@ -430,7 +431,8 @@ int gsm48_construct_ra(uint8_t *buf, const struct gprs_ra_id *raid) buf[2] = ((mnc / 100) % 10) | (((mnc / 10) % 10) << 4); } - *(uint16_t *)(buf+3) = htons(raid->lac); + _lac = htons(raid->lac); + memcpy(buf + 3, &_lac, 2); buf[5] = raid->rac; -- cgit v1.2.3 From b6cb37fec735949711c276cab1e20b46f9e58007 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 5 Nov 2012 21:28:03 +0100 Subject: debian: Testing was disabled because of a funny x86 compiler issue caused by us The bits test will fail on Debian Stable for x86. Somehow the load of a static const array is ending up accessing random memory. This only happens when not using any -OX options and this is caused by us. Do not override the default debian CFLAGS.. and the tests will pass on debian stable. --- debian/rules | 5 ----- 1 file changed, 5 deletions(-) diff --git a/debian/rules b/debian/rules index 430babce..f97995d5 100755 --- a/debian/rules +++ b/debian/rules @@ -13,8 +13,6 @@ DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2) DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') -CFLAGS = -Wall -g - %: dh --with autoreconf $@ --fail-missing @@ -25,6 +23,3 @@ override_dh_autoreconf: echo $(VERSION) > .tarball-version dh_autoreconf -override_dh_auto_test: -# tests are broken... - -- cgit v1.2.3 From 9e6789da185530c37c3c146ab9c9595135859fc4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 5 Nov 2012 21:36:48 +0100 Subject: debian: Create a git-buildpackage based 0.5.3 --- debian/changelog | 6 ++++++ debian/control | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 11ac298d..c2b221b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libosmocore (0.5.3+git1-2) unstable; urgency=low + + * New upstream version + + -- Holger Hans Peter Freyther Mon, 05 Nov 2012 21:35:57 +0100 + libosmocore (0.5.3+git1-1) precise; urgency=low * Fix issue with package version. diff --git a/debian/control b/debian/control index a3083e69..cd8398fd 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: libosmocore Section: libs Priority: optional Maintainer: Harald Welte -Build-Depends: debhelper (>= 7.0.50~), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git +Build-Depends: debhelper (>= 7.0.50~), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, doxygen Standards-Version: 3.8.4 Homepage: http://bb.osmocom.org/trac/wiki/libosmocore Vcs-Git: git://git.osmocom.org/libosmocore.git -- cgit v1.2.3 From 7ae3ac8b4222a547160cc297f4b3a093d5faa6de Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 11 Nov 2012 09:35:23 +0100 Subject: sms: Reduce the logging level to debug <001c> gsm0411_smr.c:175 TX: MNSMS-REL-REQ adds little value so I am reducing it to a debug statement. --- src/gsm/gsm0411_smr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gsm/gsm0411_smr.c b/src/gsm/gsm0411_smr.c index d5ca9238..7dd8f723 100644 --- a/src/gsm/gsm0411_smr.c +++ b/src/gsm/gsm0411_smr.c @@ -172,7 +172,7 @@ static int gsm411_send_release(struct gsm411_smr_inst *inst) { struct msgb *msg = gsm411_msgb_alloc(); - LOGP(DLSMS, LOGL_NOTICE, "TX: MNSMS-REL-REQ\n"); + LOGP(DLSMS, LOGL_DEBUG, "TX: MNSMS-REL-REQ\n"); return inst->mn_send(inst, GSM411_MNSMS_REL_REQ, msg); } @@ -182,7 +182,7 @@ static int gsm411_send_abort(struct gsm411_smr_inst *inst) struct msgb *msg = gsm411_msgb_alloc(); msgb_tv_put(msg, 1, 111); //FIXME: better idea ? */ - LOGP(DLSMS, LOGL_NOTICE, "TX: MNSMS-ABORT-REQ\n"); + LOGP(DLSMS, LOGL_DEBUG, "TX: MNSMS-ABORT-REQ\n"); return inst->mn_send(inst, GSM411_MNSMS_ABORT_REQ, msg); } @@ -191,7 +191,7 @@ static int gsm411_send_report(struct gsm411_smr_inst *inst) { struct msgb *msg = gsm411_msgb_alloc(); - LOGP(DLSMS, LOGL_NOTICE, "send empty SM_RL_REPORT_IND\n"); + LOGP(DLSMS, LOGL_DEBUG, "Sending empty SM_RL_REPORT_IND\n"); return inst->rl_recv(inst, GSM411_SM_RL_REPORT_IND, msg); } -- cgit v1.2.3 From e2a7c93da3a00551a9e6f05e7f8f87d6f34c32ae Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 11 Nov 2012 09:45:40 +0100 Subject: sms: Remove the commented out code that was the default in OpenBSC This code got copied from OpenBSC and we used the network specific and private numbering plan. Remove it as it can be easily set. --- src/gsm/gsm0411_utils.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c index ebde8fca..fe69bf41 100644 --- a/src/gsm/gsm0411_utils.c +++ b/src/gsm/gsm0411_utils.c @@ -273,7 +273,6 @@ int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len, uint8_t type, if (strlen(number) > 20) number = ""; -// oa[1] = 0xb9; /* networks-specific number, private numbering plan */ oa[1] = 0x80 | (type << 4) | plan; len_in_bytes = gsm48_encode_bcd_number(oa, oa_len, 1, number); -- cgit v1.2.3 From 09161595bde10399cbcf11a2f433c1f4fb6d6518 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 11 Nov 2012 10:09:24 +0100 Subject: smc: Print the current state of the SMS When the connection may not released print the name of the current state to ease with debugging and verification that this is not a valid state transition. --- src/gsm/gsm0411_smc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gsm/gsm0411_smc.c b/src/gsm/gsm0411_smc.c index 54e6129c..9fecd7e6 100644 --- a/src/gsm/gsm0411_smc.c +++ b/src/gsm/gsm0411_smc.c @@ -303,7 +303,9 @@ static int gsm411_mnsms_rel_req(struct gsm411_smc_inst *inst, struct msgb *msg) /* store release, until established or released */ if (inst->cp_state != GSM411_CPS_MM_ESTABLISHED) { - LOGP(DLSMS, LOGL_NOTICE, "Cannot release yet.\n"); + LOGP(DLSMS, LOGL_NOTICE, + "Cannot release yet current state: %s\n", + smc_state_names[inst->cp_state]); inst->cp_rel = 1; return 0; } -- cgit v1.2.3 From d38e0ef82a4634d5d018fa42618b9bd8ea939b13 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 13 Nov 2012 22:28:05 +0100 Subject: smc: Make it possible to include gsm0411_smc.h as first header file The code embeds the timer so one needs to include the header file. --- include/osmocom/gsm/gsm0411_smc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/osmocom/gsm/gsm0411_smc.h b/include/osmocom/gsm/gsm0411_smc.h index e1508a2d..2140db43 100644 --- a/include/osmocom/gsm/gsm0411_smc.h +++ b/include/osmocom/gsm/gsm0411_smc.h @@ -1,6 +1,7 @@ #ifndef _GSM0411_SMC_H #define _GSM0411_SMC_H +#include #include #define GSM411_MMSMS_EST_REQ 0x310 -- cgit v1.2.3 From 866fc919acb5b8706c4814beadafe1a4da2fafd3 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 13 Nov 2012 22:29:35 +0100 Subject: smc: Fix a typo in the smc code --- src/gsm/gsm0411_smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsm/gsm0411_smc.c b/src/gsm/gsm0411_smc.c index 9fecd7e6..4152ef1c 100644 --- a/src/gsm/gsm0411_smc.c +++ b/src/gsm/gsm0411_smc.c @@ -140,7 +140,7 @@ static int gsm411_tx_cp_error(struct gsm411_smc_inst *inst, uint8_t cause) GSM411_MT_CP_ERROR); } -/* etablish SMC connection */ +/* establish SMC connection */ static int gsm411_mnsms_est_req(struct gsm411_smc_inst *inst, struct msgb *msg) { struct msgb *nmsg; -- cgit v1.2.3 From 5905d5be60249b2d9ca9abce4c801bc3bceed6d9 Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Wed, 14 Nov 2012 19:36:00 +0100 Subject: msgb: fix msgb_pull_u*() msgb_pull returns a pointer to the new begin of the buffer, unlike msgb_get(), where those functions were originally taken from. Signed-off-by: Steve Markgraf --- include/osmocom/core/msgb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h index 36c7c0f9..a1939ab6 100644 --- a/include/osmocom/core/msgb.h +++ b/include/osmocom/core/msgb.h @@ -305,7 +305,7 @@ static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len) */ static inline uint8_t msgb_pull_u8(struct msgb *msgb) { - uint8_t *space = msgb_pull(msgb, 1); + uint8_t *space = msgb_pull(msgb, 1) - 1; return space[0]; } /*! \brief remove uint16 from front of message @@ -314,7 +314,7 @@ static inline uint8_t msgb_pull_u8(struct msgb *msgb) */ static inline uint16_t msgb_pull_u16(struct msgb *msgb) { - uint8_t *space = msgb_pull(msgb, 2); + uint8_t *space = msgb_pull(msgb, 2) - 2; return space[0] << 8 | space[1]; } /*! \brief remove uint32 from front of message @@ -323,7 +323,7 @@ static inline uint16_t msgb_pull_u16(struct msgb *msgb) */ static inline uint32_t msgb_pull_u32(struct msgb *msgb) { - uint8_t *space = msgb_pull(msgb, 4); + uint8_t *space = msgb_pull(msgb, 4) - 4; return space[0] << 24 | space[1] << 16 | space[2] << 8 | space[3]; } -- cgit v1.2.3