summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_bmp.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-12-11 12:27:05 +0100
committerDavid Lamparter <equinox@diac24.net>2019-12-11 12:27:05 +0100
commit125dc9525b34089903ccd4402a2e9bf8c6c7f801 (patch)
treef3899d3c1668a4db68955d3c417f30a9332e55e2 /bgpd/bgp_bmp.c
parentbgpd: Allow failed hostname lookup to continue in bmp (diff)
downloadfrr-125dc9525b34089903ccd4402a2e9bf8c6c7f801.tar.xz
frr-125dc9525b34089903ccd4402a2e9bf8c6c7f801.zip
lib/resolver: support/bypass IP literals
libc-ares doesn't do IP literals, so we have to do that before running off to do DNS. Since this isn't BMP specific, move to lib/ so NHRP can benefit too. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'bgpd/bgp_bmp.c')
-rw-r--r--bgpd/bgp_bmp.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c
index b8862c604..b376d51a1 100644
--- a/bgpd/bgp_bmp.c
+++ b/bgpd/bgp_bmp.c
@@ -1669,27 +1669,22 @@ static void bmp_active_resolved(struct resolver_query *resq, int numaddrs,
unsigned i;
if (numaddrs <= 0) {
- int ret;
-
- ba->addrpos = 0;
- ba->addrtotal = 1;
- ret = str2sockunion(ba->hostname, &ba->addrs[0]);
- if (ret < 0) {
- ba->addrtotal = 0;
- ba->curretry += ba->curretry / 2;
- bmp_active_setup(ba);
- return;
- }
- } else {
- if (numaddrs > (int)array_size(ba->addrs))
- numaddrs = array_size(ba->addrs);
-
+ zlog_warn("bmp[%s]: hostname resolution failed", ba->hostname);
+ ba->curretry += ba->curretry / 2;
ba->addrpos = 0;
- ba->addrtotal = numaddrs;
- for (i = 0; i < ba->addrtotal; i++)
- memcpy(&ba->addrs[i], &addr[i], sizeof(ba->addrs[0]));
+ ba->addrtotal = 0;
+ bmp_active_setup(ba);
+ return;
}
+ if (numaddrs > (int)array_size(ba->addrs))
+ numaddrs = array_size(ba->addrs);
+
+ ba->addrpos = 0;
+ ba->addrtotal = numaddrs;
+ for (i = 0; i < ba->addrtotal; i++)
+ memcpy(&ba->addrs[i], &addr[i], sizeof(ba->addrs[0]));
+
bmp_active_connect(ba);
}