summaryrefslogtreecommitdiffstats
path: root/src/vty/telnet_interface.c
Commit message (Collapse)AuthorAgeFilesLines
* vty/telnet_interface.c: log connection accept() / close() eventsVadim Yanitskiy2019-07-301-0/+12
| | | | | | | | | | | | | | Unfortunately, osmo_sock_get_name_buf() fails in telnet_close_client(): DLGLOBAL INFO telnet_interface.c:130 Closing telnet connection <error-in-getsockname> because getsockname(), getpeername(), and even close() fail with: "Bad file descriptor". This looks like a bug of the existing code. Change-Id: I77b31abfa159d2f269deaa5a08d94b7bbba7d23c
* vty/telnet_interface.c: avoid unneeded initializationVadim Yanitskiy2019-07-271-1/+1
| | | | | | | | Unconditional initialization follows the structure definition, so there is no need to do it twice. This prevents compiler from warning about potential errors. Change-Id: If9fd2826f132dfa203dda62940d93dbdfcfd92ac
* vty/telnet_interface.c: use DLGLOBAL logging sub-systemVadim Yanitskiy2019-07-271-2/+2
| | | | Change-Id: I1564f4714a33d36792e4982deb8f19d1b740dc0c
* add vty_is_active()Neels Hofmeyr2019-05-031-0/+10
| | | | | | | | | | | | | For async callbacks it is useful to determine whether a given VTY pointer is still valid. For example, in osmo-msc, a silent call can be triggered by VTY, which causes a Paging. The paging_cb then writes to the VTY console that the silent call has succeeded. Unless the telnet vty session has already ended, in which case osmo-msc crashes; e.g. from an osmo_interact_vty.py command invocation. With this function, osmo-msc can ask whether the vty pointer passed to the paging callback is still active, and skip vty_out() if not. Change-Id: I42cf2af47283dd42c101faae0fac293c3a68d599
* select: Rename BSC_FD_* constants to OSMO_FD_*Harald Welte2019-03-211-8/+8
| | | | | | | | | | | | The naming of these constants dates back to when the code was private within OpenBSC. Everything else was renamed (bsc_fd -> osmo_fd) at the time, but somehow the BSC_FD_* defines have been missed at the time. Keep compatibility #defines around, but allow us to migrate the applications to a less confusing naming meanwhile. Change-Id: Ifae33ed61a7cf0ae54ad487399e7dd2489986436
* vty: Make TCP port configurable and introduce telnet_init_defaultHolger Hans Peter Freyther2018-12-231-0/+12
| | | | | | | | | | | | | | | Extend the vty_bind_cmd VTY command to allow to optionally specify a port in addition to the IPv4 address. Introduce telnet_init_default to relieve client code from having to query the bind IPv4 address (and now the TCP port). Instead a client only needs to pass the default TCP port to use. Client code should use it like: int rc = telnet_init_default(ctx, priv, OSMO_VTY_PORT_SGSN); Change-Id: Id5fb2faaf4311bd7284ee870526a6f87b7e260f3
* vty: The telnet interface is TCP only. Fix the commentsHolger Hans Peter Freyther2018-12-221-2/+2
| | | | Change-Id: I38555c4d4f565ce21dda34fc3857c47b3d802dbd
* vty: adjust telnet logMax2018-10-241-1/+1
| | | | | | | Adjust wording so telnet command can be directly copy-pasted from the log to access the interface without the need for further editing. Change-Id: I1876447f9285adcd1b09937a6121afabd0b32e52
* telnet_interface: avoid double-close of fd()Harald Welte2018-10-211-1/+1
| | | | | Change-Id: Ibd81f29fa22d53553bd73c055d6a1f5255a69bad Fixes: Coverity CID#135238
* Fix/Update copyright notices; Add SPDX annotationHarald Welte2017-11-131-1/+4
| | | | | | | | Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
* [doc] Don't add libosmovty bits to libosmocore groupsHarald Welte2017-10-161-7/+5
| | | | | | | | Let's not put files of libosmovty into Doxygen groups of libosmocore, as this seems to confuse Doxygen. Also, some minor updates/fixes of libosmovty documentation. Change-Id: I70e612b8d06aabefe634fcd7861641ffb941d974
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-3/+4
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-231-5/+5
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* update/extend doxygen documentationHarald Welte2017-06-121-0/+6
| | | | | | | | | It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
* telnet_interface: Handle osmo_fd_register() eror return codeHarald Welte2016-11-261-1/+6
| | | | | Change-Id: I5bc1c2cbb04e363d868355b5ed866b4840f16c61 Fixes: Coverity 57637
* log telnet bind address and portNeels Hofmeyr2016-09-231-1/+8
| | | | | | | Log 'telnet at 1.2.3.4 5678' from telnet_init*. All callers can now drop any extra 'VTY at 1.2.3.4 5678' logging. Change-Id: I1da7b9076311d9458caea732fc0daace6533a3fd
* write_queue: Use EBADF instead of EBABDFD for portabilityHolger Hans Peter Freyther2014-07-011-1/+1
| | | | | EBADFD is linux specific while EBADF is POSIX. Fix the build on FreeBSD and use EBADF throughout the file.
* vty: Avoid use-after-free in VTY telnet interfaceDaniel Willmann2014-06-221-2/+1
| | | | | | If the read callback closes the connection conn is already freed so we can't derefernce it. Instead return -EBADFD in the read function if it closed the connection and check for that.
* vty: Make vty_event dispatch signals and use it in the testcaseHolger Hans Peter Freyther2013-10-101-1/+13
| | | | | | | | | The testcase didn't work on Ubuntu 12.04 because vty_create will directly call vty_event (e.g. not through the plt). This means that the approach to override vty_event in the testcase failed. Use the signal interface of libosmocore and make the testcase use it. The signals can be generally useful as well.
* VTY: safe version of printing VTY welcome messageHarald Welte2012-06-031-19/+0
| | | | | | | | | | | | | | | | | | | | The old method used raw writes to the telnet FD, which is bad for several reasons: a) we don't know if we can actually write that many bytes to the socket at the given time b) the socket is still in blocking mode, so we could stall the entire process c) there may be weird interaction with the buffered writes of the vty_out Now, the print_welcome() functionality has moved to vty_hello() instead, where we can use normal vty_out() in buffered mode. This commit is expected to fix the garbled welcome message on arm-eglibc targets. It might still be a good idea to migrate the entire telnet interface to libtelnet - but at some later time ;)
* doc: Fix the Doxygen section endingsSylvain Munaut2012-04-181-1/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* vty/telnet: Add function to allow binding telnet interface to custom ↵Sylvain Munaut2012-03-011-35/+22
| | | | | | IP/Interface Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* vty/telnet_interface: Add telnet_exit functionAndreas.Eversberg2011-11-121-0/+12
| | | | | | | This frees socket and pending connections Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* doxygen: split VTY configuration in multiple filesHarald Welte2011-08-171-1/+1
|
* doxygen: Add (partial) VTY API documentationHarald Welte2011-08-171-1/+14
|
* telnet_interface: if we don't check for the return value, don't use retHarald Welte2011-07-161-5/+4
|
* telnet_interface: get rid of 'const' warningHarald Welte2011-07-161-1/+1
|
* vty: print actual application name rather than always OpenBSC on connectHarald Welte2011-05-221-3/+9
|
* select: use namespace prefix osmo_fd* and osmo_select*Pablo Neira Ayuso2011-05-071-9/+9
| | | | | | | | | 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
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-3/+3
| | | | | | | | | | | | This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
* vty: Fix typo testing return value of bindSylvain Munaut2011-01-031-1/+1
| | | | | | Thanks to playya__ (Dr. Fred) on IRC for pointing this out Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* vty: Use the copyright string from the app_info.Holger Hans Peter Freyther2010-09-111-3/+6
|
* Create libosmovty as library from OpenBSC VTY functionsHarald Welte2010-05-251-0/+203