Browse code

ipops: added fixup free functions and use of ANY_ROUTE

(cherry picked from commit fa6a2d79aca3bc4733276ce99a53efd8fe63ffd5)

Daniel-Constantin Mierla authored on 25/06/2022 12:48:35
Showing 1 changed files
... ...
@@ -131,45 +131,47 @@ static pv_export_t mod_pvs[] = {
131 131
  */
132 132
 static cmd_export_t cmds[] =
133 133
 {
134
-	{ "is_ip", (cmd_function)w_is_ip, 1, fixup_spve_null, 0,
135
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
136
-	{ "is_pure_ip", (cmd_function)w_is_pure_ip, 1, fixup_spve_null, 0,
137
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
138
-	{ "is_ipv4", (cmd_function)w_is_ipv4, 1, fixup_spve_null, 0,
139
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
140
-	{ "is_ipv6", (cmd_function)w_is_ipv6, 1, fixup_spve_null, 0,
141
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
142
-	{ "is_ipv6_reference", (cmd_function)w_is_ipv6_reference, 1, fixup_spve_null, 0,
143
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
144
-	{ "ip_type", (cmd_function)w_ip_type, 1, fixup_spve_null, 0,
145
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
134
+	{ "is_ip", (cmd_function)w_is_ip, 1,
135
+		fixup_spve_null, fixup_free_spve_null, ANY_ROUTE },
136
+	{ "is_pure_ip", (cmd_function)w_is_pure_ip, 1,
137
+		fixup_spve_null, fixup_free_spve_null, ANY_ROUTE },
138
+	{ "is_ipv4", (cmd_function)w_is_ipv4, 1,
139
+		fixup_spve_null, fixup_free_spve_null, ANY_ROUTE },
140
+	{ "is_ipv6", (cmd_function)w_is_ipv6, 1,
141
+		fixup_spve_null, fixup_free_spve_null, ANY_ROUTE },
142
+	{ "is_ipv6_reference", (cmd_function)w_is_ipv6_reference, 1,
143
+		fixup_spve_null, fixup_free_spve_null, ANY_ROUTE },
144
+	{ "ip_type", (cmd_function)w_ip_type, 1,
145
+		fixup_spve_null, fixup_free_spve_null, ANY_ROUTE },
146 146
 	{ "detailed_ipv4_type", (cmd_function)w_detailed_ipv4_type, 2,
147 147
 		fixup_detailed_ip_type, fixup_free_detailed_ip_type, ANY_ROUTE },
148 148
 	{ "detailed_ipv6_type", (cmd_function)w_detailed_ipv6_type, 2,
149 149
 		fixup_detailed_ip_type, fixup_free_detailed_ip_type, ANY_ROUTE },
150 150
 	{ "detailed_ip_type", (cmd_function)w_detailed_ip_type, 2,
151 151
 		fixup_detailed_ip_type, fixup_free_detailed_ip_type, ANY_ROUTE },
152
-	{ "compare_ips", (cmd_function)w_compare_ips, 2, fixup_spve_spve, 0,
153
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
154
-	{ "compare_pure_ips", (cmd_function)w_compare_pure_ips, 2, fixup_spve_spve, 0,
155
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
156
-	{ "is_ip_rfc1918", (cmd_function)w_is_ip_rfc1918, 1, fixup_spve_null, 0,
157
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
158
-	{ "is_in_subnet", (cmd_function)w_ip_is_in_subnet, 2, fixup_spve_spve, 0,
159
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE },
160
-	{ "dns_sys_match_ip", (cmd_function)w_dns_sys_match_ip, 2, fixup_spve_spve, 0,
161
-		ANY_ROUTE },
162
-	{ "dns_int_match_ip", (cmd_function)w_dns_int_match_ip, 2, fixup_spve_spve, 0,
163
-		ANY_ROUTE },
164
-	{ "dns_query", (cmd_function)w_dns_query, 2, fixup_spve_spve, 0,
165
-		ANY_ROUTE },
166
-	{ "srv_query", (cmd_function)w_srv_query, 2, fixup_spve_spve, 0,
167
-		ANY_ROUTE },
168
-	{ "naptr_query", (cmd_function)w_naptr_query, 2, fixup_spve_spve, 0,
169
-		ANY_ROUTE },
170
-	{ "dns_set_local_ttl", (cmd_function)w_dns_set_local_ttl, 1, fixup_igp_null,
171
-		fixup_free_igp_null, ANY_ROUTE },
152
+	{ "compare_ips", (cmd_function)w_compare_ips, 2,
153
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
154
+	{ "compare_pure_ips", (cmd_function)w_compare_pure_ips, 2,
155
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
156
+	{ "is_ip_rfc1918", (cmd_function)w_is_ip_rfc1918, 1,
157
+		fixup_spve_null, fixup_free_spve_null, ANY_ROUTE },
158
+	{ "is_in_subnet", (cmd_function)w_ip_is_in_subnet, 2,
159
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
160
+	{ "dns_sys_match_ip", (cmd_function)w_dns_sys_match_ip, 2,
161
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
162
+	{ "dns_int_match_ip", (cmd_function)w_dns_int_match_ip, 2,
163
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
164
+	{ "dns_query", (cmd_function)w_dns_query, 2,
165
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
166
+	{ "srv_query", (cmd_function)w_srv_query, 2,
167
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
168
+	{ "naptr_query", (cmd_function)w_naptr_query, 2,
169
+		fixup_spve_spve, fixup_free_spve_spve, ANY_ROUTE },
170
+	{ "dns_set_local_ttl", (cmd_function)w_dns_set_local_ttl, 1,
171
+		fixup_igp_null, fixup_free_igp_null, ANY_ROUTE },
172
+
172 173
 	{ "bind_ipops", (cmd_function)bind_ipops, 0, 0, 0, 0},
174
+
173 175
 	{ 0, 0, 0, 0, 0, 0 }
174 176
 };
175 177
 
... ...
@@ -230,8 +232,7 @@ static int fixup_detailed_ip_type(void** param, int param_no)
230 232
 static int fixup_free_detailed_ip_type(void** param, int param_no)
231 233
 {
232 234
 	if (param_no == 1) {
233
-		//LM_WARN("free function has not been defined for spve\n");
234
-		return 0;
235
+		return fixup_free_spve_null(param, 1);
235 236
 	}
236 237
 
237 238
 	if (param_no == 2) {