this patch resets all pseudo devices to have no layer3 support but adds a feature to the pseudo devices admin panel to enable layer3 support. it also changes arpnip and arpwalk behaviour to always permit the action if layer3 is available (ignoring the vendor). documentation will need updating to tell users to create pseudo devices with layer3 support when they want to arpnip an unsupported platform. arpnip with ssh/cli against a supported platform (one that can be discovered) will continue to work normally. Squashed commit of the following: commit9dad5be81dAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 09:03:53 2019 +0100 allow pseudo with layer 3 to run arpnip commit7d97943fcdAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 08:59:10 2019 +0100 allow pseudo devices with layer 2/3 capability commitd1fdf574e3Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 08:55:41 2019 +0100 move pseudo and layer checks to is_able from is_able_now commite0f72ef67dAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 08:51:42 2019 +0100 ports defaults to one commit86ba01270cAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 08:50:45 2019 +0100 add tooltip for arpnip toggle commitcdd2470228Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 08:34:46 2019 +0100 simplify template commit46236d68eaAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Sep 1 23:53:56 2019 +0100 a fix up for pseudo devices which need layer 3 commit016d249efcAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Sep 1 20:37:11 2019 +0100 do not wrap buttons commit1ec1402e0cAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Sep 1 20:33:03 2019 +0100 implement user settable layer-three service for pseudo devices commita267efa3d8Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Sep 1 18:39:22 2019 +0100 only set layer if successful action commitb108be5e23Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Sep 1 18:32:19 2019 +0100 should defer SNMP against pseudo devices commit897ba3a629Merge:e0ddbaaba7348900Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Sep 1 14:54:36 2019 +0100 Merge branch 'master' into og-pseudo-vs-cli-arpnip commite0ddbaab08Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Aug 26 11:35:13 2019 +0100 as last commit, for discover commit61f9c89040Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Aug 25 23:55:38 2019 +0100 move pseudo and layer checks into is_*able functions commit8b010d4023Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Aug 25 18:38:11 2019 +0100 any device completing macsuck/arpnip must have that layer commita11bce7863Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Aug 25 18:33:27 2019 +0100 clean up device layers commitd2661bff61Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Aug 25 18:18:02 2019 +0100 first make arpnip behave like other jobs towards pseudo devices
This commit is contained in:
@@ -158,6 +158,8 @@ If C<$device_type> is also given, then C<discover_no_type> will be checked.
|
||||
Also respects C<discover_phones> and C<discover_waps> if either are set to
|
||||
false.
|
||||
|
||||
Also checks if the device is a pseudo device (vendor is C<netdisco>).
|
||||
|
||||
Returns false if the host is not permitted to discover the target device.
|
||||
|
||||
=cut
|
||||
@@ -168,6 +170,9 @@ sub is_discoverable {
|
||||
$remote_type ||= '';
|
||||
$remote_cap ||= [];
|
||||
|
||||
return _bail_msg("is_discoverable: $device is pseudo-device")
|
||||
if $device->is_pseudo;
|
||||
|
||||
return _bail_msg("is_discoverable: $device matches wap_platforms but discover_waps is not enabled")
|
||||
if ((not setting('discover_waps')) and
|
||||
(match_to_setting($remote_type, 'wap_platforms') or
|
||||
@@ -192,9 +197,8 @@ sub is_discoverable {
|
||||
|
||||
=head2 is_discoverable_now( $ip, $device_type? )
|
||||
|
||||
Same as C<is_discoverable>, but also checks the last_discover field if the
|
||||
device is in storage, and returns false if that host has been too recently
|
||||
discovered.
|
||||
Same as C<is_discoverable>, but also compares the C<last_discover> field
|
||||
of the C<device> to the C<discover_min_age> configuration.
|
||||
|
||||
Returns false if the host is not permitted to discover the target device.
|
||||
|
||||
@@ -222,6 +226,8 @@ the local configuration to arpnip the device.
|
||||
The configuration items C<arpnip_no> and C<arpnip_only> are checked
|
||||
against the given IP.
|
||||
|
||||
Also checks if the device reports layer 3 capability.
|
||||
|
||||
Returns false if the host is not permitted to arpnip the target device.
|
||||
|
||||
=cut
|
||||
@@ -230,6 +236,9 @@ sub is_arpnipable {
|
||||
my $ip = shift;
|
||||
my $device = get_device($ip) or return 0;
|
||||
|
||||
return _bail_msg("is_arpnipable: $device has no layer 3 capability")
|
||||
unless $device->has_layer(3);
|
||||
|
||||
return _bail_msg("is_arpnipable: $device matched arpnip_no")
|
||||
if check_acl_no($device, 'arpnip_no');
|
||||
|
||||
@@ -241,9 +250,8 @@ sub is_arpnipable {
|
||||
|
||||
=head2 is_arpnipable_now( $ip )
|
||||
|
||||
Same as C<is_arpnipable>, but also checks the last_arpnip field if the
|
||||
device is in storage, and returns false if that host has been too recently
|
||||
arpnipped.
|
||||
Same as C<is_arpnipable>, but also compares the C<last_arpnip> field
|
||||
of the C<device> to the C<arpnip_min_age> configuration.
|
||||
|
||||
Returns false if the host is not permitted to arpnip the target device.
|
||||
|
||||
@@ -271,6 +279,8 @@ the local configuration to macsuck the device.
|
||||
The configuration items C<macsuck_no> and C<macsuck_only> are checked
|
||||
against the given IP.
|
||||
|
||||
Also checks if the device reports layer 2 capability.
|
||||
|
||||
Returns false if the host is not permitted to macsuck the target device.
|
||||
|
||||
=cut
|
||||
@@ -279,6 +289,9 @@ sub is_macsuckable {
|
||||
my $ip = shift;
|
||||
my $device = get_device($ip) or return 0;
|
||||
|
||||
return _bail_msg("is_macsuckable: $device has no layer 2 capability")
|
||||
unless $device->has_layer(2);
|
||||
|
||||
return _bail_msg("is_macsuckable: $device matched macsuck_no")
|
||||
if check_acl_no($device, 'macsuck_no');
|
||||
|
||||
@@ -290,9 +303,8 @@ sub is_macsuckable {
|
||||
|
||||
=head2 is_macsuckable_now( $ip )
|
||||
|
||||
Same as C<is_macsuckable>, but also checks the last_macsuck field if the
|
||||
device is in storage, and returns false if that host has been too recently
|
||||
macsucked.
|
||||
Same as C<is_macsuckable>, but also compares the C<last_macsuck> field
|
||||
of the C<device> to the C<macsuck_min_age> configuration.
|
||||
|
||||
Returns false if the host is not permitted to macsuck the target device.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user