diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-02-18 15:52:36 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-18 15:52:36 +0000 |
| commit | 752b400aaf5520c29726dadfc94127a06e0ad5a9 (patch) | |
| tree | ce3d9e8320ccb20fc00731d60d543d7499a86dd6 | |
| parent | 774f775ea4875f986a9624f1b201ee76aea0da93 (diff) | |
| parent | 7897f8d216295b32626dc4d5604349812c592921 (diff) | |
| download | vyos-1x-752b400aaf5520c29726dadfc94127a06e0ad5a9.tar.gz vyos-1x-752b400aaf5520c29726dadfc94127a06e0ad5a9.zip | |
Merge pull request #15 from sever-sever/T7168
T7168: Add IPsec XFRM netlink plugin and CLI
| -rw-r--r-- | data/templates/vpp/startup.conf.j2 | 26 | ||||
| -rw-r--r-- | interface-definitions/include/vpp/netlink.xml.i | 45 | ||||
| -rw-r--r-- | interface-definitions/vpp.xml.in | 72 | ||||
| -rwxr-xr-x | src/conf_mode/vpp.py | 6 |
4 files changed, 104 insertions, 45 deletions
diff --git a/data/templates/vpp/startup.conf.j2 b/data/templates/vpp/startup.conf.j2 index 5cab34a97..cf10b6ce5 100644 --- a/data/templates/vpp/startup.conf.j2 +++ b/data/templates/vpp/startup.conf.j2 @@ -104,7 +104,15 @@ plugins { plugin geneve_plugin.so { enable } plugin gre_plugin.so { enable } plugin vxlan_plugin.so { enable } - plugin wireguard_plugin.so { enable } + # Secure + # plugin ikev2_plugin.so { enable } + # plugin dns_plugin.so { enable } # Probably required for FQDN peers +{% if ipsec is vyos_defined %} + plugin crypto_ipsecmb_plugin.so { enable } + plugin crypto_native_plugin.so { enable } + plugin crypto_openssl_plugin.so { enable } +{% endif %} + # plugin wireguard_plugin.so { enable } } linux-cp { @@ -179,3 +187,19 @@ dpdk { {% endfor %} uio-bind-force } + +{% if ipsec is vyos_defined %} +linux-xfrm-nl { + enable-route-mode-ipsec + interface {{ ipsec.interface_type }} +{% if ipsec.netlink.batch_delay_ms is vyos_defined %} + nl-batch-delay-ms {{ ipsec.netlink.batch_delay_ms }} +{% endif %} +{% if ipsec.netlink.batch_size is vyos_defined %} + nl-batch-size {{ ipsec.netlink.batch_size }} +{% endif %} +{% if ipsec.netlink.rx_buffer_size is vyos_defined %} + nl-rx-buffer-size {{ ipsec.netlink.rx_buffer_size }} +{% endif %} +} +{% endif %} diff --git a/interface-definitions/include/vpp/netlink.xml.i b/interface-definitions/include/vpp/netlink.xml.i new file mode 100644 index 000000000..903100d00 --- /dev/null +++ b/interface-definitions/include/vpp/netlink.xml.i @@ -0,0 +1,45 @@ +<!-- include start from vpp/netlink.xml.i --> +<node name="netlink"> + <properties> + <help>Netlink options</help> + </properties> + <children> + <leafNode name="rx-buffer-size"> + <properties> + <help>Receive buffer size</help> + <valueHelp> + <format>u32:0-4294967295</format> + <description>Receive buffer size</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 0-4294967295"/> + </constraint> + </properties> + </leafNode> + <leafNode name="batch-size"> + <properties> + <help>Batch size</help> + <valueHelp> + <format>u32:0-4294967295</format> + <description>Batch size</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 0-4294967295"/> + </constraint> + </properties> + </leafNode> + <leafNode name="batch-delay-ms"> + <properties> + <help>Batch delay</help> + <valueHelp> + <format>u32:0-4294967295</format> + <description>Batch delay (in ms)</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 0-4294967295"/> + </constraint> + </properties> + </leafNode> +</children> +</node> +<!-- include end --> diff --git a/interface-definitions/vpp.xml.in b/interface-definitions/vpp.xml.in index fd25bbd85..1f1cb44cc 100644 --- a/interface-definitions/vpp.xml.in +++ b/interface-definitions/vpp.xml.in @@ -638,6 +638,34 @@ </leafNode> </children> </node> + <node name="ipsec"> + <properties> + <help>IPsec settings</help> + </properties> + <children> + <leafNode name="interface-type"> + <properties> + <help>IPsec interface type</help> + <completionHelp> + <list>ipsec ipip</list> + </completionHelp> + <valueHelp> + <format>ipsec</format> + <description>IPsec interface type</description> + </valueHelp> + <valueHelp> + <format>ipip</format> + <description>IPIP tunnel interface type</description> + </valueHelp> + <constraint> + <regex>(ipsec|ipip)</regex> + </constraint> + </properties> + <defaultValue>ipsec</defaultValue> + </leafNode> + #include <include/vpp/netlink.xml.i> + </children> + </node> <node name="l2learn"> <properties> <help>Level 2 MAC address learning settings</help> @@ -663,49 +691,7 @@ <help>Linux control plane setting</help> </properties> <children> - <node name="netlink"> - <properties> - <help>Netlink options</help> - </properties> - <children> - <leafNode name="rx-buffer-size"> - <properties> - <help>Receive buffer size</help> - <valueHelp> - <format>u32:0-4294967295</format> - <description>Receive buffer size</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 0-4294967295"/> - </constraint> - </properties> - </leafNode> - <leafNode name="batch-size"> - <properties> - <help>Batch size</help> - <valueHelp> - <format>u32:0-4294967295</format> - <description>Batch size</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 0-4294967295"/> - </constraint> - </properties> - </leafNode> - <leafNode name="batch-delay-ms"> - <properties> - <help>Batch delay</help> - <valueHelp> - <format>u32:0-4294967295</format> - <description>Batch delay (in ms)</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 0-4294967295"/> - </constraint> - </properties> - </leafNode> - </children> - </node> + #include <include/vpp/netlink.xml.i> <leafNode name="ignore-kernel-routes"> <properties> <help>Ignore kernel routes</help> diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index fe6436c15..ec6873e0d 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2023-2024 VyOS Inc. +# Copyright (C) 2023-2025 VyOS Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -139,6 +139,10 @@ def get_config(config=None): config = config_dict_merge(default_values, config) + # Ignore default XML values if config doesn't exists + if not conf.exists(base_settings + ['ipsec']): + del config['settings']['ipsec'] + # add running config if effective_config: config['effective'] = effective_config |
