diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 332f3c8def..de5476173d 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -1276,7 +1276,7 @@ static int rpki_create_socket(void *_cache) { struct timeval prev_snd_tmout, prev_rcv_tmout, timeout; struct cache *cache = (struct cache *)_cache; - struct rpki_vrf *rpki_vrf = cache->rpki_vrf; + struct rpki_vrf *rpki_vrf; struct tr_tcp_config *tcp_config; struct addrinfo *res = NULL; struct addrinfo hints = {}; @@ -1294,6 +1294,8 @@ static int rpki_create_socket(void *_cache) if (!cache) return -1; + rpki_vrf = cache->rpki_vrf; + if (rpki_vrf->vrfname == NULL) vrf = vrf_lookup_by_id(VRF_DEFAULT); else