← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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.

** Affects: neutron
     Importance: Medium
     Assignee: Lucas Alvares Gomes (lucasagomes)
         Status: In Progress


** Tags: ovn

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2069625

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

Status in neutron:
  In Progress

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2069625/+subscriptions



Follow ups