summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e4bde15)
raw | patch | inline | side by side (parent: e4bde15)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Jan 2008 08:50:28 +0000 (08:50 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Jan 2008 08:50:28 +0000 (08:50 +0000) |
TODO: Check for global rule if service should be started.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8647 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8647 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/ArpHandler.pm | patch | blob | history |
index 1590572a76e829bd5732b6abc5032163808aa804..be47d61400b9fdf05cb67725313445a27df369ed 100644 (file)
use strict;
use warnings;
use GOSA::GosaSupportDaemon;
-use Getopt::Long;
-use Config::IniFiles;
use POSIX;
use Fcntl;
use Net::LDAP;
use Net::DNS;
use Switch;
use Data::Dumper;
-use Socket qw/PF_INET SOCK_DGRAM inet_ntoa sockaddr_in/;
-use POE qw(Component::Pcap Component::ArpWatch);
-BEGIN{}
+# Don't start if some of the modules are missing
+my $start_service=1;
+BEGIN{
+ unless(eval('use Socket qw(PF_INET SOCK_DGRAM inet_ntoa sockaddr_in)')) {
+ $start_service=0;
+ }
+ unless(eval('use POE qw(Component::Pcap Component::ArpWatch)')) {
+ $start_service=0;
+ }
+}
+
END{}
my ($timeout, $mailto, $mailfrom, $user, $group);
"socket",
);
- $ldap = Net::LDAP->new("ldap.intranet.gonicus.de") or die "$@";
+ # Don't start if some of the modules are missing
+ if($start_service) {
+ eval {
+ $ldap = Net::LDAP->new("ldap.intranet.gonicus.de");
+ };
+ if ($@) {
+ &main::daemon_log("Could not connect to LDAP Server!\n$@", 1);
+ } else {
+ &main::daemon_log("Could not connect to LDAP Server!\n$@", 1);
- # When interface is not configured (or 'all'), start arpwatch on all possible interfaces
- if ((!defined($interface)) || $interface eq 'all') {
- foreach my $device(&get_interfaces) {
- # TODO: Need a better workaround for IPv4-to-IPv6 bridges
- if($device =~ m/^sit.$/) {
- next;
- }
+ }
+
+ # When interface is not configured (or 'all'), start arpwatch on all possible interfaces
+ if ((!defined($interface)) || $interface eq 'all') {
+ foreach my $device(&get_interfaces) {
+ # TODO: Need a better workaround for IPv4-to-IPv6 bridges
+ if($device =~ m/^sit\d+$/) {
+ next;
+ }
- # If device has a valid mac address
- if(not(&get_mac($device) eq "00:00:00:00:00:00")) {
+ # If device has a valid mac address
+ if(not(&get_mac($device) eq "00:00:00:00:00:00")) {
+ &main::daemon_log("Starting ArpWatch on $device", 1);
+ POE::Session->create(
+ inline_states => {
+ _start => sub {
+ &start(@_,$device);
+ },
+ _stop => sub {
+ $_[KERNEL]->post( sprintf("arp_watch_$device") => 'shutdown' )
+ },
+ got_packet => \&got_packet,
+ },
+ );
+ }
+ }
+ } else {
+ foreach my $device(split(/[\s,]+/, $interface)) {
&main::daemon_log("Starting ArpWatch on $device", 1);
POE::Session->create(
inline_states => {
);
}
}
- } else {
- foreach my $device(split(/[\s,]+/, $interface)) {
- &main::daemon_log("Starting ArpWatch on $device", 1);
- POE::Session->create(
- inline_states => {
- _start => sub {
- &start(@_,$device);
- },
- _stop => sub {
- $_[KERNEL]->post( sprintf("arp_watch_$device") => 'shutdown' )
- },
- got_packet => \&got_packet,
- },
- );
- }
}
-
return \@info;
}