[ovs-dev] [patch v2] netdev-native-tnl: Fix alignment for erspan index.

Darrell Ball dball at vmware.com
Tue May 22 18:01:59 UTC 2018


pebcak issues on my part - Ignore this patch as it was not rebased

Also, I checked the erspan header and made some adjustments to the code similar to v1.

Darrell

On 5/22/18, 9:31 AM, "ovs-dev-bounces at openvswitch.org on behalf of Darrell Ball" <ovs-dev-bounces at openvswitch.org on behalf of dlu998 at gmail.com> wrote:

    Flagged by clang.
    
    CC: Greg Rose <gvrose8192 at gmail.com>
    Fixes: 068794b43f0e ("erspan: Add flow-based erspan options")
    Signed-off-by: Darrell Ball <dlu998 at gmail.com>
    ---
     lib/netdev-native-tnl.c | 15 ++++-----------
     1 file changed, 4 insertions(+), 11 deletions(-)
    
    diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
    index bb1b04f..46c7fff 100644
    --- a/lib/netdev-native-tnl.c
    +++ b/lib/netdev-native-tnl.c
    @@ -653,27 +653,20 @@ netdev_erspan_build_header(const struct netdev *netdev,
         }
     
         if (erspan_ver == 1) {
    -        ovs_be32 erspan_idx;
    -        void *erspan_hdr_idx;
     
             greh->protocol = htons(ETH_TYPE_ERSPAN1);
             greh->flags = htons(GRE_SEQ);
             ersh->ver = 1;
             set_sid(ersh, sid);
     
    -        put_16aligned_be32(ALIGNED_CAST(ovs_16aligned_be32 *, ersh + 1),
    -                           htonl(tnl_cfg->erspan_idx));
    -
    -        erspan_hdr_idx = ersh + 1;
    -
             if (tnl_cfg->erspan_idx_flow) {
    -            erspan_idx = htonl(params->flow->tunnel.erspan_idx);
    +            put_16aligned_be32(ALIGNED_CAST(ovs_16aligned_be32 *, ersh + 1),
    +                               htonl(params->flow->tunnel.erspan_idx));
             } else {
    -            erspan_idx = htonl(tnl_cfg->erspan_idx);
    +            put_16aligned_be32(ALIGNED_CAST(ovs_16aligned_be32 *, ersh + 1),
    +                               htonl(tnl_cfg->erspan_idx));
             }
     
    -        memcpy(erspan_hdr_idx, &erspan_idx, sizeof erspan_idx);
    -
             hlen = ERSPAN_GREHDR_LEN + sizeof *ersh + ERSPAN_V1_MDSIZE;
         } else if (erspan_ver == 2) {
             struct erspan_md2 *md2 = ALIGNED_CAST(struct erspan_md2 *, ersh + 1);
    -- 
    1.9.1
    
    _______________________________________________
    dev mailing list
    dev at openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=pjqQP3uSWv6cuk79a4lFafM6qi39Gb_tGVJFl64gS0M&s=G_pqF3EZvUxKGnLwuiEncHrBbGLdAPMWrI6LrNJXkqY&e=
    



More information about the dev mailing list