Browse Source

reverse crypto context in/out as they were backwards

git.mgm/mediaproxy-ng/github/master
Richard Fuchs 13 years ago
parent
commit
e3cf5d521e
2 changed files with 16 additions and 17 deletions
  1. +15
    -16
      daemon/call.c
  2. +1
    -1
      daemon/sdp.c

+ 15
- 16
daemon/call.c View File

@ -294,40 +294,40 @@ static int call_avpf2avp_rtcp(str *s, struct streamrelay *r) {
return rtcp_avpf2avp(s); return rtcp_avpf2avp(s);
} }
static int call_avp2savp_rtp(str *s, struct streamrelay *r) { static int call_avp2savp_rtp(str *s, struct streamrelay *r) {
return rtp_avp2savp(s, &r->crypto.out);
return rtp_avp2savp(s, &r->other->crypto.out);
} }
static int call_avp2savp_rtcp(str *s, struct streamrelay *r) { static int call_avp2savp_rtcp(str *s, struct streamrelay *r) {
return rtcp_avp2savp(s, &r->crypto.out);
return rtcp_avp2savp(s, &r->other->crypto.out);
} }
static int call_savp2avp_rtp(str *s, struct streamrelay *r) { static int call_savp2avp_rtp(str *s, struct streamrelay *r) {
return rtp_savp2avp(s, &r->other->crypto.in);
return rtp_savp2avp(s, &r->crypto.in);
} }
static int call_savp2avp_rtcp(str *s, struct streamrelay *r) { static int call_savp2avp_rtcp(str *s, struct streamrelay *r) {
return rtcp_savp2avp(s, &r->other->crypto.in);
return rtcp_savp2avp(s, &r->crypto.in);
} }
static int call_avpf2savp_rtcp(str *s, struct streamrelay *r) { static int call_avpf2savp_rtcp(str *s, struct streamrelay *r) {
int ret; int ret;
ret = rtcp_avpf2avp(s); ret = rtcp_avpf2avp(s);
if (ret) if (ret)
return ret; return ret;
return rtcp_avp2savp(s, &r->crypto.out);
return rtcp_avp2savp(s, &r->other->crypto.out);
} }
static int call_savpf2avp_rtcp(str *s, struct streamrelay *r) { static int call_savpf2avp_rtcp(str *s, struct streamrelay *r) {
int ret; int ret;
ret = rtcp_savp2avp(s, &r->other->crypto.in);
ret = rtcp_savp2avp(s, &r->crypto.in);
if (ret) if (ret)
return ret; return ret;
return rtcp_avpf2avp(s); return rtcp_avpf2avp(s);
} }
static int call_savpf2savp_rtcp(str *s, struct streamrelay *r) { static int call_savpf2savp_rtcp(str *s, struct streamrelay *r) {
int ret; int ret;
ret = rtcp_savp2avp(s, &r->other->crypto.in);
ret = rtcp_savp2avp(s, &r->crypto.in);
if (ret) if (ret)
return ret; return ret;
ret = rtcp_avpf2avp(s); ret = rtcp_avpf2avp(s);
if (ret) if (ret)
return ret; return ret;
return rtcp_avp2savp(s, &r->crypto.out);
return rtcp_avp2savp(s, &r->other->crypto.out);
} }
@ -349,10 +349,10 @@ static int __k_srtp_crypt(struct mediaproxy_srtp *s, struct crypto_context *c) {
return 0; return 0;
} }
static int __k_srtp_encrypt(struct mediaproxy_srtp *s, struct streamrelay *r) { static int __k_srtp_encrypt(struct mediaproxy_srtp *s, struct streamrelay *r) {
return __k_srtp_crypt(s, &r->crypto.out);
return __k_srtp_crypt(s, &r->other->crypto.out);
} }
static int __k_srtp_decrypt(struct mediaproxy_srtp *s, struct streamrelay *r) { static int __k_srtp_decrypt(struct mediaproxy_srtp *s, struct streamrelay *r) {
return __k_srtp_crypt(s, &r->other->crypto.in);
return __k_srtp_crypt(s, &r->crypto.in);
} }
static const struct streamhandler *determine_handler_rtp(struct streamrelay *in) { static const struct streamhandler *determine_handler_rtp(struct streamrelay *in) {
@ -1053,10 +1053,10 @@ static void callmaster_timer(void *ptr) {
sr->kstats.bytes = ke->stats.bytes; sr->kstats.bytes = ke->stats.bytes;
sr->kstats.errors = ke->stats.errors; sr->kstats.errors = ke->stats.errors;
if (sr->crypto.out.crypto_suite)
sr->crypto.out.s_l = ke->target.encrypt.last_index;
if (sr->other->crypto.out.crypto_suite)
sr->other->crypto.out.s_l = ke->target.encrypt.last_index;
if (sr->crypto.in.crypto_suite) if (sr->crypto.in.crypto_suite)
sr->other->crypto.in.s_l = ke->target.decrypt.last_index;
sr->crypto.in.s_l = ke->target.decrypt.last_index;
mutex_unlock(&cs->lock); mutex_unlock(&cs->lock);
@ -1307,8 +1307,8 @@ static int setup_peer(struct peer *p, struct stream_input *s, const str *tag) {
b->peer_advertised = b->peer; b->peer_advertised = b->peer;
a->rtcp = s->is_rtcp; a->rtcp = s->is_rtcp;
b->rtcp = 1; b->rtcp = 1;
a->crypto.in = s->crypto;
b->crypto.in = s->crypto;
a->other->crypto.in = s->crypto;
b->other->crypto.in = s->crypto;
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
switch (s->direction[i]) { switch (s->direction[i]) {
@ -1377,7 +1377,6 @@ static void steal_peer(struct peer *dest, struct peer *src) {
sr->stun = srs->stun; sr->stun = srs->stun;
sr->rtcp = srs->rtcp; sr->rtcp = srs->rtcp;
crypto_context_move(&sr->crypto.in, &srs->crypto.in); crypto_context_move(&sr->crypto.in, &srs->crypto.in);
crypto_context_move(&sr->other->crypto.out, &srs->other->crypto.out);
srs->fd.fd = -1; srs->fd.fd = -1;


+ 1
- 1
daemon/sdp.c View File

@ -1452,7 +1452,7 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call,
chopper_append_c(chop, "\r\n"); chopper_append_c(chop, "\r\n");
} }
generate_crypto(media, flags, rtp->other, rtcp->other, chop);
generate_crypto(media, flags, rtp, rtcp, chop);
if (do_ice) { if (do_ice) {
mutex_lock(&rtp->up->up->lock); mutex_lock(&rtp->up->up->lock);


Loading…
Cancel
Save