Skip to content

Commit edafe60

Browse files
committed
ipcache: reopen if name changes
Signed-off-by: Jarno Rajahalme <[email protected]>
1 parent 67b7ec8 commit edafe60

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cilium/ipcache.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,19 @@ IPCache::IPCache(const std::string& path)
9292

9393
void IPCache::SetPath(const std::string& path) {
9494
Thread::LockGuard guard(path_mutex_);
95-
path_ = path;
95+
if (path != path_) {
96+
path_ = path;
97+
// re-open on path change
98+
open_locked();
99+
}
96100
}
97101

98102
bool IPCache::Open() {
99103
Thread::LockGuard guard(path_mutex_);
104+
return open_locked();
105+
}
100106

107+
bool IPCache::open_locked() {
101108
if (Bpf::open(path_)) {
102109
ENVOY_LOG(debug, "cilium.ipcache: Opened ipcache at {}", path_);
103110
return true;

cilium/ipcache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class IPCache : public Singleton::Instance, public Bpf {
2424
IPCache(const std::string& path);
2525
void SetPath(const std::string& path);
2626
bool Open();
27+
bool open_locked();
2728

2829
uint32_t resolve(const Network::Address::Ip* ip);
2930

0 commit comments

Comments
 (0)