VirtualBox

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


Ignore:
Timestamp:
Nov 15, 2008 8:12:41 PM (16 years ago)
Author:
vboxsync
Message:

initial preparation for injecting FreeBSD IP fragmentation code
(Windows compilation wasn't checked)

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

Legend:

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

    r1076 r14227  
    3838#define _IP_H_
    3939
     40#ifdef VBOX_WITH_BSD_REASS
     41# ifndef RT_OS_WINDOWS
     42# include <sys/queue.h>
     43# else
     44/* XXX: Windows has own queue types declared in winnt.h (should look at them once again) */
     45# endif
     46#endif
     47
    4048#ifdef WORDS_BIGENDIAN
    4149# ifndef NTOHL
     
    236244 */
    237245struct ipq_t {
     246#ifndef VBOX_WITH_BSD_REASS
    238247        ipqp_32 next,prev;      /* to other reass headers */
     248#else
     249        TAILQ_ENTRY(ipq_t) ipq_list;
     250#endif
    239251        u_int8_t        ipq_ttl;                /* time for reass q to live */
    240252        u_int8_t        ipq_p;                  /* protocol of this fragment */
    241253        u_int16_t       ipq_id;                 /* sequence id for reassembly */
    242         ipasfragp_32 ipq_next,ipq_prev;
    243                                         /* to ip headers of fragments */
     254#ifndef VBOX_WITH_BSD_REASS
     255        ipasfragp_32 ipq_next,ipq_prev;         /* to ip headers of fragments */
     256#else
     257        struct mbuf *ipq_frags;                 /* to ip headers of fragments */
     258#endif
     259
    244260        struct  in_addr ipq_src,ipq_dst;
    245261};
  • trunk/src/VBox/Devices/Network/slirp/ip_input.c

    r13984 r14227  
    5454ip_init(PNATState pData)
    5555{
     56#ifndef VBOX_WITH_BSD_REASS
    5657        ipq.next = ipq.prev = ptr_to_u32(pData, &ipq);
     58#else /* !VBOX_WITH_BSD_REASS */
     59#endif /* VBOX_WITH_BSD_REASS */
    5760        ip_currid = tt.tv_sec & 0xffff;
    5861        udp_init(pData);
     
    153156         * XXX This should fail, don't fragment yet
    154157         */
     158#ifndef VBOX_WITH_BSD_REASS
    155159        if (ip->ip_off &~ IP_DF) {
    156160          register struct ipq_t *fp;
     
    200204        } else
    201205                ip->ip_len -= hlen;
     206#else /* !VBOX_WITH_BSD_REASS */
     207#endif /* !VBOX_WITH_BSD_REASS */
    202208
    203209        /*
     
    225231}
    226232
     233#ifndef VBOX_WITH_BSD_REASS
    227234/*
    228235 * Take incoming datagram fragment and try to
     
    402409        (void) m_free(pData, dtom(pData, fp));
    403410}
     411#else /* !VBOX_WITH_BSD_REASS */
     412struct mbuf *
     413ip_reass(PNATState pData, struct mbuf* m) {
     414    return (NULL);
     415}
     416
     417void
     418ip_freef(PNATState pData, struct ipq_t *fp) {
     419}
     420#endif /* VBOX_WITH_BSD_REASS */
    404421
    405422/*
     
    443460        DEBUG_CALL("ip_slowtimo");
    444461
     462#ifndef VBOX_WITH_BSD_REASS
    445463        fp = u32_to_ptr(pData, ipq.next, struct ipq_t *);
    446464        if (fp == 0)
     
    455473                }
    456474        }
     475#else /* !VBOX_WITH_BSD_REASS */
     476    /* XXX: the fragment expiration is the same but requier
     477     * additional loop see (see ip_input.c in FreeBSD tree)
     478     */
     479#endif /* VBOX_WITH_BSD_REASS */
    457480}
    458481
  • trunk/src/VBox/Devices/Network/slirp/mbuf.h

    r13984 r14227  
    120120#define M_DOFREE                0x08    /* when m_free is called on the mbuf, free()
    121121                                         * it rather than putting it on the free list */
     122#ifdef VBOX_WITH_BSD_REASS
     123#define M_FRAG                  0x0800  /* packet is a fragment of a larger packet */`
     124#define M_FIRSTFRAG             0x1000  /* paket is first fragment */
     125#define M_LASTFRAG              0x2000  /* paket is last fragment */
     126#endif /* VBOX_WITH_BSD_REASS */
    122127
    123128/*
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r14210 r14227  
    399399                 * in the fragment queue, or there are TCP connections active
    400400                 */
     401#ifndef VBOX_WITH_BSD_REASS
    401402                do_slowtimo = ((tcb.so_next != &tcb) ||
    402403                               ((struct ipasfrag *)&ipq != u32_to_ptr(pData, ipq.next, struct ipasfrag *)));
     404#else /* !VBOX_WITH_BSD_REASS */
     405    /* XXX: triggering of fragment expiration should be the same but use
     406     * new macroses
     407     */
     408#endif /* VBOX_WITH_BSD_REASS */
    403409
    404410                STAM_REL_COUNTER_RESET(&pData->StatTCP);
     
    792798
    793799#if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    794                         rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents);   
     800                        rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents);
    795801                        if (rc == SOCKET_ERROR)
    796802                        {
  • trunk/src/VBox/Devices/Network/slirp/slirp.h

    r14201 r14227  
    333333void ip_init _P((PNATState));
    334334void ip_input _P((PNATState, struct mbuf *));
     335#ifndef VBOX_WITH_BSD_REASS
    335336struct ip * ip_reass _P((PNATState, register struct ipasfrag *, register struct ipq_t *));
     337#else /* !VBOX_WITH_BSD_REASS */
     338struct mbuf * ip_reass _P((PNATState, register struct mbuf *));
     339#endif  /* VBOX_WITH_BSD_REASS */
    336340void ip_freef _P((PNATState, struct ipq_t *));
    337341void ip_enq _P((PNATState, register struct ipasfrag *, register struct ipasfrag *));
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