Commit Graph

139 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 444d7d8e65 ipa: Fix compiler warnings about aliasing
Use memcpy to copy from the OML message into the stack and then
convert the network byte order.

network_listen.c: In function ‘test_rep’:
network_listen.c:145:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  test_rep_len = ntohs(*(uint16_t *) &foh->data[3]);
  ^
network_listen.c:153:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   ferr_list_len = ntohs(*(uint16_t *) &foh->data[7]);
   ^
network_listen.c:164:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   ferr_list_len = ntohs(*(uint16_t *) &foh->data[7]);
   ^
network_listen.c:130:11: warning: variable ‘test_rep_len’ set but not used [-Wunused-but-set-variable]
  uint16_t test_rep_len, ferr_list_len;
2014-04-04 13:01:28 +02:00
Holger Hans Peter Freyther 5b0e8706e8 build: Remove bogus depends from ipaccess-config
The code does not use libmsc and doesn't use dlsym/dlopen etc. So
let us remove LIBRARY_DL as dependency.
2013-12-13 10:18:32 +01:00
Nikola 876b55af33 freebsd: dlopen/dlsym/dlerror is part of libc, use LIBRARY_DL for linking
In FreeBSD there is no spearate library for dlopen, dlsym and dlerror.
Use LIBRARY_DL to check for this condition.
2013-12-13 10:18:19 +01:00
Holger Hans Peter Freyther e18209c975 ipa-proxy: Socket creation can fail, address coverity issue
Fixes: Coverity CID 1040722
2013-12-12 16:20:19 +01:00
Holger Hans Peter Freyther 558bdb4330 ipa: Explain that one needs to get the IP address of the BTS as argument 2013-11-11 14:30:09 +01:00
Holger Hans Peter Freyther c9251fa8c9 ipaccess: The proxy code checked the array but not the element
Array compared against 0 (NO_EFFECT)
array_null: Comparing an array to null is not useful: "ipbc->bsc_rsl_conn".

Fixes: Coverity CID 1040718
2013-07-14 09:04:50 +02:00
Holger Hans Peter Freyther 3aedba66bd ipaccess: Fix a resource leak in case the stat is failing
Close the file when the stat is failing.

Fixes: Coverity CID 1040711
2013-07-14 09:04:50 +02:00
Holger Hans Peter Freyther b18c7456cb ipaccess-config: Add missing break to parsing the -L option
Fixes: Coverity CID 1040738
2013-07-04 18:51:07 +02:00
Holger Hans Peter Freyther 7d8139a42e ipaccess-config: Fix a resource leak in an error path
Fixes: Coverity CID 1040710, CID 1040711
2013-07-04 18:49:04 +02:00
Holger Hans Peter Freyther d5c270e71c ipaccess-find: Address a warning by coverity of unitialized memory
Use a memset on the sockaddr_in to make coverity happy.

Fixes: CID 1040705
2013-07-03 10:19:37 +02:00
Alexander Huemer a1c09a401d Makefile.am: Use AM_CPPFLAGS
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-06-12 09:16:27 +02:00
Holger Hans Peter Freyther e48c1871af ipaccess: Remove the ipaccess_gsmnet and assume there is a bsc_gsmnet
Assume that there is a bsc_gsmnet and modify the ipaccess-config to
provide this symbol. If a bsc_gsmmnet is not available when linked
the linker will complain and fail.

E.g. give an error like this:
../../src/libbsc/libbsc.a(bts_ipaccess_nanobts.o): In function `ipaccess_sign_link_up':
src/libbsc/bts_ipaccess_nanobts.c:550: undefined reference to `bsc_gsmnet'
2013-04-29 20:44:42 +02:00
Holger Hans Peter Freyther 37a63ca34a misc: Linking fixes for Ubuntu 11.10 Compiler
Ubuntu 11.10 has changed some linker/compiler flags. Some fixes for this
can be seen here[1]. In general the to be linked libs need to be moved into
the LDADD section of parameters. This is with the old BFD linker (not gold).

This is likely to end in some ping-pong with other versions of the linker.

[1] https://bugs.launchpad.net/ubuntu/+source/nis/+bug/771034

Errors:
/usr/bin/ld.bfd.real: bsc_hack.o: undefined reference to symbol 'osmo_init_ignore_signals'
/usr/bin/ld.bfd.real: note: 'osmo_init_ignore_signals' is defined in DSO /home/ich/install/openbsc/lib/libosmocore.so so try adding it to the linker command line
/home/ich/install/openbsc/lib/libosmocore.so: could not read symbols: Invalid operation

