VirtualBox

Ignore:
Timestamp:
Mar 29, 2007 12:43:54 PM (18 years ago)
Author:
vboxsync
Message:

Commit the code written by Michal (with some minor changes).

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/ctl.h

    r1 r1796  
    33#define CTL_ALIAS       2
    44#define CTL_DNS         3
     5#define CTL_BROADCAST   255
    56
    67#define CTL_SPECIAL     "10.0.2.0"
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r1076 r1796  
    484484        int ret;
    485485        struct sockaddr_in addr;
     486        struct sockaddr_in host_addr;
    486487
    487488        DEBUG_CALL("sosendto");
     
    493494          /* It's an alias */
    494495          switch(ntohl(so->so_faddr.s_addr) & 0xff) {
     496          case CTL_BROADCAST:
     497            addr.sin_addr.s_addr = INADDR_BROADCAST;
     498            /* Send the packet to host to fully emulate broadcast */
     499            /** @todo r=klaus: on Linux host this causes the host to receive
     500             * the packet twice for some reason. And I cannot find any place
     501             * in the man pages which states that sending a broadcast does not
     502             * reach the host itself. */
     503            host_addr.sin_family = AF_INET;
     504            host_addr.sin_port = so->so_fport;
     505            host_addr.sin_addr = loopback_addr;
     506            sendto(so->s, m->m_data, m->m_len, 0,
     507                  (struct sockaddr *)&host_addr, sizeof (struct sockaddr));
     508            break;
    495509          case CTL_DNS:
    496510            addr.sin_addr = dns_addr;
  • trunk/src/VBox/Devices/Network/slirp/udp.c

    r1789 r1796  
    337337#endif
    338338    } else {
     339      int opt = 1;
    339340      /* success, insert in queue */
    340341      so->so_expire = curtime + SO_EXPIRE;
     342      /* enable broadcast for later use */
     343      setsockopt(so->s, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(opt));
    341344      insque(pData, so,&udb);
    342345    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette