VirtualBox

Changeset 28365 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Apr 15, 2010 2:43:22 PM (15 years ago)
Author:
vboxsync
Message:

NAT: unify slirp_init() and adapt the coding style of some slirp_state variables

Location:
trunk/src/VBox/Devices/Network
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r28275 r28365  
    11811181                                   pDrvIns->iInstance, szNetwork);
    11821182
    1183     char szNetAddr[16];
    1184     RTStrPrintf(szNetAddr, sizeof(szNetAddr), "%d.%d.%d.%d",
    1185                (Network & 0xFF000000) >> 24, (Network & 0xFF0000) >> 16,
    1186                (Network & 0xFF00) >> 8, Network & 0xFF);
    1187 
    11881183    /*
    11891184     * Initialize slirp.
    11901185     */
    1191     rc = slirp_init(&pThis->pNATState, &szNetAddr[0], Netmask, fPassDomain, !!fUseHostResolver, pThis);
     1186    rc = slirp_init(&pThis->pNATState, RT_H2N_U32(Network), Netmask,
     1187                    fPassDomain, !!fUseHostResolver, pThis);
    11921188    if (RT_SUCCESS(rc))
    11931189    {
  • trunk/src/VBox/Devices/Network/slirp/bootp.c

    r27797 r28365  
    272272    FILL_BOOTP_EXT(q, RFC1533_GATEWAY, 4, &saddr);
    273273
    274     if (pData->use_dns_proxy || pData->use_host_resolver)
     274    if (pData->fUseDnsProxy || pData->fUseHostResolver)
    275275    {
    276276        uint32_t addr = RT_H2N_U32(RT_N2H_U32(pData->special_addr.s_addr) | CTL_DNS);
     
    300300            FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, 1, " ");
    301301    }
    302     if (pData->fPassDomain && !pData->use_host_resolver)
     302    if (pData->fPassDomain && !pData->fUseHostResolver)
    303303    {
    304304        LIST_FOREACH(dd, &pData->pDomainList, dd_list)
  • trunk/src/VBox/Devices/Network/slirp/libslirp.h

    r28147 r28365  
    2929#endif
    3030
    31 #ifndef VBOX_WITH_NAT_SERVICE
    32 int slirp_init(PNATState *, const char *, uint32_t, bool, bool, void *);
    33 #else
    3431int slirp_init(PNATState *, uint32_t, uint32_t, bool, bool, void *);
    35 #endif
    3632void slirp_register_statistics(PNATState pData, PPDMDRVINS pDrvIns);
    3733void slirp_deregister_statistics(PNATState pData, PPDMDRVINS pDrvIns);
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r28346 r28365  
    523523}
    524524
    525 #ifndef VBOX_WITH_NAT_SERVICE
    526 int slirp_init(PNATState *ppData, const char *pszNetAddr, uint32_t u32Netmask,
    527                bool fPassDomain, bool fUseHostResolver, void *pvUser)
    528 #else
    529525int slirp_init(PNATState *ppData, uint32_t u32NetAddr, uint32_t u32Netmask,
    530526               bool fPassDomain, bool fUseHostResolver, void *pvUser)
    531 #endif
    532527{
    533528    int fNATfailed = 0;
     
    541536        return VERR_INVALID_PARAMETER;
    542537    pData->fPassDomain = !fUseHostResolver ? fPassDomain : false;
    543     pData->use_host_resolver = fUseHostResolver;
     538    pData->fUseHostResolver = fUseHostResolver;
    544539    pData->pvUser = pvUser;
    545540    pData->netmask = u32Netmask;
     
    585580#endif
    586581
    587 #ifndef VBOX_WITH_NAT_SERVICE
    588     inet_aton(pszNetAddr, &pData->special_addr);
    589 #else
    590582    pData->special_addr.s_addr = u32NetAddr;
    591 #endif
    592583    pData->slirp_ethaddr = &special_ethaddr[0];
    593584    alias_addr.s_addr = pData->special_addr.s_addr | RT_H2N_U32_C(CTL_ALIAS);
     
    596587    /* set default addresses */
    597588    inet_aton("127.0.0.1", &loopback_addr);
    598     if (!pData->use_host_resolver)
     589    if (!pData->fUseHostResolver)
    599590    {
    600591        if (slirp_init_dns_list(pData) < 0)
     
    625616        ftp_alias_load(pData);
    626617        nbt_alias_load(pData);
    627         if (pData->use_host_resolver)
     618        if (pData->fUseHostResolver)
    628619            dns_alias_load(pData);
    629620    }
     
    729720    ftp_alias_unload(pData);
    730721    nbt_alias_unload(pData);
    731     if (pData->use_host_resolver)
     722    if (pData->fUseHostResolver)
    732723        dns_alias_unload(pData);
    733724    while (!LIST_EMPTY(&instancehead))
     
    19151906void slirp_set_dhcp_dns_proxy(PNATState pData, bool fDNSProxy)
    19161907{
    1917     if (!pData->use_host_resolver)
     1908    if (!pData->fUseHostResolver)
    19181909    {
    19191910        Log2(("NAT: DNS proxy switched %s\n", (fDNSProxy ? "on" : "off")));
    1920         pData->use_dns_proxy = fDNSProxy;
     1911        pData->fUseDnsProxy = fDNSProxy;
    19211912    }
    19221913    else
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r28142 r28365  
    281281    uma_zone_t zone_ext_refcnt;
    282282#endif
    283     int use_host_resolver;
     283    bool fUseHostResolver;
    284284    /* from dnsproxy/dnsproxy.h*/
    285285    unsigned int authoritative_port;
     
    311311    struct request *request_hash[1 << HASHSIZE];
    312312    /* this field control behaviour of DHCP server */
    313     bool use_dns_proxy;
     313    bool fUseDnsProxy;
    314314
    315315    LIST_HEAD(RT_NOTHING, libalias) instancehead;
  • trunk/src/VBox/Devices/Network/slirp/udp.c

    r27765 r28365  
    162162    }
    163163
    164     if (   pData->use_host_resolver
     164    if (   pData->fUseHostResolver
    165165        && uh->uh_dport == RT_H2N_U16_C(53)
    166166        && CTL_CHECK(RT_N2H_U32(ip->ip_dst.s_addr), CTL_DNS))
     
    256256     * DNS proxy
    257257     */
    258     if (   pData->use_dns_proxy
     258    if (   pData->fUseDnsProxy
    259259        && (ip->ip_dst.s_addr == RT_H2N_U32(RT_N2H_U32(pData->special_addr.s_addr) | CTL_DNS))
    260260        && (uh->uh_dport == RT_H2N_U16_C(53)))
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