... | ... |
@@ -176,7 +176,7 @@ static inline int init_su( union sockaddr_union* su, |
176 | 176 |
#ifdef USE_IPV6 |
177 | 177 |
case AF_INET6: |
178 | 178 |
memcpy(&su->sin6.sin6_addr, ip->u.addr, ip->len); |
179 |
- #ifdef FreeBSD |
|
179 |
+ #ifdef __FreeBSD__ |
|
180 | 180 |
su->sin6.sin6_len=sizeof(struct sockaddr_in6); |
181 | 181 |
#endif |
182 | 182 |
su->sin6.sin6_port=port; |
... | ... |
@@ -184,7 +184,7 @@ static inline int init_su( union sockaddr_union* su, |
184 | 184 |
#endif |
185 | 185 |
case AF_INET: |
186 | 186 |
memcpy(&su->sin.sin_addr, ip->u.addr, ip->len); |
187 |
- #ifdef FreeBSD |
|
187 |
+ #ifdef __FreeBSD__ |
|
188 | 188 |
su->sin.sin_len=sizeof(struct sockaddr_in); |
189 | 189 |
#endif |
190 | 190 |
su->sin.sin_port=port; |
... | ... |
@@ -212,7 +212,7 @@ static inline int hostent2su( union sockaddr_union* su, |
212 | 212 |
#ifdef USE_IPV6 |
213 | 213 |
case AF_INET6: |
214 | 214 |
memcpy(&su->sin6.sin6_addr, he->h_addr_list[idx], he->h_length); |
215 |
- #ifdef FreeBSD |
|
215 |
+ #ifdef __FreeBSD__ |
|
216 | 216 |
su->sin6.sin6_len=sizeof(struct sockaddr_in6); |
217 | 217 |
#endif |
218 | 218 |
su->sin6.sin6_port=port; |
... | ... |
@@ -220,7 +220,7 @@ static inline int hostent2su( union sockaddr_union* su, |
220 | 220 |
#endif |
221 | 221 |
case AF_INET: |
222 | 222 |
memcpy(&su->sin.sin_addr, he->h_addr_list[idx], he->h_length); |
223 |
- #ifdef FreeBSD |
|
223 |
+ #ifdef __FreeBSD__ |
|
224 | 224 |
su->sin.sin_len=sizeof(struct sockaddr_in); |
225 | 225 |
#endif |
226 | 226 |
su->sin.sin_port=port; |
... | ... |
@@ -704,7 +704,10 @@ int add_interfaces(char* if_name, int family, unsigned short port) |
704 | 704 |
char* tmp; |
705 | 705 |
struct ip_addr addr; |
706 | 706 |
int ret; |
707 |
- |
|
707 |
+ |
|
708 |
+#ifdef __FreeBSD__ |
|
709 |
+ #define MAX(a,b) ( ((a)>(b))?(a):(b)) |
|
710 |
+#endif |
|
708 | 711 |
/* ipv4 or ipv6 only*/ |
709 | 712 |
s=socket(family, SOCK_DGRAM, 0); |
710 | 713 |
ret=-1; |
... | ... |
@@ -12,13 +12,13 @@ log_stderror=yes # (cmd line: -E) |
12 | 12 |
#log_stderror=no # (cmd line: -E) |
13 | 13 |
|
14 | 14 |
|
15 |
-children=10 |
|
15 |
+children=2 |
|
16 | 16 |
check_via=no # (cmd. line: -v) |
17 | 17 |
dns=off # (cmd. line: -r) |
18 | 18 |
rev_dns=off # (cmd. line: -R) |
19 | 19 |
#port=5070 |
20 |
-listen=10.0.0.179 lo dorian |
|
21 |
-listen=eth0 |
|
20 |
+#listen=10.0.0.179 lo dorian |
|
21 |
+#listen=eth0 |
|
22 | 22 |
#listen=127.0.0.1 |
23 | 23 |
#listen=192.168.57.33 |
24 | 24 |
#listen=192.168.57.72 |
... | ... |
@@ -113,6 +113,7 @@ int probe_max_receive_buffer( int udp_sock ) |
113 | 113 |
int udp_init(struct socket_info* sock_info) |
114 | 114 |
{ |
115 | 115 |
union sockaddr_union* addr; |
116 |
+ int sock_len; |
|
116 | 117 |
int optval; |
117 | 118 |
|
118 | 119 |
|
... | ... |
@@ -157,8 +158,14 @@ int udp_init(struct socket_info* sock_info) |
157 | 158 |
|
158 | 159 |
|
159 | 160 |
if ( probe_max_receive_buffer(sock_info->socket)==-1) goto error; |
161 |
+#ifdef __FreeBSD__ |
|
162 |
+ sock_len=addr->s.sa_len; |
|
163 |
+#else |
|
164 |
+ sock_len=sizeof(union sockaddr_union); |
|
165 |
+#endif |
|
166 |
+ |
|
160 | 167 |
|
161 |
- if (bind(sock_info->socket, &addr->s, sizeof(union sockaddr_union))==-1){ |
|
168 |
+ if (bind(sock_info->socket, &addr->s, sock_len)==-1){ |
|
162 | 169 |
LOG(L_ERR, "ERROR: udp_init: bind(%x, %p, %d) on %s: %s\n", |
163 | 170 |
sock_info->socket, &addr->s, |
164 | 171 |
sizeof(union sockaddr_union), |