net/frr - Routing: BFD - add multihop support for IPv4. closes https://github.com/opnsense/plugins/issues/4282 (#4285)

Although IPv6 also supports multihop, it does require a local-address to be set (https://docs.frrouting.org/en/latest/bfd.html#bfdd-commands), to avoid adding extra complexity now, start with IPv4 and see where that brings us.
This commit is contained in:
Ad Schellevis
2024-10-20 10:57:21 +02:00
committed by GitHub
parent c0a976f81f
commit 3c5e2b9d77
4 changed files with 38 additions and 2 deletions
@@ -16,4 +16,13 @@
<type>text</type>
<help>Specify the IP of your neighbor.</help>
</field>
<field>
<id>neighbor.multihop</id>
<label>Multihop</label>
<type>checkbox</type>
<help>multihop tells the BFD daemon that we should expect packets with TTL less than 254
(because it will take more than one hop) and to listen on the multihop port (4784).
When using multi-hop mode echo-mode will not work (see RFC 5883 section 3).
</help>
</field>
</form>
@@ -3,8 +3,10 @@
namespace OPNsense\Quagga;
use OPNsense\Base\BaseModel;
use OPNsense\Base\Messages\Message;
/*
Copyright (C) 2024 Deciso B.V.
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 - 2021 Michael Muenz <m.muenz@gmail.com>
All rights reserved.
@@ -28,4 +30,25 @@ use OPNsense\Base\BaseModel;
*/
class BFD extends BaseModel
{
/**
* {@inheritdoc}
*/
public function performValidation($validateFullModel = false)
{
$messages = parent::performValidation($validateFullModel);
foreach ($this->neighbors->neighbor->iterateItems() as $neighbor) {
if (!$validateFullModel && !$neighbor->isFieldChanged()) {
continue;
}
$key = $neighbor->__reference;
$address_proto = str_contains($neighbor->address, ':') ? 'inet6' : 'inet';
if (!empty((string)$neighbor->multihop) && $address_proto == 'inet6') {
$messages->appendMessage(
new Message(gettext("Multihop is currently only supported for IPv4"), $key . ".multihop")
);
}
}
return $messages;
}
}
@@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/quagga/bfd</mount>
<description>BFD configuration</description>
<version>1.0.0</version>
<version>1.0.1</version>
<items>
<enabled type="BooleanField">
<default>0</default>
@@ -21,6 +21,10 @@
<default></default>
<Required>Y</Required>
</address>
<multihop type="BooleanField">
<default>0</default>
<Required>Y</Required>
</multihop>
</neighbor>
</neighbors>
</items>
@@ -21,7 +21,7 @@ bfd
{% if helpers.exists('OPNsense.quagga.bfd.neighbors.neighbor') %}
{% for neighbor in helpers.toList('OPNsense.quagga.bfd.neighbors.neighbor') %}
{% if neighbor.enabled == '1' %}
peer {{ neighbor.address }}
peer {{ neighbor.address }} {% if neighbor.multihop|default('0') == '1' %}multihop{% endif +%}
{% endif %}
{% endfor %}
{% endif %}