ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/slirp/udp.c
(Generate patch)

Comparing BasiliskII/src/slirp/udp.c (file contents):
Revision 1.2 by gbeauche, 2005-05-13T14:02:37Z vs.
Revision 1.8 by asvitkine, 2012-03-30T01:10:28Z

# Line 10 | Line 10
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   *
# Line 42 | Line 38
38   * terms and conditions of the copyright.
39   */
40  
41 + #include <stdlib.h>
42   #include <slirp.h>
43   #include "ip_icmp.h"
44  
# Line 205 | Line 202 | udp_input(m, iphlen)
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;
# Line 217 | Line 212 | udp_input(m, iphlen)
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;
# Line 312 | Line 310 | int udp_output(struct socket *so, struct
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      
# Line 402 | Line 403 | udp_emu(so, m)
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;
# Line 425 | Line 426 | struct cu_header {
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
# Line 617 | Line 618 | struct cu_header {
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;
# Line 633 | Line 634 | udp_listen(port, laddr, lport, flags)
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);
# Line 657 | Line 659 | udp_listen(port, laddr, lport, flags)
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          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines