lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #38210] ip reassembly while remove oldest datagram


From: daijun
Subject: [lwip-devel] [bug #38210] ip reassembly while remove oldest datagram
Date: Thu, 31 Jan 2013 00:50:58 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17

URL:
  <http://savannah.nongnu.org/bugs/?38210>

                 Summary: ip reassembly while remove oldest datagram
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: sydnash
            Submitted on: Thu 31 Jan 2013 12:50:57 AM GMT
                Category: IPv4
                Severity: 3 - Normal
              Item Group: Crash Error
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: 1.4.1

    _______________________________________________________

Details:

at ip_reass_remove_oldest_datagram function.
static int
ip_reass_remove_oldest_datagram(struct ip_hdr *fraghdr, int pbufs_needed)
{
  /* @todo Can't we simply remove the last datagram in the
   *       linked list behind reassdatagrams?
   */
  struct ip_reassdata *r, *oldest, *prev;
  int pbufs_freed = 0, pbufs_freed_current;
  int other_datagrams;

  /* Free datagrams until being allowed to enqueue 'pbufs_needed' pbufs,
   * but don't free the datagram that 'fraghdr' belongs to! */
  do {
    oldest = NULL;
    prev = NULL;
    other_datagrams = 0;
    r = reassdatagrams;
    while (r != NULL) {
      if (!IP_ADDRESSES_AND_ID_MATCH(&r->iphdr, fraghdr)) {
        /* Not the same datagram as fraghdr */
        other_datagrams++;
        if (oldest == NULL) {
          oldest = r;
        } else if (r->timer <= oldest->timer) {
          /* older than the previous oldest */
          oldest = r;
        }
      }
      if (r->next != NULL) {
        prev = r;
      }
      r = r->next;
    }
    if (oldest != NULL) {
      pbufs_freed_current = ip_reass_free_complete_datagram(oldest, prev);
      pbufs_freed += pbufs_freed_current;
    }
  } while ((pbufs_freed < pbufs_needed) && (other_datagrams > 1));
  return pbufs_freed;
}
#endif /* IP_REASS_FREE_OLDEST */

when find the oldest datagram and it's previous datagram, if oldest is the
first, and then it's not change, but  pref is still change ever loop, so, when
call ip_reass_free_complete_datagram function, oldest will not be prev's
next.
   i sugest to add a oldest_prev pointer, it change while oldest is change.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 31 Jan 2013 12:50:57 AM GMT  Name: ip_frag.c  Size: 29kB   By:
sydnash

<http://savannah.nongnu.org/bugs/download.php?file_id=27354>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?38210>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]