fib_semantics.c (30bbaa19500559d7625c65632195413f639b3b97) | fib_semantics.c (021dd3b8a142d482cb65a27bf6644e3764001460) |
---|---|
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> --- 824 unchanged lines hidden (view full) --- 833 nh->nh_saddr = inet_select_addr(nh->nh_dev, 834 nh->nh_gw, 835 nh->nh_parent->fib_scope); 836 nh->nh_saddr_genid = atomic_read(&net->ipv4.dev_addr_genid); 837 838 return nh->nh_saddr; 839} 840 | 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> --- 824 unchanged lines hidden (view full) --- 833 nh->nh_saddr = inet_select_addr(nh->nh_dev, 834 nh->nh_gw, 835 nh->nh_parent->fib_scope); 836 nh->nh_saddr_genid = atomic_read(&net->ipv4.dev_addr_genid); 837 838 return nh->nh_saddr; 839} 840 |
841static bool fib_valid_prefsrc(struct fib_config *cfg, __be32 fib_prefsrc) 842{ 843 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || 844 fib_prefsrc != cfg->fc_dst) { 845 int tb_id = cfg->fc_table; 846 847 if (tb_id == RT_TABLE_MAIN) 848 tb_id = RT_TABLE_LOCAL; 849 850 if (inet_addr_type_table(cfg->fc_nlinfo.nl_net, 851 fib_prefsrc, tb_id) != RTN_LOCAL) { 852 return false; 853 } 854 } 855 return true; 856} 857 |
|
841struct fib_info *fib_create_info(struct fib_config *cfg) 842{ 843 int err; 844 struct fib_info *fi = NULL; 845 struct fib_info *ofi; 846 int nhs = 1; 847 struct net *net = cfg->fc_nlinfo.nl_net; 848 --- 179 unchanged lines hidden (view full) --- 1028 goto failure; 1029 if (nexthop_nh->nh_flags & RTNH_F_LINKDOWN) 1030 linkdown++; 1031 } endfor_nexthops(fi) 1032 if (linkdown == fi->fib_nhs) 1033 fi->fib_flags |= RTNH_F_LINKDOWN; 1034 } 1035 | 858struct fib_info *fib_create_info(struct fib_config *cfg) 859{ 860 int err; 861 struct fib_info *fi = NULL; 862 struct fib_info *ofi; 863 int nhs = 1; 864 struct net *net = cfg->fc_nlinfo.nl_net; 865 --- 179 unchanged lines hidden (view full) --- 1045 goto failure; 1046 if (nexthop_nh->nh_flags & RTNH_F_LINKDOWN) 1047 linkdown++; 1048 } endfor_nexthops(fi) 1049 if (linkdown == fi->fib_nhs) 1050 fi->fib_flags |= RTNH_F_LINKDOWN; 1051 } 1052 |
1036 if (fi->fib_prefsrc) { 1037 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || 1038 fi->fib_prefsrc != cfg->fc_dst) 1039 if (inet_addr_type(net, fi->fib_prefsrc) != RTN_LOCAL) 1040 goto err_inval; 1041 } | 1053 if (fi->fib_prefsrc && !fib_valid_prefsrc(cfg, fi->fib_prefsrc)) 1054 goto err_inval; |
1042 1043 change_nexthops(fi) { 1044 fib_info_update_nh_saddr(net, nexthop_nh); 1045 } endfor_nexthops(fi) 1046 1047link_it: 1048 ofi = fib_find_info(fi); 1049 if (ofi) { --- 448 unchanged lines hidden --- | 1055 1056 change_nexthops(fi) { 1057 fib_info_update_nh_saddr(net, nexthop_nh); 1058 } endfor_nexthops(fi) 1059 1060link_it: 1061 ofi = fib_find_info(fi); 1062 if (ofi) { --- 448 unchanged lines hidden --- |