Browse code

rtpengine: allow dual usage of DTLS flag and DTLS= switch

fixes regression from ff209e978

fixes #1468

Richard Fuchs authored on 02/03/2018 13:34:55
Showing 1 changed files
... ...
@@ -1943,29 +1943,27 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
1943 1943
 		/* check for specially handled items */
1944 1944
 		switch (key.len) {
1945 1945
 			case 3:
1946
-				if (str_eq(&key, "RTP")) {
1946
+				if (str_eq(&key, "RTP") && !val.s) {
1947 1947
 					ng_flags->transport |= 0x100;
1948 1948
 					ng_flags->transport &= ~0x001;
1949 1949
 				}
1950
-				else if (str_eq(&key, "AVP")) {
1950
+				else if (str_eq(&key, "AVP") && !val.s) {
1951 1951
 					ng_flags->transport |= 0x100;
1952 1952
 					ng_flags->transport &= ~0x002;
1953 1953
 				}
1954 1954
 				else if (str_eq(&key, "TOS") && val.s)
1955 1955
 					bencode_dictionary_add_integer(ng_flags->dict, "TOS", atoi(val.s));
1956
-				else if (str_eq(&key, "delete-delay") && val.s)
1957
-					bencode_dictionary_add_integer(ng_flags->dict, "delete delay", atoi(val.s));
1958 1956
 				else
1959 1957
 					goto generic;
1960 1958
 				goto next;
1961 1959
 				break;
1962 1960
 
1963 1961
 			case 4:
1964
-				if (str_eq(&key, "SRTP"))
1962
+				if (str_eq(&key, "SRTP") && !val.s)
1965 1963
 					ng_flags->transport |= 0x101;
1966
-				else if (str_eq(&key, "AVPF"))
1964
+				else if (str_eq(&key, "AVPF") && !val.s)
1967 1965
 					ng_flags->transport |= 0x102;
1968
-				else if (str_eq(&key, "DTLS"))
1966
+				else if (str_eq(&key, "DTLS") && !val.s)
1969 1967
 					ng_flags->transport |= 0x104;
1970 1968
 				else
1971 1969
 					goto generic;
... ...
@@ -1982,7 +1980,7 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
1982 1980
 				break;
1983 1981
 
1984 1982
 			case 7:
1985
-				if (str_eq(&key, "RTP/AVP"))
1983
+				if (str_eq(&key, "RTP/AVP") && !val.s)
1986 1984
 					ng_flags->transport = 0x100;
1987 1985
 				else if (str_eq(&key, "call-id")) {
1988 1986
 					err = "missing value";
... ...
@@ -1998,9 +1996,9 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
1998 1996
 			case 8:
1999 1997
 				if (str_eq(&key, "internal") || str_eq(&key, "external"))
2000 1998
 					bencode_list_add_str(ng_flags->direction, &key);
2001
-				else if (str_eq(&key, "RTP/AVPF"))
1999
+				else if (str_eq(&key, "RTP/AVPF") && !val.s)
2002 2000
 					ng_flags->transport = 0x102;
2003
-				else if (str_eq(&key, "RTP/SAVP"))
2001
+				else if (str_eq(&key, "RTP/SAVP") && !val.s)
2004 2002
 					ng_flags->transport = 0x101;
2005 2003
 				else if (str_eq(&key, "from-tag")) {
2006 2004
 					err = "missing value";
... ...
@@ -2014,7 +2012,7 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
2014 2012
 				break;
2015 2013
 
2016 2014
 			case 9:
2017
-				if (str_eq(&key, "RTP/SAVPF"))
2015
+				if (str_eq(&key, "RTP/SAVPF") && !val.s)
2018 2016
 					ng_flags->transport = 0x103;
2019 2017
 				else if (str_eq(&key, "direction"))
2020 2018
 					bencode_list_add_str(ng_flags->direction, &val);
... ...
@@ -2068,10 +2066,12 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
2068 2066
 					*op = OP_ANSWER;
2069 2067
 					goto next;
2070 2068
 				}
2069
+				else if (str_eq(&key, "delete-delay") && val.s)
2070
+					bencode_dictionary_add_integer(ng_flags->dict, "delete delay", atoi(val.s));
2071 2071
 				break;
2072 2072
 
2073 2073
 			case 16:
2074
-				if (str_eq(&key, "UDP/TLS/RTP/SAVP"))
2074
+				if (str_eq(&key, "UDP/TLS/RTP/SAVP") && !val.s)
2075 2075
 					ng_flags->transport = 0x104;
2076 2076
 				else
2077 2077
 					goto generic;
... ...
@@ -2079,7 +2079,7 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
2079 2079
 				break;
2080 2080
 
2081 2081
 			case 17:
2082
-				if (str_eq(&key, "UDP/TLS/RTP/SAVPF"))
2082
+				if (str_eq(&key, "UDP/TLS/RTP/SAVPF") && !val.s)
2083 2083
 					ng_flags->transport = 0x106;
2084 2084
 				else
2085 2085
 					goto generic;