diff options
| author | Alexandre Derumier <aderumier@odiso.com> | 2019-08-29 12:32:46 +0200 |
|---|---|---|
| committer | Thomas Lamprecht <t.lamprecht@proxmox.com> | 2019-09-03 08:22:56 +0200 |
| commit | 3ee45e4ce1126404a0a9110a7555a657df98bb07 (patch) | |
| tree | d1452cda73e44308907ac29e051e474bd5086f4e /PVE/Network/SDN/Plugin.pm | |
| parent | 0022a9189e5cb3c008736e8cf1046e77d6dde429 (diff) | |
make Vxlanplugin generic for multicast/unicast/frr
if no multicast or unicast address is defined, default to frr
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Diffstat (limited to 'PVE/Network/SDN/Plugin.pm')
| -rw-r--r-- | PVE/Network/SDN/Plugin.pm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/PVE/Network/SDN/Plugin.pm b/PVE/Network/SDN/Plugin.pm index a76442b..36efbe1 100644 --- a/PVE/Network/SDN/Plugin.pm +++ b/PVE/Network/SDN/Plugin.pm @@ -121,4 +121,26 @@ sub parse_tag_number_or_range { return (scalar(@elements) > 1); } +#to be move to Network.pm helper +sub get_first_local_ipv4_from_interface { + my ($interface) = @_; + + my $cmd = ['/sbin/ip', 'address', 'show', 'dev', $interface]; + + my $IP = ""; + + my $code = sub { + my $line = shift; + + if ($line =~ m!^\s*inet\s+($PVE::Tools::IPRE)(?:/\d+|\s+peer\s+)!) { + $IP = $1; + return; + } + }; + + PVE::Tools::run_command($cmd, outfunc => $code); + + return $IP; +} + 1; |
