forked from meetecho/janus-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made starting MTU value for the BIO filter configurable
- Loading branch information
meetecho
committed
Jun 8, 2015
1 parent
58409e8
commit cb50c46
Showing
5 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Certificates | ||
============ | ||
|
||
This folder contains a sample certificate and key that you can use in Janus for everything that's related to security, most importantly DTLS-SRTP and, in case you need it (see the deployment instructions in the docs on why you may not), for HTTPS and/or secure WebSockets as well. Please beware that these certificates are just for testing: they're self signed and not certificated by any authority (and certainly not by us!). | ||
|
||
You can change the certificates to use in the ```janus.cfg``` settings. Should you want to generate some certificates yourself, refer to the instructions on how to do so that can be found pretty much everywhere. | ||
|
||
Please beware, though, that 512 bit certificates should be avoided, as explained in #251. | ||
|
||
# Feeling lazy? | ||
Just as an example and for the lazy (you'll probably find better samples around), here's how you can quickly create a certificate as needed by Janus: | ||
|
||
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:1024 -keyout privateKey.key -out certificate.crt | ||
|
||
Just follow the instructions. This will create a private key in ```privateKey.key``` and a certificate in ```certificate.crt```. To use them, update the configuration file ```janus.cfg``` accordingly, to have the ```cert_pem``` and ```cert_key``` in ```[certificates]``` point to the newly created files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/*! \file dtls-bio.h | ||
* \author Lorenzo Miniero <[email protected]> | ||
* \copyright GNU General Public License v3 | ||
* \brief OpenSSL BIO filter for fragmentation (headers) | ||
* \brief OpenSSL BIO filter for fragmentation | ||
* \details Implementation of an OpenSSL BIO filter to fix the broken | ||
* behaviour of fragmented packets when using mem BIOs (as we do in | ||
* Janus). See https://mta.openssl.org/pipermail/openssl-users/2015-June/001503.html | ||
|
@@ -18,12 +18,23 @@ | |
#include "mutex.h" | ||
|
||
|
||
/* We keep the MTU lower thatn 1472 just to stay on the safe side | ||
* NOTE: should we make this configurable in janus.cfg? */ | ||
static int mtu = 1200; | ||
|
||
/* Starting MTU value for the DTLS BIO filter */ | ||
static int mtu = 1472; | ||
void janus_dtls_bio_filter_set_mtu(int start_mtu) { | ||
if(start_mtu < 0) { | ||
JANUS_LOG(LOG_ERR, "Invalid MTU...\n"); | ||
return; | ||
} | ||
mtu = start_mtu; | ||
JANUS_LOG(LOG_VERB, "Setting starting MTU in the DTLS BIO filter: %d\n", mtu); | ||
} | ||
|
||
/* Filter implementation */ | ||
int janus_dtls_bio_filter_write(BIO *h, const char *buf,int num); | ||
long janus_dtls_bio_filter_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
int janus_dtls_bio_filter_new(BIO *h); | ||
int janus_dtls_bio_filter_free(BIO *data); | ||
|
||
static BIO_METHOD janus_dtls_bio_filter_methods = { | ||
BIO_TYPE_FILTER, | ||
"janus filter", | ||
|
@@ -102,7 +113,7 @@ long janus_dtls_bio_filter_ctrl(BIO *bio, int cmd, long num, void *ptr) { | |
/* The OpenSSL library needs this */ | ||
return 1; | ||
case BIO_CTRL_DGRAM_QUERY_MTU: | ||
/* Let's force a 1200 MTU */ | ||
/* Let's force the MTU that was configured */ | ||
JANUS_LOG(LOG_HUGE, "Advertizing MTU: %d\n", mtu); | ||
return mtu; | ||
case BIO_CTRL_WPENDING: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters