#### Pre-Submission Checklist - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [ ] Small bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: - [ ] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
This is a proposed evolution that adds socket timestamping of received UDP packets (using SO_TIMESTAMPNS). It computes the delay between this timestamp and the time at which the packet is read by Kamailio. This can then be accessed using pv "$TV(RD)" (RD for "receive relay").
Rationale : The Kamailio server is handling traffic that is irregular and can temporarily spike to a point where all children are still busy when new packets are incoming on the network interface. Consequently, these packets have to wait until a worker is available. The client will see a higher response time, that currently cannot be monitored by Kamailio itself. This evolution allows to make this wait time observable by Kamailio, allowing to log or write the information to CDR for example.
If this is possible, I'd like to merge this feature in Kamailio. Of course, I'm ready to discuss the PR and make any necessary changes. All comments and reviews are most welcome.
I've tested this locally on Linux (3.10.0-957.10.1.el7.x86_64) with the latest Kamailio master as of 2023/03/23.
Thanks! You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3404
-- Commit Summary --
* core: add socket timestamp of received packets and keep track of receive delay * pv: add $TV(RD) to get the new information "receive delay"
-- File Changes --
M src/core/ip_addr.h (1) M src/core/parser/msg_parser.h (1) M src/core/receive.c (8) M src/core/udp_server.c (60) M src/core/ut.h (34) M src/modules/pv/pv_time.c (15)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3404.patch https://github.com/kamailio/kamailio/pull/3404.diff
Interesting. Have you tested this on TCP/TLS too?
Interesting. Have you tested this on TCP/TLS too?
No, this only works for UDP. I didn't try to implement it for TCP, not sure how to do it. I looked a bit at the code but it seems more complicated...
I can't have an opinion right away for merging, the changes are on a critical part of the core code and I am not sure it is portable for bsd/macos/*unix. I think it needs further analysis, it is also only for udp.
This PR is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.
@nchaigne are you interested in working further on this? Right now its also in a conflict state due to other changes in the last weeks in the core.
@nchaigne are you interested in working further on this? Right now its also in a conflict state due to other changes in the last weeks in the core.
Hello Henning, Unfortunately I don't think I will be able to continue working on this.
As Daniel pointed out, it is currently too limited in scope (only for udp, maybe not portable). So it's probably better to close the PR.
Thanks for the feedback, closing it then.
Closed #3404.