Diff for /embedaddon/quagga/ospf6d/ospf6_message.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2013/07/21 23:54:39 version 1.1.1.4, 2016/11/02 10:09:12
Line 517  ospf6_dbdesc_recv_master (struct ospf6_header *oh, Line 517  ospf6_dbdesc_recv_master (struct ospf6_header *oh,
         {          {
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))            if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
             zlog_debug ("Add request (No database copy)");              zlog_debug ("Add request (No database copy)");
          ospf6_lsdb_add (his, on->request_list);          ospf6_lsdb_add (ospf6_lsa_copy(his), on->request_list);
         }          }
       else if (ospf6_lsa_compare (his, mine) < 0)        else if (ospf6_lsa_compare (his, mine) < 0)
         {          {
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))            if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
             zlog_debug ("Add request (Received MoreRecent)");              zlog_debug ("Add request (Received MoreRecent)");
          ospf6_lsdb_add (his, on->request_list);          ospf6_lsdb_add (ospf6_lsa_copy(his), on->request_list);
         }          }
       else        else
         {          {
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))            if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
             zlog_debug ("Discard (Existing MoreRecent)");              zlog_debug ("Discard (Existing MoreRecent)");
           ospf6_lsa_delete (his);  
         }          }
         ospf6_lsa_delete (his);
     }      }
   
   assert (p == OSPF6_MESSAGE_END (oh));    assert (p == OSPF6_MESSAGE_END (oh));
Line 539  ospf6_dbdesc_recv_master (struct ospf6_header *oh, Line 539  ospf6_dbdesc_recv_master (struct ospf6_header *oh,
   on->dbdesc_seqnum ++;    on->dbdesc_seqnum ++;
   
   /* schedule send lsreq */    /* schedule send lsreq */
  if (on->thread_send_lsreq == NULL)  if (on->request_list->count && (on->thread_send_lsreq == NULL))
     on->thread_send_lsreq =      on->thread_send_lsreq =
       thread_add_event (master, ospf6_lsreq_send, on, 0);        thread_add_event (master, ospf6_lsreq_send, on, 0);
   
Line 735  ospf6_dbdesc_recv_slave (struct ospf6_header *oh, Line 735  ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
         {          {
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))            if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
             zlog_debug ("Add request-list: %s", his->name);              zlog_debug ("Add request-list: %s", his->name);
          ospf6_lsdb_add (his, on->request_list);          ospf6_lsdb_add (ospf6_lsa_copy(his), on->request_list);
         }          }
      else      ospf6_lsa_delete (his);
        ospf6_lsa_delete (his); 
     }      }
   
   assert (p == OSPF6_MESSAGE_END (oh));    assert (p == OSPF6_MESSAGE_END (oh));
Line 747  ospf6_dbdesc_recv_slave (struct ospf6_header *oh, Line 746  ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
   on->dbdesc_seqnum = ntohl (dbdesc->seqnum);    on->dbdesc_seqnum = ntohl (dbdesc->seqnum);
   
   /* schedule send lsreq */    /* schedule send lsreq */
  if (on->thread_send_lsreq == NULL)  if ((on->thread_send_lsreq == NULL) &&
       (on->request_list->count))
     on->thread_send_lsreq =      on->thread_send_lsreq =
       thread_add_event (master, ospf6_lsreq_send, on, 0);        thread_add_event (master, ospf6_lsreq_send, on, 0);
   
Line 1282  ospf6_rxpacket_examin (struct ospf6_interface *oi, str Line 1282  ospf6_rxpacket_examin (struct ospf6_interface *oi, str
   {    {
     if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))      if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
     {      {
      if (oh->area_id == BACKBONE_AREA_ID)      if (oh->area_id == OSPF_AREA_BACKBONE)
         zlog_debug ("%s: Message may be via Virtual Link: not supported", __func__);          zlog_debug ("%s: Message may be via Virtual Link: not supported", __func__);
       else        else
         zlog_debug          zlog_debug
Line 1351  ospf6_lsupdate_recv (struct in6_addr *src, struct in6_ Line 1351  ospf6_lsupdate_recv (struct in6_addr *src, struct in6_
   
   assert (p == OSPF6_MESSAGE_END (oh));    assert (p == OSPF6_MESSAGE_END (oh));
   
   /* RFC2328 Section 10.9: When the neighbor responds to these requests  
      with the proper Link State Update packet(s), the Link state request  
      list is truncated and a new Link State Request packet is sent. */  
   /* send new Link State Request packet if this LS Update packet  
      can be recognized as a response to our previous LS Request */  
   if (! IN6_IS_ADDR_MULTICAST (dst) &&  
       (on->state == OSPF6_NEIGHBOR_EXCHANGE ||  
        on->state == OSPF6_NEIGHBOR_LOADING))  
     {  
       THREAD_OFF (on->thread_send_lsreq);  
       on->thread_send_lsreq =  
         thread_add_event (master, ospf6_lsreq_send, on, 0);  
     }  
 }  }
   
 static void  static void
Line 1528  ospf6_receive (struct thread *thread) Line 1515  ospf6_receive (struct thread *thread)
   unsigned int len;    unsigned int len;
   char srcname[64], dstname[64];    char srcname[64], dstname[64];
   struct in6_addr src, dst;    struct in6_addr src, dst;
  unsigned int ifindex;  ifindex_t ifindex;
   struct iovec iovector[2];    struct iovec iovector[2];
   struct ospf6_interface *oi;    struct ospf6_interface *oi;
   struct ospf6_header *oh;    struct ospf6_header *oh;
Line 1556  ospf6_receive (struct thread *thread) Line 1543  ospf6_receive (struct thread *thread)
     }      }
   
   oi = ospf6_interface_lookup_by_ifindex (ifindex);    oi = ospf6_interface_lookup_by_ifindex (ifindex);
  if (oi == NULL || oi->area == NULL)  if (oi == NULL || oi->area == NULL || CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE))
     {      {
       zlog_debug ("Message received on disabled interface");        zlog_debug ("Message received on disabled interface");
       return 0;        return 0;
Line 1643  static void Line 1630  static void
 ospf6_send (struct in6_addr *src, struct in6_addr *dst,  ospf6_send (struct in6_addr *src, struct in6_addr *dst,
             struct ospf6_interface *oi, struct ospf6_header *oh)              struct ospf6_interface *oi, struct ospf6_header *oh)
 {  {
  int len;  unsigned int len;
   char srcname[64], dstname[64];    char srcname[64], dstname[64];
   struct iovec iovector[2];    struct iovec iovector[2];
   
Line 1734  ospf6_hello_send (struct thread *thread) Line 1721  ospf6_hello_send (struct thread *thread)
       return 0;        return 0;
     }      }
   
     if (iobuflen == 0)
       {
         zlog_debug ("Unable to send Hello on interface %s iobuflen is 0",
                    oi->interface->name);
         return 0;
       }
   
   /* set next thread */    /* set next thread */
   oi->thread_send_hello = thread_add_timer (master, ospf6_hello_send,    oi->thread_send_hello = thread_add_timer (master, ospf6_hello_send,
                                             oi, oi->hello_interval);                                              oi, oi->hello_interval);
Line 1785  ospf6_dbdesc_send (struct thread *thread) Line 1779  ospf6_dbdesc_send (struct thread *thread)
   struct ospf6_dbdesc *dbdesc;    struct ospf6_dbdesc *dbdesc;
   u_char *p;    u_char *p;
   struct ospf6_lsa *lsa;    struct ospf6_lsa *lsa;
     struct in6_addr *dst;
   
   on = (struct ospf6_neighbor *) THREAD_ARG (thread);    on = (struct ospf6_neighbor *) THREAD_ARG (thread);
   on->thread_send_dbdesc = (struct thread *) NULL;    on->thread_send_dbdesc = (struct thread *) NULL;
Line 1809  ospf6_dbdesc_send (struct thread *thread) Line 1804  ospf6_dbdesc_send (struct thread *thread)
                                    sizeof (struct ospf6_header));                                     sizeof (struct ospf6_header));
   
   /* if this is initial one, initialize sequence number for DbDesc */    /* if this is initial one, initialize sequence number for DbDesc */
  if (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT))  if (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT) &&
       (on->dbdesc_seqnum == 0))
     {      {
       struct timeval tv;        struct timeval tv;
       if (quagga_gettime (QUAGGA_CLK_MONOTONIC, &tv) < 0)        if (quagga_gettime (QUAGGA_CLK_MONOTONIC, &tv) < 0)
Line 1837  ospf6_dbdesc_send (struct thread *thread) Line 1833  ospf6_dbdesc_send (struct thread *thread)
           if (p - sendbuf + sizeof (struct ospf6_lsa_header) >            if (p - sendbuf + sizeof (struct ospf6_lsa_header) >
               ospf6_packet_max(on->ospf6_if))                ospf6_packet_max(on->ospf6_if))
             {              {
              ospf6_lsa_unlock (lsa);              ospf6_lsdb_lsa_unlock (lsa);
               break;                break;
             }              }
           memcpy (p, lsa->header, sizeof (struct ospf6_lsa_header));            memcpy (p, lsa->header, sizeof (struct ospf6_lsa_header));
Line 1848  ospf6_dbdesc_send (struct thread *thread) Line 1844  ospf6_dbdesc_send (struct thread *thread)
   oh->type = OSPF6_MESSAGE_TYPE_DBDESC;    oh->type = OSPF6_MESSAGE_TYPE_DBDESC;
   oh->length = htons (p - sendbuf);    oh->length = htons (p - sendbuf);
   
  ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr,
              on->ospf6_if, oh);  if (on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT)
     dst = &allspfrouters6;
   else
     dst = &on->linklocal_addr;
 
   ospf6_send (on->ospf6_if->linklocal_addr, dst, on->ospf6_if, oh);
 
   return 0;    return 0;
 }  }
   
