Module: kamailio
Branch: master
Commit: 9dc9233289d2518419438d38ac7d7b0abf4862a1
URL:
https://github.com/kamailio/kamailio/commit/9dc9233289d2518419438d38ac7d7b0…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-12-12T15:18:46+01:00
nathelper: add fixup_free* to exported functions
---
Modified: src/modules/nathelper/nathelper.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9dc9233289d2518419438d38ac7d7b0…
Patch:
https://github.com/kamailio/kamailio/commit/9dc9233289d2518419438d38ac7d7b0…
---
diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
index 6673370a5a8..ec543079f31 100644
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -125,7 +125,9 @@ static int alter_mediaip(struct sip_msg *, str *, str *, int, str *,
int, int);
static int fix_nated_register_f(struct sip_msg *, char *, char *);
static int fixup_fix_nated_register(void **param, int param_no);
static int fixup_fix_sdp(void **param, int param_no);
+static int fixup_free_fix_sdp(void **param, int param_no);
static int fixup_add_contact_alias(void **param, int param_no);
+static int fixup_free_add_contact_alias(void **param, int param_no);
static int add_rcv_param_f(struct sip_msg *, char *, char *);
static int nh_sip_reply_received(sip_msg_t *msg);
static int test_sdp_cline(struct sip_msg *msg);
@@ -214,7 +216,7 @@ static cmd_export_t cmds[] = {
0, 0,
REQUEST_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{"add_contact_alias", (cmd_function)add_contact_alias_3_f, 3,
- fixup_add_contact_alias, 0,
+ fixup_add_contact_alias, fixup_free_add_contact_alias,
REQUEST_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE},
{"set_contact_alias", (cmd_function)set_contact_alias_f, 0,
0, 0,
@@ -228,13 +230,13 @@ static cmd_export_t cmds[] = {
fixup_igp_null, fixup_free_igp_null,
REQUEST_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{"fix_nated_sdp", (cmd_function)fix_nated_sdp_f, 1,
- fixup_fix_sdp, 0,
+ fixup_fix_sdp, fixup_free_fix_sdp,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{"fix_nated_sdp", (cmd_function)fix_nated_sdp_f, 2,
- fixup_fix_sdp, 0,
+ fixup_fix_sdp, fixup_free_fix_sdp,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{"nat_uac_test", (cmd_function)nat_uac_test_f, 1,
- fixup_igp_null, 0,
+ fixup_igp_null, fixup_free_igp_null,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{"fix_nated_register", (cmd_function)fix_nated_register_f, 0,
fixup_fix_nated_register, 0,
@@ -243,10 +245,10 @@ static cmd_export_t cmds[] = {
0, 0,
REQUEST_ROUTE },
{"add_rcv_param", (cmd_function)add_rcv_param_f, 1,
- fixup_igp_null, 0,
+ fixup_igp_null, fixup_free_igp_null,
REQUEST_ROUTE },
{"is_rfc1918", (cmd_function)is_rfc1918_f, 1,
- fixup_spve_null, 0,
+ fixup_spve_null, fixup_free_spve_null,
ANY_ROUTE },
{"set_alias_to_pv", (cmd_function)w_set_alias_to_pv, 1,
0, 0, ANY_ROUTE },
@@ -333,6 +335,20 @@ static int fixup_fix_sdp(void **param, int param_no)
return -1;
}
+static int fixup_free_fix_sdp(void **param, int param_no)
+{
+ if(param_no == 1) {
+ /* flags */
+ return fixup_free_igp_null(param, param_no);
+ }
+ if(param_no == 2) {
+ /* new IP */
+ return fixup_free_spve_all(param, param_no);
+ }
+ LM_ERR("unexpected param no: %d\n", param_no);
+ return -1;
+}
+
static int fixup_fix_nated_register(void **param, int param_no)
{
if(rcv_avp_name.n == 0) {
@@ -352,6 +368,15 @@ static int fixup_add_contact_alias(void **param, int param_no)
return -1;
}
+static int fixup_free_add_contact_alias(void **param, int param_no)
+{
+ if((param_no >= 1) && (param_no <= 3))
+ return fixup_free_spve_null(param, 1);
+
+ LM_ERR("invalid parameter number <%d>\n", param_no);
+ return -1;
+}
+
static void nathelper_rpc_enable_ping(rpc_t *rpc, void *ctx)
{
int value = 0;