Revision 62e64905 lib/net.h
lib/net.h | ||
---|---|---|
306 | 306 |
static inline int net_equal_flow6(const net_addr_flow6 *a, const net_addr_flow6 *b) |
307 | 307 |
{ return net_equal((const net_addr *) a, (const net_addr *) b); } |
308 | 308 |
|
309 |
static inline int net_equal_mpls(const net_addr_mpls *a, const net_addr_mpls *b) |
|
310 |
{ return !memcmp(a, b, sizeof(net_addr_mpls)); } |
|
311 |
|
|
309 | 312 |
|
310 | 313 |
static inline int net_equal_prefix_roa4(const net_addr_roa4 *a, const net_addr_roa4 *b) |
311 | 314 |
{ return ip4_equal(a->prefix, b->prefix) && (a->pxlen == b->pxlen); } |
... | ... | |
313 | 316 |
static inline int net_equal_prefix_roa6(const net_addr_roa6 *a, const net_addr_roa6 *b) |
314 | 317 |
{ return ip6_equal(a->prefix, b->prefix) && (a->pxlen == b->pxlen); } |
315 | 318 |
|
316 |
static inline int net_equal_mpls(const net_addr_mpls *a, const net_addr_mpls *b) |
|
317 |
{ return !memcmp(a, b, sizeof(net_addr_mpls)); } |
|
318 | 319 |
|
319 | 320 |
static inline int net_zero_ip4(const net_addr_ip4 *a) |
320 | 321 |
{ return !a->pxlen && ip4_zero(a->prefix); } |
... | ... | |
404 | 405 |
static inline void net_copy_mpls(net_addr_mpls *dst, const net_addr_mpls *src) |
405 | 406 |
{ memcpy(dst, src, sizeof(net_addr_mpls)); } |
406 | 407 |
|
408 |
|
|
409 |
/* XXXX */ |
|
410 |
static inline u32 u64_hash(u64 a) |
|
411 |
{ return u32_hash(a); } |
|
412 |
|
|
407 | 413 |
static inline u32 net_hash_ip4(const net_addr_ip4 *n) |
408 | 414 |
{ return ip4_hash(n->prefix) ^ ((u32) n->pxlen << 26); } |
409 | 415 |
|
410 | 416 |
static inline u32 net_hash_ip6(const net_addr_ip6 *n) |
411 | 417 |
{ return ip6_hash(n->prefix) ^ ((u32) n->pxlen << 26); } |
412 | 418 |
|
413 |
/* XXXX */ |
|
414 |
static inline u32 u64_hash(u64 a) |
|
415 |
{ return u32_hash(a); } |
|
416 |
|
|
417 | 419 |
static inline u32 net_hash_vpn4(const net_addr_vpn4 *n) |
418 | 420 |
{ return ip4_hash(n->prefix) ^ ((u32) n->pxlen << 26) ^ u64_hash(n->rd); } |
419 | 421 |
|
... | ... | |
452 | 454 |
|
453 | 455 |
static inline int net_validate_mpls(const net_addr_mpls *n) |
454 | 456 |
{ |
455 |
return n->label < (1<<20);
|
|
457 |
return n->label < (1 << 20);
|
|
456 | 458 |
} |
457 | 459 |
|
458 | 460 |
int net_validate(const net_addr *N); |
Also available in: Unified diff