mirror of
https://github.com/bgp/bgpq4.git
synced 2024-05-11 05:55:05 +00:00
ripe/radb asplain/asdot notation changes...
This commit is contained in:
6
bgpq3.c
6
bgpq3.c
@ -65,7 +65,7 @@ parseasnumber(struct bgpq_expander* expander, char* optarg)
|
||||
{
|
||||
char* eon=NULL;
|
||||
expander->asnumber=strtoul(optarg,&eon,10);
|
||||
if(expander->asnumber<0 || expander->asnumber>(65535ul*65535)) {
|
||||
if(expander->asnumber<1 || expander->asnumber>(65535ul*65535)) {
|
||||
sx_report(SX_FATAL,"Invalid AS number: %s\n", optarg);
|
||||
exit(1);
|
||||
};
|
||||
@ -77,7 +77,7 @@ parseasnumber(struct bgpq_expander* expander, char* optarg)
|
||||
sx_report(SX_FATAL,"Invalid AS number: %s\n", optarg);
|
||||
exit(1);
|
||||
};
|
||||
if(loas<0 || loas>65536) {
|
||||
if(loas<1 || loas>65535) {
|
||||
sx_report(SX_FATAL,"Invalid AS number: %s\n", optarg);
|
||||
exit(1);
|
||||
};
|
||||
@ -231,7 +231,7 @@ main(int argc, char* argv[])
|
||||
sx_report(SX_FATAL,"asdot notation supported only for Cisco\n");
|
||||
};
|
||||
|
||||
if(!expander.asn32 && expander.asnumber>=65536) {
|
||||
if(!expander.asn32 && expander.asnumber>65535) {
|
||||
expander.asnumber=23456;
|
||||
};
|
||||
|
||||
|
3
bgpq3.h
3
bgpq3.h
@ -30,7 +30,8 @@ struct bgpq_expander {
|
||||
struct sx_slentry* rsets;
|
||||
int family;
|
||||
char* sources;
|
||||
int asnumber, aswidth, asdot;
|
||||
uint32_t asnumber;
|
||||
int aswidth, asdot;
|
||||
char* name;
|
||||
bgpq_vendor_t vendor;
|
||||
bgpq_gen_t generation;
|
||||
|
@ -104,9 +104,15 @@ bgpq_expander_add_as(struct bgpq_expander* b, char* as)
|
||||
return 0;
|
||||
};
|
||||
|
||||
if(*eoa=='.') {
|
||||
if(*eoa=='.' || asno>65535) {
|
||||
if(b->asn32 || b->generation>=T_PREFIXLIST) {
|
||||
uint32_t asn1=strtoul(eoa+1,&eoa,10);
|
||||
uint32_t asn1;
|
||||
if(asno>65535) {
|
||||
asn1=asno%65536;
|
||||
asno/=65536;
|
||||
} else
|
||||
asn1=strtoul(eoa+1,&eoa,10);
|
||||
|
||||
if(eoa && *eoa!=0) {
|
||||
sx_report(SX_ERROR,"Invalid symbol in AS number: '%c' in %s\n",
|
||||
*eoa, as);
|
||||
|
Reference in New Issue
Block a user