On Wed, Apr 24, 2024 at 5:57 AM Naveen Yerramneni <
naveen.yerramn...@nutanix.com> wrote:
> NB SCHEMA CHANGES
> -
> 1. New DHCP_Relay table
> "DHCP_Relay": {
> "columns": {
> "name": {"type": "string"},
> "servers": {"type": {"key": "string",
>"min": 0,
>"max": 1}},
> "external_ids": {
> "type": {"key": "string", "value": "string",
> "min": 0, "max": "unlimited"}}},
> "options": {"type": {"key": "string", "value": "string",
> "min": 0, "max": "unlimited"}},
> "isRoot": true},
> 2. New column to Logical_Router_Port table
> "dhcp_relay": {"type": {"key": {"type": "uuid",
> "refTable": "DHCP_Relay",
> "refType": "strong"},
> "min": 0,
> "max": 1}},
>
> NEW PIPELINE STAGES
> ---
> Following stage is added for DHCP relay feature.
> Some of the flows are fitted into the existing pipeline tages.
> 1. lr_in_dhcp_relay_req
>- This stage process the DHCP request packets coming from DHCP
> clients.
>- DHCP request packets for which dhcp_relay_req_chk action
> (which gets applied in ip input stage) is successful are
> forwarded to DHCP server.
>- DHCP request packets for which dhcp_relay_req_chk action is
> unsuccessful gets dropped.
> 2. lr_in_dhcp_relay_resp_chk
>- This stage applied the dhcp_relay_resp_chk action for DHCP
> response packets coming
> from the DHCP server.
> 3. lr_in_dhcp_relay_resp
>- DHCP response packets for which dhcp_relay_resp_chk is sucessful
> are forwarded
> to the DHCP clients.
>- DHCP response packets for which dhcp_relay_resp_chk is
> unsucessful gets dropped.
>
> REGISTRY USAGE
> ---
> - reg9[7] : To store the result of dhcp_relay_req_chk action.
> - reg9[8] : To store the result of dhcp_relay_resp_chk action.
> - reg2 : To store the original dest ip for DHCP response packets.
>This is required to properly match the packets in
>lr_in_dhcp_relay_resp stage since dhcp_relay_resp_chk action
>changes the dest ip.
>
> FLOWS
> -
>
> Following are the flows added when DHCP Relay is configured on one overlay
> subnet,
> one additonal flow is added in ls_in_l2_lkup table for each VM part of the
> subnet.
>
> 1. table=27(ls_in_l2_lkup ), priority=100 , match=(inport ==
> && eth.src == && ip4.src == 0.0.0.0 && ip4.dst ==
> 255.255.255.255 && udp.src == 68 && udp.dst == 67),
> action=(eth.dst=;outport=;next;/* DHCP_RELAY_REQ */)
> 2. table=3 (lr_in_ip_input ), priority=110 , match=(inport ==
> && ip4.src == 0.0.0.0 && ip4.dst == 255.255.255.255 && ip.frag == 0 &&
> udp.src == 68 && udp.dst == 67),
> action=(reg9[7] = dhcp_relay_req_chk(,
> );next; /* DHCP_RELAY_REQ */)
> 3. table=3 (lr_in_ip_input ), priority=110 , match=(ip4.src ==
> && ip4.dst == && udp.src == 67 && udp.dst == 67),
> action=(next;/* DHCP_RELAY_RESP */)
> 4. table=4 (lr_in_dhcp_relay_req), priority=100 , match=(inport ==
> "lrp1" && ip4.src == 0.0.0.0 && ip4.dst == 255.255.255.255 && udp.src == 68
> && udp.dst == 67 && reg9[7]),
> action=(ip4.src=;ip4.dst=;udp.src=67;next; /*
> DHCP_RELAY_REQ */)
> 5. table=4 (lr_in_dhcp_relay_req), priority=1, match=(inport ==
> && ip4.src == 0.0.0.0 && ip4.dst == 255.255.255.255 && udp.src == 68
> && udp.dst == 67 && reg9[7] == 0),
> action=(drop; /* DHCP_RELAY_REQ */)
> 6. table=18(lr_in_dhcp_relay_resp_chk), priority=100 , match=(ip4.src
> == && ip4.dst == && ip.frag == 0 && udp.src == 67 &&
> udp.dst == 67),
> action=(reg2 = ip4.dst;reg9[8] = dhcp_relay_resp_chk(,
> );next;/* DHCP_RELAY_RESP */)
> 7. table=19(lr_in_dhcp_relay_resp), priority=100 , match=(ip4.src ==
> && reg2 == && udp.src == 67 && udp.dst == 67 &&
> reg9[8]),
> action=(ip4.src=;udp.dst=68;outport=;output; /*
> DHCP_RELAY_RESP */)
> 8. table=19(lr_in_dhcp_relay_resp), priority=1, match=(ip4.src ==
> && reg2 == && udp.src == 67 && udp.dst == 67 &&
> reg9[8] == 0), action=(drop; /* DHCP_RELAY_RESP */)
>
> Commands to enable the feature
> --
> ovn-nbctl create DHCP_Relay name= servers=
> ovn-nbctl set Logical_Router_port dhcp_relay=
> ovn-nbctl set Logical_Switch
> other_config:dhcp_relay_port=
>
> Limitations:
>
> - All OVN features that needs IP address to be configured on logical
> port (like proxy arp, etc)
> will not be supported for overlay subnets on which DHCP relay is
> enabled.
>
> Signed-off-by: Naveen Yerramneni
> Co-authored-by: Huzaifa Calcuttawala
> Signed-off-by: Huzaifa Calcuttawala
> CC: Mary Manohar
>
Thanks. I applied this patch to