mirror of
https://github.com/opnsense/plugins.git
synced 2026-02-03 20:40:37 -05:00
net/ndp-proxy-go: Add initial plugin version (#4998)
This commit is contained in:
parent
1b489c0a68
commit
f4b6ed6b80
16 changed files with 535 additions and 0 deletions
7
net/ndp-proxy-go/Makefile
Normal file
7
net/ndp-proxy-go/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
PLUGIN_NAME= ndp-proxy-go
|
||||
PLUGIN_VERSION= 0.1
|
||||
PLUGIN_COMMENT= IPv6 Neighbor Discovery Protocol Proxy
|
||||
PLUGIN_MAINTAINER= cedrik@pischem.com
|
||||
PLUGIN_DEPENDS= ndp-proxy-go
|
||||
|
||||
.include "../../Mk/plugins.mk"
|
||||
8
net/ndp-proxy-go/pkg-descr
Normal file
8
net/ndp-proxy-go/pkg-descr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
IPv6 Neighbor Discovery (ND), Router Advertisement (RA) and Duplicate Address Detection (DAD) Proxy
|
||||
|
||||
Plugin Changelog
|
||||
================
|
||||
|
||||
0.1
|
||||
|
||||
* Initial Release
|
||||
66
net/ndp-proxy-go/src/etc/inc/plugins.inc.d/ndpproxy.inc
Normal file
66
net/ndp-proxy-go/src/etc/inc/plugins.inc.d/ndpproxy.inc
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2025 Cedrik Pischem
|
||||
* 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.
|
||||
*/
|
||||
|
||||
function ndpproxy_services()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$services = [];
|
||||
|
||||
if (
|
||||
isset($config['OPNsense']['ndpproxy']['general']['enabled']) &&
|
||||
$config['OPNsense']['ndpproxy']['general']['enabled'] == 1
|
||||
) {
|
||||
$services[] = [
|
||||
'description' => gettext('NDP Proxy'),
|
||||
'configd' => [
|
||||
'start' => ['ndpproxy start'],
|
||||
'restart' => ['ndpproxy restart'],
|
||||
'stop' => ['ndpproxy stop'],
|
||||
],
|
||||
'name' => 'ndpproxy',
|
||||
'pidfile' => '/var/run/ndp_proxy_go.pid'
|
||||
];
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
function ndpproxy_xmlrpc_sync()
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$result[] = array(
|
||||
'description' => gettext('NDP Proxy'),
|
||||
'section' => 'OPNsense.ndpproxy',
|
||||
'id' => 'ndpproxy',
|
||||
'services' => ["ndpproxy"],
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2025 Cedrik Pischem
|
||||
*
|
||||
* 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\NdpProxy\Api;
|
||||
|
||||
use OPNsense\Base\ApiMutableModelControllerBase;
|
||||
use OPNsense\Core\Config;
|
||||
|
||||
class GeneralController extends ApiMutableModelControllerBase
|
||||
{
|
||||
protected static $internalModelName = 'ndpproxy';
|
||||
protected static $internalModelClass = 'OPNsense\NdpProxy\NdpProxy';
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2025 Cedrik Pischem
|
||||
*
|
||||
* 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\NdpProxy\Api;
|
||||
|
||||
use OPNsense\Base\ApiMutableServiceControllerBase;
|
||||
|
||||
class ServiceController extends ApiMutableServiceControllerBase
|
||||
{
|
||||
protected static $internalServiceClass = '\OPNsense\NdpProxy\NdpProxy';
|
||||
protected static $internalServiceTemplate = 'OPNsense/NdpProxy';
|
||||
protected static $internalServiceEnabled = 'general.enabled';
|
||||
protected static $internalServiceName = 'ndpproxy';
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2025 Cedrik Pischem
|
||||
*
|
||||
* 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\NdpProxy;
|
||||
|
||||
use OPNsense\Base\IndexController;
|
||||
|
||||
class GeneralController extends IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->pick('OPNsense/NdpProxy/general');
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
<form>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>General Settings</label>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.enabled</id>
|
||||
<label>Enable</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable or disable this service.</help>
|
||||
</field>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>Proxy Settings</label>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.upstream</id>
|
||||
<label>Upstream interface</label>
|
||||
<type>dropdown</type>
|
||||
<help>Choose the upstream interface which receives the external IPv6 prefix from the ISP. Usually, this is the WAN interface.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.downstream</id>
|
||||
<label>Downstream interfaces</label>
|
||||
<type>select_multiple</type>
|
||||
<help>Choose one or multiple downstream interfaces which should proxy the upstream IPv6 prefix.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.ra</id>
|
||||
<label>Proxy router advertisements</label>
|
||||
<type>checkbox</type>
|
||||
<help>Proxy upstream RAs to downstream interfaces. Disable this if you use your own RA daemon.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.routes</id>
|
||||
<label>Install host routes</label>
|
||||
<type>checkbox</type>
|
||||
<help>Automatically create host routes for discovered clients. Disabling this means you must manually handle all routing decisions.</help>
|
||||
</field>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>Performance Settings</label>
|
||||
<collapse>true</collapse>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.cache_ttl</id>
|
||||
<label>Neighbor cache lifetime</label>
|
||||
<type>text</type>
|
||||
<hint>10</hint>
|
||||
<help>Neighbor cache lifetime in minutes.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.cache_max</id>
|
||||
<label>Maximum learned neighbors</label>
|
||||
<type>text</type>
|
||||
<hint>4096</hint>
|
||||
<help>Maximum learned neighbors, increase for large networks.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.route_qps</id>
|
||||
<label>Max route operations</label>
|
||||
<type>text</type>
|
||||
<hint>50</hint>
|
||||
<help>Max route operations per second, increase for large networks.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.pcap_timeout</id>
|
||||
<label>Packet capture timeout</label>
|
||||
<type>text</type>
|
||||
<hint>50</hint>
|
||||
<help>Controls CPU usage vs. NDP responsiveness. Lower values (e.g., 25 ms) minimize latency during cache refresh at the cost of more CPU. Higher values (100–250 ms) reduce CPU use but may introduce small latency spikes.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ndpproxy.general.debug</id>
|
||||
<label>Debug log</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable debug logging.</help>
|
||||
</field>
|
||||
</form>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<acl>
|
||||
<page-ndp-proxy-general>
|
||||
<name>Services: NDP Proxy: General Settings</name>
|
||||
<description>Allow access to NDP Proxy General Settings</description>
|
||||
<patterns>
|
||||
<pattern>ui/ndpproxy/general/*</pattern>
|
||||
<pattern>api/ndpproxy/general/*</pattern>
|
||||
</patterns>
|
||||
</page-ndp-proxy-general>
|
||||
<page-ndp-proxy-log>
|
||||
<name>Services: NDP Proxy: Log File</name>
|
||||
<patterns>
|
||||
<pattern>ui/diagnostics/log/core/ndpproxy/*</pattern>
|
||||
<pattern>api/diagnostics/log/core/ndpproxy/*</pattern>
|
||||
</patterns>
|
||||
</page-ndp-proxy-log>
|
||||
</acl>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<menu>
|
||||
<Services>
|
||||
<ndpproxy VisibleName="NDP Proxy" cssClass="fa fa-bullseye fa-fw">
|
||||
<Settings order="10" url="/ui/ndpproxy/general"/>
|
||||
<Log VisibleName="Log File" order="20" url="/ui/diagnostics/log/core/ndpproxy"/>
|
||||
</ndpproxy>
|
||||
</Services>
|
||||
</menu>
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2025 Cedrik Pischem
|
||||
*
|
||||
* 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\NdpProxy;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
use OPNsense\Base\Messages\Message;
|
||||
|
||||
class NdpProxy extends BaseModel
|
||||
{
|
||||
private function checkConfiguration($messages)
|
||||
{
|
||||
if ($this->general->enabled->isEqual('1')) {
|
||||
foreach (['upstream', 'downstream'] as $field) {
|
||||
if ($this->general->$field->isEmpty()) {
|
||||
$messages->appendMessage(new Message(
|
||||
gettext('Interface is required.'),
|
||||
"general.$field"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$upstream = $this->general->upstream->getValue();
|
||||
$downstreamList = array_filter(explode(',', $this->general->downstream->getValue()));
|
||||
|
||||
if (!empty($upstream) && in_array($upstream, $downstreamList, true)) {
|
||||
$messages->appendMessage(new Message(
|
||||
gettext('Downstream interfaces cannot contain upstream interface.'),
|
||||
'general.downstream'
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function performValidation($validateFullModel = false)
|
||||
{
|
||||
$messages = parent::performValidation($validateFullModel);
|
||||
$this->checkConfiguration($messages);
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<model>
|
||||
<mount>//OPNsense/ndpproxy</mount>
|
||||
<description>NDP Proxy model</description>
|
||||
<version>0.2</version>
|
||||
<items>
|
||||
<general>
|
||||
<enabled type="BooleanField">
|
||||
<Default>0</Default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<upstream type="InterfaceField"/>
|
||||
<downstream type="InterfaceField">
|
||||
<Multiple>Y</Multiple>
|
||||
</downstream>
|
||||
<ra type="BooleanField">
|
||||
<Default>1</Default>
|
||||
<Required>Y</Required>
|
||||
</ra>
|
||||
<routes type="BooleanField">
|
||||
<Default>1</Default>
|
||||
<Required>Y</Required>
|
||||
</routes>
|
||||
<cache_ttl type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
</cache_ttl>
|
||||
<cache_max type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
</cache_max>
|
||||
<route_qps type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
</route_qps>
|
||||
<pcap_timeout type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
</pcap_timeout>
|
||||
<debug type="BooleanField">
|
||||
<Default>0</Default>
|
||||
<Required>Y</Required>
|
||||
</debug>
|
||||
</general>
|
||||
</items>
|
||||
</model>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
{#
|
||||
# Copyright (c) 2025 Cedrik Pischem
|
||||
# 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.
|
||||
#}
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
mapDataToFormUI({'frm_GeneralSettings': "/api/ndpproxy/general/get"}).done(function() {
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
updateServiceControlUI('ndpproxy');
|
||||
});
|
||||
|
||||
$("#reconfigureAct").SimpleActionButton({
|
||||
onPreAction: function() {
|
||||
const dfObj = $.Deferred();
|
||||
saveFormToEndpoint("/api/ndpproxy/general/set", 'frm_GeneralSettings', dfObj.resolve, true, dfObj.reject);
|
||||
return dfObj;
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="content-box __mb">
|
||||
{{ partial("layout_partials/base_form", ['fields': generalForm, 'id': 'frm_GeneralSettings']) }}
|
||||
</div>
|
||||
{{ partial('layout_partials/base_apply_button', {'data_endpoint': '/api/ndpproxy/service/reconfigure', 'data_service_widget': 'ndpproxy'}) }}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
[start]
|
||||
command:service ndp-proxy-go start
|
||||
parameters:
|
||||
type:script
|
||||
message:Starting NDP Proxy service
|
||||
|
||||
[stop]
|
||||
command:service ndp-proxy-go stop
|
||||
parameters:
|
||||
type:script
|
||||
message:Stopping NDP Proxy service
|
||||
|
||||
[restart]
|
||||
command:service ndp-proxy-go restart
|
||||
parameters:
|
||||
type:script
|
||||
message:Restarting NDP Proxy service
|
||||
description:Restart NDP Proxy service
|
||||
|
||||
[status]
|
||||
command:service ndp-proxy-go status
|
||||
parameters:
|
||||
type:script_output
|
||||
message:Requesting NDP Proxy status
|
||||
|
|
@ -0,0 +1 @@
|
|||
ndp_proxy_go:/etc/rc.conf.d/ndp_proxy_go
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
# DO NOT EDIT THIS FILE -- OPNsense auto-generated file
|
||||
{% set general = helpers.getNodeByTag('OPNsense.ndpproxy.general') %}
|
||||
{% if general.enabled|default("0") == "1" and general.upstream and general.downstream %}
|
||||
ndp_proxy_go_enable="YES"
|
||||
ndp_proxy_go_upstream="{{ helpers.physical_interface(general.upstream) }}"
|
||||
{% set downstream_interfaces = [] %}
|
||||
{% for interface in general.downstream.split(',') %}
|
||||
{% do downstream_interfaces.append(helpers.physical_interface(interface)) %}
|
||||
{% endfor %}
|
||||
ndp_proxy_go_downstream="{{ downstream_interfaces|join(' ') }}"
|
||||
{% set flags = [] %}
|
||||
{% if general.debug == "1" %}
|
||||
{% do flags.append('--debug') %}
|
||||
{% endif %}
|
||||
{% if general.ra == "0" %}
|
||||
{% do flags.append('--no-ra') %}
|
||||
{% endif %}
|
||||
{% if general.routes == "0" %}
|
||||
{% do flags.append('--no-routes') %}
|
||||
{% endif %}
|
||||
{% if general.cache_ttl %}
|
||||
{% do flags.append('--cache-ttl ' ~ general.cache_ttl ~ 'm') %}
|
||||
{% endif %}
|
||||
{% if general.cache_max %}
|
||||
{% do flags.append('--cache-max ' ~ general.cache_max) %}
|
||||
{% endif %}
|
||||
{% if general.route_qps %}
|
||||
{% do flags.append('--route-qps ' ~ general.route_qps) %}
|
||||
{% endif %}
|
||||
{% if general.pcap_timeout %}
|
||||
{% do flags.append('--pcap-timeout ' ~ general.pcap_timeout ~ 'ms') %}
|
||||
{% endif %}
|
||||
{% if flags|length > 0 %}
|
||||
ndp_proxy_go_flags="{{ flags|join(' ') }}"
|
||||
{% endif %}
|
||||
{% else %}
|
||||
ndp_proxy_go_enable="NO"
|
||||
{% endif %}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
###################################################################
|
||||
# Local syslog-ng configuration [ndpproxy].
|
||||
###################################################################
|
||||
filter f_local_ndpproxy {
|
||||
program("ndpproxy");
|
||||
};
|
||||
Loading…
Reference in a new issue