[OVN] classless-static-route DHCP option is not sanitized and overrides default routes

Bug #2069625 reported by Lucas Alvares Gomes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Lucas Alvares Gomes

Bug Description

Reported at: https://bugzilla.redhat.com/show_bug.cgi?id=2283515

extra-dhcp-option classless-static-route is not working properly. It sets the value in the SBDB without {} and overrides default routes.

Steps to Reproduce:

1. after port creation:
~~~
ovn-sbctl --db=$SBDB find logical_flow external_ids:stage-name=ls_in_dhcp_options | grep -B 2 -A 6 192.168.210.114
_uuid : 57c306d2-5e5b-460b-b314-9e581bb44e12
actions : "reg0[3] = put_dhcp_opts(offerip = 192.168.210.114, classless_static_route = {169.254.169.254/32,192.168.210.100, 0.0.0.0/0,192.168.210.1}, dns_server = {172.16.0.1, 10.0.0.1}, lease_time = 43200, mtu = 1442, netmask = 255.255.255.0, router = 192.168.210.1, server_id = 192.168.210.1); next;"
--
_uuid : cbe4a7b9-6536-4a28-833c-b941eecd7886
actions : "reg0[3] = put_dhcp_opts(offerip = 192.168.210.114, classless_static_route = {169.254.169.254/32,192.168.210.100, 0.0.0.0/0,192.168.210.1}, dns_server = {172.16.0.1, 10.0.0.1}, lease_time = 43200, mtu = 1442, netmask = 255.255.255.0, router = 192.168.210.1, server_id = 192.168.210.1); next;"
~~~

2. then if we set a set static route:
~~~
openstack port set --extra-dhcp-option name=classless-static-route,value=128.128.128.128/32,22.2.0.2,ip-version=4 a02943c7-6761-43ed-bcfd-2ac01afd2cb8
~~~

3. We will lose the default static route and it creates a syntax error because remove the {}
~~~
[root@compute-1 /]# ovn-sbctl --db=$SBDB find logical_flow external_ids:stage-name=ls_in_dhcp_options | grep -B 2 -A 6 192.168.210.114

_uuid : 8ead0f38-60fa-4d4e-88d1-63c39a03563f
actions : "reg0[3] = put_dhcp_opts(offerip = 192.168.210.114, classless_static_route = 128.128.128.128/32,22.2.0.2, dns_server = {172.16.0.1, 10.0.0.1}, lease_time = 43200, mtu = 1442, netmask = 255.255.255.0, router = 192.168.210.1, server_id = 192.168.210.1); next;"
--
_uuid : 36084950-18f7-4c41-9142-e34abdae4094
actions : "reg0[3] = put_dhcp_opts(offerip = 192.168.210.114, classless_static_route = 128.128.128.128/32,22.2.0.2, dns_server = {172.16.0.1, 10.0.0.1}, lease_time = 43200, mtu = 1442, netmask = 255.255.255.0, router = 192.168.210.1, server_id = 192.168.210.1); next;"
~~~