Line 1871  ospf6_dbdesc_send_newone (struct thread *thread) Line 1873  ospf6_dbdesc_send_newone (struct thread *thread)
     {      {
       if (size + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(on->ospf6_if))        if (size + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(on->ospf6_if))
         {          {
          ospf6_lsa_unlock (lsa);          ospf6_lsdb_lsa_unlock (lsa);
           break;            break;
         }          }
   
Line 1900  ospf6_lsreq_send (struct thread *thread) Line 1902  ospf6_lsreq_send (struct thread *thread)
   struct ospf6_header *oh;    struct ospf6_header *oh;
   struct ospf6_lsreq_entry *e;    struct ospf6_lsreq_entry *e;
   u_char *p;    u_char *p;
  struct ospf6_lsa *lsa;  struct ospf6_lsa *lsa, *last_req;
   
   on = (struct ospf6_neighbor *) THREAD_ARG (thread);    on = (struct ospf6_neighbor *) THREAD_ARG (thread);
   on->thread_send_lsreq = (struct thread *) NULL;    on->thread_send_lsreq = (struct thread *) NULL;
Line 1922  ospf6_lsreq_send (struct thread *thread) Line 1924  ospf6_lsreq_send (struct thread *thread)
       return 0;        return 0;
     }      }
   
   /* set next thread */  
   on->thread_send_lsreq =  
     thread_add_timer (master, ospf6_lsreq_send, on,  
                       on->ospf6_if->rxmt_interval);  
   
   memset (sendbuf, 0, iobuflen);    memset (sendbuf, 0, iobuflen);
   oh = (struct ospf6_header *) sendbuf;    oh = (struct ospf6_header *) sendbuf;
     last_req = NULL;
   
   /* set Request entries in lsreq */    /* set Request entries in lsreq */
   p = (u_char *)((caddr_t) oh + sizeof (struct ospf6_header));    p = (u_char *)((caddr_t) oh + sizeof (struct ospf6_header));
