diff options
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index dbcd2922ff3f..81c91e8a328f 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -506,40 +506,8 @@ __be16 xfrm_flowi_dport(struct flowi *fl) | |||
506 | return port; | 506 | return port; |
507 | } | 507 | } |
508 | 508 | ||
509 | static inline int | 509 | extern int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, |
510 | __xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl) | 510 | unsigned short family); |
511 | { | ||
512 | return addr_match(&fl->fl4_dst, &sel->daddr, sel->prefixlen_d) && | ||
513 | addr_match(&fl->fl4_src, &sel->saddr, sel->prefixlen_s) && | ||
514 | !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) && | ||
515 | !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) && | ||
516 | (fl->proto == sel->proto || !sel->proto) && | ||
517 | (fl->oif == sel->ifindex || !sel->ifindex); | ||
518 | } | ||
519 | |||
520 | static inline int | ||
521 | __xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl) | ||
522 | { | ||
523 | return addr_match(&fl->fl6_dst, &sel->daddr, sel->prefixlen_d) && | ||
524 | addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) && | ||
525 | !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) && | ||
526 | !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) && | ||
527 | (fl->proto == sel->proto || !sel->proto) && | ||
528 | (fl->oif == sel->ifindex || !sel->ifindex); | ||
529 | } | ||
530 | |||
531 | static inline int | ||
532 | xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, | ||
533 | unsigned short family) | ||
534 | { | ||
535 | switch (family) { | ||
536 | case AF_INET: | ||
537 | return __xfrm4_selector_match(sel, fl); | ||
538 | case AF_INET6: | ||
539 | return __xfrm6_selector_match(sel, fl); | ||
540 | } | ||
541 | return 0; | ||
542 | } | ||
543 | 511 | ||
544 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 512 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
545 | /* If neither has a context --> match | 513 | /* If neither has a context --> match |