mirror of
https://git.proxmox.com/git/pve-network
synced 2025-08-15 05:17:05 +00:00
add format for multicast-address
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
parent
fcfca9ef25
commit
c692cbfad0
@ -3,7 +3,7 @@ package PVE::Network::SDN::VxlanPlugin;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use PVE::Network::SDN::Plugin;
|
use PVE::Network::SDN::Plugin;
|
||||||
use PVE::Tools;
|
use PVE::Tools qw($IPV4RE);
|
||||||
use PVE::INotify;
|
use PVE::INotify;
|
||||||
|
|
||||||
use base('PVE::Network::SDN::Plugin');
|
use base('PVE::Network::SDN::Plugin');
|
||||||
@ -17,6 +17,25 @@ sub pve_verify_sdn_vxlanrange {
|
|||||||
return $vxlanstr;
|
return $vxlanstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PVE::JSONSchema::register_format('ipv4-multicast', \&parse_ipv4_multicast);
|
||||||
|
sub parse_ipv4_multicast {
|
||||||
|
my ($ipv4, $noerr) = @_;
|
||||||
|
|
||||||
|
if ($ipv4 !~ m/^(?:$IPV4RE)$/) {
|
||||||
|
return undef if $noerr;
|
||||||
|
die "value does not look like a valid multicast IPv4 address\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ipv4 =~ m/^(\d+)\.\d+.\d+.\d+/) {
|
||||||
|
if($1 < 224 || $1 > 239) {
|
||||||
|
return undef if $noerr;
|
||||||
|
die "value does not look like a valid multicast IPv4 address\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ipv4;
|
||||||
|
}
|
||||||
|
|
||||||
sub type {
|
sub type {
|
||||||
return 'vxlan';
|
return 'vxlan';
|
||||||
}
|
}
|
||||||
@ -29,7 +48,7 @@ sub properties {
|
|||||||
},
|
},
|
||||||
'multicast-address' => {
|
'multicast-address' => {
|
||||||
description => "Multicast address.",
|
description => "Multicast address.",
|
||||||
type => 'string', #fixme: format
|
type => 'string', format => 'ipv4-multicast'
|
||||||
},
|
},
|
||||||
'unicast-address' => {
|
'unicast-address' => {
|
||||||
description => "Unicast peers address ip list.",
|
description => "Unicast peers address ip list.",
|
||||||
|
Loading…
Reference in New Issue
Block a user