Browse code

- insensitive case comparisons for ipv6 addresses

Andrei Pelinescu-Onciul authored on 11/07/2002 12:47:51
Showing 4 changed files
... ...
@@ -207,8 +207,14 @@ int forward_reply(struct sip_msg* msg)
207 207
 					sock_info[r].name.len, sock_info[r].name.s
208 208
 				);
209 209
 			if ( (msg->via1->host.len==sock_info[r].name.len) && 
210
+	#ifdef USE_IPV6
211
+					(strncasecmp(msg->via1->host.s, sock_info[r].name.s,
212
+								 sock_info[r].name.len)==0) /*slower*/
213
+	#else
210 214
 					(memcmp(msg->via1->host.s, sock_info[r].name.s, 
211
-										sock_info[r].name.len)==0) )
215
+										sock_info[r].name.len)==0)
216
+	#endif
217
+					)
212 218
 				break;
213 219
 		}
214 220
 		if (r==sock_no){
... ...
@@ -61,8 +61,13 @@ int check_address(struct ip_addr* ip, char *name, int resolver)
61 61
 	s=ip_addr2a(ip);
62 62
 	if (s){
63 63
 		DBG("check_address(%s, %s, %d)\n", ip_addr2a(ip), name, resolver);
64
-		if (strcmp(name, s)==0)
65
-			return 0;
64
+	#ifdef USE_IPV6
65
+		if ((ip->af==AF_INET6) && (strcasecmp(name, s)==0))
66
+				return 0;
67
+		else
68
+	#endif
69
+			if (strcmp(name, s)==0)
70
+				return 0;
66 71
 	}else{
67 72
 		LOG(L_CRIT, "check_address: BUG: could not convert ip address\n");
68 73
 		return -1;
... ...
@@ -44,8 +44,9 @@ enum {
44 44
 
45 45
 
46 46
 
47
-static inline char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
48
-				   int *returned_status)
47
+static /*inline*/ char* parse_to_param(char *buffer, char *end,
48
+					struct to_body *to_b,
49
+					int *returned_status)
49 50
 {
50 51
 	struct to_param *param;
51 52
 	int status;
... ...
@@ -75,7 +75,7 @@ enum {
75 75
  * output state = L_PARAM or F_PARAM or END_OF_HEADER
76 76
  * (and saved_state= last state); everything else => error 
77 77
  */
78
-static inline char* parse_via_param(char* p, char* end, int* pstate, 
78
+static /*inline*/ char* parse_via_param(char* p, char* end, int* pstate, 
79 79
 				    int* psaved_state, struct via_param* param)
80 80
 {
81 81
 	char* tmp;