/[smecontribs]/rpms/smeserver-dhcpmanager/contribs10/smeserver-dhcpmanager-2.0.4-Yet-more-changes-for-SM2-panels.patch
ViewVC logotype

Diff of /rpms/smeserver-dhcpmanager/contribs10/smeserver-dhcpmanager-2.0.4-Yet-more-changes-for-SM2-panels.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.6 by brianr, Sun Jan 21 16:59:03 2024 UTC Revision 1.7 by brianr, Mon Jan 22 20:02:27 2024 UTC
# Line 1  Line 1 
1  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm  diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm
2  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm     2023-12-19 09:44:56.678590486 +0000  --- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm     2023-12-19 09:44:56.678590486 +0000
3  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2024-01-21 16:53:00.000000000 +0000  +++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2024-01-22 19:57:00.000000000 +0000
4  @@ -140,12 +140,12 @@  @@ -140,12 +140,12 @@
5          my $c = shift;          my $c = shift;
6       my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");       my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE");
# Line 68  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 68  diff -urN smeserver-dhcpmanager-2.0.4.ol
68       return "ok";       return "ok";
69   }   }
70    
71  @@ -391,6 +391,167 @@  @@ -391,6 +391,169 @@
72       return @leases;       return @leases;
73   }   }
74    
# Line 185  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 185  diff -urN smeserver-dhcpmanager-2.0.4.ol
185  +    my ($ip) = trim(@_);  +    my ($ip) = trim(@_);
186  +    # Ping the IP to ensure it's in the ARP table  +    # Ping the IP to ensure it's in the ARP table
187  +    my $ping_result = `ping -c 1 -W 1 $ip`;  +    my $ping_result = `ping -c 1 -W 1 $ip`;
188  +    if($ping_result =~ /1 packets transmitted, 1 received/) {  +    #return $ping_result;
189    +    if($ping_result =~ m/1 packets transmitted, 1 received/) {
190  +        # Fetch the ARP table and find the line with the IP address  +        # Fetch the ARP table and find the line with the IP address
191  +        my $arp_result = `arp -an | grep "\($ip)"`;  +        my $mac_result = `nmap -PR -sn $ip`;
192    +        #return "*$arp_result *$ip*";
193  +        # If found, return the MAC address  +        # If found, return the MAC address
194  +        return $arp_result;  +        #if ($arp_result =~ m/.*at ((?:[0-9a-f]{2}\:){5}[0-9a-f]{2})/) {
195  +        if ($arp_result =~ /.*at ((?:[0-9a-f]{2}\:){5}[0-9a-f]{2})/) {  +               if ($mac_result =~ /MAC Address: (..:..:..:..:..:..) /) {
196  +            return $1;  +            return $1;
197  +        } else { return "not in arp table"}  +        } else { return "mac not in nmap result";}
198  +    } else { return "no ping"}  +    } else { return "no ping";}
199  +    return undef;  +    return undef;
200  +}  +}
201  +  +
# Line 223  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 225  diff -urN smeserver-dhcpmanager-2.0.4.ol
225  +                       if (!$mac){  +                       if (!$mac){
226  +                               $mac = get_mac_address_by_ping($ip);  +                               $mac = get_mac_address_by_ping($ip);
227  +                       }  +                       }
228  +                       if (!$mac) {$mac = "unknown";}  +#                      if (!$mac) {$mac = "unknown";}
229  +                       my %pair = ('Network' => $1, 'ip' => $ip, 'mac' => $mac);  # $1 => PC Name, $2 => IP Address  +                       my %pair = ('Network' => $1, 'ip' => $ip, 'mac' => $mac);  # $1 => PC Name, $2 => IP Address
230  +                       push @extracted_output, \%pair;  +                       push @extracted_output, \%pair;
231  +       }  +       }
# Line 236  diff -urN smeserver-dhcpmanager-2.0.4.ol Line 238  diff -urN smeserver-dhcpmanager-2.0.4.ol
238   #=========================================================================   #=========================================================================
239   # Procedure qui charge le dhcpd.conf   # Procedure qui charge le dhcpd.conf
240   # retourne un tableau contenant les informations   # retourne un tableau contenant les informations
241  @@ -536,4 +697,4 @@  @@ -536,4 +699,4 @@
242    
243   1;   1;
244    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed