net/ndp-proxy-go: Add cache file support (#5085)

This commit is contained in:
Monviech 2025-12-13 14:10:25 +01:00 committed by GitHub
parent 361ec0b498
commit 420efa0c47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 3 deletions

View file

@ -9,6 +9,7 @@ Plugin Changelog
1.2
* Add firewall alias support
* Add cache file support for faster recovery after system reboots
1.1

View file

@ -3,7 +3,7 @@
<id>alias.interface</id>
<label>Interface</label>
<type>dropdown</type>
<help>Add IPv6 addresses to the firewall alias that belong to this proxied interface. When choosing any, all IPv6 addresses will be added.</help>
<help>Add IPv6 addresses to the firewall alias that belongs to this proxied interface. When choosing any, all IPv6 addresses will be added.</help>
<grid_view>
<formatter>any</formatter>
</grid_view>

View file

@ -46,7 +46,7 @@
<label>Neighbor cache lifetime</label>
<type>text</type>
<hint>10</hint>
<help>Neighbor cache lifetime in minutes. This controls when stale clients and host routes are cleaned up. When using a point-to-point interface as upstream, increasing this lifetime is necessary to not prematurely clean up routes.</help>
<help>Neighbor cache lifetime in minutes. This controls when stale clients, host routes and firewall aliases are cleaned up. When using a point-to-point interface as upstream, increasing this lifetime is necessary to not prematurely clean up routes.</help>
</field>
<field>
<id>ndpproxy.general.cache_max</id>
@ -55,6 +55,12 @@
<hint>4096</hint>
<help>Maximum learned neighbors, increase for large networks.</help>
</field>
<field>
<id>ndpproxy.general.cache_file</id>
<label>Neighbor cache file</label>
<type>checkbox</type>
<help>Persist cache to file on service stop and load it on service start. Only neighbors with a valid cache lifetime are loaded. This helps on system reboots to minimize downtime of individual clients.</help>
</field>
<field>
<id>ndpproxy.general.route_qps</id>
<label>Max route operations</label>

View file

@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/ndpproxy</mount>
<description>NDP Proxy model</description>
<version>0.2</version>
<version>1.0</version>
<items>
<general>
<enabled type="BooleanField">
@ -26,6 +26,10 @@
<cache_max type="IntegerField">
<MinimumValue>1</MinimumValue>
</cache_max>
<cache_file type="BooleanField">
<Default>0</Default>
<Required>Y</Required>
</cache_file>
<route_qps type="IntegerField">
<MinimumValue>1</MinimumValue>
</route_qps>

View file

@ -8,6 +8,9 @@ ndp_proxy_go_upstream="{{ helpers.physical_interface(general.upstream) }}"
{% do downstream_interfaces.append(helpers.physical_interface(interface)) %}
{% endfor %}
ndp_proxy_go_downstream="{{ downstream_interfaces|join(' ') }}"
{% if general.cache_file == "1" %}
ndp_proxy_go_cache_file="/var/db/ndpproxy/cache.json"
{% endif %}
{% set flags = [] %}
{% if general.debug == "1" %}
{% do flags.append('--debug') %}