| 208 | } |
| 209 | |
| 210 | static uint32_t |
| 211 | hash_priv(const struct nhop_priv *priv) |
| 212 | { |
| 213 | struct nhop_object *nh; |
| 214 | uint16_t ifindex; |
| 215 | struct _hash_data key; |
| 216 | |
| 217 | nh = priv->nh; |
| 218 | ifindex = nh->nh_ifp->if_index & 0xFFFF; |
| 219 | memset(&key, 0, sizeof(key)); |
| 220 | |
| 221 | key.ifindex = ifindex; |
| 222 | key.family = nh->gw_sa.sa_family; |
| 223 | key.nh_type = priv->nh_type & 0xFF; |
| 224 | if (nh->gw_sa.sa_family == AF_INET6) |
| 225 | memcpy(&key.gw_addr, &nh->gw6_sa.sin6_addr.s6_addr32[3], 4); |
| 226 | else if (nh->gw_sa.sa_family == AF_INET) |
| 227 | memcpy(&key.gw_addr, &nh->gw4_sa.sin_addr, 4); |
| 228 | |
| 229 | return (uint32_t)(djb_hash((const unsigned char *)&key, sizeof(key))); |
| 230 | } |
| 231 | |
| 232 | /* |
| 233 | * Checks if hash needs resizing and performs this resize if necessary |
no test coverage detected