]> git.proxmox.com Git - pve-network.git/log
pve-network.git
5 months agotests: zone: code cleanup
Thomas Lamprecht [Wed, 29 Nov 2023 10:39:58 +0000 (11:39 +0100)]
tests: zone: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agotests: zone: include error if test interfaces file cannot be opened
Thomas Lamprecht [Wed, 29 Nov 2023 10:39:46 +0000 (11:39 +0100)]
tests: zone: include error if test interfaces file cannot be opened

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agocontrollers: die if opening network interface config fails
Thomas Lamprecht [Wed, 29 Nov 2023 10:38:47 +0000 (11:38 +0100)]
controllers: die if opening network interface config fails

we should not continue in that case..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agocontrollers: fix interfacing with read_etc_network_interfaces
Thomas Lamprecht [Wed, 29 Nov 2023 10:37:05 +0000 (11:37 +0100)]
controllers: fix interfacing with read_etc_network_interfaces

While not used currently in the parser, passing 1 as file name still
makes no sense, and we might want to rework that in general, as why
does this have to use the non-inotify read path and manually open the
file.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agotests: zones: output any unexpected error as diagnostic
Thomas Lamprecht [Wed, 29 Nov 2023 10:27:13 +0000 (11:27 +0100)]
tests: zones: output any unexpected error as diagnostic

really helps debugging things..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agotests: mocking cfs_lock_file to pass subnet tests
Stefan Lendl [Fri, 24 Nov 2023 13:16:13 +0000 (14:16 +0100)]
tests: mocking cfs_lock_file to pass subnet tests

IPAM tries to lock file in clusterfs which it can't when testing as
non-root.

Mocking cfs_lock_file to emulate locking behavior.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
5 months agodhcp: dnsmasq: untaint when deleting configuration files
Stefan Hanreich [Tue, 28 Nov 2023 08:58:57 +0000 (09:58 +0100)]
dhcp: dnsmasq: untaint when deleting configuration files

The current invocation is quite unsafe and triggers the taint mode of
Perl that is enabled for our API daemons, but not pvesh used on
cluster-wide apply.
Replacing it with dir_glob_foreach solves those issues.

Reported-By: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agoapi: vnet: fix warning in vnet API
Stefan Hanreich [Mon, 27 Nov 2023 10:23:35 +0000 (11:23 +0100)]
api: vnet: fix warning in vnet API

If zone is not set, we also check the pending changes for a zone key,
since it is set as pending when the Vnet settings have not yet been
applied.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agovalidation: add support for arrays to change tracking
Stefan Hanreich [Wed, 22 Nov 2023 12:28:08 +0000 (13:28 +0100)]
validation: add support for arrays to change tracking

This is needed so dhcp-ranges are properly displayed as changed in the
web UI.

Also took the chance to properly indent the encode_value function with
our indentation scheme.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
5 months agobump version to 0.9.4
Thomas Lamprecht [Thu, 23 Nov 2023 11:12:13 +0000 (12:12 +0100)]
bump version to 0.9.4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agodhcp dnsmasq: suppress warning too if dhcp is not configured
Thomas Lamprecht [Thu, 23 Nov 2023 11:11:38 +0000 (12:11 +0100)]
dhcp dnsmasq: suppress warning too if dhcp is not configured

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agobump version to 0.9.3
Thomas Lamprecht [Thu, 23 Nov 2023 10:58:45 +0000 (11:58 +0100)]
bump version to 0.9.3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agodhcp dnsmasq: guard die with zone having enabled dhcp
Thomas Lamprecht [Thu, 23 Nov 2023 10:46:45 +0000 (11:46 +0100)]
dhcp dnsmasq: guard die with zone having enabled dhcp

as stop-gap

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agobump version to 0.9.2
Thomas Lamprecht [Thu, 23 Nov 2023 10:32:18 +0000 (11:32 +0100)]
bump version to 0.9.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agodnsmasq: drop no-resolve for default config
Thomas Lamprecht [Thu, 23 Nov 2023 10:30:00 +0000 (11:30 +0100)]
dnsmasq: drop no-resolve for default config

