Message ID | 20201028135940.45119-1-lmartins@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] Add support for DHCP options 28 (Broadcast Address) | expand |
On Wed, Oct 28, 2020 at 7:30 PM <lmartins@redhat.com> wrote: > > From: Lucas Alvares Gomes <lucasagomes@gmail.com> > > This patch adds support for the DHCP option 28 (Broadcast Address). This > options is part of the RFC 2132: https://tools.ietf.org/html/rfc2132 > and can be specified by OpenStack users. > > Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com> Thanks Lucas. I applied this patch to master. Numan > --- > lib/ovn-l7.h | 3 +++ > northd/ovn-northd.c | 1 + > ovn-nb.xml | 7 +++++++ > tests/ovn.at | 6 +++--- > tests/test-ovn.c | 1 + > 5 files changed, 15 insertions(+), 3 deletions(-) > > diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h > index c3e8fd660..aa13fa57a 100644 > --- a/lib/ovn-l7.h > +++ b/lib/ovn-l7.h > @@ -93,6 +93,9 @@ struct gen_opts_map { > #define DHCP_OPT_DOMAIN_SEARCH_LIST \ > DHCP_OPTION("domain_search_list", 119, "domains") > > +#define DHCP_OPT_BROADCAST_ADDRESS \ > + DHCP_OPTION("broadcast_address", 28, "ipv4") > + > #define DHCP_OPT_BOOTFILE_CODE 67 > > /* Use unused 254 option for iPXE bootfile_name_alt userdata DHCP option. > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c > index 8800a3d3c..16d19714a 100644 > --- a/northd/ovn-northd.c > +++ b/northd/ovn-northd.c > @@ -12483,6 +12483,7 @@ static struct gen_opts_map supported_dhcp_opts[] = { > DHCP_OPT_TCP_KEEPALIVE_INTERVAL, > DHCP_OPT_DOMAIN_SEARCH_LIST, > DHCP_OPT_BOOTFILE_ALT, > + DHCP_OPT_BROADCAST_ADDRESS, > }; > > static struct gen_opts_map supported_dhcpv6_opts[] = { > diff --git a/ovn-nb.xml b/ovn-nb.xml > index 5e8635992..d0d64d857 100644 > --- a/ovn-nb.xml > +++ b/ovn-nb.xml > @@ -3127,6 +3127,13 @@ > dhcp request contains etherboot option (175), otherwise > "bootfile_name_alt" will be used. > </column> > + > + <column name="options" key="broadcast_address"> > + <p> > + The DHCPv4 option code for this option is 28. This option > + specifies the IP address used as a broadcast address. > + </p> > + </column> > </group> > > <group title="DHCP Options of type host_id"> > diff --git a/tests/ovn.at b/tests/ovn.at > index 04b7a3df7..db4cfcd4d 100644 > --- a/tests/ovn.at > +++ b/tests/ovn.at > @@ -1284,9 +1284,9 @@ reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,m > 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) > -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=10.0.0.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 = 10.0.0.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.42.04.0a.00.00.0a,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=10.0.0.10,broadcast_address=255.255.255.255); > + 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 = 10.0.0.10, broadcast_address = 255.255.255.255); > + 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.42.04.0a.00.00.0a.1c.04.ff.ff.ff.ff,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="tftp_server_test"); > 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 = "tftp_server_test"); > 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.42.10.74.66.74.70.5f.73.65.72.76.65.72.5f.74.65.73.74,pause) > diff --git a/tests/test-ovn.c b/tests/test-ovn.c > index 80d99b7a8..74b5a3384 100644 > --- a/tests/test-ovn.c > +++ b/tests/test-ovn.c > @@ -192,6 +192,7 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, > dhcp_opt_add(dhcp_opts, "tcp_keepalive_interval", 38, "uint32"); > dhcp_opt_add(dhcp_opts, "domain_search_list", 119, "domains"); > dhcp_opt_add(dhcp_opts, "bootfile_name_alt", 254, "str"); > + dhcp_opt_add(dhcp_opts, "broadcast_address", 28, "ipv4"); > > /* DHCPv6 options. */ > hmap_init(dhcpv6_opts); > -- > 2.29.0 > > _______________________________________________ > 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 c3e8fd660..aa13fa57a 100644 --- a/lib/ovn-l7.h +++ b/lib/ovn-l7.h @@ -93,6 +93,9 @@ struct gen_opts_map { #define DHCP_OPT_DOMAIN_SEARCH_LIST \ DHCP_OPTION("domain_search_list", 119, "domains") +#define DHCP_OPT_BROADCAST_ADDRESS \ + DHCP_OPTION("broadcast_address", 28, "ipv4") + #define DHCP_OPT_BOOTFILE_CODE 67 /* Use unused 254 option for iPXE bootfile_name_alt userdata DHCP option. diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 8800a3d3c..16d19714a 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -12483,6 +12483,7 @@ static struct gen_opts_map supported_dhcp_opts[] = { DHCP_OPT_TCP_KEEPALIVE_INTERVAL, DHCP_OPT_DOMAIN_SEARCH_LIST, DHCP_OPT_BOOTFILE_ALT, + DHCP_OPT_BROADCAST_ADDRESS, }; static struct gen_opts_map supported_dhcpv6_opts[] = { diff --git a/ovn-nb.xml b/ovn-nb.xml index 5e8635992..d0d64d857 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -3127,6 +3127,13 @@ dhcp request contains etherboot option (175), otherwise "bootfile_name_alt" will be used. </column> + + <column name="options" key="broadcast_address"> + <p> + The DHCPv4 option code for this option is 28. This option + specifies the IP address used as a broadcast address. + </p> + </column> </group> <group title="DHCP Options of type host_id"> diff --git a/tests/ovn.at b/tests/ovn.at index 04b7a3df7..db4cfcd4d 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1284,9 +1284,9 @@ reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,m 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) -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=10.0.0.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 = 10.0.0.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.42.04.0a.00.00.0a,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=10.0.0.10,broadcast_address=255.255.255.255); + 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 = 10.0.0.10, broadcast_address = 255.255.255.255); + 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.42.04.0a.00.00.0a.1c.04.ff.ff.ff.ff,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="tftp_server_test"); 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 = "tftp_server_test"); 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.42.10.74.66.74.70.5f.73.65.72.76.65.72.5f.74.65.73.74,pause) diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 80d99b7a8..74b5a3384 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -192,6 +192,7 @@ create_gen_opts(struct hmap *dhcp_opts, struct hmap *dhcpv6_opts, dhcp_opt_add(dhcp_opts, "tcp_keepalive_interval", 38, "uint32"); dhcp_opt_add(dhcp_opts, "domain_search_list", 119, "domains"); dhcp_opt_add(dhcp_opts, "bootfile_name_alt", 254, "str"); + dhcp_opt_add(dhcp_opts, "broadcast_address", 28, "ipv4"); /* DHCPv6 options. */ hmap_init(dhcpv6_opts);