Skip to content

Commit 5998d64

Browse files
committed
Merge branch 'develop'
2 parents 1adf454 + 1b3cca0 commit 5998d64

18 files changed

+289
-49
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OpenLI -- open source ETSI-compliant Lawful Intercept software
22

3-
Version: 1.0.11
3+
Version: 1.0.12
44

55
---------------------------------------------------------------------------
66

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Super primitive configure script
22

3-
AC_INIT(openli, 1.0.11, salcock@waikato.ac.nz)
3+
AC_INIT(openli, 1.0.12, salcock@waikato.ac.nz)
44

55
AM_INIT_AUTOMAKE([subdir-objects])
66
AC_CONFIG_SRCDIR(src/collector/collector.c)

debian/changelog

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
openli (1.0.12-1) unstable; urgency=medium
2+
3+
* Fixed bugs where changes to certain intercept properties
4+
were not being applied to the encoded ETSI header fields.
5+
* Fixed bug where the 'username' property for a static IP
6+
intercept was not being encoded as the ETSI targetUsername
7+
field.
8+
* Fixed bug where digest hashes added to the provisioner auth
9+
database using our helper script were not readable by the
10+
provisioner itself.
11+
* Fixed crash when processing a SIP message that is spread across
12+
multiple packets.
13+
14+
-- Shane Alcock <shane.alcock@waikato.ac.nz> Mon, 8 Nov 2021 14:08:42 +1300
15+
116
openli (1.0.11-1) unstable; urgency=medium
217

318
* Improved collector encoding performance by saving and reusing

rpm/openli.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: openli
2-
Version: 1.0.11
2+
Version: 1.0.12
33
Release: 1%{?dist}
44
Summary: Software for performing ETSI-compliant lawful intercept
55

@@ -232,6 +232,9 @@ fi
232232

233233

234234
%changelog
235+
* Mon Nov 8 2021 Shane Alcock <salcock@waikato.ac.nz> - 1.0.12-1
236+
- Updated for 1.0.12 release
237+
235238
* Mon Jul 5 2021 Shane Alcock <salcock@waikato.ac.nz> - 1.0.11-1
236239
- Updated for 1.0.11 release
237240

src/collector/collector_base.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ typedef struct encoder_job {
244244
char *cinstr;
245245
openli_export_recv_t *origreq;
246246
char *liid;
247+
uint8_t cept_version;
247248
} PACKED openli_encoding_job_t;
248249

249250
void destroy_encoder_worker(openli_encoder_t *enc);

src/collector/collector_publish.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ enum {
5454
OPENLI_EXPORT_UMTSCC = 16,
5555
OPENLI_EXPORT_UMTSIRI = 17,
5656
OPENLI_EXPORT_RAW_SYNC = 18,
57-
57+
OPENLI_EXPORT_INTERCEPT_CHANGED = 19,
5858
};
5959