Line 1938  ospf6_lsreq_send (struct thread *thread) Line 1936  ospf6_lsreq_send (struct thread *thread)
       /* MTU check */        /* MTU check */
       if (p - sendbuf + sizeof (struct ospf6_lsreq_entry) > ospf6_packet_max(on->ospf6_if))        if (p - sendbuf + sizeof (struct ospf6_lsreq_entry) > ospf6_packet_max(on->ospf6_if))
         {          {
          ospf6_lsa_unlock (lsa);          ospf6_lsdb_lsa_unlock (lsa);
           break;            break;
         }          }
   
Line 1947  ospf6_lsreq_send (struct thread *thread) Line 1945  ospf6_lsreq_send (struct thread *thread)
       e->id = lsa->header->id;        e->id = lsa->header->id;
       e->adv_router = lsa->header->adv_router;        e->adv_router = lsa->header->adv_router;
       p += sizeof (struct ospf6_lsreq_entry);        p += sizeof (struct ospf6_lsreq_entry);
         last_req = lsa;
     }      }
   
     if (last_req != NULL)
       {
         if (on->last_ls_req != NULL)
           {
             ospf6_lsa_unlock (on->last_ls_req);
           }
         ospf6_lsa_lock (last_req);
         on->last_ls_req = last_req;
       }
   
   oh->type = OSPF6_MESSAGE_TYPE_LSREQ;    oh->type = OSPF6_MESSAGE_TYPE_LSREQ;
   oh->length = htons (p - sendbuf);    oh->length = htons (p - sendbuf);
   
  ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr,  if (on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT)
     ospf6_send (on->ospf6_if->linklocal_addr, &allspfrouters6,
               on->ospf6_if, oh);                on->ospf6_if, oh);
     else
       ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr,
                   on->ospf6_if, oh);
   
     /* set next thread */
     if (on->request_list->count != 0)
       {
         on->thread_send_lsreq =
           thread_add_timer (master, ospf6_lsreq_send, on,
                             on->ospf6_if->rxmt_interval);
       }
   
   return 0;    return 0;
 }  }
   
Line 1964  ospf6_lsupdate_send_neighbor (struct thread *thread) Line 1986  ospf6_lsupdate_send_neighbor (struct thread *thread)
   struct ospf6_header *oh;    struct ospf6_header *oh;
   struct ospf6_lsupdate *lsupdate;    struct ospf6_lsupdate *lsupdate;
   u_char *p;    u_char *p;
  int num;  int lsa_cnt;
   struct ospf6_lsa *lsa;    struct ospf6_lsa *lsa;
   
   on = (struct ospf6_neighbor *) THREAD_ARG (thread);    on = (struct ospf6_neighbor *) THREAD_ARG (thread);
Line 1981  ospf6_lsupdate_send_neighbor (struct thread *thread) Line 2003  ospf6_lsupdate_send_neighbor (struct thread *thread)
       return 0;        return 0;
     }      }
   
   /* if we have nothing to send, return */  
   if (on->lsupdate_list->count == 0 &&  
       on->retrans_list->count == 0)  
     {  
       if (IS_OSPF6_DEBUG_MESSAGE (OSPF6_MESSAGE_TYPE_LSUPDATE, SEND))  
         zlog_debug ("Quit to send (nothing to send)");  
       return 0;  
     }  
   
   memset (sendbuf, 0, iobuflen);    memset (sendbuf, 0, iobuflen);
   oh = (struct ospf6_header *) sendbuf;    oh = (struct ospf6_header *) sendbuf;
   lsupdate = (struct ospf6_lsupdate *)    lsupdate = (struct ospf6_lsupdate *)
     ((caddr_t) oh + sizeof (struct ospf6_header));      ((caddr_t) oh + sizeof (struct ospf6_header));
   
   p = (u_char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate));    p = (u_char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate));
  num = 0;  lsa_cnt = 0;
   
   /* lsupdate_list lists those LSA which doesn't need to be    /* lsupdate_list lists those LSA which doesn't need to be
      retransmitted. remove those from the list */       retransmitted. remove those from the list */