...
../../src/libbsc/libbsc.a(rest_octets.o):/home/ich/source/gsm/openbsc/openbsc/src/libbsc/rest_octets.c:381: more undefined references to `bitvec_set_bit' follow
../../src/libbsc/libbsc.a(rest_octets.o): In function `rest_octets_si13':
/home/ich/source/gsm/openbsc/openbsc/src/libbsc/rest_octets.c:382: undefined reference to `bitvec_set_uint'
/home/ich/source/gsm/openbsc/openbsc/src/libbsc/rest_octets.c:383: undefined reference to `bitvec_set_uint'
/home/ich/source/gsm/openbsc/openbsc/src/libbsc/rest_octets.c:385: undefined reference to `bitvec_set_bit'
/home/ich/source/gsm/openbsc/openbsc/src/libbsc/rest_octets.c:402: undefined reference to `bitvec_set_bit'
/home/ich/source/gsm/openbsc/openbsc/src/libbsc/rest_octets.c:403: undefined reference to `bitvec_set_uint'
2011-10-16 17:08:51 +02:00
Pablo Neira Ayuso ed5cacb240 src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.

The main changes are:

- The directory libabis/ has been removed as it now lives in
  libosmo-abis.

- new configuration file format for nanoBTS and HSL femto, we
  need to define the virtual e1_line and attach it to the OML
  link.

- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
  BS11 and rbs2000) now use the new libosmo-abis framework.

- use r232 input driver available in libosmo-abis for bs11_config.

- use ipa_msg_recv instead of old ipaccess_read_msg function.

- delete definition of gsm_e1_subslot and input_signal_data.
  These structures now lives in libosmo-abis.

Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.

This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:

- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node

This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-19 22:38:35 +02:00
Pablo Neira Ayuso 7abecfcfc9 src: use new msg->dst pointer instead of deprecated msg->trx
This patch modifies openBSC code to use msg->dst which stores the
pointer to the signalling link structure instead of the pointer to
the transceiver structure.

This patch prepares the introduction of libosmo-abis.
2011-08-19 22:38:33 +02:00
Holger Hans Peter Freyther d010eb4651 ipaccess-firmware: Fix dumping the wrong header fields
We want to compare the file more_magic[0] and more_magic[1]
with the static more_magic array to see where the difference
is.

src/ipaccess/ipaccess-firmware.c +64 ipaccess_analyze_file(26) warn: buffer overflow 'firmware_header->more_magic' 2 <= 2
src/ipaccess/ipaccess-firmware.c +64 ipaccess_analyze_file(26) warn: buffer overflow 'firmware_header->more_magic' 2 <= 3
2011-07-16 14:43:01 +02:00
Harald Welte d4ab13b630 ipaccess-proxy: use ANSI function declarations (void) 2011-07-16 13:39:44 +02:00
Harald Welte 36ac775838 ipaccess-proxy: fix array bounds problem
detected by Smatch:
/home/laforge/projects/git/openbsc/openbsc/src/ipaccess/ipaccess-proxy.c +173 store_idtags(14) error: buffer overflow 'ipbc->id_tags' 255 <= 255
/home/laforge/projects/git/openbsc/openbsc/src/ipaccess/ipaccess-proxy.c +173 store_idtags(14) error: buffer overflow 'ipbc->id_tags' 255 <= 255
/home/laforge/projects/git/openbsc/openbsc/src/ipaccess/ipaccess-proxy.c +175 store_idtags(16) error: buffer overflow 'ipbc->id_tags' 255 <= 255
/home/laforge/projects/git/openbsc/openbsc/src/ipaccess/ipaccess-proxy.c +178 store_idtags(19) error: buffer overflow 'ipbc->id_tags' 255 <= 255
/home/laforge/projects/git/openbsc/openbsc/src/ipaccess/ipaccess-proxy.c +500 ipaccess_rcvmsg(66) error: buffer overflow 'ipbc->rsl_conn' 4 <= 4
/home/laforge/projects/git/openbsc/openbsc/src/ipaccess/ipaccess-proxy.c +504 ipaccess_rcvmsg(70) error: buffer overflow 'ipbc->bsc_rsl_conn' 4
<= 4
2011-07-16 13:38:48 +02:00
Harald Welte 3300c01e82 split gsm_data.c in gsm_data_shared.c and gsm_data.c
This facilitates the use of gsm_data.c from osmo-bts
2011-06-05 13:31:33 +02:00
Holger Hans Peter Freyther 1e9ae4be66 ipaccess: Fix the case of specifying the interface
Pablo pointed out that my previous commit was rubish. If we have
less than two arguments we want ifname to remain NULL and if we
have a second argument (or more) we want to use that as the interface
name to bind to.
2011-05-17 20:34:53 +02:00
Holger Hans Peter Freyther d3080be131 ipaccess-find: Work without providing an interface name
This will use the default route of the operating system, e.g.
be able to use ipaccess-find without special permission.
2011-05-14 19:46:05 +02:00
Holger Hans Peter Freyther 67cd75f9fa misc: Use the osmo_init code for signals and logging
Use the libosmocore code to ignore certain signals by
default (e.g. SIGHUP, SIGPIPE) and use the new code to
create a default stderr logging target and initialize
it properly.
2011-05-12 16:11:14 +02:00
Pablo Neira Ayuso c0d17f2266 src: use namespace prefix osmo_* for misc utils
Summary of changes:

s/bcd2char/osmo_bcd2char/g
s/char2bcd/osmo_char2bcd/g
s/hexparse/osmo_hexparse/g
s/hexdump/osmo_hexdump/g
s/hexdump_nospc/osmo_hexdump_nospc/g
s/ubit_dump/osmo_ubit_dump/g
s/static_assert/osmo_static_assert/g
2011-05-07 12:58:59 +02:00
Pablo Neira Ayuso bbc5b99a6b src: use namespace prefix osmo_signal*
Summary of changes:

s/signal_cbfn/osmo_signal_cbfn/g
s/register_signal_handler/osmo_signal_register_handler/g
s/unregister_signal_handler/osmo_signal_unregister_handler/g
s/dispatch_signal/osmo_signal_dispatch/g
2011-05-06 12:12:31 +02:00
Pablo Neira Ayuso 4db9299286 src: use namespace prefix osmo_fd* and osmo_select*
Summary of changes:

s/struct bsc_fd/struct osmo_fd/g
s/bsc_register_fd/osmo_fd_register/g
s/bsc_unregister_fd/osmo_fd_unregister/g
s/bsc_select_main/osmo_select_main/g
2011-05-06 12:11:23 +02:00
Pablo Neira Ayuso bf540cb7c3 src: use namespace prefix osmo_timer* for timer functions
Summary of changes:

s/struct timer_list/struct osmo_timer_list/g
s/bsc_add_timer/osmo_timer_add/g
s/bsc_schedule_timer/osmo_timer_schedule/g
s/bsc_del_timer/osmo_timer_del/g
s/bsc_timer_pending/osmo_timer_pending/g
s/bsc_nearest_timer/osmo_timers_nearest/g
s/bsc_prepare_timers/osmo_timers_prepare/g
s/bsc_update_timers/osmo_timers_update/g
s/bsc_timer_check/osmo_timers_check/g
2011-05-06 12:11:06 +02:00
Holger Hans Peter Freyther a8a09df6a6 misc: Remove sys/types.h includes from the files
These are not needed any more. We used them for u_int
types but we now use uint which comes from stdint.h
2011-04-18 17:31:39 +02:00
Holger Hans Peter Freyther c42ad8b686 misc: Move from u_int to uint types of stdint.h
This was done with sed on the files.
2011-04-18 17:31:39 +02:00
Pablo Neira Ayuso 7e737007d9 ipaccess-proxy: get rid of make_gprs_sock()
It is similar to make_sock() available in openbsc/libcommon.
2011-04-12 21:50:47 +02:00
Pablo Neira Ayuso 4c80a516f8 ipaccess-proxy: remove leftover option `--udp'
It seems it remains unimplemented, remove it.
2011-04-12 21:50:47 +02:00
Pablo Neira Ayuso 25ffe54118 ipaccess-proxy: more robust option parsing and checking
With this patch, ipaccess-proxy makes more robust option checking:

$ ./ipaccess-proxy -l 1.1.1.1 -b 2.2.2.2 -e
ERROR: missing mandatory argument for `-e' option

And we return to shell to enforce the user to try again with the
appropriate invocation.

Before this patch, the default getopt_long() error handling was
enabled which displayed this message:

./ipaccess-proxy: option requires an argument -- 'e'

and ipaccess-proxy continued working.

This is generic enough to cover other option that require mandatory
arguments like `--bsc' and `--listen'.
2011-04-12 21:50:47 +02:00
Pablo Neira Ayuso 23b1b808f1 ipaccess-find: get rid of ipac_idtag_name()
Use generic ipaccess_idtag_name() available in libabis instead.
2011-04-12 21:50:47 +02:00
Holger Hans Peter Freyther 0e8facca42 ipaccess-config: Allow to invoke tests by names.
Allow to invoke tests by name.
2011-04-11 20:39:16 +02:00
Holger Hans Peter Freyther 390ba3faa0 ipaccess-config: Add option to list possible NVRAM settings
We can handle NVRAM settings via names but there is no way
to discover these names. This commits adds the unusual -H
option to show these values.
2011-04-11 20:39:16 +02:00
Holger Hans Peter Freyther cfccedd74a ipaccess-config: Allow to automatically loop a test
This makes the commented out code an option that might
or might not work reliable.
2011-04-11 20:39:12 +02:00
Pablo Neira Ayuso 9f1294d623 ipaccess-proxy: remove hardcoded IP for options `-l' and `-b'
This patch removes the hardcoded IP addresses for options `-l'
and `-b'.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso c281b4e85a libabis: ipaccess: export ipaccess_parse_unitid
Now this is used by ipaccess-proxy, remove redundant implementation in it.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso 625295b14f ipaccess-proxy: get rid of ipac_idtag_parse()
Use ipaccess_idtag_parse() available in libabis instead.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso 66add64b71 libabis: ipaccess: export ipaccess_idtag_name()
Now this is used by ipaccess-proxy, remove redundant implemention in it.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso 22f58a9a58 libabis: ipaccess: conclude new ipaccess_send_*() functions and use them
This patch finishes the new ipaccess_send_*() functions and use them
in the ipaccess-proxy code.

