312 |
|
struct sockaddr_in saddr, daddr; |
313 |
|
|
314 |
|
saddr = *addr; |
315 |
< |
if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) |
315 |
> |
if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) { |
316 |
|
saddr.sin_addr.s_addr = so->so_faddr.s_addr; |
317 |
+ |
if ((so->so_faddr.s_addr & htonl(0x000000ff)) == htonl(0xff)) |
318 |
+ |
saddr.sin_addr.s_addr = alias_addr.s_addr; |
319 |
+ |
} |
320 |
|
daddr.sin_addr = so->so_laddr; |
321 |
|
daddr.sin_port = so->so_lport; |
322 |
|
|
405 |
|
struct mbuf *m; |
406 |
|
{ |
407 |
|
struct sockaddr_in addr; |
408 |
< |
int addrlen = sizeof(addr); |
408 |
> |
socklen_t addrlen = sizeof(addr); |
409 |
|
#ifdef EMULATE_TALK |
410 |
|
CTL_MSG_OLD *omsg; |
411 |
|
CTL_MSG *nmsg; |
423 |
|
#endif |
424 |
|
|
425 |
|
struct cu_header { |
426 |
< |
char dest[8]; |
427 |
< |
short family; |
428 |
< |
u_short port; |
429 |
< |
u_long addr; |
426 |
> |
uint16_t d_family; // destination family |
427 |
> |
uint16_t d_port; // destination port |
428 |
> |
uint32_t d_addr; // destination address |
429 |
> |
uint16_t s_family; // source family |
430 |
> |
uint16_t s_port; // source port |
431 |
> |
uint32_t so_addr; // source address |
432 |
> |
uint32_t seqn; // sequence number |
433 |
> |
uint16_t message; // message |
434 |
> |
uint16_t data_type; // data type |
435 |
> |
uint16_t pkt_len; // packet length |
436 |
|
} *cu_head; |
437 |
|
|
438 |
|
switch(so->so_emu) { |
619 |
|
if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0) |
620 |
|
return; |
621 |
|
cu_head = mtod(m, struct cu_header *); |
622 |
< |
cu_head->port = addr.sin_port; |
623 |
< |
cu_head->addr = (u_long) our_addr.s_addr; |
622 |
> |
cu_head->s_port = addr.sin_port; |
623 |
> |
cu_head->so_addr = our_addr.s_addr; |
624 |
|
} |
625 |
|
|
626 |
|
return; |
636 |
|
{ |
637 |
|
struct sockaddr_in addr; |
638 |
|
struct socket *so; |
639 |
< |
int addrlen = sizeof(struct sockaddr_in), opt = 1; |
639 |
> |
socklen_t addrlen = sizeof(struct sockaddr_in); |
640 |
> |
int opt = 1; |
641 |
|
|
642 |
|
if ((so = socreate()) == NULL) { |
643 |
|
free(so); |
661 |
|
getsockname(so->s,(struct sockaddr *)&addr,&addrlen); |
662 |
|
so->so_fport = addr.sin_port; |
663 |
|
if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr) |
664 |
< |
so->so_faddr = our_addr; |
664 |
> |
so->so_faddr = alias_addr; |
665 |
|
else |
666 |
|
so->so_faddr = addr.sin_addr; |
667 |
|
|