Browse code

- freebsd compile fixes (use struct __res_state* instead of res_state + some typos)

Andrei Pelinescu-Onciul authored on 06/12/2007 00:07:56
Showing 4 changed files
... ...
@@ -422,7 +422,7 @@ void free_rdata_list(struct rdata* head)
422 422
  * returns 1 if found
423 423
  *         0 if not found
424 424
  */
425
-int match_search_list(const res_state res, char* name) {
425
+int match_search_list(const struct __res_state* res, char* name) {
426 426
 	int i;
427 427
 	for (i=0; (i<MAXDNSRCH) && (res->dnsrch[i]); i++) {
428 428
 		if (strcasecmp(name, res->dnsrch[i])==0) 
... ...
@@ -153,7 +153,7 @@ struct cname_rdata {
153 153
 
154 154
 
155 155
 #ifdef HAVE_RESOLV_RES
156
-int match_search_list(const res_state res, char* name);
156
+int match_search_list(const struct __res_state* res, char* name);
157 157
 #endif
158 158
 struct rdata* get_record(char* name, int type, int flags);
159 159
 void free_rdata_list(struct rdata* head);
... ...
@@ -890,6 +890,7 @@ struct tcp_connection* tcpconn_connect( union sockaddr_union* server,
890 890
 	if (from && bind(s, &from->s, sockaddru_len(*from)) != 0)
891 891
 		LOG(L_WARN, "WARNING: tcpconn_connect: binding to source address"
892 892
 					" failed: %s [%d]\n", strerror(errno), errno);
893
+	state=S_CONN_OK;
893 894
 #ifdef TCP_BUF_WRITE
894 895
 	if (likely(tcp_options.tcp_buf_write)){
895 896
 again:
... ...
@@ -910,7 +911,6 @@ again:
910 910
 						" failed\n");
911 911
 			goto error;
912 912
 		}
913
-		state=S_CONN_OK;
914 913
 #ifdef TCP_BUF_WRITE
915 914
 	}
916 915
 #endif /* TCP_BUF_WRITE */
... ...
@@ -1681,7 +1681,7 @@ int tcp_init(struct socket_info* sock_info)
1681 1681
 		memset(&afa, 0, sizeof(afa));
1682 1682
 		strcpy(afa.af_name, "dataready");
1683 1683
 		if (setsockopt(sock_info->socket, SOL_SOCKET, SO_ACCEPTFILTER,
1684
-					(void*)&afal, sizeof(afa)) ==-1){
1684
+					(void*)&afa, sizeof(afa)) ==-1){
1685 1685
 			LOG(L_WARN, "WARNING: tcp_init: setsockopt SO_ACCEPTFILTER %s\n",
1686 1686
 						strerror(errno));
1687 1687
 		/* continue since this is not critical */
... ...
@@ -249,7 +249,10 @@ int main (int argc, char** argv)
249 249
 	/* open socket*/
250 250
 	addr.sin_family=he->h_addrtype;
251 251
 	addr.sin_port=htons(port);
252
+#ifdef HAVE_SOCKADDR_SA_LEN
253
+	addr.sin_len=sizeof(struct sockaddr_in);
252 254
 	memcpy(&addr.sin_addr.s_addr, he->h_addr_list[0], he->h_length);
255
+#endif
253 256
 	
254 257
 	for (k=0; k<con_no; k++){
255 258
 		sock = socket(he->h_addrtype, (tcp)?SOCK_STREAM:SOCK_DGRAM, 0);
... ...
@@ -259,7 +262,7 @@ int main (int argc, char** argv)
259 259
 		}
260 260
 		if (tcp){
261 261
 			t=1;
262
-			if (setsockopt(sock, SOL_TCP , TCP_NODELAY, &t, sizeof(t))<0){
262
+			if (setsockopt(sock, IPPROTO_TCP , TCP_NODELAY, &t, sizeof(t))<0){
263 263
 				fprintf(stderr, "ERROR: could not disable Nagle: %s\n",
264 264
 								strerror(errno));
265 265
 			}