Add NICs that handle DNS queries to the allowlist

Resolves: bz2229287
Upstream: RHEL-ONLY
Conflict: None

There is a use case where a separate NIC is used to handle DNS queries.
In this case this NIC should be added to the allowlist as well.

Fixes: e67e4bd ("Reduce kdump memory consumption by only installing needed NIC drivers")
Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2023-08-08 14:44:52 +08:00
parent c373fc1525
commit 30b68611f7

View File

@ -108,6 +108,17 @@ source_ifcfg_file() {
fi
}
add_dns_netdev() {
local _server _route
_server=$1
_route=`/sbin/ip -o route get to $_server 2>&1`
[ $? != 0 ] && echo "DNS server $_server unreachable"
_netdev=$(get_ip_route_field "$_route" "dev")
_save_kdump_netifs "$_netdev" "$(kdump_setup_ifname $_netdev)"
}
# $1: netdev name
kdump_setup_dns() {
local _nameserver _dns
@ -115,8 +126,8 @@ kdump_setup_dns() {
source_ifcfg_file $1
[ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile"
[ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
[ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" && add_dns_netdev "$DNS1"
[ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile" && add_dns_netdev "$DNS2"
while read content;
do
@ -128,6 +139,7 @@ kdump_setup_dns() {
if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then
echo "nameserver=$_dns" >> "$_dnsfile"
add_dns_netdev "$_dns"
fi
done < "/etc/resolv.conf"
}