Browse code

- more ipv6 received= & via==us debuging

Andrei Pelinescu-Onciul authored on 08/07/2002 16:52:40
Showing 2 changed files
... ...
@@ -195,14 +195,22 @@ int forward_reply(struct sip_msg* msg)
195 195
 	
196 196
 	to=0;
197 197
 	new_buf=0;
198
-#ifndef BOGDANS_CUTOFF
199 198
 	/*check if first via host = us */
200 199
 	if (check_via){
201 200
 		for (r=0; r<sock_no; r++)
201
+		{
202
+			DBG("forward_reply - checking if via==us: %d==%d && "
203
+					" [%.*s] == [%.*s]\n", 
204
+					msg->via1->host.len,
205
+					sock_info[r].name.len,
206
+					msg->via1->host.len, msg->via1->host.s,
207
+					sock_info[r].name.len, sock_info[r].name.s
208
+				);
202 209
 			if ( (msg->via1->host.len==sock_info[r].name.len) && 
203 210
 					(memcmp(msg->via1->host.s, sock_info[r].name.s, 
204 211
 										sock_info[r].name.len)==0) )
205 212
 				break;
213
+		}
206 214
 		if (r==sock_no){
207 215
 			LOG(L_NOTICE, "ERROR: forward_reply: host in first via!=me :"
208 216
 					" %.*s\n", msg->via1->host.len, msg->via1->host.s);
... ...
@@ -210,7 +218,6 @@ int forward_reply(struct sip_msg* msg)
210 210
 			goto error;
211 211
 		}
212 212
 	}
213
-#endif
214 213
 	/* quick hack, slower for mutliple modules*/
215 214
 	for (mod=modules;mod;mod=mod->next){
216 215
 		if ((mod->exports) && (mod->exports->response_f)){
... ...
@@ -55,10 +55,19 @@ int check_address(struct ip_addr* ip, char *name, int resolver)
55 55
 {
56 56
 	struct hostent* he;
57 57
 	int i;
58
+	char* s;
58 59
 
59 60
 	/* maybe we are lucky and name it's an ip */
60
-	if (strcmp(name, ip_addr2a(ip))==0)
61
-		return 0;
61
+	s=ip_addr2a(ip);
62
+	if (s){
63
+		DBG("check_address(%s, %s, %d)\n", ip_addr2a(ip), name, resolver);
64
+		if (strcmp(name, s)==0)
65
+			return 0;
66
+	}else{
67
+		LOG(L_CRIT, "check_address: BUG: could not convert ip address\n");
68
+		return -1;
69
+	}
70
+		
62 71
 	if (resolver&DO_DNS){
63 72
 		DBG("check_address: doing dns lookup\n");
64 73
 		/* try all names ips */