VirtualBox

Changeset 17436 in vbox for trunk/src


Ignore:
Timestamp:
Mar 6, 2009 3:33:40 AM (16 years ago)
Author:
vboxsync
Message:

NAT: added extradata options to control DHCP forcing use external TFTP server and DNS proxy

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/bootp.c

    r16254 r17436  
    284284        FILL_BOOTP_EXT(q, RFC1533_DNS, 4, &dns_addr_dhcp.s_addr);
    285285#else
     286# ifdef VBOX_WITH_SLIRP_DNS_PROXY
     287        if (pData->use_dns_proxy)
     288        {
     289            uint32_t addr = htonl(ntohl(special_addr.s_addr) | CTL_DNS);
     290            FILL_BOOTP_EXT(q, RFC1533_DNS, 4, &addr);
     291        }
     292        else
     293# endif
    286294        LIST_FOREACH(de, &pData->dns_list_head, de_list)
    287295        {
  • trunk/src/VBox/Devices/Network/slirp/libslirp.h

    r16572 r17436  
    2828#endif
    2929
    30 int slirp_init(PNATState *, const char *, uint32_t, bool, const char *, const char *, void *);
     30int slirp_init(PNATState *, const char *, uint32_t, bool, void *);
    3131void slirp_register_timers(PNATState pData, PPDMDRVINS pDrvIns);
    3232void slirp_term(PNATState);
     
    6868                   int guest_port);
    6969
     70void slirp_set_dhcp_TFTP_prefix(PNATState pData, const char *tftpPrefix);
     71void slirp_set_dhcp_TFTP_bootfile(PNATState pData, const char *bootFile);
     72void slirp_set_dhcp_next_server(PNATState pData, const char *nextServer);
     73#ifdef VBOX_WITH_SLIRP_DNS_PROXY
     74void slirp_set_dhcp_dns_proxy(PNATState pData, bool fDNSProxy);
     75#endif
    7076#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    7177
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r17392 r17436  
    543543
    544544int slirp_init(PNATState *ppData, const char *pszNetAddr, uint32_t u32Netmask,
    545                bool fPassDomain, const char *pszTFTPPrefix,
    546                const char *pszBootFile, void *pvUser)
     545               bool fPassDomain, void *pvUser)
    547546{
    548547    int fNATfailed = 0;
     
    557556    pData->fPassDomain = fPassDomain;
    558557    pData->pvUser = pvUser;
    559     tftp_prefix = pszTFTPPrefix;
    560     bootp_filename = pszBootFile;
    561558    pData->netmask = u32Netmask;
    562559
     
    590587    alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
    591588    /* @todo: add ability to configure this staff */
    592     pData->tftp_server.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_TFTP);
    593589
    594590    /* set default addresses */
     
    16641660    return htons(service);
    16651661}
     1662
     1663void slirp_set_dhcp_TFTP_prefix(PNATState pData, const char *tftpPrefix)
     1664{
     1665    Log2(("tftp_prefix:%s\n", tftp_prefix));
     1666    tftp_prefix = tftpPrefix;
     1667}
     1668
     1669void slirp_set_dhcp_TFTP_bootfile(PNATState pData, const char *bootFile)
     1670{
     1671    Log2(("bootFile:%s\n", bootFile));
     1672    bootp_filename = bootFile;
     1673}
     1674
     1675void slirp_set_dhcp_next_server(PNATState pData, const char *next_server)
     1676{
     1677    Log2(("next_server:%s\n", next_server));
     1678    if (next_server == NULL)
     1679        pData->tftp_server.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_TFTP);
     1680    else
     1681        inet_aton(next_server, &pData->tftp_server);
     1682}
     1683#ifdef VBOX_WITH_SLIRP_DNS_PROXY
     1684void slirp_set_dhcp_dns_proxy(PNATState pData, bool fDNSProxy)
     1685{
     1686    pData->use_dns_proxy = fDNSProxy;
     1687}
     1688#endif
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r17262 r17436  
    209209    #define HASH(id) (id & ((1 << HASHSIZE) - 1))
    210210    struct request *request_hash[1 << HASHSIZE];
     211    /* this field control behaviour of DHCP server */
     212    bool use_dns_proxy;
    211213#endif
    212214    STAMPROFILE StatFill;
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