Module: kamailio
Branch: master
Commit: 74fa6c5570d6394af8c5352bd37e21e970f1575c
URL: https://github.com/kamailio/kamailio/commit/74fa6c5570d6394af8c5352bd37e21e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-04-08T09:38:48+02:00
core: main - coherent behaviour for fix_cfg_file()
- duplicate to build the output always, safer not to try to change the
static string defined via macro at runtime
---
Modified: src/main.c
---
Diff: https://github.com/kamailio/kamailio/commit/74fa6c5570d6394af8c5352bd37e21e…
Patch: https://github.com/kamailio/kamailio/commit/74fa6c5570d6394af8c5352bd37e21e…
---
diff --git a/src/main.c b/src/main.c
index 4dac30179c..44fb940393 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1260,14 +1260,15 @@ static struct name_lst* parse_phostport_mh(char* s, char** host, int* hlen,
-/** Update \c cfg_file variable to contain full pathname. The function updates
+/** Update \c cfg_file variable to contain full pathname or '-' (for stdin)
+ * allocated in system memory. The function updates
* the value of \c cfg_file global variable to contain full absolute pathname
- * to the main configuration file of SER. The function uses CFG_FILE macro to
+ * to the main configuration file. The function uses CFG_FILE macro to
* determine the default path to the configuration file if the user did not
* specify one using the command line option. If \c cfg_file contains an
- * absolute pathname then it is used unmodified, if it contains a relative
+ * absolute pathname then it is cloned unmodified, if it contains a relative
* pathanme than the value returned by \c getcwd function will be added at the
- * beginning. This function must be run before SER changes its current working
+ * beginning. This function must be run before changing its current working
* directory to / (in daemon mode).
* @return Zero on success, negative number
* on error.
@@ -1276,34 +1277,55 @@ int fix_cfg_file(void)
{
char* res = NULL;
size_t max_len, cwd_len, cfg_len;
-
+
if (cfg_file == NULL) cfg_file = CFG_FILE;
- if (cfg_file[0] == '/') return 0;
- if (cfg_file[0] == '-' && strlen(cfg_file)==1) return 0;
-
+ if (cfg_file[0] == '/') {
+ cfg_len = strlen(cfg_file);
+ if(cfg_len < 2) {
+ /* do not accept only '/' */
+ fprintf(stderr, "ERROR: invalid cfg file value\n");
+ return -1;
+ }
+ if ((res = malloc(cfg_len + 1)) == NULL) goto error;
+ memcpy(res, cfg_file, cfg_len);
+ cfg_file[cfg_len] = 0;
+ cfg_file = res;
+ return 0;
+ }
+ if (cfg_file[0] == '-') {
+ cfg_len = strlen(cfg_file);
+ if(cfg_len == 1) {
+ if ((res = malloc(2)) == NULL) goto error;
+ res[0] = '-';
+ res[1] = '\0';
+ cfg_file = res;
+ return 0;
+ }
+ }
+
/* cfg_file contains a relative pathname, get the current
* working directory and add it at the beginning
*/
cfg_len = strlen(cfg_file);
-
+
max_len = pathmax();
if ((res = malloc(max_len)) == NULL) goto error;
-
+
if (getcwd(res, max_len) == NULL) goto error;
cwd_len = strlen(res);
-
+
/* Make sure that the buffer is big enough */
if (cwd_len + 1 + cfg_len >= max_len) goto error;
-
+
res[cwd_len] = '/';
memcpy(res + cwd_len + 1, cfg_file, cfg_len);
-
+
res[cwd_len + 1 + cfg_len] = '\0'; /* Add terminating zero */
cfg_file = res;
return 0;
-
+
error:
- fprintf(stderr, "ERROR: Unable to fix cfg_file to contain full pathname\n");
+ fprintf(stderr, "ERROR: Unable to fix cfg file to contain full pathname\n");
if (res) free(res);
return -1;
}
Hello!
I have a problem about volte.
> 4(4467) INFO: rr [rr_mod.c:515]: pv_get_route_uri_f(): No route header present.
> 4(4467) NOTICE: <script>: PCSCF REGISTER:
> Destination URI: <null>
> Request URI: sip:ims.mnc007.mcc460.3gppnetwork.org
> 4(4467) INFO: rr [rr_mod.c:515]: pv_get_route_uri_f(): No route header present.
> 4(4467) NOTICE: <script>: Source IP and Port: (10.45.0.6:5060)
> Route-URI:
> 4(4467) NOTICE: <script>: Received IP and Port: (192.168.107.6:5060)
> 4(4467) NOTICE: <script>: Contact header: <sip:460070000000001@10.45.0.6:5060>;+sip.instance="<urn:gsma:imei:86772304-493882-0>";+g.3gpp.accesstype="cellular2";audio;video;+g.3gpp.smsip;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel"
> 4(4467) INFO: ims_registrar_pcscf [sec_agree.c:296]: cscf_get_security_verify(): No sec


urity-verify parameters found

[open5gs.tar.gz](https://github.com/kamailio/kamailio/files/6270079/open5gs.…
Can you help me see where the problem is?
Thanks!
Tips:About SQN, the SQN is the same at the beginning of the test (Open5GS, FOHSS), but when it is found that the sip registration fails, the SQN is inconsistent. If this situation is normal? If it is not normal, how to solve it?
open5gs:v2.2.3
kamailio:5.3
--
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/2703