summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d9515b)
raw | patch | inline | side by side (parent: 2d9515b)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Jan 2008 07:32:58 +0000 (07:32 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Jan 2008 07:32:58 +0000 (07:32 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8610 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/ArpHandler.pm | patch | blob | history |
index 38a93a57a6efc9edf4ea1e637b400a796e697504..7eb08205dee828165842d0937050dc001e788f6e 100644 (file)
$ldap = Net::LDAP->new("ldap.intranet.gonicus.de") or die "$@";
+ # When interface is not configured (or 'all'), start arpwatch on all possible interfaces
if ((!defined($interface)) || $interface eq 'all') {
foreach my $device(&get_interfaces) {
+
+ # 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(
&start(@_,$device);
},
_stop => sub {
- $_[KERNEL]->post( eval("arp_watch_$device") => 'shutdown' )
+ $_[KERNEL]->post( sprintf("arp_watch_$device") => 'shutdown' )
},
got_packet => \&got_packet,
},
inline_states => {
_start => \&start,
_stop => sub {
- $_[KERNEL]->post( arp_watch => 'shutdown' )
+ $_[KERNEL]->post( sprintf("arp_watch_$interface") => 'shutdown' )
},
got_packet => \&got_packet,
},
}
sub process_incoming_msg {
- return 0;
+ return 1;
}
sub start {
- my $device = $_[ARG0] || 'eth0';
+ my $device = (exists($_[ARG0])?$_[ARG0]:'eth0');
POE::Component::ArpWatch->spawn(
- Alias => eval("arp_watch_$device"),
- Device => 'eth0',
+ Alias => sprintf("arp_watch_$device"),
+ Device => $device,
Dispatch => 'got_packet',
Session => $_[SESSION],
);
- $_[KERNEL]->post( arp_watch => 'run' );
+ $_[KERNEL]->post( sprintf("arp_watch_$device") => 'run' );
}
sub got_packet {