mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 15:18:06 +00:00
bgpd: encap: extend extcommunity handling
Add code to print ENCAP communities. Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 5a81fc9ae610ff343902ebabc12237d6e40d91cb)
This commit is contained in:
parent
7a0ff1b285
commit
0014c3011f
@ -649,14 +649,33 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format)
|
|||||||
|
|
||||||
/* 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++;
|
||||||
|
@ -25,11 +25,15 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|||||||
#define ECOMMUNITY_ENCODE_AS 0x00
|
#define ECOMMUNITY_ENCODE_AS 0x00
|
||||||
#define ECOMMUNITY_ENCODE_IP 0x01
|
#define ECOMMUNITY_ENCODE_IP 0x01
|
||||||
#define ECOMMUNITY_ENCODE_AS4 0x02
|
#define ECOMMUNITY_ENCODE_AS4 0x02
|
||||||
|
#define ECOMMUNITY_ENCODE_OPAQUE 0x03
|
||||||
|
|
||||||
/* Low-order octet of the Extended Communityes type field. */
|
/* Low-order octet of the Extended Communities type field. */
|
||||||
#define ECOMMUNITY_ROUTE_TARGET 0x02
|
#define ECOMMUNITY_ROUTE_TARGET 0x02
|
||||||
#define ECOMMUNITY_SITE_ORIGIN 0x03
|
#define ECOMMUNITY_SITE_ORIGIN 0x03
|
||||||
|
|
||||||
|
/* Low-order octet of the Extended Communities type field for OPAQUE types */
|
||||||
|
#define ECOMMUNITY_OPAQUE_SUBTYPE_ENCAP 0x0c
|
||||||
|
|
||||||
/* Extended communities attribute string format. */
|
/* Extended communities attribute string format. */
|
||||||
#define ECOMMUNITY_FORMAT_ROUTE_MAP 0
|
#define ECOMMUNITY_FORMAT_ROUTE_MAP 0
|
||||||
#define ECOMMUNITY_FORMAT_COMMUNITY_LIST 1
|
#define ECOMMUNITY_FORMAT_COMMUNITY_LIST 1
|
||||||
|
Loading…
Reference in New Issue
Block a user