Message ID | 20240725112842.197565-1-shibir.basak@nutanix.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,v2] controller: Add lsp option disable_garp_rarp. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/github-robot-_ovn-kubernetes | fail | github build: failed |
On Thu, Jul 25, 2024 at 7:29 AM Shibir Basak <shibir.basak@nutanix.com> wrote: > > If the lsp option 'disable_garp_rarp' is set to true, > GARP and RARP announcements are not sent by ovn when a > VIF port is created on a bridged logical switch. > > Usecase > ======== > This option is useful during VM migration to let the > hypervisor/VM send the RARP/GARP once VM is ready to > process the packets post migration. This helps to reduce > downtime during VM migration. > > Signed-off-by: Shibir Basak <shibir.basak@nutanix.com> > Acked-by: Naveen Yerramneni <naveen.yerramneni@nutanix.com> Thanks. Applied to main. Numan > --- > v2: Rebase on top of latest main > Updated NEWS > --- > NEWS | 3 ++ > controller/pinctrl.c | 4 +-- > ovn-nb.xml | 7 +++++ > tests/ovn.at | 68 ++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 80 insertions(+), 2 deletions(-) > > diff --git a/NEWS b/NEWS > index 72933b5b9..435e6f773 100644 > --- a/NEWS > +++ b/NEWS > @@ -42,6 +42,9 @@ Post v24.03.0 > true, the traffic destined to a logical port of a provider logical switch > (having a localnet port) will be tunnelled instead of sending it via the > localnet port. > + - A new LSP option "disable_garp_rarp" has been added to prevent OVN from > + sending GARP or RARP announcements when a VIF is created on a bridged > + logical switch. > > OVN v24.03.0 - 01 Mar 2024 > -------------------------- > diff --git a/controller/pinctrl.c b/controller/pinctrl.c > index 6a4299b82..7cbb0cf81 100644 > --- a/controller/pinctrl.c > +++ b/controller/pinctrl.c > @@ -6612,7 +6612,7 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, > SSET_FOR_EACH (iface_id, &localnet_vifs) { > const struct sbrec_port_binding *pb = lport_lookup_by_name( > sbrec_port_binding_by_name, iface_id); > - if (pb) { > + if (pb && !smap_get_bool(&pb->options, "disable_garp_rarp", false)) { > send_garp_rarp_update(ovnsb_idl_txn, > sbrec_mac_binding_by_lport_ip, > local_datapaths, pb, &nat_addresses, > @@ -6625,7 +6625,7 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, > SSET_FOR_EACH (gw_port, &local_l3gw_ports) { > const struct sbrec_port_binding *pb > = lport_lookup_by_name(sbrec_port_binding_by_name, gw_port); > - if (pb) { > + if (pb && !smap_get_bool(&pb->options, "disable_garp_rarp", false)) { > send_garp_rarp_update(ovnsb_idl_txn, sbrec_mac_binding_by_lport_ip, > local_datapaths, pb, &nat_addresses, > garp_max_timeout, garp_continuous); > diff --git a/ovn-nb.xml b/ovn-nb.xml > index 0f9a1005a..fd6d42afd 100644 > --- a/ovn-nb.xml > +++ b/ovn-nb.xml > @@ -1306,6 +1306,13 @@ > The default value is <code>false</code>. > </column> > > + <column name="options" key="disable_garp_rarp" > + type='{"type": "boolean"}'> > + If set to <code>true</code>, GARP and RARP announcements are not > + sent when a VIF port is created on a bridged logical switch. > + The default value is <code>false</code>. > + </column> > + > <column name="options" key="pkt_clone_type" > type='{"type": "string", "enum": ["set", ["mc_unknown"]]}'> > If set to mc_unknown, packets going to this VIF get cloned to all > diff --git a/tests/ovn.at b/tests/ovn.at > index 2ced7c0b2..207ecf769 100644 > --- a/tests/ovn.at > +++ b/tests/ovn.at > @@ -25008,6 +25008,74 @@ OVN_CLEANUP([hv1]) > AT_CLEANUP > ]) > > +OVN_FOR_EACH_NORTHD([ > +AT_SETUP([Disabling RARP/GARP announcements]) > +ovn_start > + > +# In this test case we create 1 switch and bring up 4 VIFs on it. > +# Two VIFs will be assigned MAC addresses only (i.e. without ips) > +# and two VIFs will be assigned IP addresses along with MAC addresses. > +# VIFs with IPs are supposed to send GARPs and VIFs with only MAC > +# addresses are supposed to send RARP. However, we test the lsp > +# option disable_garp_rarp, which when set to true for an lsp does > +# not send the GARP/RARP announcements. > + > +ovn-nbctl ls-add ls1 > +ovn-nbctl lsp-add ls1 ln1 "" 101 > +ovn-nbctl lsp-set-addresses ln1 unknown > +ovn-nbctl lsp-set-type ln1 localnet > +ovn-nbctl lsp-set-options ln1 network_name=phys > + > +ovn-nbctl lsp-add ls1 lp11 > +ovn-nbctl lsp-set-addresses lp11 "f0:00:00:00:00:11" > + > +ovn-nbctl lsp-add ls1 lp12 > +ovn-nbctl lsp-set-addresses lp12 "f0:00:00:00:00:12" > +ovn-nbctl set logical_switch_port lp12 options:disable_garp_rarp=true > + > +ovn-nbctl lsp-add ls1 lp13 > +ovn-nbctl lsp-set-addresses lp13 "f0:00:00:00:00:13 192.168.1.3" > + > +ovn-nbctl lsp-add ls1 lp14 > +ovn-nbctl lsp-set-addresses lp14 "f0:00:00:00:00:14 192.168.1.4" > +ovn-nbctl set logical_switch_port lp14 options:disable_garp_rarp=true > + > +net_add n1 > + > +sim_add hv1 > +as hv1 > +ovs-vsctl add-br br-phys > +ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > +ovn_attach n1 br-phys 192.168.0.1 > + > +AT_CHECK([ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap]) > + > +ovs-vsctl add-port br-int vif11 -- \ > + set Interface vif11 external-ids:iface-id=lp11 > + > +ovs-vsctl add-port br-int vif12 -- \ > + set Interface vif12 external-ids:iface-id=lp12 > + > +ovs-vsctl add-port br-int vif13 -- \ > + set Interface vif13 external-ids:iface-id=lp13 > + > +ovs-vsctl add-port br-int vif14 -- \ > + set Interface vif14 external-ids:iface-id=lp14 > + > +wait_for_ports_up > +ovn-nbctl --wait=sb sync > + > +# RARP packet for lp11 > +echo "fffffffffffff000000000118100006580350001080006040003f0000000001100000000f0000000001100000000" > expected > +# GARP packet for lp13 > +echo "fffffffffffff000000000138100006508060001080006040001f00000000013c0a80103000000000000c0a80103" >> expected > +OVN_CHECK_PACKETS_UNIQ([hv1/snoopvif-tx.pcap], [expected]) > + > +OVN_CLEANUP([hv1]) > + > +AT_CLEANUP > +]) > + > OVN_FOR_EACH_NORTHD([ > AT_SETUP([Stateless Floating IP]) > ovn_start > -- > 2.22.3 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
diff --git a/NEWS b/NEWS index 72933b5b9..435e6f773 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,9 @@ Post v24.03.0 true, the traffic destined to a logical port of a provider logical switch (having a localnet port) will be tunnelled instead of sending it via the localnet port. + - A new LSP option "disable_garp_rarp" has been added to prevent OVN from + sending GARP or RARP announcements when a VIF is created on a bridged + logical switch. OVN v24.03.0 - 01 Mar 2024 -------------------------- diff --git a/controller/pinctrl.c b/controller/pinctrl.c index 6a4299b82..7cbb0cf81 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -6612,7 +6612,7 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, SSET_FOR_EACH (iface_id, &localnet_vifs) { const struct sbrec_port_binding *pb = lport_lookup_by_name( sbrec_port_binding_by_name, iface_id); - if (pb) { + if (pb && !smap_get_bool(&pb->options, "disable_garp_rarp", false)) { send_garp_rarp_update(ovnsb_idl_txn, sbrec_mac_binding_by_lport_ip, local_datapaths, pb, &nat_addresses, @@ -6625,7 +6625,7 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, SSET_FOR_EACH (gw_port, &local_l3gw_ports) { const struct sbrec_port_binding *pb = lport_lookup_by_name(sbrec_port_binding_by_name, gw_port); - if (pb) { + if (pb && !smap_get_bool(&pb->options, "disable_garp_rarp", false)) { send_garp_rarp_update(ovnsb_idl_txn, sbrec_mac_binding_by_lport_ip, local_datapaths, pb, &nat_addresses, garp_max_timeout, garp_continuous); diff --git a/ovn-nb.xml b/ovn-nb.xml index 0f9a1005a..fd6d42afd 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -1306,6 +1306,13 @@ The default value is <code>false</code>. </column> + <column name="options" key="disable_garp_rarp" + type='{"type": "boolean"}'> + If set to <code>true</code>, GARP and RARP announcements are not + sent when a VIF port is created on a bridged logical switch. + The default value is <code>false</code>. + </column> + <column name="options" key="pkt_clone_type" type='{"type": "string", "enum": ["set", ["mc_unknown"]]}'> If set to mc_unknown, packets going to this VIF get cloned to all diff --git a/tests/ovn.at b/tests/ovn.at index 2ced7c0b2..207ecf769 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -25008,6 +25008,74 @@ OVN_CLEANUP([hv1]) AT_CLEANUP ]) +OVN_FOR_EACH_NORTHD([ +AT_SETUP([Disabling RARP/GARP announcements]) +ovn_start + +# In this test case we create 1 switch and bring up 4 VIFs on it. +# Two VIFs will be assigned MAC addresses only (i.e. without ips) +# and two VIFs will be assigned IP addresses along with MAC addresses. +# VIFs with IPs are supposed to send GARPs and VIFs with only MAC +# addresses are supposed to send RARP. However, we test the lsp +# option disable_garp_rarp, which when set to true for an lsp does +# not send the GARP/RARP announcements. + +ovn-nbctl ls-add ls1 +ovn-nbctl lsp-add ls1 ln1 "" 101 +ovn-nbctl lsp-set-addresses ln1 unknown +ovn-nbctl lsp-set-type ln1 localnet +ovn-nbctl lsp-set-options ln1 network_name=phys + +ovn-nbctl lsp-add ls1 lp11 +ovn-nbctl lsp-set-addresses lp11 "f0:00:00:00:00:11" + +ovn-nbctl lsp-add ls1 lp12 +ovn-nbctl lsp-set-addresses lp12 "f0:00:00:00:00:12" +ovn-nbctl set logical_switch_port lp12 options:disable_garp_rarp=true + +ovn-nbctl lsp-add ls1 lp13 +ovn-nbctl lsp-set-addresses lp13 "f0:00:00:00:00:13 192.168.1.3" + +ovn-nbctl lsp-add ls1 lp14 +ovn-nbctl lsp-set-addresses lp14 "f0:00:00:00:00:14 192.168.1.4" +ovn-nbctl set logical_switch_port lp14 options:disable_garp_rarp=true + +net_add n1 + +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +ovn_attach n1 br-phys 192.168.0.1 + +AT_CHECK([ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap]) + +ovs-vsctl add-port br-int vif11 -- \ + set Interface vif11 external-ids:iface-id=lp11 + +ovs-vsctl add-port br-int vif12 -- \ + set Interface vif12 external-ids:iface-id=lp12 + +ovs-vsctl add-port br-int vif13 -- \ + set Interface vif13 external-ids:iface-id=lp13 + +ovs-vsctl add-port br-int vif14 -- \ + set Interface vif14 external-ids:iface-id=lp14 + +wait_for_ports_up +ovn-nbctl --wait=sb sync + +# RARP packet for lp11 +echo "fffffffffffff000000000118100006580350001080006040003f0000000001100000000f0000000001100000000" > expected +# GARP packet for lp13 +echo "fffffffffffff000000000138100006508060001080006040001f00000000013c0a80103000000000000c0a80103" >> expected +OVN_CHECK_PACKETS_UNIQ([hv1/snoopvif-tx.pcap], [expected]) + +OVN_CLEANUP([hv1]) + +AT_CLEANUP +]) + OVN_FOR_EACH_NORTHD([ AT_SETUP([Stateless Floating IP]) ovn_start