4. we can see the syntax error in the logs:
~~~
2024-05-27T08:53:12.951Z|328987|lflow|WARN|error parsing actions "reg0[3] = put_dhcp_opts(offerip = 192.168.210.114, classless_static_route = 128.128.128.128/32,22.2.0.2, dns_server = {192.168.210.212, 192.168.210.213}, lease_time = 43200, mtu = 1500, netmask = 255.255.255.0, router = 192.168.210.1, server_id = 192.168.210.1, tftp_server_address = 10.0.0.1); next;": Syntax error at `22.2.0.2'.
~~~

as a Workaround I pass the static route with the default ones in the {}, something like:
~~~
openstack port set --extra-dhcp-option name=classless-static-route,value="{169.254.169.254/32,192.168.210.100,0.0.0.0/0,192.168.210.1,128.128.128.128/32,22.2.0.2},ip-version=4" a02943c7-6761-43ed-bcfd-2ac01afd2cb8
~~~

ML2/OVN should not only sanitize this option (e.g making sure that it's wrapped with {} as expected by OVN) but also merge both the user routes and the default routers that comes from the subnet.

Tags: ovn
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/922119

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/922119
Committed: https://opendev.org/openstack/neutron/commit/ceee380a1835d706579aa0f3597ad9e0ce1a37ee
Submitter: "Zuul (22348)"
Branch: master

commit ceee380a1835d706579aa0f3597ad9e0ce1a37ee
Author: Lucas Alvares Gomes <email address hidden>
Date: Mon Jun 17 13:53:04 2024 +0100

    [OVN] Sanitize the classless-static-route DHCP option

    This patch ensures that the "classless-static-route" is wrapped in {} as
    expected by OVN and also merges the default routes with the user
    inputted ones so everything works as expected.

    Closes-Bug: #2069625
    Change-Id: I302a872161c55df447a05b31d99c702537502a2f
    Signed-off-by: Lucas Alvares Gomes <email address hidden>

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/2024.1)

Fix proposed to branch: stable/2024.1
Review: https://review.opendev.org/c/openstack/neutron/+/922323

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/neutron/+/922324

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/neutron/+/922325

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/2024.1)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/922323
Committed: https://opendev.org/openstack/neutron/commit/3d97c4f2ac34ee2402d1067d6828f5f3e53e713c
Submitter: "Zuul (22348)"
Branch: stable/2024.1

commit 3d97c4f2ac34ee2402d1067d6828f5f3e53e713c
Author: Lucas Alvares Gomes <email address hidden>
Date: Mon Jun 17 13:53:04 2024 +0100

    [OVN] Sanitize the classless-static-route DHCP option

    This patch ensures that the "classless-static-route" is wrapped in {} as
    expected by OVN and also merges the default routes with the user
    inputted ones so everything works as expected.

    Closes-Bug: #2069625
    Change-Id: I302a872161c55df447a05b31d99c702537502a2f
    Signed-off-by: Lucas Alvares Gomes <email address hidden>
    (cherry picked from commit ceee380a1835d706579aa0f3597ad9e0ce1a37ee)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/2023.1)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/922325
Committed: https://opendev.org/openstack/neutron/commit/0fb74dbbe1f3edb8167e591984b3593bf1bd5fbb
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit 0fb74dbbe1f3edb8167e591984b3593bf1bd5fbb
Author: Lucas Alvares Gomes <email address hidden>
Date: Mon Jun 17 13:53:04 2024 +0100

    [OVN] Sanitize the classless-static-route DHCP option

    This patch ensures that the "classless-static-route" is wrapped in {} as
    expected by OVN and also merges the default routes with the user
    inputted ones so everything works as expected.

    Closes-Bug: #2069625
    Change-Id: I302a872161c55df447a05b31d99c702537502a2f
    Signed-off-by: Lucas Alvares Gomes <email address hidden>
    (cherry picked from commit ceee380a1835d706579aa0f3597ad9e0ce1a37ee)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/2023.2)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/922324
Committed: https://opendev.org/openstack/neutron/commit/f6ec99d1b8d90010ed1bf445d6a127c900ab1892
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit f6ec99d1b8d90010ed1bf445d6a127c900ab1892
Author: Lucas Alvares Gomes <email address hidden>
Date: Mon Jun 17 13:53:04 2024 +0100

    [OVN] Sanitize the classless-static-route DHCP option

    This patch ensures that the "classless-static-route" is wrapped in {} as
    expected by OVN and also merges the default routes with the user
    inputted ones so everything works as expected.

    Closes-Bug: #2069625
    Change-Id: I302a872161c55df447a05b31d99c702537502a2f
    Signed-off-by: Lucas Alvares Gomes <email address hidden>
    (cherry picked from commit ceee380a1835d706579aa0f3597ad9e0ce1a37ee)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 25.0.0.0b1

This issue was fixed in the openstack/neutron 25.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.