summaryrefslogtreecommitdiffstats
path: root/src/vcl/ldp.c
AgeCommit message (Collapse)AuthorFilesLines
2021-08-30vcl: fix vlsh conversion errorliuyacan1-3/+1
vlsh may not belong to the current vcl worker. Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I75f962313e538fcd2b1cc6dffca53997648ca43e
2021-08-02vcl: fix sleep time in ldp_pselect()liuyacan1-1/+2
Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: Ic9c5b23be4bde88880972be35525f12fa2c6dc10
2021-07-31vcl: fix ldp for __recv_chk socket callsSivaprasad Tummala1-0/+9
add ldp support for handling __recv_chk socket calls. Type: fix Signed-off-by: Sivaprasad Tummala <Sivaprasad.Tummala@intel.com> Change-Id: I33221c465ac607bc665fcba500dd399a56b32df6
2021-07-06vcl: fix return value check for ldp_fd_to_vlshwanghanlin1-3/+3
Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: Iaad4022e84f4979016bb46c2ff5cfc5d43d6ff50
2021-06-16vcl: fix fifo sharingFlorin Coras1-0/+3
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iec1fe8315a057214901250d5fb06d1c1e33dda46
2021-06-14vcl: improve shutdown()liuyacan1-19/+2
This commit does following: - Change the behavior of shutdown() with SHUT_RDWR flag. - Check SHUT_RD flag when read() - Change the errno when write() after SHUT_WR - Remove unused code All the above modification passed the packetdrill test. Type: improvement Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I0c81f52e563562e58580d70976526b898e65e915
2021-06-03vcl: avoid updating errno on ldp init checkFlorin Coras1-71/+43
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I7f5887865aa29c9881b5063be1d7d42369a493c1
2021-06-02vcl: ldp placeholder for SO_LINGERFlorin Coras1-0/+3
Make sure we don't return error if app tries to setsockopt it. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1a9a6a8da03380b0b6a6d01efed9b672a3f0b1f9
2021-05-12session: support half-close connectionliuyacan1-0/+2
Some app(e.g. Envoy) may call shutdown() instead of close() when draining connection. Type: improvement Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I9543b9ca3caa87b10b134fd1fc4019124e41e4d2
2021-03-22vcl: fix libc epoll pwait starvedwanghanlin1-1/+2
We call vls_epoll_wait with 0 timeout to process unhandled_evts_vector in ldp_epoll_pwait_eventfd. But vls_epoll_wait will then call vppcom_epoll_wait_eventfd to process events in event queue. If there are continuous events to be handled, then libc_epoll_pwait have no chance to be called. Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: Ia4f61d0d438a3475bfde9f6715805274671d4e75
2021-02-22vcl: support sockopt of SO_REUSEPORT and SO_DOMAINwanghanlin1-0/+10
Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I800cfffb07bf7d4c4d1454b73febdba03f7d6b75
2021-01-07vcl session: switch to generic cert key apisFlorin Coras1-49/+56
Remove the deprecated tls apis. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia1e12bd813671146f0aca22e83d04c23ac13e595
2020-12-14misc: refactor clib_bitmap_foreach macroDamjan Marion1-6/+5
Type: refactor Change-Id: I077110e1a422722e20aa546a6f3224c06ab0cde5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-14misc: move to new pool_foreach macrosDamjan Marion1-2/+2
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-19hsa: cleanup sock server testFlorin Coras1-1/+1
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I769174f0023d00a59bc5a03cf0a05996b616742b
2020-09-17vcl: avoid heap use for ldp debugFlorin Coras1-5/+5
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I798db694bdc63ae3a6e28d1908245b5ea0bfa84f
2020-08-12vcl: mt detection and cleanupFlorin Coras1-3/+4
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I521c110fd4d7445bd585c96d4c768f16a0a7d3b8
2020-08-12vcl: support multi-threads with session migrationhanlin1-3/+8
Currently, mutlti-threads only support one dispatch thread and multiple worker threads, eventually only dispatch thread is a vcl worker and can interact with epoll. This patch will register all threads as vcl worker, and then each thread can interact with epoll now. Moreover, session migration also supported, such as socket created in thread A and used (bind, connect and etc.) in thread B. Type: feature Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: Iab0b43a33466968c1423d7d20faf1460c8589d91
2020-05-26vcl: fix ldp fcntl64Florin Coras1-9/+20
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I342d8f928fcc7de74f9bd288c1a5d63ea1f90020
2020-05-24vcl: add sendmsg/recvmsg for vlsh in ldpFlorin Coras1-65/+130
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: If61eec3f5723e6b36e6f4a21c05d8d0dd3547fc7
2020-05-20vcl: nest vcl_mq_epfd to support epoll_wait without high CPU usagehanlin1-2/+118
Now, libc epfd and vls epfd are independent and can only epoll_wait independently without timeout, then app calling epoll_wait will occupy high CPU. So we nest vcl_mq_epfd into libc epfd when using eventfd with VPP, and then we can only epoll_wait libc epfd with specified timeout. Type: feature Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: I6b6e0f501c769e186714bfbc187cfaed2533b4c2 Signed-off-by: hanlin <hanlin_wang@163.com>
2020-04-29vcl: add separate fcntl64 ldp handlerFlorin Coras1-5/+12
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idb81e2901398dd6ae94931c705a704c7b52bbb36
2020-04-25vcl: generate select events on read/write errorsFlorin Coras1-0/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3429f9d0406b6d710846fc82d77400f26f77fdf4
2020-04-20vcl: expand vcl select maps in ldp if neededFlorin Coras1-4/+5
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I56c487821233cebf2146745a4706cb573cc088a5
2020-04-04misc: strcpy be goneDave Barach1-1/+1
Causes static analysis "vulnerability" warnings Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I272fa69251d70f62178e6dff0423c16f99937af1
2020-03-24vcl: fix ldp recv return on errorFlorin Coras1-1/+4
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I0875705d3a0c95f2781b0595ef27a30486438aae
2020-03-24vcl: fix ldp writev 0 vecsFlorin Coras1-12/+8
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iec5db8dcf3a019b731e15fd79d0208d6eb10943b
2020-02-14vcl: fix ldp read on closing sessionFlorin Coras1-13/+8
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I60be191866d20721951ad22f571a2a3275511e12
2020-02-04vcl: switch to closed state after app closeFlorin Coras1-0/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I851db474538de76d5f70dd6d6f83a6487a5a02bd
2019-12-30vcl: hold errno when calling LDBGhanlin1-1/+5
Type: fix Call trace of LDBG: LDBG->clib_warning->_clib_error->dispatch_message->os_puts->writev However, writev will hijacked by LDP, and then execute following code: if ((errno = -ldp_init ())) return -1; Now, errno will be set. Because we always call LDBG just before return from ldp_accept4, listen, and etc. So errno will be overwritted after LDBG called. Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: I7a90f3a14772994f11f09650481411796e3f5630
2019-11-14vcl: Handle newer Glibc (>2.28) where fcntl is actually fcntl64Carl Smith1-0/+9
Glibc 2.28 now provides fcntl64 which is used instead of fcntl by defining fcntl as fcntl64 in fcntl.h Type: fix Change-Id: I87fedfbf3e0d241aafdc920e90f824d71353e0e6 Signed-off-by: Carl Smith <carl.smith@alliedtelesis.co.nz>
2019-08-21vcl: fix ldp_set_app_name overflowBenoît Ganne1-5/+2
In case of overflow, we null-terminate the parameter ('app_name') instead of ldp global name ('ldp->app_name'). Moreover, snprintf() always safely null-terminate the destination string even in case of overflow. Type: fix Fixes: 048b1d6ab7 Change-Id: I4d8b0e020a228e982b6699d652b341c5afe92993 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-05-09ldp: add option to eanble transparent TLS connectionsYu Ping1-2/+87
If LDP_TRANSPARENT_TLS is set, LDP transparently converts TCP into TLS connnection. Verified in Nginx LD_PRELOAD mode. Change-Id: I2229be61a0deb723bf5d94a2193ecb792dd997fb Signed-off-by: Yu Ping <ping.yu@intel.com>
2019-04-04ldp: ignore TCP_CORK socket optionFlorin Coras1-0/+1
Change-Id: Iffc3d2fbb478d5cd228959f4f2653d0508887489 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-20ldp: force exit if constructor init failsFlorin Coras1-2/+5
Change-Id: I0c4659b9e413cf7291ec9e3b5a67de8ad8028cd3 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-15vcl: cleanup debug messagesFlorin Coras1-1/+1
Change-Id: Ida3ecffc9a4d7a080ad63cd48fd4b5330b732ffb Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-11ldp: fix worker alloc when using eventfdsFlorin Coras1-1/+15
Change-Id: Icfba7ae9cbf504a8966923eac06c9eb0e11899d2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-02-22session/vcl: fix coverity warningsFlorin Coras1-1/+5
Change-Id: I9b0e6d65255e516cf5bf18757d4769176ef76e92 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-02-19ldp: return byte count from a successful recvfromHaggai Eran1-2/+6
Unless there's an error, recvfrom should return the number of bytes received. The current code returns zero on success due to ldp_copy_ep_to_sockaddr returning zero. Change-Id: Ib843b99a08c44b5ee2d16efe9edab0cf5df65170 Signed-off-by: Haggai Eran <haggai.eran@gmail.com>
2019-01-30ldp: initialize clib timeFlorin Coras1-8/+18
Change-Id: Ie598443f024a677a9c6938b3f3634960fd712b09 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-29vls: multi-process and multi-threaded apps improvementsFlorin Coras1-9/+10
- More fine tuning for multi-process applications. - Experimental support for multi-thread apps. This is meant for app whose threads are not vcl workers and the sessions are shared between them. Change-Id: Ie07651da5f2cdcf39f5dead5431f50ad39cf3f74 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-23vcl: generate epoll events only if requestedFlorin Coras1-8/+4
Change-Id: I6e96607f09c18755eead2c7099e1f546bdae7b88 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-21ldp: add support for TCP_CONGESTION sockopts (VPP-1550)Florin Coras1-0/+9
Change-Id: I0fcf3385cc4fb96f000b84d5f880f74131c0d60f Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-08vcl/ldp: select cleanup/improvementsFlorin Coras1-207/+185
Change-Id: I640e69388f2ab0f66ad60c5165c749f5a5a9f525 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-07vcl/ldp: add locked sessions shim layerFlorin Coras1-1284/+336
Moves LDP logic that allows sharing of sessions between multi-process app workers into a separate VCL shim layer. Also refactors LDP to use the new layer. Change-Id: I8198b51eae7d099a8c486e36b29e3a0cb8cee8e9 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-05vcl/session: add api for changing session app workerFlorin Coras1-105/+159
In case of multi process apps, after forking, the parent may decide to close part or all of the sessions it shares with the child. Because the sessions have fifos allocated in the parent's segment manager, they must be moved to the child's segment manager. Change-Id: I85b4c8c8545005724023ee14043647719cef61dd Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-02Fixes for buliding for 32bit targets:David Johnson1-3/+6
* u32/u64/uword mismatches * pointer-to-int fixes * printf formatting issues * issues with incorrect "ULL" and related suffixes * structure alignment and padding issues Change-Id: I70b989007758755fe8211c074f651150680f60b4 Signed-off-by: David Johnson <davijoh3@cisco.com>
2019-01-02ldp/vcl: epoll and shutdown cleanupFlorin Coras1-92/+45
Change-Id: I882b4c495426551fad63372dc106496c5e8c141e Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-01vcl/ldp: add write msg function and fine tuningFlorin Coras1-45/+7
Allows app to push data. Additionally, ensure reset/close replies are not sent unless vcl closes the session. Change-Id: Icbbf933cf57b55cfbcc7b802af0f83919a066f65 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-12-13ldp/vcl: reduce debug verbosityFlorin Coras1-307/+113
Also cleanup some ldp debug code. Change-Id: I23d1b9d744289244f4778f623702fc2b5d6fcd8b Signed-off-by: Florin Coras <fcoras@cisco.com>