I have also cleanup the definition of the PONG, ID_ACK and ID_REQ
messages (including some minor documentation about them).

I had to rename ipaccess_recvmsg() in ipaccess-proxy to avoid clashing
with the one defined in libabis.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso 3ab864a860 ipaccess-proxy: get rid of make_listen_sock() and use make_sock() instead
This patch replaces make_listen_sock() by the generic make_sock()
available in libcommon/socket.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso da2f769681 ipaccess: proxy: get rid of internal make_sock() implementation
With this patch, we use the implementation available in libcommon.
2011-04-05 18:33:28 +02:00
Pablo Neira Ayuso f22e348287 ipaccess-config: exit if no network interface is specified
ipaccess-config has to exit if no network interface is specified,
otherwise it uses argv[1] which has a uninitialized value.
2011-04-05 18:33:17 +02:00
Pablo Neira Ayuso 3c409c249d ipaccess-proxy: fix segfault in handle_dead_socket
This patch fixes a segfault if we or one BTS start a TCP connection
and close it before any IPAC_MSGT_ID_RESP message is sent.
2011-03-27 22:21:08 +02:00
Pablo Neira Ayuso 136f453dd2 src: use new library libosmogsm and new path to headers in libosmocore
libosmogsm is a new library that is distributed in the libosmocore.
Now, openbsc depends on it. This patch gets openbsc with this
change.

This patch also rewrites all include path to the new
osmocom/[gsm|core]

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:17:56 +01:00
Harald Welte 89579b4317 prefix sub-directories containing libraries with 'lib'
... and make sure tests work again after restructuring
2011-03-04 13:23:09 +01:00
Harald Welte 31c00f7d6f re-structure the OpenBSC directory layout
The new structure divides the code into a number of libraries
for the BSC core functionality, MSC core functionality, Abis transport,
TRAU and other bits.

This doesn't introduce any functional code change but simply moves
around files and alters Makefile.am accordingly.

Next step would be to disentangle a lot of the inter-library
dependencies and make the individual bits of code more independent.
2011-03-03 23:29:05 +01:00
Harald Welte 5ec26fe983 Install programs into $(prefix)/bin, not /sbin
At least in many configurations, there is no need to run any
of our programs as root.  Thus, we shouldn't install them in sbin.
2011-02-19 16:19:19 +09:00
Harald Welte f338a03b0c [BSC] Move the BTS-type specific code from bcs_init.c to bts_*.c
bsc_init.c was a big mess even only for two supported BTS models,
so before adding more BTS types, this needs a cleanup.

All the BTS specific code from bsc_init.c has now moved into
bts_{siemens_bs11,ipaccess_nanobts}.c

This has required that input_event() and nm_state_event() get both
converted to proper libosmocore signals instead of referencing external
symbols.
2011-02-11 16:26:31 +01:00
Harald Welte 9af6ddfcec License change: We are now AGPLv3+ instead of GPLv2+
The reason for this is quite simple: We want to make sure anyone
running a customized version of OpenBSC to operate a network will
have to release all custom modifiations to the source code.
2011-01-01 15:39:34 +01:00