@@ -937,6 +937,20 @@ static int ip6_rt_type_to_error(u8 fib6_type)
937937 return fib6_prop [fib6_type ];
938938}
939939
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+
940954static void ip6_rt_init_dst_reject (struct rt6_info * rt , struct rt6_info * ort )
941955{
942956 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)
961975
962976static void ip6_rt_init_dst (struct rt6_info * rt , struct rt6_info * ort )
963977{
978+ rt -> dst .flags |= fib6_info_dst_flags (ort );
979+
964980 if (ort -> rt6i_flags & RTF_REJECT ) {
965981 ip6_rt_init_dst_reject (rt , ort );
966982 return ;
@@ -970,7 +986,6 @@ static void ip6_rt_init_dst(struct rt6_info *rt, struct rt6_info *ort)
970986 rt -> dst .output = ip6_output ;
971987
972988 if (ort -> fib6_type == RTN_LOCAL ) {
973- rt -> dst .flags |= DST_HOST ;
974989 rt -> dst .input = ip6_input ;
975990 } else if (ipv6_addr_type (& ort -> rt6i_dst .addr ) & IPV6_ADDR_MULTICAST ) {
976991 rt -> dst .input = ip6_mc_input ;
@@ -1058,10 +1073,11 @@ static bool ip6_hold_safe(struct net *net, struct rt6_info **prt,
10581073/* called with rcu_lock held */
10591074static struct rt6_info * ip6_create_rt_rcu (struct rt6_info * rt )
10601075{
1076+ unsigned short flags = fib6_info_dst_flags (rt );
10611077 struct net_device * dev = rt -> fib6_nh .nh_dev ;
10621078 struct rt6_info * nrt ;
10631079
1064- nrt = __ip6_dst_alloc (dev_net (dev ), dev , 0 );
1080+ nrt = __ip6_dst_alloc (dev_net (dev ), dev , flags );
10651081 if (nrt )
10661082 ip6_rt_copy_init (nrt , rt );
10671083
@@ -1229,12 +1245,13 @@ static struct rt6_info *ip6_rt_cache_alloc(struct rt6_info *ort,
12291245
12301246static struct rt6_info * ip6_rt_pcpu_alloc (struct rt6_info * rt )
12311247{
1248+ unsigned short flags = fib6_info_dst_flags (rt );
12321249 struct net_device * dev ;
12331250 struct rt6_info * pcpu_rt ;
12341251
12351252 rcu_read_lock ();
12361253 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 );
12381255 rcu_read_unlock ();
12391256 if (!pcpu_rt )
12401257 return NULL ;
@@ -2965,7 +2982,7 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
29652982 ipv6_addr_prefix (& rt -> rt6i_dst .addr , & cfg -> fc_dst , cfg -> fc_dst_len );
29662983 rt -> rt6i_dst .plen = cfg -> fc_dst_len ;
29672984 if (rt -> rt6i_dst .plen == 128 )
2968- rt -> dst . flags |= DST_HOST ;
2985+ rt -> dst_host = true ;
29692986
29702987#ifdef CONFIG_IPV6_SUBTREES
29712988 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,
36263643 if (!rt )
36273644 return ERR_PTR (- ENOMEM );
36283645
3646+ rt -> dst_nocount = true;
3647+
36293648 in6_dev_hold (idev );
36303649 rt -> rt6i_idev = idev ;
36313650
3632- rt -> dst . flags |= DST_HOST ;
3651+ rt -> dst_host = true ;
36333652 rt -> rt6i_protocol = RTPROT_KERNEL ;
36343653 rt -> rt6i_flags = RTF_UP | RTF_NONEXTHOP ;
36353654 if (anycast ) {
0 commit comments