for a better default user experience make dnsmasq always answer to DNS
requests, we can add a more sophisticated logic later.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agobump version to 0.9.1
Thomas Lamprecht [Wed, 22 Nov 2023 18:50:50 +0000 (19:50 +0100)]
bump version to 0.9.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agocontroller: evpn reload: use log_warn to cause a task-warning
Thomas Lamprecht [Wed, 22 Nov 2023 18:49:04 +0000 (19:49 +0100)]
controller: evpn reload: use log_warn to cause a task-warning

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agodnsmasq: check for existence of dnsmasq binary
Stefan Hanreich [Wed, 22 Nov 2023 18:33:47 +0000 (19:33 +0100)]
dnsmasq: check for existence of dnsmasq binary

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agoFix #4917: evpn: forbid vlan-aware bridge
Alexandre Derumier [Fri, 27 Oct 2023 11:53:28 +0000 (13:53 +0200)]
Fix #4917: evpn: forbid vlan-aware bridge

Do it on vnet update instead throwing a warning at config generation.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agosdn: allow deletion of empty subnet with gateway
Stefan Lendl [Fri, 17 Nov 2023 14:02:27 +0000 (15:02 +0100)]
sdn: allow deletion of empty subnet with gateway

If the gateway IP is last remaining IP in the subnet (in IPAM), allow
deleting the subnet.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
5 months agobump version to 0.9.0
Thomas Lamprecht [Wed, 22 Nov 2023 13:46:53 +0000 (14:46 +0100)]
bump version to 0.9.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agodnsmasq: use quite-ra
Wolfgang Bumiller [Wed, 22 Nov 2023 13:37:01 +0000 (14:37 +0100)]
dnsmasq: use quite-ra

otherwise each instance logs its RAs every 10 seconds the journal

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agoinstall dnsmasq@.service snippet
Wolfgang Bumiller [Wed, 22 Nov 2023 13:22:13 +0000 (14:22 +0100)]
install dnsmasq@.service snippet

