5
0
mirror of git://git.proxmox.com/git/pve-network.git synced 2025-01-07 21:18:01 +03:00
Commit Graph

427 Commits

Author SHA1 Message Date
Stefan Hanreich
24ab59e0af 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>
2023-11-29 11:04:37 +01:00
Stefan Hanreich
2664f29575 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>
2023-11-29 10:54:37 +01:00
Stefan Hanreich
fb97ed300a 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>
2023-11-29 10:28:26 +01:00
Thomas Lamprecht
1032f6d838 bump version to 0.9.4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-23 12:12:13 +01:00
Thomas Lamprecht
0558f26d2e dhcp dnsmasq: suppress warning too if dhcp is not configured
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-23 12:11:41 +01:00
Thomas Lamprecht
faa17e045f bump version to 0.9.3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-23 12:03:05 +01:00
Thomas Lamprecht
bed9fbc246 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>
2023-11-23 12:03:00 +01:00
Thomas Lamprecht
0559cd7015 bump version to 0.9.2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-23 11:32:18 +01:00
Thomas Lamprecht
d4a671e3f7 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>
2023-11-23 11:30:02 +01:00
Thomas Lamprecht
b4a3bbd73c bump version to 0.9.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-22 19:50:50 +01:00
Thomas Lamprecht
a3c114c0ef controller: evpn reload: use log_warn to cause a task-warning
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-22 19:49:04 +01:00
Stefan Hanreich
2c298fa1f8 dnsmasq: check for existence of dnsmasq binary
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2023-11-22 19:45:52 +01:00
Alexandre Derumier
708b2f40ce 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>
2023-11-22 19:45:52 +01:00
Stefan Lendl
4a675ba3a3 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>
2023-11-22 15:24:41 +01:00
Thomas Lamprecht
a9107d35d2 bump version to 0.9.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-22 14:46:53 +01:00
Wolfgang Bumiller
2a17e5f323 dnsmasq: use quite-ra
otherwise each instance logs its RAs every 10 seconds the journal

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-22 14:37:39 +01:00
Wolfgang Bumiller
f9497f55e8 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>
2023-11-22 14:37:39 +01:00
Stefan Lendl
d4938d7aa3 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>
2023-11-22 14:37:32 +01:00
Stefan Hanreich
fb045d8c75 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>
2023-11-22 14:14:29 +01:00
Thomas Lamprecht
5469161c13 subnets: avoid nested post-if in eval
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-22 14:08:00 +01:00
Stefan Hanreich
5aea20cd5b 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>
2023-11-22 14:05:08 +01:00
Alexandre Derumier
d34cd5d180 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>
2023-11-22 13:10:40 +01:00
Wolfgang Bumiller
3cce500fc5 api: handle delete parameter when updating controllers
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-22 12:29:07 +01:00
Wolfgang Bumiller
1f5481ad6b api: handle delete parameter when updating dns entries
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-22 12:29:07 +01:00
Wolfgang Bumiller
99264c81d6 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>
2023-11-22 12:29:07 +01:00
Wolfgang Bumiller
4552f5d490 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>
2023-11-22 12:28:49 +01:00
Wolfgang Bumiller
d4c9897507 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>
2023-11-22 12:28:25 +01:00
Wolfgang Bumiller
3e3cafabaf 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>
2023-11-22 12:21:38 +01:00
Wolfgang Bumiller
9b448b0154 Revert "sdn: require ipam in simple plugin for dhcp"
This reverts commit 53ab149562.

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>
2023-11-22 11:32:47 +01:00
Wolfgang Bumiller
f8407bd27e dnsmasq: fix config directory permission
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-22 09:51:00 +01:00
Thomas Lamprecht
f58c7169fd bump version to 0.8.5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-21 20:34:48 +01:00
Stefan Hanreich
42ff574f3c subnet: fix dhcp-dns-server format
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2023-11-21 20:34:15 +01:00
Stefan Lendl
596d9c238a 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>
2023-11-21 20:34:10 +01:00
Wolfgang Bumiller
3bef780a5a bump version to 0.8.4
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-21 14:49:46 +01:00
Stefan Hanreich
04e1c8ed73 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>
2023-11-21 14:48:36 +01:00
Wolfgang Bumiller
5ab15238af bump version to 0.8.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-21 14:41:53 +01:00
Stefan Hanreich
543e2b75cd sdn: simple: Improve dhcp property description and validation
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2023-11-21 14:35:06 +01:00
Stefan Hanreich
53ab149562 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>
2023-11-21 14:35:04 +01:00
Thomas Lamprecht
365a4072e4 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>
2023-11-21 08:26:59 +01:00
Thomas Lamprecht
46348e8ba6 d/control: drop explicit perl dependency
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-21 08:26:36 +01:00
Thomas Lamprecht
8baff6bc3a d/control: update versioned dependency for pve-cluster
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-20 17:41:33 +01:00
Stefan Hanreich
359416aa52 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>
2023-11-20 17:40:36 +01:00
Alexandre Derumier
39062bc53a dhcp : dnsmasq: generate dbus policy
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-18 16:00:10 +01:00
Alexandre Derumier
a26a43bf97 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>
2023-11-18 16:00:10 +01:00
Alexandre Derumier
e6211baee9 dnsmasq: enable dbus && purge old ip lease on reservation
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-18 16:00:10 +01:00
Alexandre Derumier
3f764f82d1 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>
2023-11-18 16:00:10 +01:00
Alexandre Derumier
77617306c3 dhcp : remove del_ip_mapping
The cleanup is done in add_ip_mapping

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-18 16:00:10 +01:00
Alexandre Derumier
bbc34c2062 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>
2023-11-18 16:00:10 +01:00
Alexandre Derumier
e45924b41f 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>
2023-11-18 16:00:10 +01:00
Alexandre Derumier
beef73d642 add add_dhcp_mapping
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-18 15:59:50 +01:00