Message ID | 20200423153754.60570-1-lmartins@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,ovn,v2] Add support for DHCP options 35 and 38 | expand |
On Thu, Apr 23, 2020 at 9:08 PM <lmartins@redhat.com> wrote: > > From: Lucas Alvares Gomes <lucasagomes@gmail.com> > > This patch is adding support for two new DHCP options: > > * Option 35, ARP timeout: > http://www.networksorcery.com/enp/protocol/bootp/option035.htm > * Option 38, TCP Keepalive interval: > http://www.networksorcery.com/enp/protocol/bootp/option038.htm > > I noticed that these two options were missing in OVN while working in > DHCP related code for OpenStack. > > Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com> Thanks Lucas for the patch and Flavio for the review. I applied this patch to master. Numan > --- > v1 -> v2: > * Renamed the "arp_timeout" option to "arp_cache_timeout" > > lib/ovn-l7.h | 5 +++++ > northd/ovn-northd.c | 2 ++ > ovn-nb.xml | 13 +++++++++++++ > tests/ovn.at | 6 +++--- > tests/test-ovn.c | 2 ++ > 5 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h > index cbea2a0c8..cc63d822d 100644 > --- a/lib/ovn-l7.h > +++ b/lib/ovn-l7.h > @@ -82,6 +82,11 @@ struct gen_opts_map { > #define DHCP_OPT_TFTP_SERVER_ADDRESS \ > DHCP_OPTION("tftp_server_address", 150, "ipv4") > > +#define DHCP_OPT_ARP_CACHE_TIMEOUT \ > + DHCP_OPTION("arp_cache_timeout", 35, "uint32") > +#define DHCP_OPT_TCP_KEEPALIVE_INTERVAL \ > + DHCP_OPTION("tcp_keepalive_interval", 38, "uint32") > + > static inline uint32_t > gen_opt_hash(char *opt_name) > { > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c > index c4675bd68..545186ecd 100644 > --- a/northd/ovn-northd.c > +++ b/northd/ovn-northd.c > @@ -11300,6 +11300,8 @@ static struct gen_opts_map supported_dhcp_opts[] = { > DHCP_OPT_PATH_PREFIX, > DHCP_OPT_TFTP_SERVER_ADDRESS, > DHCP_OPT_DOMAIN_NAME, > + DHCP_OPT_ARP_CACHE_TIMEOUT, > + DHCP_OPT_TCP_KEEPALIVE_INTERVAL, > }; > > static struct gen_opts_map supported_dhcpv6_opts[] = { > diff --git a/ovn-nb.xml b/ovn-nb.xml > index 163dd12ee..af15c550a 100644 > --- a/ovn-nb.xml > +++ b/ovn-nb.xml > @@ -2852,6 +2852,19 @@ > client begins trying to rebind its address. The DHCPv4 option code > for this option is 59. > </column> > + > + <column name="options" key="arp_cache_timeout" > + type='{"type": "integer", "minInteger": 0, "maxInteger": 255}'> > + The DHCPv4 option code for this option is 35. This option > + specifies the timeout in seconds for ARP cache entries. > + </column> > + > + <column name="options" key="tcp_keepalive_interval" > + type='{"type": "integer", "minInteger": 0, "maxInteger": 255}'> > + The DHCPv4 option code for this option is 38. This option > + specifies the interval that the client TCP should wait before > + sending a keepalive message on a TCP connection. > + </column> > </group> > > <group title="String DHCP Options"> > diff --git a/tests/ovn.at b/tests/ovn.at > index 2a7ee7528..2f2ca7a17 100644 > --- a/tests/ovn.at > +++ b/tests/ovn.at > @@ -1188,9 +1188,9 @@ reg1[0] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1); > reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,mtu=1400,domain_name="ovn.org",wpad="https://example.org",bootfile_name="https://127.0.0.1/boot.ipxe",path_prefix="/tftpboot"); > formats as reg2[5] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.254.0, mtu = 1400, domain_name = "ovn.org", wpad = "https://example.org", bootfile_name = "https://127.0.0.1/boot.ipxe", path_prefix = "/tftpboot"); > encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.25.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.fe.00.1a.02.05.78.0f.07.6f.76.6e.2e.6f.72.67.fc.13.68.74.74.70.73.3a.2f.2f.65.78.61.6d.70.6c.65.2e.6f.72.67.43.1b.68.74.74.70.73.3a.2f.2f.31.32.37.2e.30.2e.30.2e.31.2f.62.6f.6f.74.2e.69.70.78.65.d2.09.2f.74.66.74.70.62.6f.6f.74,pause) > -reg0[15] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.255.0,mtu=1400,ip_forward_enable=1,default_ttl=121,dns_server={8.8.8.8,7.7.7.7},classless_static_route={30.0.0.0/24,10.0.0.4,40.0.0.0/16,10.0.0.6,0.0.0.0/0,10.0.0.1},ethernet_encap=1,router_discovery=0,tftp_server_address={10.0.0.4,10.0.0.5}); > - formats as reg0[15] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.255.0, mtu = 1400, ip_forward_enable = 1, default_ttl = 121, dns_server = {8.8.8.8, 7.7.7.7}, classless_static_route = {30.0.0.0/24, 10.0.0.4, 40.0.0.0/16, 10.0.0.6, 0.0.0.0/0, 10.0.0.1}, ethernet_encap = 1, router_discovery = 0, tftp_server_address = {10.0.0.4, 10.0.0.5}); > - encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.6f.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.ff.00.1a.02.05.78.13.01.01.17.01.79.06.08.08.08.08.08.07.07.07.07.79.14.18.1e.00.00.0a.00.00.04.10.28.00.0a.00.00.06.00.0a.00.00.01.24.01.01.1f.01.00.96.08.0a.00.00.04.0a.00.00.05,pause) > +reg0[15] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.255.0,mtu=1400,ip_forward_enable=1,default_ttl=121,dns_server={8.8.8.8,7.7.7.7},classless_static_route={30.0.0.0/24,10.0.0.4,40.0.0.0/16,10.0.0.6,0.0.0.0/0,10.0.0.1},ethernet_encap=1,router_discovery=0,tftp_server_address={10.0.0.4,10.0.0.5},arp_cache_timeout=10,tcp_keepalive_interval=10); > + formats as reg0[15] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.255.0, mtu = 1400, ip_forward_enable = 1, default_ttl = 121, dns_server = {8.8.8.8, 7.7.7.7}, classless_static_route = {30.0.0.0/24, 10.0.0.4, 40.0.0.0/16, 10.0.0.6, 0.0.0.0/0, 10.0.0.1}, ethernet_encap = 1, router_discovery = 0, tftp_server_address = {10.0.0.4, 10.0.0.5}, arp_cache_timeout = 10, tcp_keepalive_interval = 10); > + encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.6f.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.ff.00.1a.02.05.78.13.01.01.17.01.79.06.08.08.08.08.08.07.07.07.07.79.14.18.1e.00.00.0a.00.00.04.10.28.00.0a.00.00.06.00.0a.00.00.01.24.01.01.1f.01.00.96.08.0a.00.00.04.0a.00.00.05.23.04.00.00.00.0a.26.04.00.00.00.0a,pause) > > reg1[0..1] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1); > Cannot use 2-bit field reg1[0..1] where 1-bit field is required. > diff --git a/tests/test-ovn.c b/tests/test-ovn.c > index 11697ebd0..a77d2f120 100644 > --- a/tests/test-ovn.c > +++ b/tests/test-ovn.c > @@ -187,6 +187,8 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, > dhcp_opt_add(dhcp_opts, "bootfile_name", 67, "str"); > dhcp_opt_add(dhcp_opts, "path_prefix", 210, "str"); > dhcp_opt_add(dhcp_opts, "tftp_server_address", 150, "ipv4"); > + dhcp_opt_add(dhcp_opts, "arp_cache_timeout", 35, "uint32"); > + dhcp_opt_add(dhcp_opts, "tcp_keepalive_interval", 38, "uint32"); > > /* DHCPv6 options. */ > hmap_init(dhcpv6_opts); > -- > 2.26.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h index cbea2a0c8..cc63d822d 100644 --- a/lib/ovn-l7.h +++ b/lib/ovn-l7.h @@ -82,6 +82,11 @@ struct gen_opts_map { #define DHCP_OPT_TFTP_SERVER_ADDRESS \ DHCP_OPTION("tftp_server_address", 150, "ipv4") +#define DHCP_OPT_ARP_CACHE_TIMEOUT \ + DHCP_OPTION("arp_cache_timeout", 35, "uint32") +#define DHCP_OPT_TCP_KEEPALIVE_INTERVAL \ + DHCP_OPTION("tcp_keepalive_interval", 38, "uint32") + static inline uint32_t gen_opt_hash(char *opt_name) { diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index c4675bd68..545186ecd 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -11300,6 +11300,8 @@ static struct gen_opts_map supported_dhcp_opts[] = { DHCP_OPT_PATH_PREFIX, DHCP_OPT_TFTP_SERVER_ADDRESS, DHCP_OPT_DOMAIN_NAME, + DHCP_OPT_ARP_CACHE_TIMEOUT, + DHCP_OPT_TCP_KEEPALIVE_INTERVAL, }; static struct gen_opts_map supported_dhcpv6_opts[] = { diff --git a/ovn-nb.xml b/ovn-nb.xml index 163dd12ee..af15c550a 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -2852,6 +2852,19 @@ client begins trying to rebind its address. The DHCPv4 option code for this option is 59. </column> + + <column name="options" key="arp_cache_timeout" + type='{"type": "integer", "minInteger": 0, "maxInteger": 255}'> + The DHCPv4 option code for this option is 35. This option + specifies the timeout in seconds for ARP cache entries. + </column> + + <column name="options" key="tcp_keepalive_interval" + type='{"type": "integer", "minInteger": 0, "maxInteger": 255}'> + The DHCPv4 option code for this option is 38. This option + specifies the interval that the client TCP should wait before + sending a keepalive message on a TCP connection. + </column> </group> <group title="String DHCP Options"> diff --git a/tests/ovn.at b/tests/ovn.at index 2a7ee7528..2f2ca7a17 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1188,9 +1188,9 @@ reg1[0] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1); reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,mtu=1400,domain_name="ovn.org",wpad="https://example.org",bootfile_name="https://127.0.0.1/boot.ipxe",path_prefix="/tftpboot"); formats as reg2[5] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.254.0, mtu = 1400, domain_name = "ovn.org", wpad = "https://example.org", bootfile_name = "https://127.0.0.1/boot.ipxe", path_prefix = "/tftpboot"); encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.25.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.fe.00.1a.02.05.78.0f.07.6f.76.6e.2e.6f.72.67.fc.13.68.74.74.70.73.3a.2f.2f.65.78.61.6d.70.6c.65.2e.6f.72.67.43.1b.68.74.74.70.73.3a.2f.2f.31.32.37.2e.30.2e.30.2e.31.2f.62.6f.6f.74.2e.69.70.78.65.d2.09.2f.74.66.74.70.62.6f.6f.74,pause) -reg0[15] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.255.0,mtu=1400,ip_forward_enable=1,default_ttl=121,dns_server={8.8.8.8,7.7.7.7},classless_static_route={30.0.0.0/24,10.0.0.4,40.0.0.0/16,10.0.0.6,0.0.0.0/0,10.0.0.1},ethernet_encap=1,router_discovery=0,tftp_server_address={10.0.0.4,10.0.0.5}); - formats as reg0[15] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.255.0, mtu = 1400, ip_forward_enable = 1, default_ttl = 121, dns_server = {8.8.8.8, 7.7.7.7}, classless_static_route = {30.0.0.0/24, 10.0.0.4, 40.0.0.0/16, 10.0.0.6, 0.0.0.0/0, 10.0.0.1}, ethernet_encap = 1, router_discovery = 0, tftp_server_address = {10.0.0.4, 10.0.0.5}); - encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.6f.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.ff.00.1a.02.05.78.13.01.01.17.01.79.06.08.08.08.08.08.07.07.07.07.79.14.18.1e.00.00.0a.00.00.04.10.28.00.0a.00.00.06.00.0a.00.00.01.24.01.01.1f.01.00.96.08.0a.00.00.04.0a.00.00.05,pause) +reg0[15] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.255.0,mtu=1400,ip_forward_enable=1,default_ttl=121,dns_server={8.8.8.8,7.7.7.7},classless_static_route={30.0.0.0/24,10.0.0.4,40.0.0.0/16,10.0.0.6,0.0.0.0/0,10.0.0.1},ethernet_encap=1,router_discovery=0,tftp_server_address={10.0.0.4,10.0.0.5},arp_cache_timeout=10,tcp_keepalive_interval=10); + formats as reg0[15] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.255.0, mtu = 1400, ip_forward_enable = 1, default_ttl = 121, dns_server = {8.8.8.8, 7.7.7.7}, classless_static_route = {30.0.0.0/24, 10.0.0.4, 40.0.0.0/16, 10.0.0.6, 0.0.0.0/0, 10.0.0.1}, ethernet_encap = 1, router_discovery = 0, tftp_server_address = {10.0.0.4, 10.0.0.5}, arp_cache_timeout = 10, tcp_keepalive_interval = 10); + encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.6f.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.ff.00.1a.02.05.78.13.01.01.17.01.79.06.08.08.08.08.08.07.07.07.07.79.14.18.1e.00.00.0a.00.00.04.10.28.00.0a.00.00.06.00.0a.00.00.01.24.01.01.1f.01.00.96.08.0a.00.00.04.0a.00.00.05.23.04.00.00.00.0a.26.04.00.00.00.0a,pause) reg1[0..1] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1); Cannot use 2-bit field reg1[0..1] where 1-bit field is required. diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 11697ebd0..a77d2f120 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -187,6 +187,8 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, dhcp_opt_add(dhcp_opts, "bootfile_name", 67, "str"); dhcp_opt_add(dhcp_opts, "path_prefix", 210, "str"); dhcp_opt_add(dhcp_opts, "tftp_server_address", 150, "ipv4"); + dhcp_opt_add(dhcp_opts, "arp_cache_timeout", 35, "uint32"); + dhcp_opt_add(dhcp_opts, "tcp_keepalive_interval", 38, "uint32"); /* DHCPv6 options. */ hmap_init(dhcpv6_opts);