[ovs-dev] [PATCH v2] datapath-windows: Update Orig Tuple to use ICMP Type and Code

Anand Kumar kumaranand at vmware.com
Wed Aug 16 17:45:48 UTC 2017


Hi Shashank,

Thanks for reviewing the patch. I will update the commit message and send out a v3 patch.
For the other comment, please find my response inline.

Thanks,
Anand Kumar


On 8/16/17, 10:03 AM, "Shashank Ram" <rams at vmware.com> wrote:

    ________________________________________
    From: ovs-dev-bounces at openvswitch.org <ovs-dev-bounces at openvswitch.org> on behalf of Anand Kumar <kumaranand at vmware.com>
    Sent: Tuesday, August 15, 2017 3:23 PM
    To: dev at openvswitch.org
    Subject: [ovs-dev] [PATCH v2] datapath-windows: Update Orig Tuple to use        ICMP Type and Code
    
    - Also add in some padding for the ct_endpoint's union.
    >>> Mention in the commit description why this padding is required.

    Co-authored-by: Sairam Venugopal <vsairam at vmware.com>
    Signed-off-by: Anand Kumar <kumaranand at vmware.com>
    ---
     datapath-windows/ovsext/Conntrack.c | 11 +++++++++--
     datapath-windows/ovsext/Conntrack.h |  6 ++++--
     2 files changed, 13 insertions(+), 4 deletions(-)
    
    diff --git a/datapath-windows/ovsext/Conntrack.c b/datapath-windows/ovsext/Conntrack.c
    index 917ebee..ce8c1c8 100644
    --- a/datapath-windows/ovsext/Conntrack.c
    +++ b/datapath-windows/ovsext/Conntrack.c
    @@ -782,9 +782,16 @@ OvsCtExecute_(OvsForwardingContext *fwdCtx,
    
             key->ct.tuple_ipv4.ipv4_src = ctKey->src.addr.ipv4_aligned;
             key->ct.tuple_ipv4.ipv4_dst = ctKey->dst.addr.ipv4_aligned;
    -        key->ct.tuple_ipv4.src_port = ctKey->src.port;
    -        key->ct.tuple_ipv4.dst_port = ctKey->dst.port;
             key->ct.tuple_ipv4.ipv4_proto = ctKey->nw_proto;
    +
    +        /* Orig tuple Port is overloaded to take in ICMP-Type & Code */
    +        /* This mimics the behavior in lib/conntrack.c*/
    +        key->ct.tuple_ipv4.src_port = ctKey->nw_proto != IPPROTO_ICMP ?
    +                                      ctKey->src.port :
    +                                      htons(ctKey->src.icmp_type);
    +        key->ct.tuple_ipv4.dst_port = ctKey->nw_proto != IPPROTO_ICMP ?
    +                                      ctKey->dst.port :
    +                                      htons(ctKey->src.icmp_code);
         }
    
         if (entryCreated && entry) {
    diff --git a/datapath-windows/ovsext/Conntrack.h b/datapath-windows/ovsext/Conntrack.h
    index 04ca299..bca7d90 100644
    --- a/datapath-windows/ovsext/Conntrack.h
    +++ b/datapath-windows/ovsext/Conntrack.h
    @@ -41,14 +41,16 @@ struct ct_addr {
     struct ct_endpoint {
         struct ct_addr addr;
         union {
    -        ovs_be16 port;
    +        struct {
    +            ovs_be16 port;
    +            uint16 pad_port;
    >>> It might be worth to add a comment about why the pad is required, so that if the struct changes later the padding is not forgotten about.
    [Anand Kumar] : I believe a comment here is not needed, it evident from the variable name. Can add it if it is really required.
    +        };
             struct {
                 ovs_be16 icmp_id;
                 uint8_t icmp_type;
                 uint8_t icmp_code;
             };
         };
    -    UINT16 pad;
     };
    
     typedef enum CT_UPDATE_RES {
    --
    2.9.3.windows.1
    
    _______________________________________________
    







More information about the dev mailing list