aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix
AgeCommit message (Collapse)AuthorFilesLines
2022-04-05vppinfra: refactor address sanitizerDamjan Marion1-2/+2
Type: refactor Change-Id: I5ca142ec1557d5b5c3806b43553ad9d3b5ea1112 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-04-04vppinfra: make _vec_len() read-onlyDamjan Marion4-28/+28
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-04-04vlib: remove unused fieldsDamjan Marion1-4/+0
Type: refactor Change-Id: I449fcea92a1c96dd7dd0bcad893060ad1c614351 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-04-04vlib: improve exec path searchDamjan Marion1-6/+26
Fixes VPP invocation with relative path, i.e.: $ bin/vpp unix interactive Type: improvement Change-Id: I0278710bb472b92e31389b2d28955c3d33550230 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-04-04vlib: fix memory leak in load_one_pluginDamjan Marion1-0/+2
Type: fix Fixes: 500ba9f Change-Id: I32872a084276d9b38ff07cdccccb746c0212777f Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-03-23vlib: send full error message to syslogJing Peng1-22/+6
Currently the last character of the error message string is temporarily changed to a null byte '\0' before the string is sent to syslog(3), resulting in confusingly incomplete log entries. This patch changes the syslog format to "%.*s" so that the maximum number of characters to be printed could be controlled. Type: improvement Signed-off-by: Jing Peng <pj.hades@gmail.com> Change-Id: I1bd6295c19b51b962a3d8ee3016cd91ffb2a4eaf
2022-03-23vppinfra: change vlib_register_node so it takes format string for node nameDamjan Marion1-3/+1
This allows specifying both c string and vector for node name and removes need for crafting temporary string. Type: improvement Change-Id: I0b016cd70aeda0f68eb6f9171c5152f303be7369 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-03-23vlib: mitigate outdated new cli session eventsVladislav Grishenko1-1/+5
Possible races while concurrent additon to the new sessions vector in a one process and remove from it in an another need to be avoided. Let the vector be changed in the new session process function only. Also cli_file_pool element may be freed already at the new session event arrive timepoint, still causing unexpected cli banner for noninteracive cli sessions. Type: fix Fixes: 17a67218587d40541ff522c6a86f354720481fbb Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: I022d16dd3aad9c9330834d35c58938f04b015b08
2022-03-23vlib: leave SIGCONT signal with its default handlerVladislav Grishenko1-0/+1
Systemd always sends SIGCONT after KillSignal, to ensure that even suspended tasks can be terminated cleanly. However, the default action of SIGCONT handler in VPP such as unix_signal_handler() is process termination with coredump, what is not really desired. So, leave it alike SIGSTOP with its default handler. Type: feature Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: I54c06d21669ec3c709322d746db9e28448c31bb8
2021-12-24vlib: introduce vlib frame aux dataDamjan Marion1-2/+2
Type: improvement Change-Id: I53890a13210cfb0d2b2d9d8cfd9b15118d3bb273 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-10-06vlib: doc nitfixesNathan Skrzypczak1-1/+1
Type: improvement Change-Id: I9e761f908d9d2becbc61eb0515dc6b7c1e1e036f Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-10-05build: don't hardcode triplet, allow specifying custom lib dirDamjan Marion2-1/+9
Type: fix Change-Id: I33f364fda88914f88f9b976cb83e6d3ff466f0bb Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2021-09-15vlib: add option to plugin registration to prefer deep bindingDamjan Marion2-6/+7
Type: improvement Change-Id: I9ce7e1ee7e7afe8e9befe36ae8c59291beaaaf36 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-08-27vlib: vpp banner is outputted to non-interactive vppctl sessionSteven Luong1-0/+11
Running a batch file which contains many vppctl commands, occasionally, VPP may spit out the banner for some of the commands. This happens when VPP erroneously views the vppctl session as interactive. A simple way to recreate the problem is to run a batch script as followed while [ 1 ] do vppctl create loopback interface vppctl delete loopback interface intfc loop0 done We have two processes which may display the banner, unix_cli_new_session_process and unix_cli_process. Normally, unix_cli_process parses the input tokens and displays the banner after it negotiates the terminal type with the vppctl app. unix_cli_new_session_process only displays the banner just in case the client fails to negotiate terminal type. It runs on a timer and expires in 1 second to display the banner if by then the terminal type is still not yet negotiated. The problem is when the session is killed or exitted, VPP does not remove the element that was enqueued for cli_new_session_process. The index for the connection (cf) is recycled. The timer for the queue element continues to run. When the timer expires for the queue element, it finds the wrong new session due to index recycling. If the new session has not had negotiated the terminal type, the banner is printed erroneously to the new session from cli_new_session_process. The fix is to clean up the queue element to stop cli_new_session_process from processing the wrong connection when the session is killed. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ife2f1b1c95661e442f0fc6b73505e330e6641fc1
2021-06-13vlib: fix dangling reference in node_by_name hashDave Barach1-1/+4
When recycling a debug CLI process node, unix_cli_file_add() needs to delete and recreate the related node_by_name hash table entry. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I635da4918509d5b22eae37627c2d9b3608380ca6
2021-05-26pg: revert exec file fixesRay Kinsella1-6/+1
This reverts commit fd4fd0d1853ae7384e7a64c4cad17a3469720b95. Type: fix Change-Id: I6ef84f646372270ded486eacee81817067e49106 Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2021-05-26vlib: revert exec cmd handle scripts with blank linesRay Kinsella1-21/+3
This reverts commit 269e1569e1f7798bf7d7f539daf505b2f1997a08. Type: fix Change-Id: I40bd71ae3b5e9dc8345fb2460aae437de8a9a5ba Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2021-05-11vlib: exec cmd handle scripts with blank linesDave Barach1-3/+21
Type: fix Fixes: 2f96e7648b9b7d501088eddff7e4a761973e71f4 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ia75c863850c0df978f61bfc0343a167d8636ed97
2021-04-28pg: exec file fixesmdr781-1/+6
A number of the pg commands were being passed the whole exec file, instead of just a line from the file. Type: fix Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: I2f96e7648b9b7d501088eddff7e4a761973e71f4
2021-03-26vlib: split vlib_main_t into global and per-threadDamjan Marion1-7/+11
Type: refactor Change-Id: I8b273bc3bf16aa360f031f1b2692f766e5fc4613 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-03-26vlib: introduce vlib_get_elog_main()Damjan Marion1-2/+2
Type: improvement Change-Id: I73383eb15186021cd6527d112da8443a0082f129 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-03-26vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()Damjan Marion3-6/+6
Type: improvement Change-Id: If3da7d4338470912f37ff1794620418d928fb77f Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-02-08ping: fix aborting on keypressIvan Shvedunov2-7/+8
Type: fix Currently ping stops on events like SOCKET_READ_EVENT, which makes it hard to use over e.g. govpp as it aborts immediately most of the time. With this patch, ping only stops upon real CLI read / quit events. Signed-off-by: Ivan Shvedunov <ivan4th@gmail.com> Change-Id: Id7a8d0b0fdeb7bbc7b85240e398d27bd5199345b
2021-01-21interface: rx queue infra rework, part oneDamjan Marion1-2/+2
Type: improvement Change-Id: I4008cadfd5141f921afbdc09a3ebcd1dcf88eb29 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-28vlib: add missing file template descriptionsPaul Vinciguerra1-1/+8
Add descriptions to clib_file_t template structures so that sockets can be identified via the 'show unix file' cli command. Type: fix Change-Id: Ibf82d55aa6c7b1126bd252b76d0dc8b7076f5046 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-14misc: move to new pool_foreach macrosDamjan Marion1-4/+4
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-25vlib: add elog events for vlib log entriesDave Barach1-0/+5
Pretty interesting to see how long plugins take to load. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If496eb73b2e1fd9dd714142cd5195fa7ccd93ebd
2020-11-10ip6-nd: fix memory leaksDave Barach1-0/+1
Quite a noticeable amount of memory. Recoded ra event tx and rx fns in the usual manner, which terminated the leaks. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I486d348456b465ad3940a280d4cf489e8dd655a5
2020-11-09vlib: support macros in initial config fileDave Barach1-15/+59
Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If8a19eb6688755311a3430437331ddf13c7e28c8
2020-10-21vlib: print logs to stderr if interactive or nosyslog setDamjan Marion3-2/+14
If VPP is started in interactive mode, instead of sending logs to syslog server we print them directly to stderr. Output is colorized, but that can be turned off with unix { nocolor } Type: improvement Change-Id: I9a0f0803e4cba2849a6efa0b6a86b9614ed33ced Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-19misc: don't export symbols from pluginsDamjan Marion1-1/+1
Type: improvement Change-Id: I2a176fe2871d2e54b010bffc4f1f7a3616f0c455 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-15vlib: add cgo-friendly plugin registration supportDave Barach2-9/+128
Allows us to declare plugin registrations in a non-disgusting way: var plugin_reg = vpp.PluginRegistration{ Description: "The CGO plugin", Version: "My Version", Overrides: "sample_plugin.so", } It turns out that the specific compiler setup generates (.data section offset, length) pairs in the .vlib_plugin_r2 section: Contents of section .vlib_plugin_r2: 1ba9d0 00000000 00000000 50a81800 00000000 ........P....... 1ba9e0 0a000000 00000000 00000000 00000000 ................ 1ba9f0 00000000 00000000 00000000 00000000 ................ 1baa00 00000000 00000000 00000000 00000000 ................ 1baa10 00000000 00000000 70a81800 00000000 ........p....... 1baa20 0e000000 00000000 ........ Contents of section .data: 18a800 00a81800 00000000 00000000 00000000 ................ 18a810 00000000 00000000 00000000 00000000 ................ 18a820 00000000 00000000 00000000 00000000 ................ 18a830 00000000 00000000 00000000 00000000 ................ 18a840 00000000 00000000 14000000 00000000 ................ 18a850 4d792056 65727369 6f6e0000 00000000 My Version...... 18a860 00000000 00000000 14000000 00000000 ................ 18a870 54686520 45474f20 706c7567 696e0000 The CGO plugin.. 18a880 00000000 00000000 0c000000 00000000 ................ <etc> Unfortunately, it seems impossible to torture clang / gcc into producing anything like this. This patch fabricates a plausible vlib_plugin_registration_t from the so-called vlib_plugin_r2_t. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I8c0c5a24f3b7bfea07d5181a7250b3d9685e8446
2020-10-09vlib: save signal handler data to global vblsDave Barach1-4/+4
Turns out that clang is a bit too enthusiastic about mapping static variables to registers, which makes it hard to extract (especially) the faulting VA from an optimized core file. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I836e5d9695aeb4c5ee4a27f9565acf08ee4eaac0
2020-10-01vlib: fix line-mode cli memory leakBenoît Ganne1-0/+1
Type: fix Change-Id: Iaf60ec93ee9750074f52ba4dbe955355de5dbccc Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-09-17vlib: map thread stack instead of allocating them from heapDamjan Marion1-10/+9
Heap may use different page sizes so we will not be able to create stack protection page. Type: improvement Change-Id: Ibb35c9f0a151c464ee0167d17f2bd773ef6f530b Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-03vlib: exit 0 (nocore) on SIGHUPChristian Hopps1-2/+2
Scenarios where SIGHUP is sent would include the user closing an xterm while in interactive/nodaemon mode, or similarly when running vpp in the same mode during testing (e.g., using ssh to run VPP on a DUT). VPP should exit in these cases; however, generating a core is unwanted. Type: fix Signed-off-by: Christian Hopps <chopps@labn.net> Change-Id: Ibccfe5e676547e913c8a205ff16ab56d9abb1c82
2020-08-31vlib: extend telnet protocol guardVladimir Isaev1-1/+1
There is a number of TERMs with big length, such as 'screen.konsole-256color' (23). These TERMs can not be processed properly by vpp because maximum telnet byte stream supported is 24 and we need 6 more service bytes to send TTYPE. So I extended maximum depth guard to 32. Type: fix Signed-off-by: Vladimir Isaev <visaev@netgate.com> Change-Id: I9ca506996a97e9567d06483c5f020d6cc394329c
2020-07-16vlib: fix asan compilation with gccBenoît Ganne1-1/+1
clang tends to force alignment of all sections when compiling for address sanitizer, confusing VPP plugin infra. On the contrary, GCC does not support this attribute on sections. Selectively enable it depending upon the compiler. Type: fix Fixes: cea46522e79637f6ec37c03ec3fbeb87b160a378 Change-Id: I2dd6e52e70e6b4d89c101171cafc813e175ec472 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-07-01vlib: wake up workers if interrupts are postedBenoît Ganne1-1/+2
Type: fix Change-Id: If8dbbcb46193fd057fe8d704058609a3a8787d6c Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-06-23vlib: debug CLI macro expander, part deuxDave Barach1-11/+34
Deal with circular macro definitions instead of crashing due to stack overflow. Separate macro tables, per CLI session Add documentation to the Sphinx docs Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I55fc9152bd37ad0c15fa3959f38b07b63100e634
2020-06-19vlib: add recursive macro expander to debug cliDave Barach1-1/+142
All of the pieces have been sitting around for years. Added several debug CLI commands: "define <variable-name> <value>" "undefine <variable-name>" "show macro [noeval]" "echo <whatever>" Macros may refer to other macros. To defer evaluation: "define foo \$(bar)" or some such. The macro evaluator is not smart about "define foo \$(foo)" or more complicated circular definitions, so don't do that. Environment variables are available, simply use $<name-of-environment-vbl> The macro expander has a table of (overrideable) builtin names, which are evaluated by calling functions. Simple example: echo $USER define ip1 192.168.1.1/24 define ip2 192.168.2.1/24 loop create loop create set int ip address loop0 $ip1 set int ip address loop1 $ip2 show int addr show macro undefine ip1 undefine ip2 Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I08a800647bac573d8ae3cfd75c40061d41c5f976
2020-06-16vlib: address sanitizer support for stack switch, enable clangDamjan Marion2-0/+4
Type: improvement Change-Id: I81df4b61d1f0b8c1df77c1ee9bebcb491e155b69 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-15vlib: restore commands for non-interactive sessionsBenoît Ganne1-8/+13
'quit' and 'show terminal' are valid for non-interactive sessions too. Type: fix Fixes: a58be82dda89d6496f92e451b42eee31f0cf47b4 Change-Id: Ib63244c7b64ad2e30c257ed19e982295f59bfffa Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-05-15misc: removed executable bits from source filesRay Kinsella1-0/+0
Identified and removed executable bit from source files in the tree. find . -perm 755 -name *.[ch] -exec chmod a-x {} \; Type: improvement Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: I00710d59fcc46ce5be5233109af4c8077daff74b
2020-05-14vlib: fix unix cli commands crash without sessionBenoît Ganne1-15/+23
If a cli command is run while there are no cli session, then cm->cli_file_pool will not be initialized and we should not try to operate on it. Type: fix Change-Id: Iaea15a23f7efd5b17fab13e6c1cbb3a9a34080e0 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-05-02vlib: add nosyslog unix optionRuslan Babayev2-3/+12
The "nosyslog" option disables syslog just like the "interactive" mode but can be used together with "nodaemon". This is useful for when VPP is running under a process supervisor like runit or daemontools that pipe the stdout/stderr to a dedicated logger service. Type: feature Change-Id: Ic4287338d6836fea9f3eabdcf960dc1f51875dd1 Signed-off-by: Ruslan Babayev <ruslan@babayev.com>
2020-04-27vlib: deprecate i2c and cjDave Barach2-363/+0
i2c follows its only use case - the original 82599 driver - into extras/deprecated. cj is/was an emergency debug tool unused in several years. Move to extras/deprecated/vlib Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ib55b65373f62630db295c562974bd8f2456c3107
2020-03-21vlib: leave SIGPROF signal with its default handlerJieqiang Wang1-0/+1
When profiling VPP with MAP (a software profile suite on Arm CPUs, see details in https://www.arm.com/products/development-tools/server-and-hpc/forge/map) on Arm servers, VPP will receive SIGPROF signal because MAP uses SIGPROF signal to drive its sampler to do profiling on VPP. However, the default action of SIGPROF signal handler in VPP such as unix_signal_handler() is process termination. To profile VPP with MAP, the SIGPROF handler should be left as default, and MAP sampler will overwrite it with its own implementation. Type: feature Change-Id: Ie14e513d35ec27a66e95067689408bad8ed1ad6b Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
2020-03-12vlib: fix unix cli SIGSEGV for empty line inputFan Zhang1-1/+2
When logging is enabled, an empty line input (press Enter only) will cause SIGSEGV. This patch fixes the problem by checking the command length first. Type: fix Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com> Change-Id: Ib4cbd1c7bfd6a694e289d28958875c7d2356a93e
2020-03-11vlib: unix cli - log cli commands one per linePaul Vinciguerra1-0/+2
This changeset modifies the log output so that cli commands now look like: cat /tmp/vpp-cli.log 2020/03/10 19:24:42:186: ***** Start: PID 29570 ***** /* [0] is stdin */ 2020/03/10 19:24:53:518[0]: show clock 2020/03/10 19:24:56:078[0]: show clock 2020/03/10 19:25:01:983[0]: show pci /* [1] is vppctl socket */ 2020/03/10 19:26:14:372[1]: show ver 2020/03/10 19:26:23:395[1]: show hardware-interfaces 2020/03/10 19:26:28:507[1]: q instead of: cat /tmp/vpp-cli.log 2020/03/01 00:40:12:834: ***** Start: PID 29974 ***** 2020/03/01 00:40:24:969[0]: show interface2020/03/01 00:40:31:945[0]: show clo2020/03/01 00:40:41:288[0]: show classify 2020/03/01 00:40:43:753[0]: show classify ?2020/03/01 00:40:53:392[0]: show classify tables2020/03/01 00:40:57:352[0]: quit Type: improvement Change-Id: I38d85535977296d174db7121ae340850b6476a39 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>