Line 2005  ospf6_lsupdate_send_neighbor (struct thread *thread) Line 2018  ospf6_lsupdate_send_neighbor (struct thread *thread)
     {      {
       /* MTU check */        /* MTU check */
       if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header))        if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header))
          > ospf6_packet_max(on->ospf6_if))           > ospf6_packet_max(on->ospf6_if))
        {        {
          ospf6_lsa_unlock (lsa);          ospf6_lsdb_lsa_unlock (lsa);
          break;          break;
        }        }
   
       ospf6_lsa_age_update_to_send (lsa, on->ospf6_if->transdelay);        ospf6_lsa_age_update_to_send (lsa, on->ospf6_if->transdelay);
       memcpy (p, lsa->header, OSPF6_LSA_SIZE (lsa->header));        memcpy (p, lsa->header, OSPF6_LSA_SIZE (lsa->header));
       p += OSPF6_LSA_SIZE (lsa->header);        p += OSPF6_LSA_SIZE (lsa->header);
      num++;      lsa_cnt++;
   
       assert (lsa->lock == 2);        assert (lsa->lock == 2);
       ospf6_lsdb_remove (lsa, on->lsupdate_list);        ospf6_lsdb_remove (lsa, on->lsupdate_list);
     }      }
   
     if (lsa_cnt)
       {
         oh->type = OSPF6_MESSAGE_TYPE_LSUPDATE;
         oh->length = htons (p - sendbuf);
         lsupdate->lsa_number = htonl (lsa_cnt);
   
         if ((on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT) ||
             (on->ospf6_if->state == OSPF6_INTERFACE_DR) ||
             (on->ospf6_if->state == OSPF6_INTERFACE_BDR))
           ospf6_send (on->ospf6_if->linklocal_addr, &allspfrouters6,
                       on->ospf6_if, oh);
         else
           ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr,
                       on->ospf6_if, oh);
       }
   
     /* The addresses used for retransmissions are different from those sent the
        first time and so we need to separate them here.
     */
     memset (sendbuf, 0, iobuflen);
     oh = (struct ospf6_header *) sendbuf;
     lsupdate = (struct ospf6_lsupdate *)
       ((caddr_t) oh + sizeof (struct ospf6_header));
     p = (u_char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate));
     lsa_cnt = 0;
   
   for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;    for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
        lsa = ospf6_lsdb_next (lsa))         lsa = ospf6_lsdb_next (lsa))
     {      {
       /* MTU check */        /* MTU check */
       if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header))        if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header))
          > ospf6_packet_max(on->ospf6_if))           > ospf6_packet_max(on->ospf6_if))
        {        {
          ospf6_lsa_unlock (lsa);          ospf6_lsdb_lsa_unlock (lsa);
          break;          break;
        }        }
   
       ospf6_lsa_age_update_to_send (lsa, on->ospf6_if->transdelay);        ospf6_lsa_age_update_to_send (lsa, on->ospf6_if->transdelay);
       memcpy (p, lsa->header, OSPF6_LSA_SIZE (lsa->header));        memcpy (p, lsa->header, OSPF6_LSA_SIZE (lsa->header));
       p += OSPF6_LSA_SIZE (lsa->header);        p += OSPF6_LSA_SIZE (lsa->header);
      num++;      lsa_cnt++;
     }      }
   
  lsupdate->lsa_number = htonl (num);  if (lsa_cnt)
 
  oh->type = OSPF6_MESSAGE_TYPE_LSUPDATE; 
  oh->length = htons (p - sendbuf); 
 
  ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr, 
              on->ospf6_if, oh); 
 
  if (on->lsupdate_list->count != 0 || 
      on->retrans_list->count != 0) 
     {      {
      if (on->lsupdate_list->count != 0)      oh->type = OSPF6_MESSAGE_TYPE_LSUPDATE;
        on->thread_send_lsupdate =      oh->length = htons (p - sendbuf);
          thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0);      lsupdate->lsa_number = htonl (lsa_cnt);
 
       if (on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT)
         ospf6_send (on->ospf6_if->linklocal_addr, &allspfrouters6,
                     on->ospf6_if, oh);
       else        else
        on->thread_send_lsupdate =        ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr,
          thread_add_timer (master, ospf6_lsupdate_send_neighbor, on,                    on->ospf6_if, oh);
                            on->ospf6_if->rxmt_interval); 
     }      }
   
     if (on->lsupdate_list->count != 0)
       on->thread_send_lsupdate =
         thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0);
     else if (on->retrans_list->count != 0)
       on->thread_send_lsupdate =
         thread_add_timer (master, ospf6_lsupdate_send_neighbor, on,
                           on->ospf6_if->rxmt_interval);
   return 0;    return 0;
 }  }
   
