Skip to content

Commit ac34fbf

Browse files
committed
gw: Validate IP is within client_ip_range in valid_ip()
When gateway config changes and client_ip_range is modified, existing CVMs may have IPs outside the new range. The valid_ip() function now checks if IP is within client_ip_range, causing re-registration to allocate a new IP within the valid range.
1 parent 51152d5 commit ac34fbf

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

gateway/src/main_service.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,10 @@ fn reload_instances_from_kv_store(proxy: &Proxy, store: &KvStore) -> Result<()>
782782

783783
impl ProxyState {
784784
fn valid_ip(&self, ip: Ipv4Addr) -> bool {
785+
// Must be within client IP range
786+
if !self.config.wg.client_ip_range.contains(&ip) {
787+
return false;
788+
}
785789
if self.config.wg.ip.broadcast() == ip {
786790
return false;
787791
}

0 commit comments

Comments
 (0)