... | ... |
@@ -530,7 +530,8 @@ LIBS= -lfl -ldl -lresolv |
530 | 530 |
|
531 | 531 |
#os specific stuff |
532 | 532 |
ifeq ($(OS), linux) |
533 |
- DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD |
|
533 |
+ DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \ |
|
534 |
+ -DHAVE_MSG_NOSIGNAL |
|
534 | 535 |
ifneq ($(found_lock_method), yes) |
535 | 536 |
DEFS+= -DUSE_SYSV_SEM # try posix sems |
536 | 537 |
found_lock_method=yes |
... | ... |
@@ -63,13 +63,16 @@ |
63 | 63 |
#include <unistd.h> |
64 | 64 |
#include <stdio.h> |
65 | 65 |
#include <errno.h> |
66 |
-#include <sys/types.h> |
|
67 | 66 |
#include <sys/stat.h> |
68 | 67 |
#include <fcntl.h> |
69 | 68 |
#include <signal.h> |
70 | 69 |
#include <string.h> |
71 | 70 |
#include <time.h> |
72 | 71 |
#include <stdarg.h> |
72 |
+#ifdef USE_TCP |
|
73 |
+#include <sys/socket.h> |
|
74 |
+#endif |
|
75 |
+ |
|
73 | 76 |
#include "dprint.h" |
74 | 77 |
#include "ut.h" |
75 | 78 |
#include "error.h" |
... | ... |
@@ -512,7 +515,7 @@ int open_fifo_server() |
512 | 515 |
} |
513 | 516 |
memcpy(up_since_ctime,t,strlen(t)+1); |
514 | 517 |
#ifdef USE_TCP |
515 |
- if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockfd)<0){ |
|
518 |
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){ |
|
516 | 519 |
LOG(L_ERR, "ERROR: open_fifo_server: socketpair failed: %s\n", |
517 | 520 |
strerror(errno)); |
518 | 521 |
return -1; |
... | ... |
@@ -712,7 +712,7 @@ int main_loop() |
712 | 712 |
for(i=0;i<children_no;i++){ |
713 | 713 |
process_no++; |
714 | 714 |
#ifdef USE_TCP |
715 |
- if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockfd)<0){ |
|
715 |
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){ |
|
716 | 716 |
LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n", |
717 | 717 |
strerror(errno)); |
718 | 718 |
goto error; |
... | ... |
@@ -770,7 +770,7 @@ int main_loop() |
770 | 770 |
#endif |
771 | 771 |
{ |
772 | 772 |
#ifdef USE_TCP |
773 |
- if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockfd)<0){ |
|
773 |
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){ |
|
774 | 774 |
LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n", |
775 | 775 |
strerror(errno)); |
776 | 776 |
goto error; |
... | ... |
@@ -355,7 +355,7 @@ struct module_exports exports= { |
355 | 355 |
|
356 | 356 |
inline static int fixup_str2int( void** param, int param_no) |
357 | 357 |
{ |
358 |
- unsigned int go_to; |
|
358 |
+ unsigned long go_to; |
|
359 | 359 |
int err; |
360 | 360 |
|
361 | 361 |
if (param_no==1) { |
... | ... |
@@ -530,7 +530,7 @@ inline static int fixup_hostport2proxy(void** param, int param_no) |
530 | 530 |
/* (char *code, char *reason_phrase)==>(int code, r_p as is) */ |
531 | 531 |
inline static int fixup_t_send_reply(void** param, int param_no) |
532 | 532 |
{ |
533 |
- unsigned int code; |
|
533 |
+ unsigned long code; |
|
534 | 534 |
int err; |
535 | 535 |
|
536 | 536 |
if (param_no==1){ |
... | ... |
@@ -619,9 +619,9 @@ inline static int w_t_reply(struct sip_msg* msg, char* str, char* str2) |
619 | 619 |
*/ |
620 | 620 |
if (rmode==MODE_ONREPLY_REQUEST) { |
621 | 621 |
DBG("DEBUG: t_reply_unsafe called from w_t_reply\n"); |
622 |
- return t_reply_unsafe(t, msg, (unsigned int) str, str2); |
|
622 |
+ return t_reply_unsafe(t, msg, (unsigned int)(long) str, str2); |
|
623 | 623 |
} else { |
624 |
- return t_reply( t, msg, (unsigned int) str, str2); |
|
624 |
+ return t_reply( t, msg, (unsigned int)(long) str, str2); |
|
625 | 625 |
} |
626 | 626 |
} |
627 | 627 |
|
... | ... |
@@ -698,7 +698,7 @@ inline static int w_t_newtran( struct sip_msg* p_msg, char* foo, char* bar ) |
698 | 698 |
|
699 | 699 |
inline static int w_t_on_negative( struct sip_msg* msg, char *go_to, char *foo ) |
700 | 700 |
{ |
701 |
- return t_on_negative( (unsigned int ) go_to ); |
|
701 |
+ return t_on_negative( (unsigned int )(long) go_to ); |
|
702 | 702 |
} |
703 | 703 |
|
704 | 704 |
inline static int w_t_relay_to( struct sip_msg *p_msg , |
... | ... |
@@ -173,9 +173,10 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr) |
173 | 173 |
LOG(L_ERR, "ERROR:get_hdr_field: bad content_length header\n"); |
174 | 174 |
goto error; |
175 | 175 |
} |
176 |
- hdr->parsed=(void*)integer; |
|
176 |
+ hdr->parsed=(void*)(long)integer; |
|
177 | 177 |
hdr->body.len=tmp-hdr->body.s; |
178 |
- DBG("DEBUG: get_hdr_body : content_length=%d\n",(int)hdr->parsed); |
|
178 |
+ DBG("DEBUG: get_hdr_body : content_length=%d\n", |
|
179 |
+ (int)(long)hdr->parsed); |
|
179 | 180 |
break; |
180 | 181 |
case HDR_CONTENTTYPE: |
181 | 182 |
case HDR_FROM: |
... | ... |
@@ -117,7 +117,7 @@ int parse_content_type_hdr( struct sip_msg *msg ) |
117 | 117 |
{'p',CONTENT_TYPE_APPLICATION_SDP,0,-1}, |
118 | 118 |
}; |
119 | 119 |
int node; |
120 |
- int mime; |
|
120 |
+ long mime; |
|
121 | 121 |
char *mark; |
122 | 122 |
char *p, *end; |
123 | 123 |
|
... | ... |
@@ -203,11 +203,11 @@ int parse_content_type_hdr( struct sip_msg *msg ) |
203 | 203 |
goto error; |
204 | 204 |
|
205 | 205 |
mime = ((mime==-1)?CONTENT_TYPE_UNKNOWN:mime); |
206 |
- (int)(msg->content_type->parsed) = mime; |
|
206 |
+ msg->content_type->parsed = (void*)mime; |
|
207 | 207 |
return mime; |
208 | 208 |
error: |
209 | 209 |
LOG(L_ERR,"ERROR:parse_content_type: parse error near char [%d][%c] " |
210 |
- "offset=%d\n",*p,*p,p-msg->content_type->body.s); |
|
210 |
+ "offset=%d\n",*p,*p,(int)(p-msg->content_type->body.s)); |
|
211 | 211 |
return -1; |
212 | 212 |
} |
213 | 213 |
|
... | ... |
@@ -45,13 +45,13 @@ |
45 | 45 |
/* |
46 | 46 |
* returns the content-length value of a sip_msg as an integer |
47 | 47 |
*/ |
48 |
-#define get_content_length(_msg_) ((int)((_msg_)->content_length->parsed)) |
|
48 |
+#define get_content_length(_msg_) ((long)((_msg_)->content_length->parsed)) |
|
49 | 49 |
|
50 | 50 |
|
51 | 51 |
/* |
52 | 52 |
* returns the content-type value of a sip_msg as an integer |
53 | 53 |
*/ |
54 |
-#define get_content_type(_msg_) ((int)((_msg_)->content_type->parsed)) |
|
54 |
+#define get_content_type(_msg_) ((long)((_msg_)->content_type->parsed)) |
|
55 | 55 |
|
56 | 56 |
|
57 | 57 |
|
... | ... |
@@ -29,9 +29,10 @@ |
29 | 29 |
|
30 | 30 |
#include <sys/types.h> |
31 | 31 |
#include <sys/socket.h> |
32 |
+#include <sys/uio.h> |
|
33 |
+#include <stdlib.h> /* for NULL definition on openbsd */ |
|
32 | 34 |
|
33 |
-/* remove this after replacing fprintf*/ |
|
34 |
-#include <stdio.h> |
|
35 |
+#include "dprint.h" |
|
35 | 36 |
|
36 | 37 |
|
37 | 38 |
/* at least 1 byte must be sent! */ |
... | ... |
@@ -100,18 +101,18 @@ int receive_fd(int unix_socket, void* data, int data_len, int* fd) |
100 | 101 |
cmsg=CMSG_FIRSTHDR(&msg); |
101 | 102 |
if ((cmsg!=0) && (cmsg->cmsg_len==CMSG_LEN(sizeof(new_fd)))){ |
102 | 103 |
if (cmsg->cmsg_type!= SCM_RIGHTS){ |
103 |
- fprintf(stderr, " msg control type != SCM_RIGHTS\n"); |
|
104 |
+ LOG(L_ERR, "receive_fd: msg control type != SCM_RIGHTS\n"); |
|
104 | 105 |
ret=-1; |
105 | 106 |
goto error; |
106 | 107 |
} |
107 | 108 |
if (cmsg->cmsg_level!= SOL_SOCKET){ |
108 |
- fprintf(stderr, " msg level != SOL_SOCKET\n"); |
|
109 |
+ LOG(L_ERR, "receive_fd: msg level != SOL_SOCKET\n"); |
|
109 | 110 |
ret=-1; |
110 | 111 |
goto error; |
111 | 112 |
} |
112 | 113 |
*fd=*((int*) CMSG_DATA(cmsg)); |
113 | 114 |
}else{ |
114 |
- fprintf(stderr, " no descriptor passed, cmsg=%p, len=%d\n", |
|
115 |
+ LOG(L_ERR, "receive_fd: no descriptor passed, cmsg=%p, len=%d\n", |
|
115 | 116 |
cmsg, cmsg->cmsg_len); |
116 | 117 |
*fd=-1; |
117 | 118 |
/* it's not really an error */ |
... | ... |
@@ -249,7 +249,7 @@ static int comp_port( int port, void *param, int op, int subtype ) |
249 | 249 |
LOG(L_CRIT, "BUG: comp_port: number expected: %d\n", subtype ); |
250 | 250 |
return E_BUG; |
251 | 251 |
} |
252 |
- return port==(int)param; |
|
252 |
+ return port==(long)param; |
|
253 | 253 |
} |
254 | 254 |
|
255 | 255 |
/* eval_elem helping function, returns str op param */ |
... | ... |
@@ -33,10 +33,10 @@ |
33 | 33 |
#error "shared memory support needed (add -DSHM_MEM to Makefile.defs)" |
34 | 34 |
#endif |
35 | 35 |
|
36 |
-#include <sys/select.h> |
|
37 | 36 |
|
38 | 37 |
#include <sys/time.h> |
39 | 38 |
#include <sys/types.h> |
39 |
+#include <sys/select.h> |
|
40 | 40 |
#include <sys/socket.h> |
41 | 41 |
#include <sys/uio.h> /* writev*/ |
42 | 42 |
|
... | ... |
@@ -348,7 +348,13 @@ get_fd: |
348 | 348 |
send_it: |
349 | 349 |
DBG("tcp_send: sending...\n"); |
350 | 350 |
lock_get(&c->write_lock); |
351 |
- n=send(fd, buf, len, MSG_NOSIGNAL); |
|
351 |
+ n=send(fd, buf, len, |
|
352 |
+#ifdef HAVE_MSG_NOSIGNAL |
|
353 |
+ MSG_NOSIGNAL |
|
354 |
+#else |
|
355 |
+ 0 |
|
356 |
+#endif |
|
357 |
+ ); |
|
352 | 358 |
lock_release(&c->write_lock); |
353 | 359 |
DBG("tcp_send: after write: c= %p n=%d fd=%d\n",c, n, fd); |
354 | 360 |
DBG("tcp_send: buf=\n%.*s\n", (int)len, buf); |
... | ... |
@@ -37,10 +37,10 @@ |
37 | 37 |
#include <errno.h> |
38 | 38 |
#include <string.h> |
39 | 39 |
|
40 |
-#include <sys/select.h> |
|
41 | 40 |
|
42 | 41 |
#include <sys/time.h> |
43 | 42 |
#include <sys/types.h> |
43 |
+#include <sys/select.h> |
|
44 | 44 |
#include <sys/socket.h> |
45 | 45 |
|
46 | 46 |
#include <unistd.h> |
... | ... |
@@ -368,9 +368,11 @@ again: |
368 | 368 |
bytes=tcp_read_headers(req, s); |
369 | 369 |
/* if timeout state=0; goto end__req; */ |
370 | 370 |
DBG("read= %d bytes, parsed=%d, state=%d, error=%d\n", |
371 |
- bytes, req->parsed-req->start, req->state, req->error ); |
|
371 |
+ bytes, (int)(req->parsed-req->start), req->state, |
|
372 |
+ req->error ); |
|
372 | 373 |
DBG("tcp_read_req: last char=%X, parsed msg=\n%.*s\n", |
373 |
- *(req->parsed-1), req->parsed-req->start, req->start); |
|
374 |
+ *(req->parsed-1), (int)(req->parsed-req->start), |
|
375 |
+ req->start); |
|
374 | 376 |
if (bytes==-1){ |
375 | 377 |
LOG(L_ERR, "ERROR: tcp_read_req: error reading \n"); |
376 | 378 |
resp=CONN_ERROR; |
... | ... |
@@ -386,8 +388,8 @@ again: |
386 | 388 |
if (req->error!=TCP_REQ_OK){ |
387 | 389 |
LOG(L_ERR,"ERROR: tcp_read_req: bad request, state=%d, error=%d " |
388 | 390 |
"buf:\n%.*s\nparsed:\n%.*s\n", req->state, req->error, |
389 |
- req->pos-req->buf, req->buf, |
|
390 |
- req->parsed-req->start, req->start); |
|
391 |
+ (int)(req->pos-req->buf), req->buf, |
|
392 |
+ (int)(req->parsed-req->start), req->start); |
|
391 | 393 |
DBG("- received from: port %d, ip -", ntohs(con->rcv.src_port)); |
392 | 394 |
print_ip(&con->rcv.src_ip); DBG("-\n"); |
393 | 395 |
resp=CONN_ERROR; |
... | ... |
@@ -398,7 +400,7 @@ again: |
398 | 400 |
DBG("- received from: port %d, ip - ", ntohs(con->rcv.src_port)); |
399 | 401 |
print_ip(&con->rcv.src_ip); DBG("-\n"); |
400 | 402 |
DBG("tcp_read_req: headers:\n%.*s.\n", |
401 |
- req->body-req->start, req->start); |
|
403 |
+ (int)(req->body-req->start), req->start); |
|
402 | 404 |
if (req->has_content_len){ |
403 | 405 |
DBG("tcp_read_req: content-length= %d\n", req->content_len); |
404 | 406 |
DBG("tcp_read_req: body:\n%.*s\n", req->content_len,req->body); |