* Takes an array of uint8_t (IPv6 address) and masks it using the depth. * It leaves untouched one bit per unit in the depth variable * and set the rest to 0. */
| 115 | * and set the rest to 0. |
| 116 | */ |
| 117 | static inline void |
| 118 | ip6_mask_addr(uint8_t *ip, uint8_t depth) |
| 119 | { |
| 120 | int16_t part_depth, mask; |
| 121 | int i; |
| 122 | |
| 123 | part_depth = depth; |
| 124 | |
| 125 | for (i = 0; i < RTE_LPM6_IPV6_ADDR_SIZE; i++) { |
| 126 | if (part_depth < BYTE_SIZE && part_depth >= 0) { |
| 127 | mask = (uint16_t)(~(UINT8_MAX >> part_depth)); |
| 128 | ip[i] = (uint8_t)(ip[i] & mask); |
| 129 | } else if (part_depth < 0) |
| 130 | ip[i] = 0; |
| 131 | |
| 132 | part_depth -= BYTE_SIZE; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /* copy ipv6 address */ |
| 137 | static inline void |
no outgoing calls
no test coverage detected