* Parse next IPv6 header extension * * This function checks if proto number is an IPv6 extensions and parses its * data if so, providing information on next header and extension length. * * @param p * Pointer to an extension raw data. * @param proto * Protocol number extracted from the "next header" field from * the IPv6 header or the previous extension. * @param ext_len * Exten
| 810 | * next protocol number if proto is an IPv6 extension, -EINVAL otherwise |
| 811 | */ |
| 812 | static inline int |
| 813 | rte_ipv6_get_next_ext(const uint8_t *p, int proto, size_t *ext_len) |
| 814 | { |
| 815 | int next_proto; |
| 816 | |
| 817 | switch (proto) { |
| 818 | case IPPROTO_AH: |
| 819 | next_proto = *p++; |
| 820 | *ext_len = (*p + 2) * sizeof(uint32_t); |
| 821 | break; |
| 822 | |
| 823 | case IPPROTO_HOPOPTS: |
| 824 | case IPPROTO_ROUTING: |
| 825 | case IPPROTO_DSTOPTS: |
| 826 | next_proto = *p++; |
| 827 | *ext_len = (*p + 1) * sizeof(uint64_t); |
| 828 | break; |
| 829 | |
| 830 | case IPPROTO_FRAGMENT: |
| 831 | next_proto = *p; |
| 832 | *ext_len = RTE_IPV6_FRAG_HDR_SIZE; |
| 833 | break; |
| 834 | |
| 835 | default: |
| 836 | return -EINVAL; |
| 837 | } |
| 838 | |
| 839 | return next_proto; |
| 840 | } |
| 841 | |
| 842 | #ifdef __cplusplus |
| 843 | } |
no outgoing calls