upstream: added dns result priorization option
@@ -46,6 +46,12 @@ struct flb_config_map upstream_net[] = {
"Select the primary DNS resolver type (LEGACY or ASYNC)"
},
+ {
+ FLB_CONFIG_MAP_BOOL, "net.dns.prefer_ipv4", "false",
+ 0, FLB_TRUE, offsetof(struct flb_net_setup, dns_prefer_ipv4),
+ "Prioritize IPv4 DNS results when trying to establish a connection"
+ },
+
{
FLB_CONFIG_MAP_BOOL, "net.keepalive", "true",
0, FLB_TRUE, offsetof(struct flb_net_setup, keepalive),
@@ -123,6 +129,12 @@ struct mk_list *flb_upstream_get_config_map(struct flb_config *config)
upstream_net[config_index].def_value = config->dns_resolver;
}
}
+ if (config->dns_prefer_ipv4) {
+ if (strcmp(upstream_net[config_index].name,
+ "net.dns.prefer_ipv4") == 0) {
+ upstream_net[config_index].def_value = "true";
+ }
+ }
}
config_map = flb_config_map_create(config, upstream_net);
