#### 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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] 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
In case the first lookup (with tcp id) is not successful, the second
attempt should have been performed without a tcp id.
Issue was introduced with dc43750644 (new global parameter
tcp_connection_match) in 5.3.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2305
-- Commit Summary --
* core: do not use tcp id for lookup if not needed
-- File Changes --
M src/core/tcp_main.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2305.patchhttps://github.com/kamailio/kamailio/pull/2305.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2305
Module: kamailio
Branch: master
Commit: 24a3a172dbdecb6e987df943a3ad1acb4da664b5
URL: https://github.com/kamailio/kamailio/commit/24a3a172dbdecb6e987df943a3ad1ac…
Author: Donato Sciarra <donato.sciarra(a)bmw.de>
Committer: Donato Sciarra <donato.sciarra(a)bmw.de>
Date: 2020-04-28T10:33:23+02:00
core: do not use tcp id for lookup if not needed
In case the first lookup (with tcp id) is not successfull, the second
attempt should have been performed without a tcp id.
Issue was introduced with dc43750644 (new global parameter
tcp_connection_match) in 5.3.
---
Modified: src/core/tcp_main.c
---
Diff: https://github.com/kamailio/kamailio/commit/24a3a172dbdecb6e987df943a3ad1ac…
Patch: https://github.com/kamailio/kamailio/commit/24a3a172dbdecb6e987df943a3ad1ac…
---
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index e57a29d99e..89e3b56b7c 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1967,7 +1967,7 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* from,
if (likely(port)){
/* try again w/o id */
if(tcp_connection_match==TCPCONN_MATCH_STRICT) {
- c=tcpconn_lookup(dst->id, &ip, port, from, try_local_port, con_lifetime);
+ c=tcpconn_lookup(0, &ip, port, from, try_local_port, con_lifetime);
} else {
c=tcpconn_get(0, &ip, port, from, con_lifetime);
}
Hello,
(cross-posting because it is relevant to know where users need to run
Kamailio as well as what developers tend to use for coding, but replies
can go to one or the other list).
Somehow I tried to stay close to ANSI-C/C90 with C coding style, for the
reason of being compatible as much as possible with old compiles and
niche/embedded systems. But I noticed that there are couple of C99
extensions in the core, like inline functions, variadic macros (the
debugging macros), use of 'long long' or line comments starting with
"//" (not so many, but still such comment style is used). Although I
haven't searched for occurrences in core, but I remember seeing
designated initializers (or initializing a structure by field names).
These are part of C99, as listed by:
* https://en.wikipedia.org/wiki/C99#Design
Although likely GCC had some of them like custom extensions before the
standard was out.
On the other hand, newer standard C11 made some of those extensions
optional:
*
https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features
So, my email here is to figure out if we should consider C99 as the
requirement for adding C code or be more restrictive because there are
still cases of usage on very specific systems that do not have such C
compiler. We can eventually make a list of what is accepted or not from
the recent versions of C standard to stay as much as possible portable
across Unix'es.
>From develeopers perspective, it would be good to learn if they use (in
other projects, etc.) extensions of the new standards that they found
useful and simplify their programming work.
Cheers,
Daniel
--
Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
### Description
I tried to use the `$env(NAME)` pseudovariable as argument for `modparam()` calls but evidently the result was empty.
### Troubleshooting
#### Reproduction
Set up `auth_ephemeral` and add this to your configuration:
```
modparam("auth_ephemeral", "secret", "$env(AUTH_EPHEMERAL_SECRET)")
```
Now export `AUTH_EPHEMERAL_SECRET=something` and start Kamailio with sufficient debug output. You'll see that Kamailio literally uses `$env(AUTH_EPHEMERAL_SECRET)` as secret instead of inserting the value of the environment variable.
#### Log Messages
```
kamailio_1 | 17(23) DEBUG: auth_ephemeral [authorize.c:136]: do_auth(): secret: $env(AUTH_EPHEMERAL_SECRET) (27)
```
### Possible Solutions
Replacement of environment variables should be supported in `modparams()`. (And possibly in *all* functions.)
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.2.1 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 5.3.1
```
* **Operating System**:
```
$ uname -a
Linux e2193249aa45 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
```
(Using the Docker image `kamailio/kamailio:5.2.1-xenial` ATM.)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2276