* Generate hash for a given flow record. * * FIB is not used here, because: * most VRFS will carry public IPv4 addresses which are unique even * without FIB private addresses can overlap, but this is worked out * via flow_rec bcmp() containing fib id. In IPv6 world addresses are * all globally unique (it's not fully true, there is FC00::/7 for example, * but chances of address overlap are M
| 128 | * but chances of address overlap are MUCH smaller) |
| 129 | */ |
| 130 | static inline uint32_t |
| 131 | ip_hash(struct flow_rec *r) |
| 132 | { |
| 133 | |
| 134 | switch (r->r_ip_p) { |
| 135 | case IPPROTO_TCP: |
| 136 | case IPPROTO_UDP: |
| 137 | return FULL_HASH(r->r_src.s_addr, r->r_dst.s_addr, |
| 138 | r->r_sport, r->r_dport); |
| 139 | default: |
| 140 | return ADDR_HASH(r->r_src.s_addr, r->r_dst.s_addr); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | #ifdef INET6 |
| 145 | /* Generate hash for a given flow6 record. Use lower 4 octets from v6 addresses */ |
no outgoing calls
no test coverage detected