From db9cc7f187ff8b2796bafd1f3b14472256385338 Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Tue, 8 Nov 2011 16:02:06 -0800 Subject: First pass implementation of support for virtual MAC address This change introduces a new parameter named "interface" under the vrrp-group configuration tree under ethernet interfaces and vlans. If the "interface" parameter is set, keepalived will be configured to bring up a macvlan interface, which will hold the virtual MAC address that is specified in the VRRP spec. --- scripts/keepalived/vyatta-keepalived.pl | 9 +++++++++ .../vif/node.tag/vrrp/vrrp-group/node.tag/interface/node.def | 1 + .../node.tag/vrrp/vrrp-group/node.tag/interface/node.def | 1 + 3 files changed, 11 insertions(+) create mode 100644 templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/interface/node.def create mode 100644 templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/interface/node.def diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl index 7a113469..e834745b 100755 --- a/scripts/keepalived/vyatta-keepalived.pl +++ b/scripts/keepalived/vyatta-keepalived.pl @@ -144,6 +144,12 @@ sub keepalived_get_values { push @errs, $err; next; } + + my $use_vmac = 0; + if ( $config->exists("interface") ) { + $use_vmac = 1; + } + my $priority = $config->returnValue("priority"); if ( !defined $priority ) { $priority = 1; @@ -240,6 +246,9 @@ sub keepalived_get_values { $output .= "\tstate $init_state\n"; $output .= "\tinterface $intf\n"; $output .= "\tvirtual_router_id $group\n"; + if ($use_vmac) { + $output .= "\tuse_vmac\n"; + } $output .= "\tpriority $priority\n"; if ( $preempt eq "false" ) { $output .= "\tnopreempt\n"; diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/interface/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/interface/node.def new file mode 100644 index 00000000..03f22d28 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/interface/node.def @@ -0,0 +1 @@ +help: Configure a virtual MAC interface diff --git a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/interface/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/interface/node.def new file mode 100644 index 00000000..03f22d28 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/interface/node.def @@ -0,0 +1 @@ +help: Configure a virtual MAC interface -- cgit v1.2.3