This archive is retained to ensure existing URLs remain functional. It will not contain any emails sent to this mailing list after July 1, 2024. For all messages, including those sent before and after this date, please visit the new location of the archive at https://mailman.ripe.net/archives/list/ris-users@ripe.net/
Using libbgpdump - obtain aspath?
- Previous message (by thread): Using libbgpdump - obtain aspath?
- Next message (by thread): Two years of selective peering with RIS
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Colin Petrie
colin at spakka.net
Tue Nov 7 11:31:52 CET 2023
Hi Rob, In the entry data structure, there is a field called 'attr'. This contains various attributes, including the AS PATH: see bgpdump_attr.h: struct attr { <snip> struct aspath *aspath; } struct aspath { u_int8_t asn_len; int length; int count; caddr_t data; char *str; }; The 'data' is the raw attribute, but libbgpdump also helpfully fills in 'str' as a decoded string representation of the AS Path (using function process_attr_aspath_string). So to access it, quoting from what bgpdump.c and example.c does: if (entry->attr && entry->attr->len) { if( (entry->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_AS_PATH) ) !=0) { printf("ASPATH: %s\n",entry->attr->aspath->str); } } Hope this helps, if you need some more help with it, just let me know. Colin (bgpdump maintainer) On 06-11-2023 19:59, Rob Ballantyne wrote: > Hello All, > > I’ve just started looking at libbgpdump for a project where I will be > parsing MRT/BGP data. > > I’ve managed, following the example/advice I’ve seen, to get a basic > loop running through an update file from the repository working. > > However, I don’t seem to be able to find the ASPATH component in the > parsed data structure. > > I can see the type/subtype of the data block is > BGPDUMP_TYPE_ZEBRA_BGP/BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE.I can also see > that the BGPDUMP_BODY is a discriminated union based on these values. I > can see that BGPDUMP_ENTRY.attr should probably contain an ASPATH but it > doesn’t seem to be set ever. > > Should I be expecting the ASPATH to be set in this case? Should I be > doing something different (calling some init function after discovering > the BGPDUMP_BODY is of the right type?). > > Thanks! > > Rob >
- Previous message (by thread): Using libbgpdump - obtain aspath?
- Next message (by thread): Two years of selective peering with RIS
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]