Browse Source

MT#55283 store sfd in fsin in dtls_connection

This makes it possible for the BIO callback to access these values,
instead of obtaining possibly mismatched values from packet_stream.

Restores behaviour prior to 5331506

Closes #1996

Change-Id: I74ccb82f1739ca98eb033e68df4e27619ca7e46a
(cherry picked from commit 271b3b1520)
(cherry picked from commit 0608fa3e1e)
mr13.3.1
Richard Fuchs 4 months ago
parent
commit
7379d99ed3
2 changed files with 12 additions and 2 deletions
  1. +10
    -2
      daemon/dtls.c
  2. +2
    -0
      include/dtls.h

+ 10
- 2
daemon/dtls.c View File

@ -623,7 +623,7 @@ static long dtls_bio_callback(BIO *bio, int oper, const char *argp, size_t len,
struct packet_stream *ps = d->ps;
if (!ps)
return ret;
struct stream_fd *sfd = ps->selected_sfd;
struct stream_fd *sfd = d->sfd;
if (!sfd)
return ret;
@ -634,7 +634,9 @@ static long dtls_bio_callback(BIO *bio, int oper, const char *argp, size_t len,
argp[8], argp[9], argp[10], argp[11],
argp[12], argp[13], argp[14], argp[15]);
const endpoint_t *fsin = &ps->endpoint;
const endpoint_t *fsin = &d->fsin;
if (fsin->address.family == NULL)
fsin = &ps->endpoint;
if (fsin->port == 9 || fsin->address.family == NULL)
return ret;
@ -864,6 +866,11 @@ int dtls(stream_fd *sfd, const str *s, const endpoint_t *fsin) {
if (!d->init || !d->ssl)
return -1;
// used by the BIO callback
d->fsin = fsin ? *fsin : (endpoint_t) {0};
obj_release(d->sfd);
d->sfd = obj_get(sfd);
if (s) {
ilogs(srtp, LOG_DEBUG, "Processing incoming DTLS packet");
BIO_write(d->r_bio, s->s, s->len);
@ -959,5 +966,6 @@ void dtls_connection_cleanup(struct dtls_connection *c) {
if (c->w_bio)
BIO_free(c->w_bio);
}
obj_release(c->sfd);
ZERO(*c);
}

+ 2
- 0
include/dtls.h View File

@ -43,6 +43,8 @@ struct dtls_connection {
SSL *ssl;
BIO *r_bio, *w_bio;
struct packet_stream *ps;
endpoint_t fsin;
stream_fd *sfd;
unsigned char tls_id[16];
unsigned int init:1,
active:1,


Loading…
Cancel
Save