Skip to content

Commit

Permalink
is_subnet_of fix
Browse files Browse the repository at this point in the history
was broken if the supernet was not the network address.

Signed-off-by: Fredrick Brennan <copypaste@kittens.ph>
  • Loading branch information
Barre authored and ctrlcctrlv committed Jun 13, 2023
1 parent ca2da8a commit 50640b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Ipv4Network {

/// Checks if the given `Ipv4Network` is a subnet of the other.
pub fn is_subnet_of(self, other: Ipv4Network) -> bool {
other.ip() <= self.ip() && other.broadcast() >= self.broadcast()
other.network() <= self.network() && other.broadcast() >= self.broadcast()
}

/// Checks if the given `Ipv4Network` is a supernet of the other.
Expand Down
2 changes: 1 addition & 1 deletion src/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl Ipv6Network {

/// Checks if the given `Ipv6Network` is a subnet of the other.
pub fn is_subnet_of(self, other: Ipv6Network) -> bool {
other.ip() <= self.ip() && other.broadcast() >= self.broadcast()
other.network() <= self.network() && other.broadcast() >= self.broadcast()
}

/// Checks if the given `Ipv6Network` is a supernet of the other.
Expand Down

0 comments on commit 50640b6

Please sign in to comment.