fib_semantics.c (ce8ee02d519ab20c5b87d3b3929b5e44ad89e26f) fib_semantics.c (0d876f2c6de5b1b00c2fd38bb4f4692e720207b1)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * IPv4 Forwarding Information Base: semantics.
7 *
8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>

--- 1746 unchanged lines hidden (view full) ---

1755 }
1756 } endfor_nexthops(fi);
1757}
1758#endif
1759
1760void fib_select_path(struct net *net, struct fib_result *res,
1761 struct flowi4 *fl4, const struct sk_buff *skb)
1762{
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * IPv4 Forwarding Information Base: semantics.
7 *
8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>

--- 1746 unchanged lines hidden (view full) ---

1755 }
1756 } endfor_nexthops(fi);
1757}
1758#endif
1759
1760void fib_select_path(struct net *net, struct fib_result *res,
1761 struct flowi4 *fl4, const struct sk_buff *skb)
1762{
1763 bool oif_check;
1763 if (fl4->flowi4_oif && !(fl4->flowi4_flags & FLOWI_FLAG_SKIP_NH_OIF))
1764 goto check_saddr;
1764
1765
1765 oif_check = (fl4->flowi4_oif == 0 ||
1766 fl4->flowi4_flags & FLOWI_FLAG_SKIP_NH_OIF);
1767
1768#ifdef CONFIG_IP_ROUTE_MULTIPATH
1766#ifdef CONFIG_IP_ROUTE_MULTIPATH
1769 if (res->fi->fib_nhs > 1 && oif_check) {
1767 if (res->fi->fib_nhs > 1) {
1770 int h = fib_multipath_hash(res->fi, fl4, skb);
1771
1772 fib_select_multipath(res, h);
1773 }
1774 else
1775#endif
1776 if (!res->prefixlen &&
1777 res->table->tb_num_default > 1 &&
1768 int h = fib_multipath_hash(res->fi, fl4, skb);
1769
1770 fib_select_multipath(res, h);
1771 }
1772 else
1773#endif
1774 if (!res->prefixlen &&
1775 res->table->tb_num_default > 1 &&
1778 res->type == RTN_UNICAST && oif_check)
1776 res->type == RTN_UNICAST)
1779 fib_select_default(fl4, res);
1780
1777 fib_select_default(fl4, res);
1778
1779check_saddr:
1781 if (!fl4->saddr)
1782 fl4->saddr = FIB_RES_PREFSRC(net, *res);
1783}
1784EXPORT_SYMBOL_GPL(fib_select_path);
1780 if (!fl4->saddr)
1781 fl4->saddr = FIB_RES_PREFSRC(net, *res);
1782}
1783EXPORT_SYMBOL_GPL(fib_select_path);