@@ -937,6 +937,20 @@ static int ip6_rt_type_to_error(u8 fib6_type)
937
937
return fib6_prop [fib6_type ];
938
938
}
939
939
940
+ static unsigned short fib6_info_dst_flags (struct rt6_info * rt )
941
+ {
942
+ unsigned short flags = 0 ;
943
+
944
+ if (rt -> dst_nocount )
945
+ flags |= DST_NOCOUNT ;
946
+ if (rt -> dst_nopolicy )
947
+ flags |= DST_NOPOLICY ;
948
+ if (rt -> dst_host )
949
+ flags |= DST_HOST ;
950
+
951
+ return flags ;
952
+ }
953
+
940
954
static void ip6_rt_init_dst_reject (struct rt6_info * rt , struct rt6_info * ort )
941
955
{
942
956
rt -> dst .error = ip6_rt_type_to_error (ort -> fib6_type );
@@ -961,6 +975,8 @@ static void ip6_rt_init_dst_reject(struct rt6_info *rt, struct rt6_info *ort)
961
975
962
976
static void ip6_rt_init_dst (struct rt6_info * rt , struct rt6_info * ort )
963
977
{
978
+ rt -> dst .flags |= fib6_info_dst_flags (ort );
979
+
964
980
if (ort -> rt6i_flags & RTF_REJECT ) {
965
981
ip6_rt_init_dst_reject (rt , ort );
966
982
return ;
@@ -970,7 +986,6 @@ static void ip6_rt_init_dst(struct rt6_info *rt, struct rt6_info *ort)
970
986
rt -> dst .output = ip6_output ;
971
987
972
988
if (ort -> fib6_type == RTN_LOCAL ) {
973
- rt -> dst .flags |= DST_HOST ;
974
989
rt -> dst .input = ip6_input ;
975
990
} else if (ipv6_addr_type (& ort -> rt6i_dst .addr ) & IPV6_ADDR_MULTICAST ) {
976
991
rt -> dst .input = ip6_mc_input ;
@@ -1058,10 +1073,11 @@ static bool ip6_hold_safe(struct net *net, struct rt6_info **prt,
1058
1073
/* called with rcu_lock held */
1059
1074
static struct rt6_info * ip6_create_rt_rcu (struct rt6_info * rt )
1060
1075
{
1076
+ unsigned short flags = fib6_info_dst_flags (rt );
1061
1077
struct net_device * dev = rt -> fib6_nh .nh_dev ;
1062
1078
struct rt6_info * nrt ;
1063
1079
1064
- nrt = __ip6_dst_alloc (dev_net (dev ), dev , 0 );
1080
+ nrt = __ip6_dst_alloc (dev_net (dev ), dev , flags );
1065
1081
if (nrt )
1066
1082
ip6_rt_copy_init (nrt , rt );
1067
1083
@@ -1229,12 +1245,13 @@ static struct rt6_info *ip6_rt_cache_alloc(struct rt6_info *ort,
1229
1245
1230
1246
static struct rt6_info * ip6_rt_pcpu_alloc (struct rt6_info * rt )
1231
1247
{
1248
+ unsigned short flags = fib6_info_dst_flags (rt );
1232
1249
struct net_device * dev ;
1233
1250
struct rt6_info * pcpu_rt ;
1234
1251
1235
1252
rcu_read_lock ();
1236
1253
dev = ip6_rt_get_dev_rcu (rt );
1237
- pcpu_rt = __ip6_dst_alloc (dev_net (dev ), dev , rt -> dst . flags );
1254
+ pcpu_rt = __ip6_dst_alloc (dev_net (dev ), dev , flags );
1238
1255
rcu_read_unlock ();
1239
1256
if (!pcpu_rt )
1240
1257
return NULL ;
@@ -2965,7 +2982,7 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
2965
2982
ipv6_addr_prefix (& rt -> rt6i_dst .addr , & cfg -> fc_dst , cfg -> fc_dst_len );
2966
2983
rt -> rt6i_dst .plen = cfg -> fc_dst_len ;
2967
2984
if (rt -> rt6i_dst .plen == 128 )
2968
- rt -> dst . flags |= DST_HOST ;
2985
+ rt -> dst_host = true ;
2969
2986
2970
2987
#ifdef CONFIG_IPV6_SUBTREES
2971
2988
ipv6_addr_prefix (& rt -> rt6i_src .addr , & cfg -> fc_src , cfg -> fc_src_len );
@@ -3626,10 +3643,12 @@ struct rt6_info *addrconf_dst_alloc(struct net *net,
3626
3643
if (!rt )
3627
3644
return ERR_PTR (- ENOMEM );
3628
3645
3646
+ rt -> dst_nocount = true;
3647
+
3629
3648
in6_dev_hold (idev );
3630
3649
rt -> rt6i_idev = idev ;
3631
3650
3632
- rt -> dst . flags |= DST_HOST ;
3651
+ rt -> dst_host = true ;
3633
3652
rt -> rt6i_protocol = RTPROT_KERNEL ;
3634
3653
rt -> rt6i_flags = RTF_UP | RTF_NONEXTHOP ;
3635
3654
if (anycast ) {
0 commit comments