VirtualBox

Changeset 29656 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
May 19, 2010 6:05:09 AM (15 years ago)
Author:
vboxsync
Message:

NAT: reanable r61642.

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

Legend:

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

    r29506 r29656  
    636636    struct in_addr req_ip;
    637637    int fDhcpDiscover = 0;
     638    uint8_t *parameter_list = NULL;
    638639    struct mbuf *m = NULL;
    639640
     
    651652    if (p == NULL)
    652653        return;
     654    /*
     655     * We're going update dns list at least once per DHCP transaction (!not on every operation
     656     * within transaction), assuming that transaction can't be longer than 1 min.
     657     */
     658    if (   !pData->fUseHostResolver
     659           && (   pData->dnsLastUpdate == 0
     660               || curtime - pData->dnsLastUpdate > 60 * 1000)) /* one minute*/
     661    {
     662        uint8_t i = 2; /* i = 0 - tag, i == 1 - length */
     663        parameter_list = dhcp_find_option(&bp->bp_vend[0], RFC2132_PARAM_LIST);
     664        for (;parameter_list && i < parameter_list[1]; ++i)
     665        {
     666            if (parameter_list[i] == RFC1533_DNS)
     667            {
     668                slirp_release_dns_list(pData);
     669                slirp_init_dns_list(pData);
     670                pData->dnsLastUpdate = curtime;
     671                break;
     672            }
     673        }
     674    }
    653675
    654676#ifndef VBOX_WITH_SLIRP_BSD_MBUF
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r29506 r29656  
    532532#endif /* !RT_OS_WINDOWS */
    533533
    534 static int slirp_init_dns_list(PNATState pData)
     534int slirp_init_dns_list(PNATState pData)
    535535{
    536536    TAILQ_INIT(&pData->pDnsList);
     
    539539}
    540540
    541 static void slirp_release_dns_list(PNATState pData)
     541void slirp_release_dns_list(PNATState pData)
    542542{
    543543    struct dns_entry *pDns = NULL;
  • trunk/src/VBox/Devices/Network/slirp/slirp.h

    r29506 r29656  
    341341void slirp_arp_cache_add(PNATState pData, uint32_t ip, const uint8_t *ether);
    342342int slirp_arp_cache_update_or_add(PNATState pData, uint32_t dst, const uint8_t *mac);
     343int slirp_init_dns_list(PNATState pData);
     344void slirp_release_dns_list(PNATState pData);
    343345#define MIN_MRU 128
    344346#define MAX_MRU 16384
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r29506 r29656  
    175175    struct in_addr tftp_server;
    176176    struct in_addr loopback_addr;
     177    uint32_t dnsLastUpdate;
    177178    uint32_t netmask;
    178179#ifndef VBOX_WITH_NAT_SERVICE
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