Line 2067  ospf6_lsupdate_send_interface (struct thread *thread) Line 2107  ospf6_lsupdate_send_interface (struct thread *thread)
   struct ospf6_header *oh;    struct ospf6_header *oh;
   struct ospf6_lsupdate *lsupdate;    struct ospf6_lsupdate *lsupdate;
   u_char *p;    u_char *p;
  int num;  int lsa_cnt;
   struct ospf6_lsa *lsa;    struct ospf6_lsa *lsa;
   
   oi = (struct ospf6_interface *) THREAD_ARG (thread);    oi = (struct ospf6_interface *) THREAD_ARG (thread);
Line 2088  ospf6_lsupdate_send_interface (struct thread *thread) Line 2128  ospf6_lsupdate_send_interface (struct thread *thread)
   memset (sendbuf, 0, iobuflen);    memset (sendbuf, 0, iobuflen);
   oh = (struct ospf6_header *) sendbuf;    oh = (struct ospf6_header *) sendbuf;
   lsupdate = (struct ospf6_lsupdate *)((caddr_t) oh +    lsupdate = (struct ospf6_lsupdate *)((caddr_t) oh +
                                       sizeof (struct ospf6_header));                                       sizeof (struct ospf6_header));
   
   p = (u_char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate));    p = (u_char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate));
  num = 0;  lsa_cnt = 0;
   
   for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;    for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa;
        lsa = ospf6_lsdb_next (lsa))         lsa = ospf6_lsdb_next (lsa))
     {      {
       /* MTU check */        /* MTU check */
       if ( (p - sendbuf + ((unsigned int)OSPF6_LSA_SIZE (lsa->header)))        if ( (p - sendbuf + ((unsigned int)OSPF6_LSA_SIZE (lsa->header)))
          > ospf6_packet_max(oi))           > ospf6_packet_max(oi))
        {        {
          ospf6_lsa_unlock (lsa);          ospf6_lsdb_lsa_unlock (lsa);
          break;          break;
        }        }
   
       ospf6_lsa_age_update_to_send (lsa, oi->transdelay);        ospf6_lsa_age_update_to_send (lsa, oi->transdelay);
       memcpy (p, lsa->header, OSPF6_LSA_SIZE (lsa->header));        memcpy (p, lsa->header, OSPF6_LSA_SIZE (lsa->header));
       p += OSPF6_LSA_SIZE (lsa->header);        p += OSPF6_LSA_SIZE (lsa->header);
      num++;      lsa_cnt++;
   
       assert (lsa->lock == 2);        assert (lsa->lock == 2);
       ospf6_lsdb_remove (lsa, oi->lsupdate_list);        ospf6_lsdb_remove (lsa, oi->lsupdate_list);
     }      }
   
  lsupdate->lsa_number = htonl (num);  if (lsa_cnt)
     {
       lsupdate->lsa_number = htonl (lsa_cnt);
   
  oh->type = OSPF6_MESSAGE_TYPE_LSUPDATE;      oh->type = OSPF6_MESSAGE_TYPE_LSUPDATE;
  oh->length = htons (p - sendbuf);      oh->length = htons (p - sendbuf);
   
  if (oi->state == OSPF6_INTERFACE_DR ||      if ((oi->state == OSPF6_INTERFACE_POINTTOPOINT) ||
      oi->state == OSPF6_INTERFACE_BDR)          (oi->state == OSPF6_INTERFACE_DR) ||
    ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh);          (oi->state == OSPF6_INTERFACE_BDR))
  else        ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh);
    ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh);      else
         ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh);
   
       }
   
   if (oi->lsupdate_list->count > 0)    if (oi->lsupdate_list->count > 0)
     {      {
       oi->thread_send_lsupdate =        oi->thread_send_lsupdate =
Line 2140  ospf6_lsack_send_neighbor (struct thread *thread) Line 2185  ospf6_lsack_send_neighbor (struct thread *thread)
   struct ospf6_header *oh;    struct ospf6_header *oh;
   u_char *p;    u_char *p;
   struct ospf6_lsa *lsa;    struct ospf6_lsa *lsa;
     int lsa_cnt = 0;
   
   on = (struct ospf6_neighbor *) THREAD_ARG (thread);    on = (struct ospf6_neighbor *) THREAD_ARG (thread);
   on->thread_send_lsack = (struct thread *) NULL;    on->thread_send_lsack = (struct thread *) NULL;
Line 2166  ospf6_lsack_send_neighbor (struct thread *thread) Line 2212  ospf6_lsack_send_neighbor (struct thread *thread)
     {      {
       /* MTU check */        /* MTU check */
       if (p - sendbuf + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(on->ospf6_if))        if (p - sendbuf + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(on->ospf6_if))
        {        {
          /* if we run out of packet size/space here,          /* if we run out of packet size/space here,
             better to try again soon. */             better to try again soon. */
          THREAD_OFF (on->thread_send_lsack);          THREAD_OFF (on->thread_send_lsack);
          on->thread_send_lsack =          on->thread_send_lsack =
            thread_add_event (master, ospf6_lsack_send_neighbor, on, 0);            thread_add_event (master, ospf6_lsack_send_neighbor, on, 0);
   
          ospf6_lsa_unlock (lsa);          ospf6_lsdb_lsa_unlock (lsa);
          break;          break;
        }        }
   
       ospf6_lsa_age_update_to_send (lsa, on->ospf6_if->transdelay);        ospf6_lsa_age_update_to_send (lsa, on->ospf6_if->transdelay);
       memcpy (p, lsa->header, sizeof (struct ospf6_lsa_header));        memcpy (p, lsa->header, sizeof (struct ospf6_lsa_header));
Line 2183  ospf6_lsack_send_neighbor (struct thread *thread) Line 2229  ospf6_lsack_send_neighbor (struct thread *thread)
   
       assert (lsa->lock == 2);        assert (lsa->lock == 2);
       ospf6_lsdb_remove (lsa, on->lsack_list);        ospf6_lsdb_remove (lsa, on->lsack_list);
         lsa_cnt++;
     }      }
   
  oh->type = OSPF6_MESSAGE_TYPE_LSACK;  if (lsa_cnt)
  oh->length = htons (p - sendbuf);    {
       oh->type = OSPF6_MESSAGE_TYPE_LSACK;
       oh->length = htons (p - sendbuf);
   
  ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr,      ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr,
              on->ospf6_if, oh);                  on->ospf6_if, oh);
     }
 
   if (on->thread_send_lsack == NULL && on->lsack_list->count > 0)
     {
       on->thread_send_lsack =
         thread_add_event (master, ospf6_lsack_send_neighbor, on, 0);
     }
 
   return 0;    return 0;
 }  }
   