To
- start after networking.service (in order to make sure ifupdown has
  created all the interfaces before dnsmasq tries to find them via the
  'interfaces=' lines.
- drop the 'Requires=network.target' since it is not a *provider* of
  that target

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agosdn: validate dhcp-range in API
Stefan Lendl [Wed, 22 Nov 2023 13:00:41 +0000 (14:00 +0100)]
sdn: validate dhcp-range in API

* start- and end-addresses must be valid IPs
* must both be in the subnet's CIDR
* and start needs to smaller (or equal) to end

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
5 months agoipam: improve update / delete behavior
Stefan Hanreich [Wed, 22 Nov 2023 12:29:50 +0000 (13:29 +0100)]
ipam: improve update / delete behavior

Currently when updating or deleting a mapping in the IPAM we would
delete all existing entries in the IPAM with that mac address. Now we
only delete the specific entry we are updating / deleting.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosubnets: avoid nested post-if in eval
Thomas Lamprecht [Wed, 22 Nov 2023 13:08:00 +0000 (14:08 +0100)]
subnets: avoid nested post-if in eval

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agosubnets: only delete macs.db entries if mac is available
Stefan Hanreich [Wed, 22 Nov 2023 12:27:28 +0000 (13:27 +0100)]
subnets: only delete macs.db entries if mac is available

When removing a gateway do not attempt to delete its entry from
macs.db since we do not have anything cached for the gateway anyway.

Reported-By: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agofix dhcpv6 router advertisement
Alexandre Derumier [Wed, 22 Nov 2023 07:58:01 +0000 (08:58 +0100)]
fix dhcpv6 router advertisement

- don't listen to ip address, but use interface= instead
- generate 1 config file by vnet instead 1 by subnet
- enable-ra is global to server, enable it in default conf

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agoapi: handle delete parameter when updating controllers
Wolfgang Bumiller [Wed, 22 Nov 2023 11:20:41 +0000 (12:20 +0100)]
api: handle delete parameter when updating controllers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agoapi: handle delete parameter when updating dns entries
Wolfgang Bumiller [Wed, 22 Nov 2023 10:56:12 +0000 (11:56 +0100)]
api: handle delete parameter when updating dns entries

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agoapi: handle delete parameter when updating ipams
Wolfgang Bumiller [Wed, 22 Nov 2023 10:49:20 +0000 (11:49 +0100)]
api: handle delete parameter when updating ipams

this is for completeness, currently no plugin has optional
properties...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agoapi: take partial configs for PUT /cluster/sdn/vnets/<n>/subnets/<i>
Wolfgang Bumiller [Wed, 22 Nov 2023 10:42:24 +0000 (11:42 +0100)]
api: take partial configs for PUT /cluster/sdn/vnets/<n>/subnets/<i>

Handle 'delete' parameter and partial updates.
See 2 commits earlier for explanation.

Cc: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agoapi: take partial configs for PUT /cluster/sdn/vnets/<id>
Wolfgang Bumiller [Wed, 22 Nov 2023 10:14:38 +0000 (11:14 +0100)]
api: take partial configs for PUT /cluster/sdn/vnets/<id>

Handle 'delete' parameter and partial updates.
See previous commit for explanation.

Cc: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agoapi: take partial configs for PUT /cluster/sdn/zones/<id>
Wolfgang Bumiller [Wed, 22 Nov 2023 10:08:21 +0000 (11:08 +0100)]
api: take partial configs for PUT /cluster/sdn/zones/<id>

Zones previously expected a complete config, but the API schema
also contains a 'delete' parameter via the SectionConfig's
updateSchema() helper. This was not handled, and instead failed to
validate as part of the config.

The same is true for vnets and subnets, while ipams, dns and
controller entries followed our usual update procedures (but also
ignored the 'delete' parameter).

Since all of our SectionConfig based API endpoints are supposed to
take changes, rather than complete configs, this changes these
endpoints to not replace the full configuration anymore.

This is a major break for automation tools (the web UI already passed
the full config each time).

Cc: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agoRevert "sdn: require ipam in simple plugin for dhcp"
Wolfgang Bumiller [Wed, 22 Nov 2023 09:56:14 +0000 (10:56 +0100)]
Revert "sdn: require ipam in simple plugin for dhcp"

This reverts commit 53ab1495621f46c8af4dc560905f7e501bee75a7.

This also affects the updateSchema which is not intentional, since the
update API calls are supposed to take changes, not full replacements.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agodnsmasq: fix config directory permission
Wolfgang Bumiller [Wed, 22 Nov 2023 08:47:15 +0000 (09:47 +0100)]
dnsmasq: fix config directory permission

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agobump version to 0.8.5
Thomas Lamprecht [Tue, 21 Nov 2023 19:34:48 +0000 (20:34 +0100)]
bump version to 0.8.5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agosubnet: fix dhcp-dns-server format
Stefan Hanreich [Tue, 21 Nov 2023 18:28:21 +0000 (19:28 +0100)]
subnet: fix dhcp-dns-server format

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosdn: register MAC in IPAM if not found
Stefan Lendl [Tue, 21 Nov 2023 14:55:54 +0000 (15:55 +0100)]
sdn: register MAC in IPAM if not found

if inside add_dhcp_mapping, which is called at VM or LCX start, we do
not find an IP in IPAM, register the MAC.

This is very useful as a fallback if for some reason an IP mapping was
deleted or there is a bug somewhere that does not register an IP.

This acts more like DHCP to allocate an IP on demand.

In order to properly register the IP, the VMID and hostname is required
as a parameter.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
5 months agobump version to 0.8.4
Wolfgang Bumiller [Tue, 21 Nov 2023 13:49:46 +0000 (14:49 +0100)]
bump version to 0.8.4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agodhcp: fix allocating IP for every defined dhcp-range
Stefan Hanreich [Tue, 21 Nov 2023 12:40:12 +0000 (13:40 +0100)]
dhcp: fix allocating IP for every defined dhcp-range

Due to the wrong check an IP was allocated for every DHCP range,
instead of only allocating an IP in the first free DHCP range.

Suggested-By: Stefan Lendl <s.lendl@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agobump version to 0.8.3
Wolfgang Bumiller [Tue, 21 Nov 2023 13:41:53 +0000 (14:41 +0100)]
bump version to 0.8.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 months agosdn: simple: Improve dhcp property description and validation
Stefan Hanreich [Tue, 21 Nov 2023 13:31:04 +0000 (14:31 +0100)]
sdn: simple: Improve dhcp property description and validation

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosdn: require ipam in simple plugin for dhcp
Stefan Hanreich [Tue, 21 Nov 2023 13:31:03 +0000 (14:31 +0100)]
sdn: require ipam in simple plugin for dhcp

Suggested-By: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agod/control: downgrade frr-pythontools from recommends to suggests
Thomas Lamprecht [Tue, 21 Nov 2023 07:26:56 +0000 (08:26 +0100)]
d/control: downgrade frr-pythontools from recommends to suggests

avoid pulling FRR in on upgrade if we'd hard-depend on
libpve-network-perl for all those systems that kept the default
install-recommends enabled as FRR is a bit involved and might announce
stuff and break some network environments if not correctly configured.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agod/control: drop explicit perl dependency
Thomas Lamprecht [Tue, 21 Nov 2023 07:26:36 +0000 (08:26 +0100)]
d/control: drop explicit perl dependency

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agod/control: update versioned dependency for pve-cluster
Thomas Lamprecht [Mon, 20 Nov 2023 16:41:33 +0000 (17:41 +0100)]
d/control: update versioned dependency for pve-cluster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agoapi: refactor URL structure for Ipam
Stefan Hanreich [Mon, 20 Nov 2023 16:28:32 +0000 (17:28 +0100)]
api: refactor URL structure for Ipam

The initial URL structure was less than optimal due to Ipam as well as
Ipams being endpoints in the API, which are too similar and might be
confusing to users.

Move the listing of PVE IPAM to /ipams/pve/status
Move the create / update / delete endpoints to /vnets/{vnetid}/ips

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agodhcp : dnsmasq: generate dbus policy
Alexandre Derumier [Sat, 18 Nov 2023 14:13:14 +0000 (15:13 +0100)]
dhcp : dnsmasq: generate dbus policy

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agodnsmasq: fix ipv6 support
Alexandre Derumier [Sat, 18 Nov 2023 14:13:13 +0000 (15:13 +0100)]
dnsmasq: fix ipv6 support

ether file should have 1 line by mac address with ip4+ip6

ip6 address should be in braced [ip6]

for now: don't update ip6 through bus as it seem to be incorrect

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agodnsmasq: enable dbus && purge old ip lease on reservation
Alexandre Derumier [Sat, 18 Nov 2023 14:13:12 +0000 (15:13 +0100)]
dnsmasq: enable dbus && purge old ip lease on reservation

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agodnsmasq: configure static range for each subnet
Alexandre Derumier [Sat, 18 Nov 2023 14:13:11 +0000 (15:13 +0100)]
dnsmasq: configure static range for each subnet

we don't want dynamic lease, simply define each subnet as a static range.

dhcp-range defined on a subnet is only used by ipam plugin.

This will also allow to use dhcp subnet without need to define a range.
Can be usefull for external ipam like phpipam, where you can't define ranges.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agodhcp : remove del_ip_mapping
Alexandre Derumier [Sat, 18 Nov 2023 14:13:10 +0000 (15:13 +0100)]
dhcp : remove del_ip_mapping

The cleanup is done in add_ip_mapping

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agoapi2: ipam : remove add|del_mapping in mac/ip management
Alexandre Derumier [Sat, 18 Nov 2023 14:13:09 +0000 (15:13 +0100)]
api2: ipam : remove add|del_mapping in mac/ip management

only register/del ip in ipam here.

The dhcp mapping is done a vm start.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agofix subnet tests
Alexandre Derumier [Sat, 18 Nov 2023 14:13:08 +0000 (15:13 +0100)]
fix subnet tests

- add vmid in in ipam.db
- remove ip value in ipam.db (is already the key)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agoadd add_dhcp_mapping
Alexandre Derumier [Fri, 17 Nov 2023 11:39:54 +0000 (12:39 +0100)]
add add_dhcp_mapping

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agosdn: fix subnets && netbox ipam tests
Alexandre Derumier [Fri, 17 Nov 2023 11:39:53 +0000 (12:39 +0100)]
sdn: fix subnets && netbox ipam tests

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
5 months agosdn: fix tests
Alexandre Derumier [Fri, 17 Nov 2023 11:39:52 +0000 (12:39 +0100)]
sdn: fix tests

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agodhcp: regenerate config for DHCP plugins on applying configuration
Stefan Hanreich [Fri, 17 Nov 2023 11:39:51 +0000 (12:39 +0100)]
dhcp: regenerate config for DHCP plugins on applying configuration

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agoapi: zone: add dhcp option
Stefan Hanreich [Fri, 17 Nov 2023 11:39:50 +0000 (12:39 +0100)]
api: zone: add dhcp option

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agoapi: subnet: add dhcp ranges
Stefan Hanreich [Fri, 17 Nov 2023 11:39:49 +0000 (12:39 +0100)]
api: subnet: add dhcp ranges

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agoapi: add endpoints for managing PVE IPAM
Stefan Hanreich [Fri, 17 Nov 2023 11:39:48 +0000 (12:39 +0100)]
api: add endpoints for managing PVE IPAM

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosdn: dhcp: add helper for creating DHCP leases
Stefan Hanreich [Fri, 17 Nov 2023 11:39:47 +0000 (12:39 +0100)]
sdn: dhcp: add helper for creating DHCP leases

This helper can be used to create DHCP entries for a specific zone. It
is used by the API to create DHCP leases for VMs/CTs.

Co-Authored-By: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosdn: dhcp: add dnsmasq plugin
Stefan Hanreich [Fri, 17 Nov 2023 11:39:46 +0000 (12:39 +0100)]
sdn: dhcp: add dnsmasq plugin

The plugin creates a dnsmasq@<zone> service that spawns a dnsmasq
instance that handles dhcp for that zone.

The configuration files for a dnsmasq instance lie within
/etc/dnsmasq.d/<zone>

The plugin generates the following configuration files:
* 00-default.conf
  Contains the default global configuration for dnsmasq. Disables DNS,
  enables some specific options for Windows, does some
  security-related configuration and makes dnsmasq bind only to the
  interfaces it is responsible for
* 10-<subnet>.conf
  Contains the default settings for a subnet. Sets dhcp options for
  DNS and gateway.
* 10-<subnet>.ranges.conf
  Contains the configuration of DHCP ranges for a subnet.
* ethers
  Contains the MAC address to IP mappings for a zone.

Every subnet gets assigned a tag in the dnsmasq configuration that is
equal to the subnet_id. This can be used to override / set additional
configuration options on a per-subnet basis.

Additionally it creates the file /etc/default/dnsmasq.<zone> that
provides default options for the dnsmasq service.

Leases are stored in /var/lib/misc/dnsmasq.<zone>.

Co-Authored-By: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agodhcp: add abstract class for DHCP plugins
Stefan Hanreich [Fri, 17 Nov 2023 11:39:45 +0000 (12:39 +0100)]
dhcp: add abstract class for DHCP plugins

This abstract class provides several hooks that should be called
during the config generation process, they expose the functionality
for the different configuration tasks required from the DHCP plugins.

add_ip_mapping
Adds a mapping from MAC address to an IP for a given DHCP server. The
DHCP server will then always assign the given IP address to the MAC.

del_ip_mapping
Deletes all mappings for a given MAC address for a given DHCP server.

before_regenerate
Should be called before the plugin does any configuration tasks. The
main usage for this hook is tearing down old instances.

after_regenerate
Should be called after the plugin has finished generating any
configuration. The main usage for this hook is to perform cleanup and
restart / reload services.

before_configure
Should be called before creating the configuration for a specific DHCP
instance, as defined in the dhcp.cfg. This can be used for performing
instance-specific setup.

after_configure
Should be called after the configuration for a specific DHCP instance,
as defined in the dhcp.cfg. This will mainly be used for enabling and
restarting / reloading a specific instance of a DHCP server.

configure_subnet
This function configures the settings for a specific subnet (that can
contain multiple DHCP ranges). This sets global settings for a
specific subnet such as DNS server or gateway.

configure_range
This configures a DHCP range that is available for a given Subnet.

Co-Authored-By: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosubnet: vnet: refactor IPAM related methods
Stefan Hanreich [Fri, 17 Nov 2023 11:39:44 +0000 (12:39 +0100)]
subnet: vnet: refactor IPAM related methods

Those methods are used by the DHCP plugins to attain the next free
IP address for a given DHCP range, as well as delete all entries with
a certain MAC address.

Co-Authored-By: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agoipam: plugins: preparations for DHCP
Stefan Hanreich [Fri, 17 Nov 2023 11:39:43 +0000 (12:39 +0100)]
ipam: plugins: preparations for DHCP

Adds a new file priv/macs.db for caching the queries to IPAM.

Additionally adds and imeplements methods to the IPAM plugins that
are required for the DHCP functionality.

Co-Authored-By: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosdn: zone: add dhcp option
Stefan Hanreich [Fri, 17 Nov 2023 11:39:42 +0000 (12:39 +0100)]
sdn: zone: add dhcp option

Co-Authored-By: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosubnet: add dhcp options
Stefan Hanreich [Fri, 17 Nov 2023 11:39:41 +0000 (12:39 +0100)]
subnet: add dhcp options

Additionally add a helper function for parsing the DHCP ranges of a
subnet.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agosdn: preparations for DHCP plugin
Stefan Hanreich [Fri, 17 Nov 2023 11:39:40 +0000 (12:39 +0100)]
sdn: preparations for DHCP plugin

Add the option to retrieve the running configuration instead of only
the pending configuration via the config methods. Refactor methods
using the running config to utilize the new parameter.

Add helper methods and return additional attributes from the getter
functions that are needed by the dhcp plugins.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
5 months agogitignore: sort content
Thomas Lamprecht [Fri, 17 Nov 2023 14:53:03 +0000 (15:53 +0100)]
gitignore: sort content

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agogitignore: add build artefacts and .vscode to ignore list
Stefan Lendl [Fri, 17 Nov 2023 14:23:07 +0000 (15:23 +0100)]
gitignore: add build artefacts and .vscode to ignore list

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
 [ TL: avoid one-word subject & make build-dir glob more specific ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agobump version to 0.8.2
Fabian Grünbichler [Wed, 25 Oct 2023 11:07:03 +0000 (13:07 +0200)]
bump version to 0.8.2

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
6 months agocontrollers: add isis router plugin
Alexandre Derumier [Wed, 13 Sep 2023 11:38:45 +0000 (13:38 +0200)]
controllers: add isis router plugin

6 months agocontrollers: frr: add parsing of "interfaces" section
Alexandre Derumier [Wed, 13 Sep 2023 11:38:43 +0000 (13:38 +0200)]
controllers: frr: add parsing of "interfaces" section

6 months agocontroller: evpn: fix find_bgp_controller
Alexandre Derumier [Wed, 13 Sep 2023 11:38:40 +0000 (13:38 +0200)]
controller: evpn: fix find_bgp_controller

6 months agozones: evpn: add disable-bridge-learning
Alexandre Derumier [Tue, 26 Sep 2023 07:39:42 +0000 (09:39 +0200)]
zones: evpn: add disable-bridge-learning

Allow to statically register mac address in evpn,

can be useful for silent hosts

6 months agozones: add add|del_bridge_fdb to plugins
Alexandre Derumier [Tue, 26 Sep 2023 07:39:41 +0000 (09:39 +0200)]
zones: add add|del_bridge_fdb to plugins

We want to be able to override it for some specific plugins.

Can be used by an sdn controller (like ovn for example), where
mac need to be registered manually.

6 months agozones: add|del_bridge_fdb : remove firewall param
Alexandre Derumier [Tue, 26 Sep 2023 07:39:40 +0000 (09:39 +0200)]
zones: add|del_bridge_fdb : remove firewall param

It's not used anymore in Network.pm

9 months agozones: simplify status code
Fabian Grünbichler [Wed, 19 Jul 2023 09:42:44 +0000 (11:42 +0200)]
zones: simplify status code

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
9 months agozones: improve error message
Fabian Grünbichler [Wed, 19 Jul 2023 09:42:33 +0000 (11:42 +0200)]
zones: improve error message

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
9 months agozones: status: display specific message if vnet is not generated.
Alexandre Derumier [Fri, 23 Jun 2023 12:49:41 +0000 (14:49 +0200)]
zones: status: display specific message if vnet is not generated.

also cleanup duplicate code in plugins

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 months agosdn: config generation : check if interfaces.d/sdn is sourced
Fabian Grünbichler [Wed, 19 Jul 2023 09:35:00 +0000 (11:35 +0200)]
sdn: config generation : check if interfaces.d/sdn is sourced

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
10 months agozones: fix status
Alexandre Derumier [Mon, 12 Jun 2023 17:43:46 +0000 (19:43 +0200)]
zones: fix status

Vnets were wrongly displayed in the main tree because of this,
and error was not set on zone

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
10 months agofix permissions && use new /sdn/zones/<zone>/<vnet> path
Alexandre Derumier [Thu, 8 Jun 2023 01:24:44 +0000 (03:24 +0200)]
fix permissions && use new /sdn/zones/<zone>/<vnet> path

- use new /sdn/zones/zone/<vnet> path for vnet && subnets permissions

- fix some permissions on /sdn/zones  && /sdn

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
11 months agofix tests for bookworm
Fabian Grünbichler [Wed, 7 Jun 2023 11:25:02 +0000 (13:25 +0200)]
fix tests for bookworm

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
11 months agoget_local_vnets: fix permission path && perm
Alexandre Derumier [Tue, 6 Jun 2023 13:19:21 +0000 (15:19 +0200)]
get_local_vnets: fix permission path && perm

new path is /zones/<zone>/<vnetid>

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
11 months agobump version to 0.8.1
Thomas Lamprecht [Tue, 6 Jun 2023 06:33:30 +0000 (08:33 +0200)]
bump version to 0.8.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoskip tests in sbuild environment for now
Thomas Lamprecht [Tue, 6 Jun 2023 08:23:03 +0000 (10:23 +0200)]
skip tests in sbuild environment for now

they access pmxcfs directly and so cannot really work, this needs to
be mocked some day (soon!), but as stop-gap just skip the tests if a
sbuild lock is present

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: update dependencies
Thomas Lamprecht [Tue, 6 Jun 2023 08:22:50 +0000 (10:22 +0200)]
d/control: update dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoevpn: update config to frr 8.5.1
Alexandre Derumier [Tue, 23 May 2023 06:47:26 +0000 (08:47 +0200)]
evpn: update config to frr 8.5.1

add default values:
 "no bgp hard-administrative-reset"
 "no bgp graceful-restart notification"

to avoid frr-reload warning

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agonetwork reload: fix UPID parsing
Alexandre Derumier [Thu, 20 Apr 2023 21:36:22 +0000 (23:36 +0200)]
network reload: fix UPID parsing

When warning or error from ifreload are logged they are received in
1 line in result of pvesh.

So, the UPID might not always start at the beginning, which was
assumed by the old code, failing parsing it, throwing a warning like:

> Use of uninitialized value $upid in pattern match (m//) at /usr/share/perl5/PVE/Tools.pm line 1106.
> Use of uninitialized value $upid in concatenation (.) or string at /usr/share/perl5/PVE/Tools.pm line 1120.

Drop the start anchor of the regex.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #4683: zones: QinQ: fix vlan-protocol when bridge is VLAN aware
Alexandre Derumier [Thu, 20 Apr 2023 21:36:21 +0000 (23:36 +0200)]
fix #4683: zones: QinQ: fix vlan-protocol when bridge is VLAN aware

The tagged bridge interface need to also have to correct
vlan-protocol

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #4389: evpn: exit nodes: null routes subnets from other zones
Alexandre Derumier [Thu, 20 Apr 2023 21:36:20 +0000 (23:36 +0200)]
fix #4389: evpn: exit nodes: null routes subnets from other zones

We don't want to routes subnets between different zones when same
exit node is used.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #4662: frr: fix config generation ordering
Alexandre Derumier [Thu, 20 Apr 2023 21:36:19 +0000 (23:36 +0200)]
fix #4662: frr: fix config generation ordering

vrf and router bgp vrf need to be ordered by vrf name

ip protocol need to be at the end

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #4425: vxlan, evpn: add vxlan-port option to override default
Alexandre Derumier [Thu, 20 Apr 2023 21:36:18 +0000 (23:36 +0200)]
fix #4425: vxlan, evpn: add vxlan-port option to override default

Some users requested it as their physical network equipments don't
use standard vxlan port

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #4657: evpn: fix exit-node with multiple vrf
Alexandre Derumier [Thu, 20 Apr 2023 21:36:17 +0000 (23:36 +0200)]
fix #4657: evpn: fix exit-node with multiple vrf

Currently, if a node is primary exit-node for 1 vrf, and secondary
exit-node for another vrf,

The deny route-map is filtering routes imports for both vrf.

This patch adds filtering only for the vrf's where the node is
secondary.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 0.8.0
Thomas Lamprecht [Thu, 25 May 2023 16:18:42 +0000 (18:18 +0200)]
bump version to 0.8.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: raise compat level to 13
Thomas Lamprecht [Thu, 25 May 2023 16:18:12 +0000 (18:18 +0200)]
d/control: raise compat level to 13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: derive upload dist automatically
Thomas Lamprecht [Thu, 25 May 2023 16:18:39 +0000 (18:18 +0200)]
buildsys: derive upload dist automatically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>