aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/dns/dns.c3
-rw-r--r--src/vnet/dns/dns.h5
-rw-r--r--src/vnet/dns/resolver_process.c19
3 files changed, 19 insertions, 8 deletions
diff --git a/src/vnet/dns/dns.c b/src/vnet/dns/dns.c
index 2951679eaa4..bae6cb4911e 100644
--- a/src/vnet/dns/dns.c
+++ b/src/vnet/dns/dns.c
@@ -74,6 +74,9 @@ dns_enable_disable (dns_main_t * dm, int is_enable)
u32 n_vlib_mains = tm->n_vlib_mains;
vlib_main_t *vm = dm->vlib_main;
+ /* Create the resolver process if not done already */
+ vnet_dns_create_resolver_process (dm);
+
if (is_enable)
{
if (vec_len (dm->ip4_name_servers) == 0
diff --git a/src/vnet/dns/dns.h b/src/vnet/dns/dns.h
index c747e2ecd38..b2e3e9b90cb 100644
--- a/src/vnet/dns/dns.h
+++ b/src/vnet/dns/dns.h
@@ -108,6 +108,9 @@ typedef struct
ip4_address_t *ip4_name_servers;
ip6_address_t *ip6_name_servers;
+ /** resolver process node index */
+ u32 resolver_process_node_index;
+
/** config parameters */
u32 name_cache_size;
u32 max_ttl_in_seconds;
@@ -183,6 +186,8 @@ void vnet_send_dns6_reply (dns_main_t * dm, dns_pending_request_t * t,
u8 *vnet_dns_labels_to_name (u8 * label, u8 * full_text,
u8 ** parse_from_here);
+void vnet_dns_create_resolver_process (dns_main_t * dm);
+
format_function_t format_dns_reply;
static inline void
diff --git a/src/vnet/dns/resolver_process.c b/src/vnet/dns/resolver_process.c
index 5f43fada983..cba659266c9 100644
--- a/src/vnet/dns/resolver_process.c
+++ b/src/vnet/dns/resolver_process.c
@@ -322,15 +322,18 @@ dns_resolver_process (vlib_main_t * vm,
return 0; /* or not */
}
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (dns_resolver_node) =
+void
+vnet_dns_create_resolver_process (dns_main_t * dm)
{
- .function = dns_resolver_process,
- .type = VLIB_NODE_TYPE_PROCESS,
- .name = "dns-resolver-process",
-};
-/* *INDENT-ON* */
-
+ /* Already created the resolver process? */
+ if (dm->resolver_process_node_index > 0)
+ return;
+
+ /* No, create it now and make a note of the node index */
+ dm->resolver_process_node_index = vlib_process_create
+ (dm->vlib_main, "dns-resolver-process",
+ dns_resolver_process, 16 /* log2_n_stack_bytes */ );
+}
/*
* fd.io coding-style-patch-verification: ON