Diff for /embedaddon/quagga/bgpd/bgp_ecommunity.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2013/07/21 23:54:37 version 1.1.1.4, 2016/11/02 10:09:10
Line 24  Software Foundation, Inc., 59 Temple Place - Suite 330 Line 24  Software Foundation, Inc., 59 Temple Place - Suite 330
 #include "memory.h"  #include "memory.h"
 #include "prefix.h"  #include "prefix.h"
 #include "command.h"  #include "command.h"
   #include "filter.h"
   
 #include "bgpd/bgpd.h"  #include "bgpd/bgpd.h"
 #include "bgpd/bgp_ecommunity.h"  #include "bgpd/bgp_ecommunity.h"
Line 31  Software Foundation, Inc., 59 Temple Place - Suite 330 Line 32  Software Foundation, Inc., 59 Temple Place - Suite 330
   
 /* Hash of community attribute. */  /* Hash of community attribute. */
 static struct hash *ecomhash;  static struct hash *ecomhash;
 /* Allocate a new ecommunities.  */  /* Allocate a new ecommunities.  */
 static struct ecommunity *  static struct ecommunity *
 ecommunity_new (void)  ecommunity_new (void)
Line 277  ecommunity_finish (void) Line 278  ecommunity_finish (void)
   hash_free (ecomhash);    hash_free (ecomhash);
   ecomhash = NULL;    ecomhash = NULL;
 }  }
 /* Extended Communities token enum. */  /* Extended Communities token enum. */
 enum ecommunity_token  enum ecommunity_token
 {  {
     ecommunity_token_unknown = 0,
   ecommunity_token_rt,    ecommunity_token_rt,
   ecommunity_token_soo,    ecommunity_token_soo,
   ecommunity_token_val,    ecommunity_token_val,
   ecommunity_token_unknown  
 };  };
   
 /* Get next Extended Communities token from the string. */  /* Get next Extended Communities token from the string. */
Line 511  struct ecommunity * Line 512  struct ecommunity *
 ecommunity_str2com (const char *str, int type, int keyword_included)  ecommunity_str2com (const char *str, int type, int keyword_included)
 {  {
   struct ecommunity *ecom = NULL;    struct ecommunity *ecom = NULL;
  enum ecommunity_token token;  enum ecommunity_token token = ecommunity_token_unknown;
   struct ecommunity_val eval;    struct ecommunity_val eval;
   int keyword = 0;    int keyword = 0;
   
Line 642  ecommunity_ecom2str (struct ecommunity *ecom, int form Line 643  ecommunity_ecom2str (struct ecommunity *ecom, int form
   
       /* High-order octet of type. */        /* High-order octet of type. */
       encode = *pnt++;        encode = *pnt++;
      if (encode != ECOMMUNITY_ENCODE_AS && encode != ECOMMUNITY_ENCODE_IP
                      && encode != ECOMMUNITY_ENCODE_AS4)      switch (encode)
        {        {
          len = sprintf (str_buf + str_pnt, "?");        case ECOMMUNITY_ENCODE_AS:
          str_pnt += len;        case ECOMMUNITY_ENCODE_IP:
          first = 0;        case ECOMMUNITY_ENCODE_AS4:
          continue;          break;
        }
              case ECOMMUNITY_ENCODE_OPAQUE:
           if (*pnt == ECOMMUNITY_OPAQUE_SUBTYPE_ENCAP)
             {
               uint16_t tunneltype;
               memcpy (&tunneltype, pnt + 5, 2);
               tunneltype = ntohs(tunneltype);
               len = sprintf (str_buf + str_pnt, "ET:%d", tunneltype);
               str_pnt += len;
               first = 0;
               continue;
             }
             /* fall through */
 
         default:
           len = sprintf (str_buf + str_pnt, "?");
           str_pnt += len;
           first = 0;
           continue;
         }
 
       /* Low-order octet of type. */        /* Low-order octet of type. */
       type = *pnt++;        type = *pnt++;
       if (type !=  ECOMMUNITY_ROUTE_TARGET && type != ECOMMUNITY_SITE_ORIGIN)        if (type !=  ECOMMUNITY_ROUTE_TARGET && type != ECOMMUNITY_SITE_ORIGIN)
Line 688  ecommunity_ecom2str (struct ecommunity *ecom, int form Line 708  ecommunity_ecom2str (struct ecommunity *ecom, int form
           eas.val = (*pnt++ << 8);            eas.val = (*pnt++ << 8);
           eas.val |= (*pnt++);            eas.val |= (*pnt++);
   
          len = sprintf( str_buf + str_pnt, "%s%u:%d", prefix,          len = sprintf( str_buf + str_pnt, "%s%u:%u", prefix,
                         eas.as, eas.val );                          eas.as, eas.val );
           str_pnt += len;            str_pnt += len;
           first = 0;            first = 0;
Line 703  ecommunity_ecom2str (struct ecommunity *ecom, int form Line 723  ecommunity_ecom2str (struct ecommunity *ecom, int form
           eas.val |= (*pnt++ << 8);            eas.val |= (*pnt++ << 8);
           eas.val |= (*pnt++);            eas.val |= (*pnt++);
   
          len = sprintf (str_buf + str_pnt, "%s%u:%d", prefix,          len = sprintf (str_buf + str_pnt, "%s%u:%u", prefix,
                          eas.as, eas.val);                           eas.as, eas.val);
           str_pnt += len;            str_pnt += len;
           first = 0;            first = 0;
Line 715  ecommunity_ecom2str (struct ecommunity *ecom, int form Line 735  ecommunity_ecom2str (struct ecommunity *ecom, int form
           eip.val = (*pnt++ << 8);            eip.val = (*pnt++ << 8);
           eip.val |= (*pnt++);            eip.val |= (*pnt++);
   
          len = sprintf (str_buf + str_pnt, "%s%s:%d", prefix,          len = sprintf (str_buf + str_pnt, "%s%s:%u", prefix,
                          inet_ntoa (eip.ip), eip.val);                           inet_ntoa (eip.ip), eip.val);
           str_pnt += len;            str_pnt += len;
           first = 0;            first = 0;

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


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