1 package PVE
::Network
::VxlanMulticastPlugin
;
5 use PVE
::Network
::Plugin
;
7 use base
('PVE::Network::Plugin');
9 PVE
::JSONSchema
::register_format
('pve-network-vxlanrange', \
&pve_verify_network_vxlanrange
);
10 sub pve_verify_network_vxlanrange
{
13 PVE
::Network
::Plugin
::parse_tag_number_or_range
($vxlanstr, '16777216');
19 return 'vxlanmulticast';
25 type
=> 'string', format
=> 'pve-network-vxlanrange',
26 description
=> "Allowed vlan range",
28 'multicast-address' => {
29 description
=> "Multicast address.",
30 type
=> 'string', #fixme: format
39 'uplink-id' => { fixed
=> 1 },
40 'multicast-address' => { fixed
=> 1 },
41 'vxlan-allowed' => { optional
=> 1 },
45 # Plugin implementation
46 sub generate_network_config
{
47 my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $interfaces, $uplinks) = @_;
49 my $tag = $vnet->{tag
};
50 my $mtu = $vnet->{mtu
};
51 my $multicastaddress = $plugin_config->{'multicast-address'};
52 my $uplink = $plugin_config->{'uplink-id'};
53 my $vxlanallowed = $plugin_config->{'vxlan-allowed'};
55 die "missing vxlan tag" if !$tag;
56 die "uplink $uplink is not defined" if !$uplinks->{$uplink};
57 my $iface = $uplinks->{$uplink};
60 PVE
::Network
::Plugin
::parse_tag_number_or_range
($vxlanallowed, '16777216', $tag) if $vxlanallowed;
63 die "vlan $tag is not allowed in transport $zoneid";
67 $config .= "auto vxlan$vnetid\n";
68 $config .= "iface vxlan$vnetid inet manual\n";
69 $config .= " vxlan-id $tag\n" if $tag;
70 $config .= " vxlan-svcnodeip $multicastaddress\n" if $multicastaddress;
71 $config .= " vxlan-physdev $iface\n" if $iface;
73 $config .= "auto $vnetid\n";
74 $config .= "iface $vnetid inet manual\n";
75 $config .= " bridge_ports vxlan$vnetid\n";
76 $config .= " bridge_stp off\n";
77 $config .= " bridge_fd 0\n";
78 $config .= " mtu $mtu\n" if $mtu;