VirtualBox

Changeset 23369 in vbox for trunk/src


Ignore:
Timestamp:
Sep 28, 2009 12:41:20 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
52893
Message:

NAT: small cosmetics, trailing spaces

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

Legend:

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

    r23158 r23369  
    4747    uint8_t len;
    4848    /*@todo magic validation */
    49     q += 4; /*magic*/ 
     49    q += 4; /*magic*/
    5050    while(*q != RFC1533_END)
    5151    {
     
    5656        q++;
    5757        len = *q;
    58         q += 1 + len; 
    59     }
    60     return NULL; 
     58        q += 1 + len;
     59    }
     60    return NULL;
    6161}
    6262static BOOTPClient *bc_alloc_client(PNATState pData)
     
    135135 *            name or options      name or options
    136136 * 'options'  options              options
    137  * 
     137 *
    138138 * Option                    DHCPOFFER    DHCPACK            DHCPNAK
    139139 * ------                    ---------    -------            -------
     
    265265    }while(0)
    266266
    267    
    268    
     267
    269268    FILL_BOOTP_EXT(q, RFC1533_NETMASK, 4, &netmask);
    270269    FILL_BOOTP_EXT(q, RFC1533_GATEWAY, 4, &saddr);
    271    
     270
    272271    if (pData->use_dns_proxy || pData->use_host_resolver)
    273272    {
     
    276275        goto skip_dns_servers;
    277276    }
    278    
    279     if (!TAILQ_EMPTY(&pData->dns_list_head)) 
     277
     278    if (!TAILQ_EMPTY(&pData->dns_list_head))
    280279    {
    281280        de = TAILQ_LAST(&pData->dns_list_head, dns_list_head);
     
    283282        FILL_BOOTP_EXT(q, RFC1533_DNS, 4, &de->de_addr.s_addr);
    284283    }
    285    
     284
    286285    TAILQ_FOREACH_REVERSE(de, &pData->dns_list_head, dns_list_head, de_list)
    287286    {
     
    296295            /* Microsoft dhcp client doen't like domain-less dhcp and trimmed packets*/
    297296            /* dhcpcd client very sad if no domain name is passed */
    298             FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, 1, " "); 
     297            FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, 1, " ");
    299298    }
    300299    if (pData->fPassDomain && !pData->use_host_resolver)
     
    302301        LIST_FOREACH(dd, &pData->dns_domain_list_head, dd_list)
    303302        {
    304            
     303
    305304            if (dd->dd_pszDomain == NULL)
    306305                continue;
    307306            /* never meet valid separator here in RFC1533*/
    308             if (added != 0) 
    309                 FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, 1, ","); 
     307            if (added != 0)
     308                FILL_BOOTP_EXT(q, RFC1533_DOMAINNAME, 1, ",");
    310309            else
    311310                added = 1;
     
    314313        }
    315314    }
    316    
     315
    317316    FILL_BOOTP_EXT(q, RFC2132_LEASE_TIME, 4, &lease_time);
    318    
     317
    319318    if (*slirp_hostname)
    320319    {
     
    332331
    333332    dhcp_create_msg(pData, bp, m, DHCPNAK);
    334    
     333
    335334    return 7;
    336335}
     
    408407            /*see table 4 rfc2131*/
    409408            if (bp->bp_flags & DHCP_FLAGS_B)
    410                 dhcp_stat = REBINDING; 
    411             else 
    412                 dhcp_stat = RENEWING; 
     409                dhcp_stat = REBINDING;
     410            else
     411                dhcp_stat = RENEWING;
    413412        }
    414413    }
     
    416415    switch (dhcp_stat)
    417416    {
    418         case RENEWING: 
    419         {
    420             Assert((   server_ip == NULL 
     417        case RENEWING:
     418        {
     419            Assert((   server_ip == NULL
    421420                && req_ip == NULL
    422421                && bp->bp_ciaddr.s_addr != INADDR_ANY));
     
    428427            else
    429428            {
    430                if ((bp->bp_ciaddr.s_addr & htonl(pData->netmask)) != special_addr.s_addr) 
     429               if ((bp->bp_ciaddr.s_addr & htonl(pData->netmask)) != special_addr.s_addr)
    431430               {
    432431                    off = dhcp_send_nack(pData, bp, bc, m);
     
    441440               Assert((bp->bp_hlen == ETH_ALEN));
    442441               memcpy(bc->macaddr, bp->bp_hwaddr, bp->bp_hlen);
    443                bc->addr.s_addr = bp->bp_ciaddr.s_addr; 
     442               bc->addr.s_addr = bp->bp_ciaddr.s_addr;
    444443               slirp_arp_cache_update(pData, bp->bp_ciaddr.s_addr, bp->bp_hwaddr);
    445444            }
     
    450449            Assert(req_ip != NULL);
    451450            ui32 = *(uint32_t *)(req_ip + 2);
    452             if ((ui32 & htonl(pData->netmask)) != special_addr.s_addr) 
     451            if ((ui32 & htonl(pData->netmask)) != special_addr.s_addr)
    453452            {
    454453                LogRel(("NAT: address %R[IP4] has been req.\n", &ui32));
     
    464463            Assert((bp->bp_hlen == ETH_ALEN));
    465464            memcpy(bc->macaddr, bp->bp_hwaddr, bp->bp_hlen);
    466             bc->addr.s_addr = ui32; 
     465            bc->addr.s_addr = ui32;
    467466            slirp_arp_cache_update(pData, bp->bp_ciaddr.s_addr, bp->bp_hwaddr);
    468467        break;
     
    499498        bc->xid = bp->bp_xid;
    500499        /*bc isn't NULL */
    501         off = dhcp_send_offer(pData, bp, bc, m); 
     500        off = dhcp_send_offer(pData, bp, bc, m);
    502501        return off;
    503     } 
     502    }
    504503    else
    505504    {
     
    511510            return -1;
    512511        }
    513         off = dhcp_send_ack(pData, bp, bc, m, 0); 
     512        off = dhcp_send_ack(pData, bp, bc, m, 0);
    514513        return off;
    515514    }
     
    584583 * Site-specific              MAY           MAY              MUST NOT
    585584 * All others                 MAY           MAY              MUST NOT
    586  * 
     585 *
    587586 */
    588587static void dhcp_decode(PNATState pData, struct bootp_t *bp, const uint8_t *buf, int size)
     
    590589    const uint8_t *p, *p_end;
    591590    int rc;
    592     int pmsg_type; 
     591    int pmsg_type;
    593592    struct in_addr req_ip;
    594593    int flag = 0;
     
    655654static void bootp_reply(PNATState pData, struct mbuf *m, int off, uint16_t flags)
    656655{
    657     struct sockaddr_in saddr, daddr; 
     656    struct sockaddr_in saddr, daddr;
    658657    struct bootp_t *rbp = NULL;
    659658    uint8_t *q = NULL;
     
    674673    FILL_BOOTP_EXT(q, RFC2132_SRV_ID, 4, &saddr.sin_addr);
    675674
    676    
     675
    677676    *q++ = RFC1533_END; /*end of message */
    678    
     677
    679678
    680679#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     
    708707{
    709708    int rc = 1;
    710     uint32_t ip = INADDR_ANY; 
     709    uint32_t ip = INADDR_ANY;
    711710    int i;
    712711    if (ether == NULL || pip == NULL)
     
    746745
    747746/*
    748  * Initialize dhcp server 
     747 * Initialize dhcp server
    749748 * @returns 0 - if initialization is ok, non-zero otherwise
    750749 */
  • trunk/src/VBox/Devices/Network/slirp/cksum.c

    r14964 r23369  
    4242 * This routine is very heavily used in the network
    4343 * code and should be modified for each CPU to be as fast as possible.
    44  * 
     44 *
    4545 * XXX Since we will never span more than 1 mbuf, we can optimise this
    4646 */
     
    6666        u_int32_t l;
    6767    } l_util;
    68        
     68
    6969    if (m->m_len == 0)
    7070        goto cont;
     
    7272
    7373    mlen = m->m_len;
    74        
     74
    7575    if (len < mlen)
    7676        mlen = len;
     
    114114        sum += *w++;
    115115    }
    116        
     116
    117117    if (byte_swapped)
    118118    {
     
    131131    else if (mlen == -1)
    132132        s_util.c[0] = *(u_int8_t *)w;
    133        
     133
    134134cont:
    135135#ifdef DEBUG
  • trunk/src/VBox/Devices/Network/slirp/debug.c

    r23154 r23369  
    249249    AssertReturn(strcmp(pszType, "ether") == 0, 0);
    250250    if (ether != NULL)
    251         return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 
     251        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
    252252            "[ether %hhx:%hhx:%hhx:%hhx:%hhx:%hhx]",
    253             ether[0], ether[1], ether[2], 
     253            ether[0], ether[1], ether[2],
    254254            ether[3], ether[4], ether[5]);
    255255    else
     
    271271
    272272    AssertReturn(strcmp(pszType, "natsock") == 0, 0);
    273     if (so == NULL) 
    274         return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 
     273    if (so == NULL)
     274        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
    275275                "socket is null");
    276     if (so->so_state == SS_NOFDREF || so->s == -1) 
    277         return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 
     276    if (so->so_state == SS_NOFDREF || so->s == -1)
     277        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
    278278                "socket(%d) SS_NODREF",so->s);
    279279    status = getsockname(so->s, &addr, &socklen);
     
    281281    if(status != 0 || addr.sa_family != AF_INET)
    282282    {
    283         return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 
     283        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
    284284                "socket(%d) is invalid(probably closed)",so->s);
    285285    }
     
    290290            "state=%04x ip=" IP4_ADDR_PRINTF_FORMAT ":%d "
    291291            "name=" IP4_ADDR_PRINTF_FORMAT ":%d",
    292             so->s, so->so_type, so->so_state, IP4_ADDR_PRINTF_DECOMP(ip), 
    293             ntohs(so->so_fport), 
     292            so->s, so->so_type, so->so_state, IP4_ADDR_PRINTF_DECOMP(ip),
     293            ntohs(so->so_fport),
    294294            IP4_ADDR_PRINTF_DECOMP(ntohl(in_addr->sin_addr.s_addr)),
    295295            ntohs(in_addr->sin_port));
     
    309309    AssertReturn(strcmp(pszType, "natwinnetevents") == 0, 0);
    310310
    311     cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (", 
     311    cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "events=%02x (",
    312312            pNetworkEvents->lNetworkEvents);
    313313# define DO_BIT(bit) \
     
    354354    {
    355355        /*
    356          * XXX(r - frank): Move this to IPRT using RTNETADDRIPV4. 
     356         * XXX(r - frank): Move this to IPRT using RTNETADDRIPV4.
    357357         * Use the specifier %RNAipv4.
    358358         */
     
    363363        rc = RTStrFormatTypeRegister("natsock", print_socket, NULL);
    364364        AssertRC(rc);
    365         rc = RTStrFormatTypeRegister("natwinnetevents", 
     365        rc = RTStrFormatTypeRegister("natwinnetevents",
    366366            print_networkevents, NULL);
    367367        AssertRC(rc);
  • trunk/src/VBox/Devices/Network/slirp/if.c

    r23163 r23369  
    146146        ifq = TAILQ_LAST(&if_batchq, if_queue);
    147147    }
    148    
     148
    149149    /* queue already created */
    150150#endif
     
    282282        if_encap(pData, ETH_P_IP, ifm);
    283283
    284         if (!if_queued) 
     284        if (!if_queued)
    285285        {
    286286            return;
  • trunk/src/VBox/Devices/Network/slirp/if.h

    r15933 r23369  
    11/*
    22 * Copyright (c) 1995 Danny Gasparovski.
    3  * 
    4  * Please read the file COPYRIGHT for the 
     3 *
     4 * Please read the file COPYRIGHT for the
    55 * terms and conditions of the copyright.
    66 */
  • trunk/src/VBox/Devices/Network/slirp/ip_icmp.c

    r23154 r23369  
    555555    {
    556556        size = MCLBYTES;
    557     } 
     557    }
    558558    else if (new_m_size < MCLBYTES)
    559559    {
  • trunk/src/VBox/Devices/Network/slirp/ip_input.c

    r23240 r23369  
    7979    if (t = m_tag_find(m, PACKET_TAG_ALIAS, NULL) != 0)
    8080    {
    81         return (struct libalias *)&t[1]; 
     81        return (struct libalias *)&t[1];
    8282    }
    8383#endif
     
    234234    return;
    235235bad:
    236     Log2(("NAT: IP datagram to %R[IP4] with size(%d) claimed as bad\n", 
     236    Log2(("NAT: IP datagram to %R[IP4] with size(%d) claimed as bad\n",
    237237        &ip->ip_dst, ip->ip_len));
    238238    m_freem(pData, m);
  • trunk/src/VBox/Devices/Network/slirp/ip_output.c

    r23202 r23369  
    6565    if (rc == 0)
    6666        return rc;
    67     /* 
    68      * no chance to send this packet, sorry, we will request ether address via ARP 
    69      */
    70     slirp_arp_who_has(pData, dst); 
    71     return rc; 
     67    /*
     68     * no chance to send this packet, sorry, we will request ether address via ARP
     69     */
     70    slirp_arp_who_has(pData, dst);
     71    return rc;
    7272}
    7373
     
    152152    }
    153153#else
    154     /* 
     154    /*
    155155     * (vvl) Assumption is that m_data points at the IP header and only
    156156     * in case of dhcp we know and have header before IP.
     
    170170        ip->ip_sum = 0;
    171171        ip->ip_sum = cksum(m, hlen);
    172    
     172
    173173        {
    174174#ifndef VBOX_WITH_SLIRP_BSD_MBUF
    175175            STAM_PROFILE_START(&pData->StatALIAS_output, a);
    176             rc = LibAliasOut((m->m_la ? m->m_la : pData->proxy_alias), 
     176            rc = LibAliasOut((m->m_la ? m->m_la : pData->proxy_alias),
    177177                mtod(m, char *), m->m_len);
    178178            Log2(("NAT: LibAlias return %d\n", rc));
     
    186186            else
    187187            {
    188                 rc = LibAliasOut(pData->proxy_alias, mtod(m, char *), 
     188                rc = LibAliasOut(pData->proxy_alias, mtod(m, char *),
    189189                                 m_length(m, NULL));
    190             } 
     190            }
    191191            if (rc == PKT_ALIAS_IGNORED)
    192192            {
     
    198198        }
    199199
    200         memcpy(eh->h_source, eth_dst, ETH_ALEN); 
     200        memcpy(eh->h_source, eth_dst, ETH_ALEN);
    201201
    202202        if_output(pData, so, m);
     
    240240                ip->ip_sum = cksum(m, hlen);
    241241#ifndef VBOX_WITH_SLIRP_BSD_MBUF
    242                 rc = LibAliasOut((m->m_la ? m->m_la : pData->proxy_alias), 
     242                rc = LibAliasOut((m->m_la ? m->m_la : pData->proxy_alias),
    243243                    mtod(m, char *), m->m_len);
    244244#else
     
    264264                {
    265265                    rc = LibAliasOut(pData->proxy_alias, tmpbuf, tmplen);
    266                 } 
     266                }
    267267                if (m->m_next != NULL)
    268268                {
     
    379379                m->m_data += ETH_HLEN;
    380380#endif
    381                 memcpy(eh->h_source, eth_dst, ETH_ALEN); 
     381                memcpy(eh->h_source, eth_dst, ETH_ALEN);
    382382
    383383                if_output(pData, so, m);
    384384            }
    385             else 
     385            else
    386386            {
    387387                m_freem(pData, m);
  • trunk/src/VBox/Devices/Network/slirp/libslirp.h

    r23163 r23369  
    5757
    5858int slirp_redir(PNATState pData, int is_udp, struct in_addr host_addr,
    59                 int host_port, struct in_addr guest_addr, 
     59                int host_port, struct in_addr guest_addr,
    6060                int guest_port, const uint8_t *);
    6161int slirp_add_exec(PNATState pData, int do_pty, const char *args, int addr_low_byte,
  • trunk/src/VBox/Devices/Network/slirp/mbuf.c

    r23242 r23369  
    3434     * Find a nice value for msize
    3535     */
    36     msize = (if_mtu>if_mru ? if_mtu : if_mru) 
     36    msize = (if_mtu>if_mru ? if_mtu : if_mru)
    3737          + sizeof(struct m_hdr) + sizeof(void *)   /*pointer to the backstore*/
    3838          + if_maxlinkhdr ;
     
    244244        else
    245245        {
    246             if (   (char *)dat >=  m->m_dat 
     246            if (   (char *)dat >=  m->m_dat
    247247                && (char *)dat <  (m->m_dat + m->m_size))
    248248                return m;
  • trunk/src/VBox/Devices/Network/slirp/misc.c

    r23154 r23369  
    117117#ifdef VBOX_WITH_SLIRP_BSD_MBUF
    118118#define ITEM_MAGIC 0xdead0001
    119 struct item 
     119struct item
    120120{
    121121    uint32_t magic;
     
    146146
    147147
    148 static void *slirp_uma_alloc(uma_zone_t zone, 
     148static void *slirp_uma_alloc(uma_zone_t zone,
    149149    int size, uint8_t *pflags, int wait)
    150150{
     
    155155    {
    156156        /*
    157          * @todo (r=vvl) here should be some 
    158          * accounting of extra items in case 
     157         * @todo (r=vvl) here should be some
     158         * accounting of extra items in case
    159159         * breakthrough barrier
    160160         */
    161161        if (LIST_EMPTY(&zone->free_items))
    162             return NULL; 
     162            return NULL;
    163163        it = LIST_FIRST(&zone->free_items);
    164         LIST_REMOVE(it, list); 
     164        LIST_REMOVE(it, list);
    165165        LIST_INSERT_HEAD(&zone->used_items, it, list);
    166166        goto allocated;
     
    188188    struct item *it;
    189189    uma_zone_t zone;
    190     Assert(item); 
     190    Assert(item);
    191191    it = &((struct item *)item)[-1];
    192192    Assert(it->magic == ITEM_MAGIC);
    193193    zone = it->zone;
    194194    Assert(zone->magic == ZONE_MAGIC);
    195     LIST_REMOVE(it, list); 
     195    LIST_REMOVE(it, list);
    196196    LIST_INSERT_HEAD(&zone->free_items, it, list);
    197197}
    198198
    199 uma_zone_t uma_zcreate(PNATState pData, char *name, size_t size, 
     199uma_zone_t uma_zcreate(PNATState pData, char *name, size_t size,
    200200    ctor_t ctor, dtor_t dtor, zinit_t init, zfini_t fini, int flags1, int flags2)
    201201{
     
    213213    zone->pfFree = slirp_uma_free;
    214214    return zone;
    215    
    216 }
    217 uma_zone_t uma_zsecond_create(char *name, ctor_t ctor, 
     215
     216}
     217uma_zone_t uma_zsecond_create(char *name, ctor_t ctor,
    218218    dtor_t dtor, zinit_t init, zfini_t fini, uma_zone_t master)
    219219{
    220220    uma_zone_t zone;
    221221#if 0
    222     if (master->pfAlloc != NULL) 
     222    if (master->pfAlloc != NULL)
    223223        zone = (uma_zone_t)master->pfAlloc(master, sizeof(struct uma_zone), NULL, 0);
    224 #endif       
     224#endif
    225225    zone = RTMemAllocZ(sizeof(struct uma_zone));
    226     if (zone == NULL) 
     226    if (zone == NULL)
    227227    {
    228228        return NULL;
     
    247247void uma_zone_set_allocf(uma_zone_t zone, uma_alloc_t pfAlloc)
    248248{
    249    zone->pfAlloc = pfAlloc; 
     249   zone->pfAlloc = pfAlloc;
    250250}
    251251void uma_zone_set_freef(uma_zone_t zone, uma_free_t pfFree)
    252252{
    253    zone->pfFree = pfFree; 
     253   zone->pfFree = pfFree;
    254254}
    255255
    256256uint32_t *uma_find_refcnt(uma_zone_t zone, void *mem)
    257257{
    258     /*@todo (r-vvl) this function supposed to work with special zone storing 
    259     reference counters */ 
     258    /*@todo (r-vvl) this function supposed to work with special zone storing
     259    reference counters */
    260260    struct item *it = (struct item *)mem; /* 1st element */
    261261    Assert(zone->magic == ZONE_MAGIC);
     
    288288        return;
    289289    Assert((mem));
    290     it = &((struct item *)mem)[-1]; 
     290    it = &((struct item *)mem)[-1];
    291291    if (it->magic != ITEM_MAGIC)
    292292    {
     
    296296    }
    297297    Assert((zone->magic == ZONE_MAGIC && zone == it->zone));
    298      
     298
    299299    if (zone->pfDtor)
    300300        zone->pfDtor(zone->pData, mem, zone->size, flags);
     
    307307void zone_drain(uma_zone_t zone)
    308308{
    309    
    310309}
    311310
  • trunk/src/VBox/Devices/Network/slirp/sbuf.c

    r23154 r23369  
    9292#ifndef VBOX_WITH_SLIRP_BSD_MBUF
    9393    if (m->m_len <= 0)
    94 #else 
     94#else
    9595    mlen = m_length(m, NULL);
    9696    if (mlen <= 0)
     
    127127        ret = 0;
    128128        goto no_sent;
    129     }   
     129    }
    130130    m_copydata(m, 0, mlen, buf);
    131131    if(!so->so_rcv.sb_cc)
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r23164 r23369  
    274274                return VERR_NO_MEMORY;
    275275            }
    276             LogRel(("NAT: adding %R[IP4] to DNS server list\n", 
     276            LogRel(("NAT: adding %R[IP4] to DNS server list\n",
    277277                    &((struct sockaddr_in *)saddr)->sin_addr));
    278             if ((((  struct sockaddr_in *)saddr)->sin_addr.s_addr & htonl(IN_CLASSA_NET)) == 
     278            if ((((  struct sockaddr_in *)saddr)->sin_addr.s_addr & htonl(IN_CLASSA_NET)) ==
    279279                     ntohl(INADDR_LOOPBACK & IN_CLASSA_NET)) {
    280280                da->de_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
     
    341341    char *pu8Buf = (char *)pvBuf;
    342342    *pcbRead = 0;
    343     while(   RT_SUCCESS(rc = RTFileRead(File, &bTest, 1, &cbRead)) 
     343    while(   RT_SUCCESS(rc = RTFileRead(File, &bTest, 1, &cbRead))
    344344          && (pu8Buf - (char *)pvBuf) < cbBufSize)
    345345    {
     
    549549    {
    550550        LogRel(("NAT: DHCP server initialization was failed\n"));
    551         return VINF_NAT_DNS; 
     551        return VINF_NAT_DNS;
    552552    }
    553553    debug_init();
     
    684684    if (pData->use_host_resolver)
    685685        dns_alias_unload(pData);
    686     while(!LIST_EMPTY(&instancehead)) 
     686    while(!LIST_EMPTY(&instancehead))
    687687    {
    688688        struct libalias *la = LIST_FIRST(&instancehead);
     
    690690        LibAliasUninit(la);
    691691    }
    692     while(!LIST_EMPTY(&pData->arp_cache)) 
     692    while(!LIST_EMPTY(&pData->arp_cache))
    693693    {
    694694        struct arp_cache_entry *ac = LIST_FIRST(&pData->arp_cache);
     
    14391439                &&  memcmp(eh->h_dest, broadcast_ethaddr, ETH_ALEN) == 0)
    14401440            {
    1441                 /* we've received anounce about address asignment 
     1441                /* we've received anounce about address asignment
    14421442                 * Let's do ARP cache update
    14431443                 */
    1444                 if (slirp_arp_cache_update(pData, *(uint32_t *)ah->ar_tip, &eh->h_dest[0]) == 0) 
     1444                if (slirp_arp_cache_update(pData, *(uint32_t *)ah->ar_tip, &eh->h_dest[0]) == 0)
    14451445                {
    14461446                    m_free(pData, mr);
     
    14481448                    break;
    14491449                }
    1450                 slirp_arp_cache_add(pData, *(uint32_t *)ah->ar_tip, &eh->h_dest[0]);     
     1450                slirp_arp_cache_add(pData, *(uint32_t *)ah->ar_tip, &eh->h_dest[0]);
    14511451                /* good opportunity to activate port-forwarding on address (self)asignment*/
    14521452                activate_port_forwarding(pData, eh);
     
    14631463            /*after/save restore we need up port forwarding again*/
    14641464            if (pData->port_forwarding_activated == 0)
    1465                 activate_port_forwarding(pData, eh); 
     1465                activate_port_forwarding(pData, eh);
    14661466            m_free(pData, m);
    14671467        }
     
    15041504    {
    15051505        size = MCLBYTES;
    1506     } 
     1506    }
    15071507    else if (pkt_len < MCLBYTES)
    15081508    {
     
    18981898        Log2(("NAT: DNS proxy switched %s\n", (fDNSProxy ? "on" : "off")));
    18991899        pData->use_dns_proxy = fDNSProxy;
    1900     } 
     1900    }
    19011901    else
    19021902    {
     
    20322032}
    20332033
    2034 /* updates the arp cache 
     2034/* updates the arp cache
    20352035 * @returns 0 - if has found and updated
    20362036 *          1 - if hasn't found.
     
    20722072        mtu = 1500;
    20732073    }
    2074     if_mtu = 
     2074    if_mtu =
    20752075    if_mru = mtu;
    20762076}
  • trunk/src/VBox/Devices/Network/slirp/slirp.h

    r23154 r23369  
    383383
    384384# define strncasecmp RTStrNICmp
    385 # define stderr NULL 
    386 # define stdout NULL 
     385# define stderr NULL
     386# define stdout NULL
    387387
    388388# ifdef DEBUG
     
    395395
    396396#ifdef VBOX_WITH_SLIRP_BSD_MBUF
    397 /* @todo might be useful to make it configurable, 
     397/* @todo might be useful to make it configurable,
    398398 * especially in terms of Intnet behind NAT
    399399 */
    400 # define maxusers 32 
     400# define maxusers 32
    401401# define max_protohdr 0
    402402/* @todo (r=vvl) for now ignore value,
     
    416416    void *newptr;
    417417};
    418  
     418
    419419#define SYSCTL_HANDLER_ARGS PNATState pData, void *oidp, struct dummy_req *req
    420420
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r23158 r23369  
    3838
    3939/*
    40  * ARP cache this is naive implementaion of ARP 
    41  * cache of mapping 4 byte IPv4 address to 6 byte 
     40 * ARP cache this is naive implementaion of ARP
     41 * cache of mapping 4 byte IPv4 address to 6 byte
    4242 * ethernet one.
    4343 */
     
    228228#ifdef VBOX_WITH_SLIRP_BSD_MBUF
    229229# ifdef zone_mbuf
    230 #  undef zone_mbuf 
     230#  undef zone_mbuf
    231231# endif
    232232    uma_zone_t zone_mbuf;
     
    261261    uma_zone_t zone_ext_refcnt;
    262262#endif
    263     int use_host_resolver; 
     263    int use_host_resolver;
    264264    /* from dnsproxy/dnsproxy.h*/
    265265    unsigned int authoritative_port;
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r23241 r23369  
    6262
    6363    so = (struct socket *)RTMemAllocZ(sizeof(struct socket));
    64     if(so)
     64    if (so)
    6565    {
    6666        so->so_state = SS_NOFDREF;
     
    9191        m_free(pData, so->so_m);
    9292#ifndef VBOX_WITH_SLIRP_MT
    93     if(so->so_next && so->so_prev)
     93    if (so->so_next && so->so_prev)
    9494    {
    9595        remque(pData, so);  /* crashes if so is not in a queue */
     
    167167            iov[1].iov_base = sb->sb_data;
    168168            iov[1].iov_len = sb->sb_rptr - sb->sb_data;
    169             if(iov[1].iov_len > len)
     169            if (iov[1].iov_len > len)
    170170                iov[1].iov_len = len;
    171171            total = iov[0].iov_len + iov[1].iov_len;
     
    224224        }
    225225#endif
    226         if (nn < 0 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK))
     226        if (   nn < 0
     227            && (   errno == EINTR
     228                || errno == EAGAIN
     229                || errno == EWOULDBLOCK))
    227230        {
    228231            SOCKET_UNLOCK(so);
     
    272275            nn += ret;
    273276        STAM_STATS(
    274             if(ret > 0)
     277            if (ret > 0)
    275278            {
    276279                STAM_COUNTER_INC(&pData->StatIORead_in_2);
     
    482485#endif
    483486    /* This should never happen, but people tell me it does *shrug* */
    484     if (nn < 0 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK))
     487    if (   nn < 0
     488        && (   errno == EAGAIN
     489            || errno == EINTR
     490            || errno == EWOULDBLOCK))
    485491    {
    486492        SOCKET_UNLOCK(so);
     
    569575        int size;
    570576#endif
    571             int rc = 0;
     577        int rc = 0;
    572578        static int signaled = 0;
    573579
     
    593599        {
    594600            rc = ioctlsocket(so->s, FIONREAD, &n);
    595             if (   (rc == -1)
    596                 && (errno == EAGAIN
     601            if (   rc == -1
     602                && (  errno == EAGAIN
    597603                   || errno == EWOULDBLOCK
    598604                   || errno == EINPROGRESS
     
    608614                m_free(pData, m);
    609615                return;
    610             } 
     616            }
    611617
    612618            if (rc > 0 && n > len)
     
    629635        */
    630636        rc = ioctlsocket(so->s, FIONREAD, &n);
    631        
    632637        if (rc == -1 && signaled == 0)
    633638        {
    634639            LogRel(("NAT: can't fetch amount of bytes on socket %R[natsock], so message will be truncated.\n", so));
    635640            signaled = 1;
    636         } 
     641        }
    637642
    638643        len = sizeof(struct udpiphdr) + ETH_HLEN;
    639644        len += n;
    640        
     645
    641646        if (len < MSIZE)
    642647        {
    643648            size = MCLBYTES;
    644         } 
     649        }
    645650        else if (len < MCLBYTES)
    646651        {
    647652            size = MCLBYTES;
    648653        }
    649         else if(len < MJUM9BYTES)
     654        else if (len < MJUM9BYTES)
    650655        {
    651656            size = MJUM9BYTES;
     
    660665        }
    661666        m = m_getjcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR, size);
    662         m->m_data += ETH_HLEN; 
     667        m->m_data += ETH_HLEN;
    663668        m->m_pkthdr.header = mtod(m, void *);
    664         m->m_data += sizeof(struct udpiphdr); 
     669        m->m_data += sizeof(struct udpiphdr);
    665670        ret = recvfrom(so->s, mtod(m, char *), n, 0,
    666671                            (struct sockaddr *)&addr, &addrlen);
     
    668673#endif
    669674        m->m_len = ret;
    670         if(ret < 0)
     675        if (ret < 0)
    671676        {
    672677            u_char code = ICMP_UNREACH_PORT;
     
    674679            if (errno == EHOSTUNREACH)
    675680                code = ICMP_UNREACH_HOST;
    676             else if(errno == ENETUNREACH)
     681            else if (errno == ENETUNREACH)
    677682                code = ICMP_UNREACH_NET;
    678683
     
    750755    DEBUG_ARG("so = %lx", (long)so);
    751756    DEBUG_ARG("m = %lx", (long)m);
    752    
     757
    753758    memset(&addr, 0, sizeof(struct sockaddr));
    754759#ifdef RT_OS_DARWIN
     
    12711276    int rc = 0;
    12721277    static int signalled = 0;
     1278
    12731279    rc = ioctlsocket(so->s, FIONREAD, &len);
    1274     if (   rc == -1 
    1275         && (errno == EAGAIN
    1276         || errno == EWOULDBLOCK
    1277         || errno == EINPROGRESS
    1278         || errno == ENOTCONN))
     1280    if (   rc == -1
     1281        && (   errno == EAGAIN
     1282            || errno == EWOULDBLOCK
     1283            || errno == EINPROGRESS
     1284            || errno == ENOTCONN))
    12791285    {
    12801286        return;
     
    12961302    {
    12971303        u_char code;
    1298         if (   len == -1 
     1304        if (   len == -1
    12991305            && (errno == EAGAIN
    13001306            || errno == EWOULDBLOCK
     
    13081314        if (errno == EHOSTUNREACH)
    13091315            code = ICMP_UNREACH_HOST;
    1310         else if(errno == ENETUNREACH)
     1316        else if (errno == ENETUNREACH)
    13111317            code = ICMP_UNREACH_NET;
    13121318
  • trunk/src/VBox/Devices/Network/slirp/socket.h

    r22013 r23369  
    7575#else /* !RT_OS_WINDOWS */
    7676    /*
    77      * FD_CLOSE event has been occurred on socket 
     77     * FD_CLOSE event has been occurred on socket
    7878     */
    79     int so_close; 
     79    int so_close;
    8080#endif /* RT_OS_WINDOWS */
    8181
     
    8585#ifdef VBOX_WITH_NAT_SERVICE
    8686    /* storage of source ether address */
    87     unsigned char so_ethaddr[6]; 
     87    unsigned char so_ethaddr[6];
    8888#endif
    8989    /* required for port-forwarding */
  • trunk/src/VBox/Devices/Network/slirp/tcp_output.c

    r23154 r23369  
    216216         * TCP_MAXWIN << tp->rcv_scale.
    217217         */
    218         long adv = min(win, 
    219                        (long)TCP_MAXWIN << tp->rcv_scale) - 
     218        long adv = min(win,
     219                       (long)TCP_MAXWIN << tp->rcv_scale) -
    220220                       (tp->rcv_adv - tp->rcv_nxt);
    221221
     
    378378        {
    379379            size = MCLBYTES;
    380         } 
     380        }
    381381        else if ((len + hdrlen + ETH_HLEN) < MCLBYTES)
    382382        {
     
    460460        {
    461461            size = MCLBYTES;
    462         } 
     462        }
    463463        else if ((hdrlen + ETH_HLEN) < MCLBYTES)
    464464        {
     
    574574     * the retransmit.  In persist state, just set snd_max.
    575575     */
    576     if (tp->t_force == 0 || tp->t_timer[TCPT_PERSIST] == 0) 
     576    if (tp->t_force == 0 || tp->t_timer[TCPT_PERSIST] == 0)
    577577    {
    578578        tcp_seq startseq = tp->snd_nxt;
  • trunk/src/VBox/Devices/Network/slirp/tcp_subr.c

    r23166 r23369  
    447447    socklen_t addrlen = sizeof(struct sockaddr_in);
    448448    struct tcpcb *tp;
    449     int s, opt; 
     449    int s, opt;
    450450    int status;
    451451    socklen_t optlen;
  • trunk/src/VBox/Devices/Network/slirp/tcp_timer.c

    r22249 r23369  
    8686        return;
    8787    QSOCKET_FOREACH(ip, ipnxt, tcp)
    88     /* { */ 
     88    /* { */
    8989        ipnxt = ip->so_next;
    9090        tp = sototcpcb(ip);
  • trunk/src/VBox/Devices/Network/slirp/tftp.c

    r22873 r23369  
    187187    nobytes = 2;
    188188
    189     m->m_len = sizeof(struct tftp_t) 
     189    m->m_len = sizeof(struct tftp_t)
    190190             - 514
    191              + 3 
     191             + 3
    192192             + strlen(msg)
    193              - sizeof(struct ip) 
     193             - sizeof(struct ip)
    194194             - sizeof(struct udphdr);
    195195
     
    242242    }
    243243
    244     m->m_len = sizeof(struct tftp_t) 
    245              - (512 - nobytes) 
    246              - sizeof(struct ip) 
     244    m->m_len = sizeof(struct tftp_t)
     245             - (512 - nobytes)
     246             - sizeof(struct ip)
    247247             - sizeof(struct udphdr);
    248248
  • trunk/src/VBox/Devices/Network/slirp/udp.c

    r23161 r23369  
    162162    }
    163163
    164     if (   pData->use_host_resolver 
     164    if (   pData->use_host_resolver
    165165        && ntohs(uh->uh_dport) == 53
    166166        && CTL_CHECK(ntohl(ip->ip_dst.s_addr), CTL_DNS))
     
    172172        dst.sin_port = uh->uh_sport;
    173173        /* udp_output2 will do opposite operations on mbuf*/
    174        
     174
    175175        m->m_data += sizeof(struct udpiphdr);
    176176        m->m_len -= sizeof(struct udpiphdr);
     
    260260    if (   pData->use_dns_proxy
    261261        && (ip->ip_dst.s_addr == htonl(ntohl(special_addr.s_addr) | CTL_DNS))
    262         && (ntohs(uh->uh_dport) == 53)) 
     262        && (ntohs(uh->uh_dport) == 53))
    263263    {
    264264        dnsproxy_query(pData, so, m, iphlen);
     
    287287        m->m_data -= iphlen;
    288288        *ip = save_ip;
    289         DEBUG_MISC((dfd,"NAT: UDP tx errno = %d-%s (on sent to %R[IP4])\n", errno, 
     289        DEBUG_MISC((dfd,"NAT: UDP tx errno = %d-%s (on sent to %R[IP4])\n", errno,
    290290                strerror(errno), &ip->ip_dst));
    291291        icmp_error(pData, m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno));
    292292        /* in case we receive ICMP on this socket we'll aware that ICMP has been already sent to host*/
    293         so->so_m = NULL; 
     293        so->so_m = NULL;
    294294    }
    295295
     
    306306
    307307bad:
    308     Log2(("NAT: UDP(id: %hd) datagram to %R[IP4] with size(%d) claimed as bad\n", 
     308    Log2(("NAT: UDP(id: %hd) datagram to %R[IP4] with size(%d) claimed as bad\n",
    309309        ip->ip_id, &ip->ip_dst, ip->ip_len));
    310 done: 
     310done:
    311311    /* some services like bootp(built-in), dns(buildt-in) and dhcp don't need sockets
    312      * and create new m'buffers to send them to guest, so we'll free their incomming 
    313      * buffers here. 
     312     * and create new m'buffers to send them to guest, so we'll free their incomming
     313     * buffers here.
    314314     */
    315315    m_freem(pData, m);
     
    343343    memset(ui->ui_x1, 0, 9);
    344344    ui->ui_pr = IPPROTO_UDP;
    345     ui->ui_len = htons(m->m_len - sizeof(struct ip)); 
     345    ui->ui_len = htons(m->m_len - sizeof(struct ip));
    346346    /* XXXXX Check for from-one-location sockets, or from-any-location sockets */
    347347    ui->ui_src = saddr->sin_addr;
Note: See TracChangeset for help on using the changeset viewer.

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