10 |
|
* 2. Redistributions in binary form must reproduce the above copyright |
11 |
|
* notice, this list of conditions and the following disclaimer in the |
12 |
|
* documentation and/or other materials provided with the distribution. |
13 |
< |
* 3. All advertising materials mentioning features or use of this software |
14 |
< |
* must display the following acknowledgement: |
15 |
< |
* This product includes software developed by the University of |
16 |
< |
* California, Berkeley and its contributors. |
17 |
< |
* 4. Neither the name of the University nor the names of its contributors |
13 |
> |
* 3. Neither the name of the University nor the names of its contributors |
14 |
|
* may be used to endorse or promote products derived from this software |
15 |
|
* without specific prior written permission. |
16 |
|
* |
38 |
|
* terms and conditions of the copyright. |
39 |
|
*/ |
40 |
|
|
41 |
+ |
#include <stdlib.h> |
42 |
|
#include <slirp.h> |
43 |
|
#include "ip_icmp.h" |
44 |
|
|
202 |
|
/* udp_last_so = so; */ |
203 |
|
so->so_laddr = ip->ip_src; |
204 |
|
so->so_lport = uh->uh_sport; |
208 |
– |
so->so_faddr = ip->ip_dst; /* XXX */ |
209 |
– |
so->so_fport = uh->uh_dport; /* XXX */ |
205 |
|
|
206 |
|
if ((so->so_iptos = udp_tos(so)) == 0) |
207 |
|
so->so_iptos = ip->ip_tos; |
212 |
|
*/ |
213 |
|
} |
214 |
|
|
215 |
+ |
so->so_faddr = ip->ip_dst; /* XXX */ |
216 |
+ |
so->so_fport = uh->uh_dport; /* XXX */ |
217 |
+ |
|
218 |
|
iphlen += sizeof(struct udphdr); |
219 |
|
m->m_len -= iphlen; |
220 |
|
m->m_data += iphlen; |
310 |
|
struct sockaddr_in saddr, daddr; |
311 |
|
|
312 |
|
saddr = *addr; |
313 |
< |
if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) |
313 |
> |
if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) { |
314 |
|
saddr.sin_addr.s_addr = so->so_faddr.s_addr; |
315 |
+ |
if ((so->so_faddr.s_addr & htonl(0x000000ff)) == htonl(0xff)) |
316 |
+ |
saddr.sin_addr.s_addr = alias_addr.s_addr; |
317 |
+ |
} |
318 |
|
daddr.sin_addr = so->so_laddr; |
319 |
|
daddr.sin_port = so->so_lport; |
320 |
|
|
403 |
|
struct mbuf *m; |
404 |
|
{ |
405 |
|
struct sockaddr_in addr; |
406 |
< |
int addrlen = sizeof(addr); |
406 |
> |
socklen_t addrlen = sizeof(addr); |
407 |
|
#ifdef EMULATE_TALK |
408 |
|
CTL_MSG_OLD *omsg; |
409 |
|
CTL_MSG *nmsg; |
426 |
|
uint32_t d_addr; // destination address |
427 |
|
uint16_t s_family; // source family |
428 |
|
uint16_t s_port; // source port |
429 |
< |
uint32_t s_addr; // source address |
429 |
> |
uint32_t so_addr; // source address |
430 |
|
uint32_t seqn; // sequence number |
431 |
|
uint16_t message; // message |
432 |
|
uint16_t data_type; // data type |
618 |
|
return; |
619 |
|
cu_head = mtod(m, struct cu_header *); |
620 |
|
cu_head->s_port = addr.sin_port; |
621 |
< |
cu_head->s_addr = our_addr.s_addr; |
621 |
> |
cu_head->so_addr = our_addr.s_addr; |
622 |
|
} |
623 |
|
|
624 |
|
return; |
634 |
|
{ |
635 |
|
struct sockaddr_in addr; |
636 |
|
struct socket *so; |
637 |
< |
int addrlen = sizeof(struct sockaddr_in), opt = 1; |
637 |
> |
socklen_t addrlen = sizeof(struct sockaddr_in); |
638 |
> |
int opt = 1; |
639 |
|
|
640 |
|
if ((so = socreate()) == NULL) { |
641 |
|
free(so); |
659 |
|
getsockname(so->s,(struct sockaddr *)&addr,&addrlen); |
660 |
|
so->so_fport = addr.sin_port; |
661 |
|
if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr) |
662 |
< |
so->so_faddr = our_addr; |
662 |
> |
so->so_faddr = alias_addr; |
663 |
|
else |
664 |
|
so->so_faddr = addr.sin_addr; |
665 |
|
|