mirror of
https://github.com/bgp/bgpq4.git
synced 2024-05-11 05:55:05 +00:00
Allow use of alternate port in -h host[:port]
This commit is contained in:
14
bgpq3.c
14
bgpq3.c
@@ -26,7 +26,7 @@ extern int expand_special_asn;
|
||||
int
|
||||
usage(int ecode)
|
||||
{
|
||||
printf("\nUsage: bgpq3 [-h host] [-S sources] [-P|E|G <num>|f <num>]"
|
||||
printf("\nUsage: bgpq3 [-h host[:port]] [-S sources] [-P|E|G <num>|f <num>]"
|
||||
" [-2346AbDJjXd] [-R len] <OBJECTS>...\n");
|
||||
printf(" -2 : allow routes belonging to as23456 (transition-as) "
|
||||
"(default: false)\n");
|
||||
@@ -44,7 +44,8 @@ usage(int ecode)
|
||||
printf(" -F fmt : generate output in user-defined format\n");
|
||||
printf(" -G number : generate output as-path access-list\n");
|
||||
printf(" -h host : host running IRRD software (whois.radb.net by "
|
||||
"default)\n");
|
||||
"default)\n"
|
||||
" (use host:port to specify alternate port)\n");
|
||||
printf(" -J : generate config for JunOS (Cisco IOS by default)\n");
|
||||
printf(" -j : generate JSON output (Cisco IOS by default)\n");
|
||||
printf(" -M match : extra match conditions for JunOS route-filters\n");
|
||||
@@ -178,8 +179,15 @@ main(int argc, char* argv[])
|
||||
expander.vendor=V_FORMAT;
|
||||
expander.format=optarg;
|
||||
break;
|
||||
case 'h': expander.server=optarg;
|
||||
case 'h': {
|
||||
char* d=strchr(optarg, ':');
|
||||
expander.server=optarg;
|
||||
if(d) {
|
||||
*d=0;
|
||||
expander.port=d+1;
|
||||
};
|
||||
break;
|
||||
};
|
||||
case 'J': if(expander.vendor) vendor_exclusive();
|
||||
expander.vendor=V_JUNIPER;
|
||||
break;
|
||||
|
1
bgpq3.h
1
bgpq3.h
@@ -58,6 +58,7 @@ struct bgpq_expander {
|
||||
int piped;
|
||||
char* match;
|
||||
char* server;
|
||||
char* port;
|
||||
char* format;
|
||||
unsigned maxlen;
|
||||
STAILQ_HEAD(bgpq_requests, bgpq_request) wq, rq;
|
||||
|
@@ -58,6 +58,7 @@ bgpq_expander_init(struct bgpq_expander* b, int af)
|
||||
memset(b->asn32s[0],0,8192);
|
||||
b->identify=1;
|
||||
b->server="whois.radb.net";
|
||||
b->port="43";
|
||||
|
||||
STAILQ_INIT(&b->wq);
|
||||
STAILQ_INIT(&b->rq);
|
||||
@@ -714,7 +715,7 @@ bgpq_expand(struct bgpq_expander* b)
|
||||
|
||||
hints.ai_socktype=SOCK_STREAM;
|
||||
|
||||
err=getaddrinfo(b->server,"43",&hints,&res);
|
||||
err=getaddrinfo(b->server,b->port,&hints,&res);
|
||||
if(err) {
|
||||
sx_report(SX_ERROR,"Unable to resolve %s: %s\n",
|
||||
b->server, gai_strerror(err));
|
||||
|
Reference in New Issue
Block a user