[ovs-dev] [PATCH ovn] Introduce DHCPDECLINE msg support to OVN DHCP server

Numan Siddique numans at ovn.org
Fri Sep 4 18:04:37 UTC 2020


On Wed, Aug 26, 2020 at 3:46 PM Lorenzo Bianconi <
lorenzo.bianconi at redhat.com> wrote:

> According to the RFC2131 (https://tools.ietf.org/html/rfc2131), if the
> server server receives a DHCPDECLINE message, the client has discovered
> through some other means that the suggested network address is already
> in use. The server SHOULD notify the local system administrator of a
> possible configuration problem.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
>

Thanks Lorenzo. I applied this patch to master.

Numan


> ---
>  controller/pinctrl.c |  6 ++++++
>  lib/ovn-l7.h         |  1 +
>  tests/ovn.at         | 13 +++++++++++++
>  3 files changed, 20 insertions(+)
>
> diff --git a/controller/pinctrl.c b/controller/pinctrl.c
> index f72ab70e1..4adfe1809 100644
> --- a/controller/pinctrl.c
> +++ b/controller/pinctrl.c
> @@ -1889,6 +1889,12 @@ pinctrl_handle_put_dhcp_opts(
>
>          break;
>      }
> +    case OVN_DHCP_MSG_DECLINE:
> +        if (request_ip == *offer_ip) {
> +            VLOG_INFO("DHCPDECLINE from "ETH_ADDR_FMT ", "IP_FMT"
> duplicated",
> +                      ETH_ADDR_ARGS(in_flow->dl_src), IP_ARGS(*offer_ip));
> +        }
> +        goto exit;
>      default: {
>          static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
>          VLOG_WARN_RL(&rl, "Invalid DHCP message type: %d",
> *in_dhcp_msg_type);
> diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h
> index 9acfbe075..18c59896d 100644
> --- a/lib/ovn-l7.h
> +++ b/lib/ovn-l7.h
> @@ -180,6 +180,7 @@ struct dhcp_opt6_header {
>  };
>
>  /* These are not defined in ovs/lib/dhcp.h, hence defining here. */
> +#define OVN_DHCP_MSG_DECLINE        4
>  #define OVN_DHCP_MSG_RELEASE        7
>  #define OVN_DHCP_MSG_INFORM         8
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 8aabdf307..9dc310224 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -5332,6 +5332,10 @@ test_dhcp() {
>          reply_dst_ip=${offer_ip}
>      fi
>
> +    if test "$dhcp_type" == "04"; then
> +        ciaddr=$offer_ip
> +    fi
> +
>      local
> request=ffffffffffff${src_mac}08004510${ip_len}0000000080110000${src_ip}${dst_ip}
>      # udp header and dhcp header
>      request=${request}00440043${udp_len}0000
> @@ -5897,6 +5901,15 @@ AT_CHECK([cat 2.packets | cut -c -48], [0],
> [expout])
>  cat 2.expected | cut -c 53- > expout
>  AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout])
>
> +# test DHCPDECLINE
> +offer_ip=`ip_to_hex 10 0 0 4`
> +server_ip=`ip_to_hex 10 0 0 1`
> +ciaddr=`ip_to_hex 0 0 0 0`
> +request_ip=0
> +expected_dhcp_opts=""
> +test_dhcp 1 f00000000001 04 0 $ciaddr $offer_ip $request_ip 0
> ff1000000001 $server_ip 02 $expected_dhcp_opts
> +AT_CHECK([fgrep -iq 'DHCPDECLINE from f0:00:00:00:00:01, 10.0.0.4
> duplicated' hv1/ovn-controller.log], [0], [])
> +
>  OVN_CLEANUP([hv1])
>
>  AT_CLEANUP
> --
> 2.26.2
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>


More information about the dev mailing list