summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoropenshift-merge-bot[bot] <148852131+openshift-merge-bot[bot]@users.noreply.github.com>2024-02-07 15:53:49 +0000
committerGitHub <noreply@github.com>2024-02-07 15:53:49 +0000
commit66c17f1df59ddc2a1d9c74c2fe083bd74c2f09fb (patch)
treeeb198829c61c56580b0be27828f53c917673d401
parent0beb68373f54622f12a9990e4e0dfa11b81c6905 (diff)
parenta88dc00eba6e63e4f3491b2ebd40d21765b2a8fd (diff)
Merge pull request #923 from openshift-cherrypick-robot/cherry-pick-922-to-v1.10
[v1.10] fix netavark update to not start a new aardvark-dns
-rw-r--r--src/dns/aardvark.rs29
-rw-r--r--test/100-bridge-iptables.bats4
2 files changed, 21 insertions, 12 deletions
diff --git a/src/dns/aardvark.rs b/src/dns/aardvark.rs
index ba68d27..029af4f 100644
--- a/src/dns/aardvark.rs
+++ b/src/dns/aardvark.rs
@@ -151,18 +151,23 @@ impl Aardvark {
Ok(pid) => {
match signal::kill(Pid::from_raw(pid), Signal::SIGHUP) {
Ok(_) => {
- if !is_update {
- match self.check_netns(pid) {
- Ok(_) => return Ok(()),
- Err(e) => {
- // If the error is ENOENT it means the process must have died in
- // the meantime so drop down below to start a new server process.
- if e.kind() != std::io::ErrorKind::NotFound {
- return Err(NetavarkError::wrap(
- "check aardvark-dns netns",
- e.into(),
- ));
- }
+ // We do not want to check the netns when doing an update
+ // this is not working because podman doe snot enter the
+ // rootless netns for the update as we only change the file
+ // and send SIGHUP.
+ if is_update {
+ return Ok(());
+ }
+ match self.check_netns(pid) {
+ Ok(_) => return Ok(()),
+ Err(e) => {
+ // If the error is ENOENT it means the process must have died in
+ // the meantime so drop down below to start a new server process.
+ if e.kind() != std::io::ErrorKind::NotFound {
+ return Err(NetavarkError::wrap(
+ "check aardvark-dns netns",
+ e.into(),
+ ));
}
}
}
diff --git a/test/100-bridge-iptables.bats b/test/100-bridge-iptables.bats
index c91f0cc..420547b 100644
--- a/test/100-bridge-iptables.bats
+++ b/test/100-bridge-iptables.bats
@@ -156,6 +156,10 @@ fw_driver=iptables
update podman1 --network-dns-servers 8.8.8.8
assert "$output" = ""
+ # after update the pid should never change
+ aardvark_pid2=$(cat "$NETAVARK_TMPDIR/config/aardvark-dns/aardvark.pid")
+ assert "$aardvark_pid2" == "$aardvark_pid" "aardvark-dns pid after nv update"
+
# check aardvark config and running
run_helper cat "$NETAVARK_TMPDIR/config/aardvark-dns/podman1"
assert "${lines[0]}" =~ "10.89.3.1,fd10:88:a::1 8.8.8.8" "aardvark set to listen to all IPs"