aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/device.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2022-08-23 17:05:58 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2022-08-23 17:39:18 +0000
commita6b2d7ed5a5d20ddb1133da4a153e319151e41e9 (patch)
tree9f303914f81aea40e1aab7e5302a000ad63d37a2 /src/plugins/dpdk/device/device.c
parent174f5c850253bf47f22ce8272d3e321fdf6e5144 (diff)
rdma: fix coverity 249197
flags is u64, makes sure we do not overflow when shifting. Type: fix Change-Id: Ieea34187c0b568dc4d24c9415b9cff36907a5a87 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/device/device.c')
0 files changed, 0 insertions, 0 deletions
r: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
Copyright (c) 2016-2016 Cisco Systems, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#include "IPv6Header.h"

/*
 * Return l4 type of Ipv6 packet
 * pkt - pointer to start of packet data (including header)
 * pkt_len - length of packet (including header)
 * p_l4 - return pointer to start of l4 header
 */
uint8_t IPv6Header::getl4Proto(uint8_t *pkt, uint16_t pkt_len, uint8_t *&p_l4) {
    bool stop = false;
    uint8_t *next_header = pkt + IPV6_HDR_LEN;;
    uint8_t next_header_type = myNextHdr;
    uint16_t len_left = pkt_len - IPV6_HDR_LEN;
    uint16_t curr_header_len;

    do {
        switch(next_header_type) {
        case IPPROTO_HOPOPTS:
        case IPPROTO_ROUTING:
        case IPPROTO_ENCAP_SEC:
        case IPPROTO_AUTH:
        case IPPROTO_FRAGMENT:
        case IPPROTO_DSTOPTS:
        case IPPROTO_MH:
            next_header_type = next_header[0];
            curr_header_len = (next_header[1] + 1) * 8;
            next_header += curr_header_len;
            len_left -= curr_header_len;
            break;
        default:
            stop = true;
            break;
        }
    } while ((! stop) && len_left >= 2);

    p_l4 = next_header;
    return next_header_type;
}