Line 2200  ospf6_lsack_send_interface (struct thread *thread) Line 2257  ospf6_lsack_send_interface (struct thread *thread)
   struct ospf6_header *oh;    struct ospf6_header *oh;
   u_char *p;    u_char *p;
   struct ospf6_lsa *lsa;    struct ospf6_lsa *lsa;
     int lsa_cnt = 0;
   
   oi = (struct ospf6_interface *) THREAD_ARG (thread);    oi = (struct ospf6_interface *) THREAD_ARG (thread);
   oi->thread_send_lsack = (struct thread *) NULL;    oi->thread_send_lsack = (struct thread *) NULL;
Line 2226  ospf6_lsack_send_interface (struct thread *thread) Line 2284  ospf6_lsack_send_interface (struct thread *thread)
     {      {
       /* MTU check */        /* MTU check */
       if (p - sendbuf + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(oi))        if (p - sendbuf + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(oi))
        {        {
          /* if we run out of packet size/space here,          /* if we run out of packet size/space here,
             better to try again soon. */             better to try again soon. */
          THREAD_OFF (oi->thread_send_lsack);          THREAD_OFF (oi->thread_send_lsack);
          oi->thread_send_lsack =          oi->thread_send_lsack =
            thread_add_event (master, ospf6_lsack_send_interface, oi, 0);            thread_add_event (master, ospf6_lsack_send_interface, oi, 0);
   
          ospf6_lsa_unlock (lsa);          ospf6_lsdb_lsa_unlock (lsa);
          break;          break;
        }        }
   
       ospf6_lsa_age_update_to_send (lsa, oi->transdelay);        ospf6_lsa_age_update_to_send (lsa, oi->transdelay);
       memcpy (p, lsa->header, sizeof (struct ospf6_lsa_header));        memcpy (p, lsa->header, sizeof (struct ospf6_lsa_header));
Line 2243  ospf6_lsack_send_interface (struct thread *thread) Line 2301  ospf6_lsack_send_interface (struct thread *thread)
   
       assert (lsa->lock == 2);        assert (lsa->lock == 2);
       ospf6_lsdb_remove (lsa, oi->lsack_list);        ospf6_lsdb_remove (lsa, oi->lsack_list);
         lsa_cnt++;
     }      }
   
  oh->type = OSPF6_MESSAGE_TYPE_LSACK;  if (lsa_cnt)
  oh->length = htons (p - sendbuf);    {
       oh->type = OSPF6_MESSAGE_TYPE_LSACK;
       oh->length = htons (p - sendbuf);
   
  if (oi->state == OSPF6_INTERFACE_DR ||      if ((oi->state == OSPF6_INTERFACE_POINTTOPOINT) ||
      oi->state == OSPF6_INTERFACE_BDR)          (oi->state == OSPF6_INTERFACE_DR) ||
    ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh);          (oi->state == OSPF6_INTERFACE_BDR))
  else        ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh);
    ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh);      else
         ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh);
     }
   
   if (oi->thread_send_lsack == NULL && oi->lsack_list->count > 0)    if (oi->thread_send_lsack == NULL && oi->lsack_list->count > 0)
     {      {
Line 2263  ospf6_lsack_send_interface (struct thread *thread) Line 2326  ospf6_lsack_send_interface (struct thread *thread)
   return 0;    return 0;
 }  }
   
 /* Commands */  /* Commands */
 DEFUN (debug_ospf6_message,  DEFUN (debug_ospf6_message,
        debug_ospf6_message_cmd,         debug_ospf6_message_cmd,
Line 2337  ALIAS (debug_ospf6_message, Line 2400  ALIAS (debug_ospf6_message,
        "Debug only receiving message\n"         "Debug only receiving message\n"
        )         )
   
 DEFUN (no_debug_ospf6_message,  DEFUN (no_debug_ospf6_message,
        no_debug_ospf6_message_cmd,         no_debug_ospf6_message_cmd,
        "no debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all)",         "no debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all)",

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>