Skip to content

Commit

Permalink
TT#14008 add new "reject-invalid-sdp" option
Browse files Browse the repository at this point in the history
for #52

Change-Id: I75f69a4a4b546fed74e0838ba9ba167f957e8d17
  • Loading branch information
rfuchs committed Mar 24, 2022
1 parent 44e06b8 commit f869c23
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
1 change: 0 additions & 1 deletion daemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ endif

### compile time options:
#CFLAGS+= -DSRTCP_KEY_DERIVATION_RFC_COMPLIANCE
#CFLAGS+= -DTERMINATE_SDP_AT_BLANK_LINE
#CFLAGS+= -DSTRICT_SDES_KEY_LIFETIME

LDLIBS= -lm
Expand Down
1 change: 1 addition & 0 deletions daemon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ static void options(int *argc, char ***argv) {
{ "jitter-buffer",0, 0, G_OPTION_ARG_INT, &rtpe_config.jb_length, "Size of jitter buffer", "INT" },
{ "jb-clock-drift",0,0, G_OPTION_ARG_NONE, &rtpe_config.jb_clock_drift,"Compensate for source clock drift",NULL },
{ "debug-srtp",0,0, G_OPTION_ARG_NONE, &debug_srtp, "Log raw encryption details for SRTP", NULL },
{ "reject-invalid-sdp",0,0, G_OPTION_ARG_NONE, &rtpe_config.reject_invalid_sdp,"Refuse to process SDP bodies with broken syntax", NULL },
{ "dtls-rsa-key-size",0, 0, G_OPTION_ARG_INT,&rtpe_config.dtls_rsa_key_size,"Size of RSA key for DTLS", "INT" },
{ "dtls-mtu",0, 0, G_OPTION_ARG_INT,&rtpe_config.dtls_mtu,"DTLS MTU", "INT" },
{ "dtls-ciphers",0, 0, G_OPTION_ARG_STRING, &rtpe_config.dtls_ciphers,"List of ciphers for DTLS", "STRING" },
Expand Down
7 changes: 7 additions & 0 deletions daemon/rtpengine.pod
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,13 @@ tags, etc are recorded to the log. Every RTCP packet is logged in this way,
while every 512th RTP packet is logged. Only applies to packets
forwarded/processed in userspace.

=item B<--reject-invalid-sdp>

With this option set, refuse to process SDP bodies that could not be cleanly
parsed, instead of skipping over the parsing error and processing the SDP
anyway. Currently this only affects the processing of SDP bodies that end in a
blank line.

=item B<--listen-http=>[I<IP>|I<HOSTNAME>B<:>]I<PORT>

=item B<--listen-https=>[I<IP>|I<HOSTNAME>B<:>]I<PORT>
Expand Down
10 changes: 5 additions & 5 deletions daemon/sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,12 +1097,12 @@ int sdp_parse(str *body, GQueue *sessions, const struct sdp_ng_flags *flags) {
end = str_end(body);

while (b && b < end - 1) {
#ifdef TERMINATE_SDP_AT_BLANK_LINE
if (b[0] == '\n' || b[0] == '\r') {
body->len = b - body->s;
break;
if (!rtpe_config.reject_invalid_sdp) {
if (b[0] == '\n' || b[0] == '\r') {
body->len = b - body->s;
break;
}
}
#endif
errstr = "Missing '=' sign";
if (b[1] != '=')
goto error;
Expand Down
3 changes: 2 additions & 1 deletion etc/rtpengine.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ listen-cli = localhost:2224
timeout = 60
silent-timeout = 3600
tos = 184
#control-tos = 184
# control-tos = 184
# delete-delay = 30
# final-timeout = 10800
# endpoint-learning = heuristic
# reject-invalid-sdp = false

# foreground = false
# pidfile = /run/ngcp-rtpengine-daemon.pid
Expand Down
1 change: 1 addition & 0 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct rtpengine_config {
int homer_protocol;
int homer_id;
int no_fallback;
int reject_invalid_sdp;
int save_interface_ports;
int port_min;
int port_max;
Expand Down

0 comments on commit f869c23

Please sign in to comment.