Interfaces/Diagnostics/Packet Capture - add frontend options for https://github.com/opnsense/core/issues/5981

This commit is contained in:
Ad Schellevis 2022-08-28 20:06:07 +02:00
parent 92910cb4e8
commit 2941b4eb14
3 changed files with 147 additions and 2 deletions

View File

@ -1,14 +1,79 @@
<form>
<field>
<field>
<id>packetcapture.settings.interface</id>
<label>Interface</label>
<type>select_multiple</type>
<help>Interfaces to capture.</help>
</field>
<field>
<id>packetcapture.settings.promiscuous</id>
<label>Promiscuous</label>
<type>checkbox</type>
<help>When set, the system will capture all traffic present on the interface in stead of the traffic heading to the firewall.</help>
</field>
<field>
<id>packetcapture.settings.fam</id>
<label>Address Family</label>
<type>dropdown</type>
<help>Select the type of traffic to be captured, either Any, IPv4 only or IPv6 only.</help>
</field>
<field>
<id>packetcapture.settings.protocol_not</id>
<label>Invert Protocol</label>
<type>checkbox</type>
<help>invert protocol (not)</help>
</field>
<field>
<id>packetcapture.settings.protocol</id>
<label>Protocol</label>
<type>dropdown</type>
<help>Select the type of traffic to be captured, either Any, IPv4 only or IPv6 only.</help>
</field>
<field>
<id>packetcapture.settings.host</id>
<label>Host Address</label>
<type>text</type>
<help>
This value is either the Source or Destination IP address or subnet in CIDR notation.
The packet capture will look for this address in either field.
Matching can be negated by preceding the value with "not".
Multiple IP addresses or CIDR subnets may be specified as boolean expression.
If you leave this field blank, all packets on the specified interface will be captured.
Example: not 10.0.0.0/24 not and not 11.0.0.1
</help>
</field>
<field>
<id>packetcapture.settings.port_not</id>
<label>Invert Port</label>
<type>checkbox</type>
<help>invert port (not)</help>
</field>
<field>
<id>packetcapture.settings.port</id>
<label>Port</label>
<type>text</type>
<help>The port can be either the source or destination port. The packet capture will look for this port in either field.</help>
</field>
<field>
<id>packetcapture.settings.snaplen</id>
<label>Packet Length</label>
<type>text</type>
<help>The Packet length is the number of bytes of each packet that will be captured. Default value is 0, which will capture the entire frame regardless of its size.</help>
</field>
<field>
<id>packetcapture.settings.count</id>
<label>Count</label>
<type>text</type>
<help>
This is the number of packets the packet capture will grab. Default value is 100.
Enter 0 (zero) for no count limit.
</help>
</field>
<field>
<id>packetcapture.settings.description</id>
<label>Description</label>
<type>text</type>
<help>Optional description to easily find this capture job when more are active.</help>
<help>Select the protocol to capture, or Any.</help>
</field>
</form>

View File

@ -0,0 +1,38 @@
<?php
/**
* Copyright (C) 2022 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Diagnostics\FieldTypes;
use OPNsense\Base\FieldTypes\BaseField;
class HostField extends BaseField
{
// TODO: implement validation
}

View File

@ -16,6 +16,48 @@
<mask>/^(.){1,255}$/u</mask>
<ValidationMessage>Description should be a string between 1 and 255 characters</ValidationMessage>
</description>
<promiscuous type="BooleanField">
<default>0</default>
<Required>Y</Required>
</promiscuous>
<fam type="OptionField">
<Required>Y</Required>
<OptionValues>
<any>any</any>
<ip>IPv4 Only</ip>
<ip6>IPv6 Only</ip6>
</OptionValues>
</fam>
<protocol_not type="BooleanField">
<default>0</default>
<Required>Y</Required>
</protocol_not>
<protocol type="ProtocolField">
<Required>Y</Required>
<default>any</default>
</protocol>
<host type=".\HostField">
<Required>N</Required>
</host>
<port_not type="BooleanField">
<default>0</default>
<Required>Y</Required>
</port_not>
<port type="IntegerField">
<Required>N</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>65535</MaximumValue>
</port>
<snaplen type="IntegerField">
<Required>N</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>262144</MaximumValue>
</snaplen>
<count type="IntegerField">
<Required>Y</Required>
<default>100</default>
<MinimumValue>0</MinimumValue>
</count>
</settings>
</items>
</model>