summaryrefslogtreecommitdiffstats
path: root/src/vcl/ldp.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-01vcl: remove perror ldp callFlorin Coras1-1/+0
Reported by coverity Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Idae1bceb1eeb6dfe0394eed39ced9d09342d201f
2023-11-29vcl: fix init of ldp workersFlorin Coras1-4/+2
LDP workers is used as vector but was initialized as a pool. There was no side effect but ASAN does not properly unpoison memory and this triggers false used-after-poison crashes. Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie769dad0e86ab970de9929800d0a4131f846e70e
2023-11-07misc: silence -Wmaybe-uninitialized warningsJieqiang Wang1-1/+1
GCC 12 complains about such errors while the code itself looks good. Type: fix Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com> Change-Id: I021719fdbf7d9bd93a12eac76aeac8cbca13a810
2023-08-15vcl: fix ldp epoll events array overrunFlorin Coras1-1/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3dd65946c220f958a4fda0551b053d690bf06c39
2023-08-08vcl: Fix the ldp init checkGao Feng1-1/+5
Maybe some function calls the wrapper funtion like read which invokes the ldp_init_check in the other libs as a constructor before ldp_constructor. Then the ldp has been initialized already when ldp_constructor is invoked. And it's normal case, we shouldn't treat it as an error. So ldp_init should return success if ldp is initialized already instead of an assert. Type: fix Change-Id: Ifa2a7b1d5471981a3f840b14a4fa5d48fb1f1374 Signed-off-by: Gao Feng <gfree.wind@outlook.com>
2023-07-21vcl: ldp support SO_ORIGINAL_DSTqinyang1-0/+19
Type: improvement Support SO_ORIGINAL_DST socket option to get original dst_ip4 and dst_port if nat44 rule enabled. Change-Id: If00e00d03e48f3b78a23a68f1b078954d79dd0f7 Signed-off-by: qinyang <qiny@yusur.tech>
2023-07-19vcl: zero out cmsg for recvmsg APISteven Luong1-0/+1
When msg->msg_controllen is set in recvmsg, the caller wants to receive additional information about the messages. However, they might not always be available. In that case, we should clear cmsg since the caller uses CMSG_NXTHDR which might access uninitialized fields in cmsg. Type: fix Change-Id: Ifdf9634bfcb1427f7ae3812014a46bfd7f4bc473 Signed-off-by: Steven Luong <sluong@cisco.com>
2023-05-12vcl: fix ldp ioctl FIONBIO handlerFlorin Coras1-1/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ife5f72dc9587c9f6b8aa513cd039fa28bb22fca3
2023-03-10vcl: init ldp config before vcl initFlorin Coras1-26/+31
This avoids printing ldp debug messages while debug is disabled and vcl is initializing. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I5dfd1d59032db937fea146b6b84b8e26307a0de0
2023-03-06vcl: always drain libc epoll with eventfds in ldpFlorin Coras1-17/+36
Otherwise if vcl epoll lt events are ignored by the app, libc and vcl mq events are never drained. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1e22f6da46d56236c52714181f6c20dcb80a33a5
2023-03-01vcl: accept vcl spurious wakeup in epoll wait eventfdFlorin Coras1-1/+5
Accept one spurious wakeup from vcl in epoll_pwait_eventfd to avoid returning zero events to app without timeout. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I447c7f8176413c562be28605376a92d15e22a1f9
2023-03-01vcl: close libc epfd on vls epfd closeFlorin Coras1-7/+7
Nginx recreates epfds. Make sure ldp tracks the event and recreates the libc epfd or eventfd flavor of epoll pwait will not work. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2994bead9494f0fbb85dd32767cecc1cf69ff6eb
2023-03-01vcl: fix undeclared UDP_SEGMENT for centos 8Tianyu Li1-0/+4
Old distros Centos 8 / Ubuntu 18.04 header files doesn't have UDP_SEGMENT declared, define UDP_SEGMENT to right value if not defined. Type: fix Fixes: eff5f7aea8c7 ("vcl: ldp support for ip_pktinfo") Signed-off-by: Tianyu Li <tianyu.li@arm.com> Change-Id: I99314b895e7d09962a36e7f5582c09d0d77563dc
2023-02-28vcl: use program invocation name in ldp app nameFlorin Coras1-3/+2
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2c97faa2cdca32d083aabc3344c8fe67c74ff2fd
2023-02-20vcl: ldp support for ip_pktinfoFlorin Coras1-23/+120
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3c15f38a4a3f5e92506059277948e7fca9cd8b55
2023-02-16vcl: fix incorrect ldp worker in ldp_epoll_pwait()Liangxing Wang1-1/+5
For some apps(e.g. wrk2) upon vpp hoststack, ldp_epoll_pwait() is called. In this function, epoll fd was created on one thread, but it is now used on another thread. The vcl worker index is still invalid, so the fetched ldp worker is also invalid and can corrupt some already allocated memory. Just as the ldp_epoll_pwait_eventfd(), make sure the vcl worker is valid before getting the ldp worker in ldp_epoll_pwait(). Type: fix Signed-off-by: Liangxing Wang <liangxing.wang@arm.com> Change-Id: I2ec23a4b5d5b0879a06642ffd80f95e948af4274
2023-02-07vcl: add ldp implementation for recvmmsgFlorin Coras1-31/+39
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I7322abc3d3b0aa81399667bf02b03786fc62c958
2023-02-07vcl: better handlig of ldp apis that rely on gnu sourceFlorin Coras1-19/+36
Control use of apis that rely on _GNU_SOURCE being defined with compile time macro. Also fixes sendmmsg and recvmmsg which were not probably wrapped. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I207de23210d4b9dc960bb4289159502760c5614d
2022-12-14vcl: enable gso for 'sendmsg' in LDP mode.Dou Chao1-5/+27
Some upon apps(e.g. Nginx-quic) package it's several protocol buffers into a struct msg which is a combination of gso_buffer and gso_size. but if HostStack regardless the gso_size to the buffer and split the buffer with default mss, that cause peer client failed on parsing the package. Type: improvement Signed-off-by: Dou Chao <chao.dou@intel.com> Change-Id: I805eb642be826038ba96d1b85dad8ec0c0f6c459 Signed-off-by: Dou Chao <chao.dou@intel.com>
2021-11-29vcl: fix build with older gccFlorin Coras1-1/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic941065aa7d7c0002863a6391c8914089c438445
2021-10-15vcl: narrow the scope of the restriction of vlsh_bit_valwanghanlin1-3/+4
The restriction of vlsh_bit_val only effect select/pselect, so move the check to select/pselect function. Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I3585c83cfc2f0a2fd834450be650dccda67e3faa
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