[Top][All Lists]

[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


                 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



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 */
        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;

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
   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:



Reply to this item at:


  Message sent via/by Savannah

reply via email to

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