/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2002-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* bgp mrt method
*
* Glenn Fowler
* AT&T Research
*/
#include "bgplib.h"
#include "mrt.h"
#include <ip6.h>
#include <swap.h>
/*
* mcast_vpn_grp_addr => agg_addr
*/
#define GROUP_STATE 0
#define BE1(p) (*(unsigned char*)(p))
#define ZERO(sp,rp) ((rp->set&BGP_SET_mvpn?(sp->np->size=0,memset(sp->np,0,BGP_FIXED),memset(sp->np+1,0,BGP_FIXED),sp->np->unknown.size=0):0),sp->size=0,memset(rp,0,BGP_FIXED),sp->unknown.size=0)
typedef struct Mrtpeer_s
{
} Mrtpeer_t;
typedef struct Mrtstate_s
{
unsigned int size;
unsigned int osize;
int as32;
int entries;
int group;
int push;
int state;
char* buf;
char* nxt;
char* end;
char* bugbuf;
struct Unknown_s
{
int size;
} unknown;
} Mrtstate_t;
#if ANONYMIZE
#define ANONYMIZE_WRITE(f,r,d) return 0
typedef struct Anonymize_s
{
char* data;
} Anonymize_t;
static void
{
int i;
}
static unsigned int
{
unsigned int r;
int i;
int j;
for (i = n - 1; i >= 0; i -= 4)
if (dat)
{
return 0;
}
r = 0;
for (i = 0; i < n; i++)
return r;
}
static int
{
{
if (sfwrite(anonymize.io, anonymize.head, MRT_HEAD) != MRT_HEAD || sfwrite(anonymize.io, anonymize.data, anonymize.size) != anonymize.size)
{
return -1;
}
}
return 0;
}
#else
#define ANONYMIZE 0
#define ANONYMIZE_OPEN(f,d)
#define ANONYMIZE_HEAD(b,n)
#define ANONYMIZE_DATA(b,n)
#define ANONYMIZE_FLUSH(f,d)
#define ANONYMIZE_WRITE(f,r,d)
#endif
/*
* dump n bytes of the payload
*/
static void
{
int i;
int j;
for (i = j = 0; i < n; i++)
{
if (++j >= 30)
{
j = 0;
if ((n - i) > 1)
}
}
if (j)
}
static char*
{
switch (group)
{
case GROUP_MESSAGE:
switch (index)
{
case MRT_I_AM_DEAD: return "I_AM_DEAD";
case MRT_BGP: return "BGP";
case MRT_RIP: return "RIP";
case MRT_IDRP: return "IDRP";
case MRT_RIPNG: return "RIPNG";
case MRT_BGP4PLUS: return "BGP4PLUS";
case MRT_BGP4PLUS_01: return "BGP4PLUS_01";
case MRT_OSPFv2: return "OSPFv2";
case MRT_TABLE_DUMP: return "TABLE_DUMP";
case MRT_TABLE_DUMP_V2: return "TABLE_DUMP_V2";
case MRT_BGP4MP: return "BGP4MP";
case MRT_BGP4MP_ET: return "BGP4MP_ET";
case MRT_ISIS: return "ISIS";
case MRT_ISIS_ET: return "ISIS_ET";
case MRT_OSPFv3: return "OSPFv3";
case MRT_OSPFv3_ET: return "OSPFv3_ET";
}
break;
case GROUP_BGP:
switch (index)
{
case MRT_BGP_NULL: return "NULL";
case MRT_BGP_UPDATE: return "UPDATE";
case MRT_BGP_PREF_UPDATE: return "PREF_UPDATE";
case MRT_BGP_STATE_CHANGE: return "STATE_CHANGE";
case MRT_BGP_SYNC: return "SYNC";
case MRT_BGP_OPEN: return "OPEN";
case MRT_BGP_NOTIFY: return "NOTIFY";
case MRT_BGP_KEEPALIVE: return "KEEPALIVE";
}
break;
case GROUP_TABLE:
switch (index)
{
case MRT_TABLE_IPV4_UNICAST: return "IPV4_UNICAST";
case MRT_TABLE_IPV6_UNICAST: return "IPV6_UNICAST";
}
break;
case GROUP_TABLE_V2:
switch (index)
{
case MRT_TABLE_PEER_INDEX_TABLE: return "PEER_INDEX_TABLE";
case MRT_TABLE_RIB_IPV4_UNICAST: return "RIB_IPV4_UNICAST";
case MRT_TABLE_RIB_IPV4_MULTICAST: return "RIB_IPV4_MULTICAST";
case MRT_TABLE_RIB_IPV6_UNICAST: return "RIB_IPV6_UNICAST";
case MRT_TABLE_RIB_IPV6_MULTICAST: return "RIB_IPV6_MULTICAST";
case MRT_TABLE_RIB_GENERIC: return "RIB_GENERIC";
}
break;
case GROUP_BGP4MP:
case GROUP_BGP4MP_ET:
switch (index)
{
case MRT_BGP4MP_KEEPALIVE: return "KEEPALIVE";
case MRT_BGP4MP_STATE_CHANGE: return "STATE_CHANGE";
case MRT_BGP4MP_MESSAGE: return "MESSAGE";
case MRT_BGP4MP_UPDATE: return "UPDATE";
case MRT_BGP4MP_NOTIFY: return "NOTIFY";
case MRT_BGP4MP_MESSAGE_AS4: return "MESSAGE_AS4";
case MRT_BGP4MP_STATE_CHANGE_AS4: return "STATE_CHANGE_AS4";
case MRT_BGP4MP_MESSAGE_LOCAL: return "MESSAGE_LOCAL";
case MRT_BGP4MP_MESSAGE_AS4_LOCAL: return "MESSAGE_AS4_LOCAL";
case MRT_BGP4MP_EXTENSION_20: return "EXTENSION_20";
}
break;
case GROUP_ATTR:
switch (index)
{
case MRT_ATTR_ORIGIN: return "ORIGIN";
case MRT_ATTR_AS_PATH: return "AS_PATH";
case MRT_ATTR_HOP: return "HOP";
case MRT_ATTR_MED: return "MED";
case MRT_ATTR_LOCAL: return "LOCAL";
case MRT_ATTR_ATOMIC: return "ATOMIC";
case MRT_ATTR_AGGREGATOR: return "AGGREGATOR";
case MRT_ATTR_COMMUNITY: return "COMMUNITY";
case MRT_ATTR_ORIGINATOR: return "ORIGINATOR";
case MRT_ATTR_CLUSTER: return "CLUSTER";
case MRT_ATTR_DPA: return "DPA";
case MRT_ATTR_ADVERTIZER: return "ADVERTIZER";
case MRT_ATTR_RCID_PATH: return "RCID_PATH";
case MRT_ATTR_MP_REACH_NLRI: return "MP_REACH_NLRI";
case MRT_ATTR_MP_UNREACH_NLRI: return "MP_UNREACH_NLRI";
case MRT_ATTR_EXTENDED_COMMUNITY: return "EXTENDED_COMMUNITY";
case MRT_ATTR_AS32_PATH: return "AS32_PATH";
case MRT_ATTR_AGGREGATOR32: return "AGGREGATOR32";
case MRT_ATTR_CONNECTOR: return "CONNECTOR";
case MRT_ATTR_PMSI_TUNNEL: return "PMSI_TUNNEL";
case MRT_ATTR_SET: return "SET";
}
break;
case GROUP_AFI:
switch (index)
{
case MRT_AFI_IPV4: return "ipv4";
case MRT_AFI_IPV6: return "ipv6";
}
break;
case GROUP_SAFI:
switch (index)
{
case MRT_SAFI_NLRI_UCAST_FORWARD: return "NLRI_UCAST_FORWARD";
case MRT_SAFI_NLRI_MCAST_FORWARD: return "NLRI_MCAST_FORWARD";
case MRT_SAFI_NLRI_MLPS_LABEL: return "NLRI_MLPS_LABEL";
case MRT_SAFI_MCAST_VPN: return "MCAST_VPN";
case MRT_SAFI_VPN_MLPS_LABEL: return "VPN_MLPS_LABEL";
}
break;
case GROUP_MCAST_VPN:
switch (index)
{
case VPN_INTRA_AS_I_PMSI_A_D: return "INTRA_AS_I_PMSI_A_D";
case VPN_INTER_AS_I_PMSI_A_D: return "INTER_AS_I_PMSI_A_D";
case VPN_S_PMSI_A_D: return "S_PMSI_A_D";
case VPN_LEAF_A_D: return "LEAF_A_D";
case VPN_SOURCE_ACTIVE_A_D: return "SOURCE_ACTIVE_A_D";
case VPN_SHARED_TREE_JOIN: return "SHARED_TREE_JOIN";
case VPN_SOURCE_TREE_JOIN: return "SOURCE_TREE_JOIN";
}
break;
case GROUP_BGP_MESSAGE:
switch (index)
{
case MRT_BGP_MESSAGE_STATE_CHANGE: return "STATE_CHANGE";
case MRT_BGP_MESSAGE_OPEN: return "OPEN";
case MRT_BGP_MESSAGE_UPDATE: return "UPDATE";
case MRT_BGP_MESSAGE_NOTIFY: return "NOTIFY";
case MRT_BGP_MESSAGE_KEEPALIVE: return "KEEPALIVE";
}
break;
case GROUP_STATE:
switch (index)
{
case STATE_BGP_HEADER: return "BGP_HEADER";
case STATE_BGP_MESSAGE: return "BGP_MESSAGE";
case STATE_BGP_ATTRIBUTES: return "BGP_ATTRIBUTES";
case STATE_BGP_ANNOUNCE: return "BGP_ANNOUNCE";
case STATE_BGP_PREFIX: return "BGP_PREFIX";
case STATE_BGP_NLRI: return "BGP_NLRI";
case STATE_BGP_ATTR: return "BGP_ATTR";
case STATE_TABLE_DUMP: return "TABLE_DUMP";
case STATE_TABLE_DUMP_V2_RIB: return "TABLE_DUMP_V2_RIB";
case STATE_TABLE_DUMP_V2_RIB_GENERIC: return "TABLE_DUMP_V2_RIB_GENERIC";
}
break;
}
return buf;
}
/*
* mrt identf
*/
static int
{
if (n < MRT_HEAD)
return 0;
#if ANONYMIZE
return 0;
#else
return 0;
#endif
{
case MRT_BGP:
case MRT_BGP4PLUS:
case MRT_TABLE_DUMP:
case MRT_TABLE_DUMP_V2:
case MRT_BGP4MP:
case MRT_BGP4MP_ET:
/* implemented */
return 1;
case MRT_RIP:
case MRT_IDRP:
case MRT_RIPNG:
case MRT_BGP4PLUS_01:
case MRT_OSPFv2:
case MRT_ISIS:
case MRT_ISIS_ET:
case MRT_OSPFv3:
case MRT_OSPFv3_ET:
/* not implemented */
break;
default:
/* unknown */
break;
}
return 0;
}
/*
* mrt openf
*/
static int
{
{
return -1;
}
return 0;
}
/*
* extract a route distinguisher
*/
static int
{
{
(*disc->errorf)(NiL, disc, 1, "rd %s size %u -- %d available", symbol(GROUP_STATE, state->state), 8, (int)(end - state->buf));
return -1;
}
{
case 0:
break;
case 1:
break;
case 2:
break;
}
sfprintf(sfstderr, " nlri rd type %u number %u as %u addr %s\n", rp->rd_type, rp->rd_number, rp->rd_as, fmtip4(rp->rd_addr.v4, -1));
return 0;
}
/*
* extract a prefix, or is it an nlri, no wait, nlri() calls this
* see what the RFCs say
*/
static int
{
int i;
int n;
if (bits < 0)
{
case MRT_AFI_IPV4:
if (n = bits)
n = (n - 1) / 8 + 1;
{
i = 4;
goto nope;
}
v4 = 0;
for (i = 0; i < n; i++)
{
v4 <<= 8;
}
while (i++ < 4)
v4 <<= 8;
if (state->best != state->message && (state->best = state->message) || rp->addr.v4 != v4 || rp->bits != bits)
{
}
sfprintf(sfstderr, " nlri %c %s prefix %s\n", rp->type, symbol(GROUP_AFI, rp->afi), fmtip4(rp->addr.v4, rp->bits));
break;
case MRT_AFI_IPV6:
n = (n - 1) / 8 + 1;
{
i = 16;
goto nope;
}
i = 0;
while (i < n)
while (i < 16)
v6[i++] = 0;
if (state->best != state->message && (state->best = state->message) || memcmp(rp->prefixv6, v6, sizeof(rp->prefixv6)))
{
}
sfprintf(sfstderr, " nlri %c %s prefix %s\n", rp->type, symbol(GROUP_AFI, rp->afi), fmtip6(rp->prefixv6, rp->prefixv6[IP6BITS]));
break;
}
return 0;
nope:
(*disc->errorf)(NiL, disc, 1, "nlri %s %s prefix bytes %d too large -- %d max, %d available", symbol(GROUP_STATE, state->state), symbol(GROUP_AFI, rp->afi), n, i, (int)(end - state->buf));
return 0;
}
/*
* extract a single nlri
*/
static int
nlri(register Dssfile_t* file, register Mrtstate_t* state, register Bgproute_t* rp, char* end, Dssdisc_t* disc)
{
int n;
int m;
int i;
int j;
int q;
int v;
char* buf;
{
break;
case MRT_SAFI_NLRI_MLPS_LABEL:
case MRT_SAFI_VPN_MLPS_LABEL:
m = q = 0;
for (;;)
{
m++;
q += 2;
q += 1;
/* XXX: where is the BGP_TYPE_withdraw check documented */
{
break;
}
/* XXX: where is "no TTL present" documented */
}
j -= q * 8;
m *= 2;
for (q = 0; q < m; q += 2)
{
{
np[q] = (v | n) >> 4;
}
}
sfprintf(sfstderr, " nlri %c %s/%s label %u labels %d\n", rp->type, symbol(GROUP_AFI, rp->afi), symbol(GROUP_SAFI, rp->safi), rp->label, rp->labels.size / 2);
{
goto nope;
}
break;
case MRT_SAFI_MCAST_VPN:
{
(*disc->errorf)(NiL, disc, 1, "nlri %s.%s size %d too large -- %d available", symbol(GROUP_SAFI, op->safi), symbol(GROUP_MCAST_VPN, j), m, (int)(end - state->buf));
goto nope;
}
sfprintf(sfstderr, " %s.%s size %d available %d/%d\n", symbol(GROUP_SAFI, op->safi), symbol(GROUP_MCAST_VPN, j), m, (int)(end - state->buf), (int)(state->end - state->buf));
switch (j)
{
case VPN_INTRA_AS_I_PMSI_A_D:
q = VPN_rd|VPN_originator;
break;
case VPN_INTER_AS_I_PMSI_A_D:
q = VPN_rd|VPN_src_as;
break;
case VPN_S_PMSI_A_D:
break;
case VPN_LEAF_A_D:
q = VPN_key|VPN_originator;
break;
case VPN_SOURCE_ACTIVE_A_D:
q = VPN_rd|VPN_multicast;
break;
case VPN_SHARED_TREE_JOIN:
case VPN_SOURCE_TREE_JOIN:
break;
default:
(*disc->errorf)(NiL, disc, 1, "%s.%s unknown route type", symbol(GROUP_SAFI, op->safi), symbol(GROUP_MCAST_VPN, j));
goto skip;
}
goto nope;
if (q & VPN_key)
{
rp++;
goto nope;
}
if (q & VPN_src_as)
{
}
if (q & VPN_multicast)
{
switch (i)
{
case MRT_BITS_IPV4:
break;
case MRT_BITS_IPV6:
break;
default:
goto skip;
}
switch (i)
{
case MRT_BITS_IPV4:
break;
case MRT_BITS_IPV6:
break;
default:
goto skip;
}
}
if (q & VPN_originator)
{
{
}
{
}
else
{
goto nope;
}
}
{
(*disc->errorf)(NiL, disc, 1, "nlri %s.%s size %d -- %d unused", symbol(GROUP_SAFI, op->safi), symbol(GROUP_MCAST_VPN, j), m, (int)(end - state->buf));
}
goto done;
default:
goto skip;
}
sfprintf(sfstderr, " nlri %c %s/%s bits %d\n", rp->type, symbol(GROUP_AFI, rp->afi), symbol(GROUP_SAFI, rp->safi), j);
goto nope;
done:
{
goto nope;
}
return 0;
skip:
return 0;
nope:
return -1;
}
/*
* extract a single attribute
*/
static int
attr(register Dssfile_t* file, register Mrtstate_t* state, register Bgproute_t* rp, char* end, Dssdisc_t* disc)
{
register int i;
int j;
int k;
int m;
int n;
int q;
int r;
char* nxt;
unsigned char* up;
unsigned long v;
unsigned int type;
unsigned int flag;
unsigned int size;
{
return 0;
}
if (flag & 0x10)
{
{
return 0;
}
}
sfprintf(sfstderr, " attr flag 0x%02x %s size %u available %d/%d\n", flag, symbol(GROUP_ATTR, type), size, (int)(end - state->buf), (int)(state->end - state->buf));
{
(*disc->errorf)(NiL, disc, 1, "nlri attribute %s size %u -- %d available", symbol(GROUP_ATTR, type), size, (int)(end - state->buf));
goto nope;
}
switch (type)
{
case MRT_ATTR_ORIGIN:
{
case 0:
break;
case 1:
break;
default:
break;
}
break;
case MRT_ATTR_AS_PATH:
{
for (i = j = 0; i <= (m - 4); i += 2)
{
/* <type> 1:set 2:sequence 3:confed_sequence 4:confed_set <length> */
if (k < 1 || k > 4)
break;
if (!(k & 2))
j += 2;
if ((i + 2 + k) > m)
break;
while (k-- > 0 && i <= (m - 4))
{
i += 2;
j++;
j += 2;
}
}
/*
* XXX: mrt has no "old bgp" or "new bgp" marker
* old bgp AS_PATH contain 16 bit AS (i==m)
* new bgp AS_PATH contain 32 bit AS (i!=m most of the time)
* there is a small chance of hitting an AS32 encoding that is also a valid AS16
* how about an RFC that addresses all the XXX in this parser
*/
if (i == m)
{
for (i = j = q = 0; i <= (m - 2); i += 2)
{
/* <type> 1:set 2:sequence 3:confed_sequence 4:confed_set <length> */
q += k;
else
{
q++;
ap[j++] = k;
}
while (k-- > 0 && i <= (m - 4))
{
i += 2;
{
ap[j++] = 0;
}
}
}
{
for (i = 0; i < j; i++)
else if (ap[++i])
else
}
break;
}
}
/*FALLTHROUGH*/
case MRT_ATTR_AS32_PATH:
if (m = size)
{
for (i = j = 0; i <= (m - 6); i += 4)
{
/* <type> 1:set 2:sequence 3:confed_sequence 4:confed_set <length> */
j += 2;
i -= 2;
while (k-- > 0 && i <= (m - 8))
{
i += 4;
j++;
j += 2;
}
}
for (i = j = q = 0; i <= (m - 2); i += 4)
{
q += k;
else
{
q++;
ap32[j++] = k;
}
i -= 2;
while (k-- > 0 && i <= (m - 8))
{
i += 4;
{
ap32[j++] = 0;
}
}
}
{
for (i = 0; i < j; i++)
else if (ap[++i])
else
}
}
break;
case MRT_ATTR_HOP:
break;
case MRT_ATTR_MED:
break;
case MRT_ATTR_LOCAL:
break;
case MRT_ATTR_ATOMIC:
break;
case MRT_ATTR_AGGREGATOR:
break;
case MRT_ATTR_COMMUNITY:
k = size / 2;
for (i = j = 0; j < k; i += 4)
{
ap[j++] = v & 0xffff;
}
break;
case MRT_ATTR_ORIGINATOR:
break;
case MRT_ATTR_CLUSTER:
k = size / 4;
for (i = j = 0; j < k; i += 4)
break;
case MRT_ATTR_DPA:
break;
case MRT_ATTR_MP_REACH_NLRI:
{
case STATE_TABLE_DUMP_V2_RIB: /* XXX: how can afi/safi be inline? */
{
k = 0;
break;
}
/*FALLTHROUGH*/
case STATE_BGP_ANNOUNCE:
k = 1;
break;
default:
k = 0;
break;
}
{
sfprintf(sfstderr, " nlri mp %s %s/%s hop %d %s state %s\n", "announce", symbol(GROUP_AFI, rp->afi), symbol(GROUP_SAFI, rp->safi), n, k ? "inline" : "global", symbol(GROUP_STATE, state->state));
{
if (n > 4)
}
{
if (n > 16)
}
else
goto unknown;
{
/* reserved */
}
}
sfprintf(sfstderr, " nlri mp %s %s/%s %s state %s\n", "withdraw", symbol(GROUP_AFI, rp->afi), symbol(GROUP_SAFI, rp->safi), k == 1 ? "inline" : "global", symbol(GROUP_STATE, state->state));
{
return 0;
}
break;
case MRT_ATTR_MP_UNREACH_NLRI:
goto reach;
k = size;
break;
case MRT_ATTR_AGGREGATOR32:
break;
case MRT_ATTR_ADVERTIZER:
case MRT_ATTR_RCID_PATH:
case MRT_ATTR_SET:
default:
{
i += sfsprintf(state->unknown.data + i, sizeof(state->unknown.data) - i, "0x%02x:%u:%u:0x", flag, type, size);
for (m = 0; m < size; m++)
i += sfsprintf(state->unknown.data + i, sizeof(state->unknown.data) - i, "%02x", AE1(state->buf + m));
}
break;
}
done:
return 1;
nope:
return -1;
}
/*
* extract path attributes
*/
static int
pathattr(register Dssfile_t* file, register Mrtstate_t* state, register Bgproute_t* rp, Dssdisc_t* disc)
{
char* end;
size_t n;
size_t r;
int x;
unsigned int size;
{
/*
* old mrtd had a 4 byte short bug that we fix here
* hoping that no other corruption is 4 bytes short
* this costs a memcpy -- how much buggy data is there?
*/
if (r == 4)
{
{
{
return -1;
}
}
{
return -1;
}
}
else
{
(*disc->errorf)(NiL, disc, 1, "%u: invalid path attribute buffer size -- %d available", size, (int)(state->end - state->buf));
}
}
return x;
}
static void
{
char* s;
{
}
}
/*
* mrt readf
*/
static int
{
register int i;
int j;
int afi;
int safi;
Bgpnum_t n;
unsigned int type;
unsigned int subtype;
{
}
for (;;)
{
{
case 0:
break;
sfprintf(sfstderr, "message %6lu record %6lu time %8lu %s.%s size %I*u offset %I*u\n", state->message, file->count, state->time, symbol(GROUP_MESSAGE, type), symbol(type, subtype), sizeof(size), size, sizeof(file->offset), file->offset + skip);
break;
switch (type)
{
case MRT_I_AM_DEAD:
case MRT_BGP:
if (type == MRT_I_AM_DEAD)
{
}
else
{
}
switch (subtype)
{
case MRT_BGP_PREF_UPDATE:
break;
case MRT_BGP_STATE_CHANGE:
break;
case MRT_BGP_OPEN:
break;
case MRT_BGP_NOTIFY:
break;
case MRT_BGP_KEEPALIVE:
break;
default:
continue;
}
break;
case MRT_TABLE_DUMP:
switch (subtype)
{
case MRT_TABLE_IPV6_UNICAST:
break;
default:
break;
}
break;
case MRT_TABLE_DUMP_V2:
switch (subtype)
{
{
{
return -1;
}
}
{
{
}
else
{
}
{
}
else
{
}
sfprintf(sfstderr, " peer %2d %8d %s\n", i, state->peer[i].as, (state->peer[i].type & PEER_IPV6) ? fmtip6(state->peer[i].addr.v6, -1) : fmtip4(state->peer[i].addr.v4, -1));
}
continue;
afi = MRT_AFI_IPV4;
break;
afi = MRT_AFI_IPV4;
break;
afi = MRT_AFI_IPV6;
break;
afi = MRT_AFI_IPV6;
break;
case MRT_TABLE_RIB_GENERIC:
break;
default:
continue;
}
{
sfprintf(sfstderr, " %s %s/%s sequence %u\n", symbol(GROUP_STATE, state->state), symbol(GROUP_AFI, rp->afi), symbol(GROUP_SAFI, rp->safi), j);
return -1;
}
else
{
sfprintf(sfstderr, " %s %s/%s sequence %u\n", symbol(GROUP_STATE, state->state), symbol(GROUP_AFI, rp->afi), symbol(GROUP_SAFI, rp->safi), j);
continue;
}
continue;
case MRT_BGP4MP:
case MRT_BGP4MP_ET:
if (type == MRT_BGP4MP_ET)
{
}
switch (subtype)
{
case MRT_BGP4MP_MESSAGE_AS4:
break;
default:
break;
}
{
}
else
{
}
switch (subtype)
{
case MRT_BGP4MP_STATE_CHANGE:
return 1;
case MRT_BGP4MP_MESSAGE:
case MRT_BGP4MP_MESSAGE_AS4:
case MRT_BGP4MP_MESSAGE_LOCAL:
case MRT_BGP4MP_EXTENSION_20:
break;
default:
return 1;
}
break;
}
continue;
case STATE_BGP_HEADER:
/*FALLTHROUGH*/
case STATE_BGP_MESSAGE:
switch (type)
{
return 1;
case MRT_BGP_MESSAGE_OPEN:
return 1;
case MRT_BGP_MESSAGE_UPDATE:
break;
case MRT_BGP_MESSAGE_NOTIFY:
return 1;
return 1;
default:
continue;
}
/*FALLTHROUGH*/
case STATE_BGP_ATTRIBUTES:
{
if (i & 7)
i += 8;
i >>= 3;
addr = 0;
for (j = 0; j < i; j++)
for (; j < 4; j++)
addr <<= 8;
return 1;
}
return -1;
continue;
return 1;
case STATE_BGP_ANNOUNCE:
goto state_bgp_prefix;
case STATE_BGP_PREFIX:
{
if (i & 7)
i += 8;
i >>= 3;
addr = 0;
for (j = 0; j < i; j++)
for (; j < 4; j++)
addr <<= 8;
return 1;
}
continue;
case STATE_BGP_NLRI:
{
return -1;
{
}
return 1;
}
continue;
case STATE_BGP_ATTR:
if (i < 0)
return -1;
continue;
case STATE_TABLE_DUMP:
{
{
{
}
}
else
{
{
}
}
return -1;
break;
return 1;
}
continue;
case STATE_TABLE_DUMP_V2_RIB:
for (;;)
{
{
break;
}
{
}
else
else
return -1;
break;
return 1;
}
continue;
}
break;
}
return 0;
}
/*
* mrt writef
*/
static int
{
if (record)
return -1;
}
/*
* mrt closef
*/
static int
{
return -1;
return 0;
}
{
"mrt" ANONYMIZE_FORMAT_NAME,
"mrt binary format" ANONYMIZE_FORMAT_DESCRIPTION " (2011-09-11) -T0x0010 enables payload trace [http://tools.ietf.org/html/draft-ietf-grow-mrt-15]",
CXH,
0,
0,
};