6060
/* This structure is also used for IPMMCCs since they require the same

src/collector/collector_push_messaging.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,23 @@ static int update_ipv4_intercept(colthread_local_t *loc, ipsession_t *toup) {
280280

281281
ipsession_t *found;
282282
ipv4_target_t *v4;
283+
char *tmp;
283284

284285
found = find_ipv4_intercept(loc, toup, &v4);
285286
if (!found) {
286287
return 0;
287288
}
288289

290+
tmp = found->common.authcc;
291+
found->common.authcc = toup->common.authcc;
292+
found->common.authcc_len = toup->common.authcc_len;
293+
toup->common.authcc = tmp;
294+
295+
tmp = found->common.delivcc;
296+
found->common.delivcc = toup->common.delivcc;
297+
found->common.delivcc_len = toup->common.delivcc_len;
298+
toup->common.delivcc = tmp;
299+
289300
found->common.tostart_time = toup->common.tostart_time;
290301
found->common.toend_time = toup->common.toend_time;
291302

@@ -350,12 +361,23 @@ static int update_ipv6_intercept(colthread_local_t *loc, ipsession_t *toup) {
350361
ipsession_t *found;
351362
ipv6_target_t *v6;
352363
char prefixstr[100];
364+
char *tmp;
353365

354366
found = find_ipv6_intercept(loc, toup, &v6, prefixstr, 100);
355367
if (!found) {
356368
return 0;
357369
}
358370

371+
tmp = found->common.authcc;
372+
found->common.authcc = toup->common.authcc;
373+
found->common.authcc_len = toup->common.authcc_len;
374+
toup->common.authcc = tmp;
375+
376+
tmp = found->common.delivcc;
377+
found->common.delivcc = toup->common.delivcc;
378+
found->common.delivcc_len = toup->common.delivcc_len;
379+
toup->common.delivcc = tmp;
380+
359381
found->common.tostart_time = toup->common.tostart_time;
360382
found->common.toend_time = toup->common.toend_time;
361383

@@ -749,6 +771,7 @@ void handle_change_voip_intercept(libtrace_thread_t *t, colthread_local_t *loc,
749771
rtpstreaminf_t *tochange) {
750772

751773
rtpstreaminf_t *rtp;
774+
char *tmp;
752775

753776
if (tochange->streamkey == NULL) {
754777
return;
@@ -763,6 +786,16 @@ void handle_change_voip_intercept(libtrace_thread_t *t, colthread_local_t *loc,
763786
return;
764787
}
765788

789+
tmp = rtp->common.authcc;
790+
rtp->common.authcc = tochange->common.authcc;
791+
rtp->common.authcc_len = tochange->common.authcc_len;
792+
tochange->common.authcc = tmp;
793+
794+
tmp = rtp->common.delivcc;
795+
rtp->common.delivcc = tochange->common.delivcc;
796+
rtp->common.delivcc_len = tochange->common.delivcc_len;
797+
tochange->common.delivcc = tmp;
798+
766799
rtp->common.tostart_time = tochange->common.tostart_time;
767800
rtp->common.toend_time = tochange->common.toend_time;
768801

@@ -774,6 +807,7 @@ void handle_change_vendmirror_intercept(libtrace_thread_t *t,
774807

775808
vendmirror_intercept_t *found;
776809
vendmirror_intercept_list_t *parent;
810+
char *tmp;
777811

778812
HASH_FIND(hh, loc->activemirrorintercepts, &(vend->sessionid),
779813
sizeof(vend->sessionid), parent);
@@ -792,6 +826,16 @@ void handle_change_vendmirror_intercept(libtrace_thread_t *t,
792826
return;
793827
}
794828

829+
tmp = found->common.authcc;
830+
found->common.authcc = vend->common.authcc;
831+
found->common.authcc_len = vend->common.authcc_len;
832+
vend->common.authcc = tmp;
833+
834+
tmp = found->common.delivcc;
835+
found->common.delivcc = vend->common.delivcc;
836+
found->common.delivcc_len = vend->common.delivcc_len;
837+
vend->common.delivcc = tmp;
838+
795839
found->common.tostart_time = vend->common.tostart_time;
796840
found->common.toend_time = vend->common.toend_time;
797841
free_single_vendmirror_intercept(vend);
@@ -801,12 +845,24 @@ void handle_change_iprange_intercept(libtrace_thread_t *t,
801845
colthread_local_t *loc, staticipsession_t *ipr) {
802846

803847
staticipsession_t *sessrec;
848+
char *tmp;
804849

805850
HASH_FIND(hh, loc->activestaticintercepts, ipr->key, strlen(ipr->key),
806851
sessrec);
807852
if (sessrec) {
808853
sessrec->common.tostart_time = ipr->common.tostart_time;
809854
sessrec->common.toend_time = ipr->common.toend_time;
855+
856+
tmp = sessrec->common.authcc;
857+
sessrec->common.authcc = ipr->common.authcc;
858+
sessrec->common.authcc_len = ipr->common.authcc_len;
859+
ipr->common.authcc = tmp;
860+
861+
tmp = sessrec->common.delivcc;
862+
sessrec->common.delivcc = ipr->common.delivcc;
863+
sessrec->common.delivcc_len = ipr->common.delivcc_len;
864+
ipr->common.delivcc = tmp;
865+
810866
}
811867

812868
free_single_staticipsession(ipr);

src/collector/collector_seqtracker.c

Lines changed: 65 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,29 @@ static inline void remove_preencoded(seqtracker_thread_data_t *seqdata,
151151

152152
}
153153

154+
static inline void preencode_etsi_fields(seqtracker_thread_data_t *seqdata,
155+
exporter_intercept_state_t *intstate) {
156+
157+
etsili_intercept_details_t intdetails;
158+
159+
intdetails.liid = intstate->details.liid;
160+
intdetails.authcc = intstate->details.authcc;
161+
intdetails.delivcc = intstate->details.delivcc;
162+
163+
intdetails.operatorid = seqdata->colident->operatorid;
164+
intdetails.networkelemid = seqdata->colident->networkelemid;
165+
intdetails.intpointid = seqdata->colident->intpointid;
166+
167+
intstate->preencoded = calloc(OPENLI_PREENCODE_LAST,
168+
sizeof(wandder_encode_job_t));
169+
etsili_preencode_static_fields(intstate->preencoded, &intdetails);
170+
}
171+
154172

155173
static void track_new_intercept(seqtracker_thread_data_t *seqdata,
156174
published_intercept_msg_t *cept) {
157175

158176
exporter_intercept_state_t *intstate;
159-
etsili_intercept_details_t intdetails;
160177

161178
/* If this LIID already exists, we'll need to replace it */
162179
HASH_FIND(hh, seqdata->intercepts, cept->liid, strlen(cept->liid),
@@ -173,6 +190,7 @@ static void track_new_intercept(seqtracker_thread_data_t *seqdata,
173190
intstate->details.liid_len = strlen(cept->liid);
174191
intstate->details.authcc_len = strlen(cept->authcc);
175192
intstate->details.delivcc_len = strlen(cept->delivcc);
193+
intstate->version ++;
176194

177195
} else {
178196

@@ -186,47 +204,25 @@ static void track_new_intercept(seqtracker_thread_data_t *seqdata,
186204
intstate->details.authcc_len = strlen(cept->authcc);
187205
intstate->details.delivcc_len = strlen(cept->delivcc);
188206
intstate->cinsequencing = NULL;
207+
intstate->version = 0;
189208

190209
HASH_ADD_KEYPTR(hh, seqdata->intercepts, intstate->details.liid,
191210
intstate->details.liid_len, intstate);
192211
}
193212

194-
intdetails.liid = cept->liid;
195-
intdetails.authcc = cept->authcc;
196-
intdetails.delivcc = cept->delivcc;
197-
198-
intdetails.operatorid = seqdata->colident->operatorid;
199-
intdetails.networkelemid = seqdata->colident->networkelemid;
200-
intdetails.intpointid = seqdata->colident->intpointid;
201-
202-
if(seqdata->encoding_method == OPENLI_ENCODING_DER){
203-
intstate->preencoded = calloc(OPENLI_PREENCODE_LAST,
204-
sizeof(wandder_encode_job_t));
205-
etsili_preencode_static_fields(intstate->preencoded, &intdetails);
206-
}
213+
preencode_etsi_fields(seqdata, intstate);
207214
}
208215

209216
static void reconfigure_intercepts(seqtracker_thread_data_t *seqdata) {
210217

211218
exporter_intercept_state_t *intstate, *tmp;
212-
etsili_intercept_details_t intdetails;
213219

214220
logger(LOG_INFO, "OpenLI configuration reloaded -- updating pre-encoded intercept fields");
215221

216222
HASH_ITER(hh, seqdata->intercepts, intstate, tmp) {
217223
remove_preencoded(seqdata, intstate);
218-
219-
intdetails.liid = intstate->details.liid;
220-
intdetails.authcc = intstate->details.authcc;
221-
intdetails.delivcc = intstate->details.delivcc;
222-
223-
intdetails.operatorid = seqdata->colident->operatorid;
224-
intdetails.networkelemid = seqdata->colident->networkelemid;
225-
intdetails.intpointid = seqdata->colident->intpointid;
226-
227-
intstate->preencoded = calloc(OPENLI_PREENCODE_LAST,
228-
sizeof(wandder_encode_job_t));
229-
etsili_preencode_static_fields(intstate->preencoded, &intdetails);
224+
preencode_etsi_fields(seqdata, intstate);
225+
intstate->version ++;
230226
}
231227

232228
}
@@ -241,6 +237,39 @@ static inline void free_intercept_state(seqtracker_thread_data_t *seqdata,
241237
free(intstate);
242238
}
243239

240+
static int modify_tracked_intercept(seqtracker_thread_data_t *seqdata,
241+
published_intercept_msg_t *msg) {
242+
243+
exporter_intercept_state_t *intstate;
244+
HASH_FIND(hh, seqdata->intercepts, msg->liid, strlen(msg->liid), intstate);
245+
etsili_intercept_details_t intdetails;
246+
247+
if (!intstate) {
248+
logger(LOG_INFO, "OpenLI collector: tracker thread was told to modify intercept LIID %s, but it is not a valid ID?",
249+
msg->liid);
250+
return -1;
251+
}
252+
253+
if (intstate->details.authcc) {
254+
free(intstate->details.authcc);
255+
}
256+
intstate->details.authcc = msg->authcc;
257+
258+
if (intstate->details.delivcc) {
259+
free(intstate->details.delivcc);
260+
}
261+
intstate->details.delivcc = msg->delivcc;
262+
263+
remove_preencoded(seqdata, intstate);
264+
preencode_etsi_fields(seqdata, intstate);
265+
intstate->version ++;
266+
267+
if (msg->liid) {
268+
free(msg->liid);
269+
}
270+
return 0;
271+
}
272+
244273
static int remove_tracked_intercept(seqtracker_thread_data_t *seqdata,
245274
published_intercept_msg_t *msg) {
246275

@@ -253,10 +282,9 @@ static int remove_tracked_intercept(seqtracker_thread_data_t *seqdata,
253282
return -1;
254283
}
255284

256-
/*
257-
logger(LOG_INFO, "OpenLI collector: tracker thread %d removed intercept %s",
258-
seqdata->trackerid, msg->liid);
259-
*/
285+
/* TODO All encoders need to know that they should clear all templates
286+
* for this particular intercept, somehow?
287+
*/
260288
HASH_DELETE(hh, seqdata->intercepts, intstate);
261289
if (msg->liid) {
262290
free(msg->liid);
@@ -322,6 +350,7 @@ static int run_encoding_job(seqtracker_thread_data_t *seqdata,
322350
job.liid = strdup(liid);
323351
job.cinstr = strdup(cinseq->cin_string);
324352
job.cin = (int64_t)cin;
353+
job.cept_version = intstate->version;
325354

326355
if (recvd->type == OPENLI_EXPORT_IPMMCC ||
327356
recvd->type == OPENLI_EXPORT_IPCC ||
@@ -393,6 +422,11 @@ static void seqtracker_main(seqtracker_thread_data_t *seqdata) {
393422
free(job);
394423
break;
395424

425+
case OPENLI_EXPORT_INTERCEPT_CHANGED:
426+
modify_tracked_intercept(seqdata, &(job->data.cept));
427+
free(job);
428+
break;
429+
396430
case OPENLI_EXPORT_IPMMCC:
397431
case OPENLI_EXPORT_IPMMIRI:
398432
case OPENLI_EXPORT_IPIRI:

0 commit comments

Comments
 (0)