From 56d37c8dbfe5793212163814e6ca34b9ee6d34e2 Mon Sep 17 00:00:00 2001 From: Leo-Andres Hofmann Date: Tue, 12 Jan 2021 19:11:14 +0100 Subject: [PATCH] header.pl: Remove duplicate "IpInSubnet" function This function is deprecated. The commonly used and maintained "IpInSubnet" function can be found in general-functions.pl. Signed-off-by: Leo-Andres Hofmann Signed-off-by: Michael Tremer --- config/cfgroot/header.pl | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index e2e6fd6892..5684c01c55 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -311,22 +311,6 @@ sub getcgihash { return; } - -# Test if IP is within a subnet -# Call: IpInSubnet (Addr, Subnet, Subnet Mask) -# Subnet can be an IP of the subnet: 10.0.0.0 or 10.0.0.1 -# Everything in dottted notation -# Return: TRUE/FALSE -sub IpInSubnet -{ - $ip = unpack('N', inet_aton(shift)); - $start = unpack('N', inet_aton(shift)); - $mask = unpack('N', inet_aton(shift)); - $start &= $mask; # base of subnet... - $end = $start + ~$mask; - return (($ip >= $start) && ($ip <= $end)); -} - sub escape($) { my $s = shift; return HTML::Entities::encode_entities($s); @@ -559,13 +543,13 @@ sub colorize { return "".$string.""; } elsif ( $string =~ "lo" or $string =~ "127.0.0.0" ){ return "".$string.""; - } elsif ( $string =~ $ethsettings{'GREEN_DEV'} or &IpInSubnet($string2,$ethsettings{'GREEN_NETADDRESS'},$ethsettings{'GREEN_NETMASK'}) ){ + } elsif ( $string =~ $ethsettings{'GREEN_DEV'} or &General::IpInSubnet($string2,$ethsettings{'GREEN_NETADDRESS'},$ethsettings{'GREEN_NETMASK'}) ){ return "".$string.""; } elsif ( $string =~ "ppp0" or $string =~ $ethsettings{'RED_DEV'} or $string =~ "0.0.0.0" or $string =~ $ethsettings{'RED_ADDRESS'} ){ return "".$string.""; - } elsif ( $ethsettings{'CONFIG_TYPE'}>1 and ( $string =~ $ethsettings{'BLUE_DEV'} or &IpInSubnet($string2,$ethsettings{'BLUE_NETADDRESS'},$ethsettings{'BLUE_NETMASK'}) )){ + } elsif ( $ethsettings{'CONFIG_TYPE'}>1 and ( $string =~ $ethsettings{'BLUE_DEV'} or &General::IpInSubnet($string2,$ethsettings{'BLUE_NETADDRESS'},$ethsettings{'BLUE_NETMASK'}) )){ return "".$string.""; - } elsif ( $ethsettings{'CONFIG_TYPE'}>2 and ( $string =~ $ethsettings{'ORANGE_DEV'} or &IpInSubnet($string2,$ethsettings{'ORANGE_NETADDRESS'},$ethsettings{'ORANGE_NETMASK'}) )){ + } elsif ( $ethsettings{'CONFIG_TYPE'}>2 and ( $string =~ $ethsettings{'ORANGE_DEV'} or &General::IpInSubnet($string2,$ethsettings{'ORANGE_NETADDRESS'},$ethsettings{'ORANGE_NETMASK'}) )){ return "".$string.""; } else { return $string; -- 2.39.2