@@ -1775,7 +1775,7 @@ static struct rtable *vxlan_get_route(struct vxlan_dev *vxlan,
17751775 /* when the ip_tunnel_info is availble, the tos used for lookup is
17761776 * packet independent, so we can use the cache
17771777 */
1778- if (dst_cache && !skb -> mark && (!tos || info )) {
1778+ if (!skb -> mark && (!tos || info )) {
17791779 use_cache = true;
17801780 rt = dst_cache_get_ip4 (dst_cache , saddr );
17811781 if (rt )
@@ -1806,13 +1806,11 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
18061806 struct in6_addr * saddr ,
18071807 struct dst_cache * dst_cache )
18081808{
1809- bool use_cache = false;
18101809 struct dst_entry * ndst ;
18111810 struct flowi6 fl6 ;
18121811 int err ;
18131812
1814- if (dst_cache && !skb -> mark ) {
1815- use_cache = true;
1813+ if (!skb -> mark ) {
18161814 ndst = dst_cache_get_ip6 (dst_cache , saddr );
18171815 if (ndst )
18181816 return ndst ;
@@ -1832,7 +1830,7 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
18321830 return ERR_PTR (err );
18331831
18341832 * saddr = fl6 .saddr ;
1835- if (use_cache )
1833+ if (! skb -> mark )
18361834 dst_cache_set_ip6 (dst_cache , ndst , saddr );
18371835 return ndst ;
18381836}
@@ -1886,6 +1884,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
18861884static void vxlan_xmit_one (struct sk_buff * skb , struct net_device * dev ,
18871885 struct vxlan_rdst * rdst , bool did_rsc )
18881886{
1887+ struct dst_cache * dst_cache ;
18891888 struct ip_tunnel_info * info ;
18901889 struct vxlan_dev * vxlan = netdev_priv (dev );
18911890 struct sock * sk ;
@@ -1910,6 +1909,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
19101909 dst_port = rdst -> remote_port ? rdst -> remote_port : vxlan -> cfg .dst_port ;
19111910 vni = rdst -> remote_vni ;
19121911 dst = & rdst -> remote_ip ;
1912+ dst_cache = & rdst -> dst_cache ;
19131913 } else {
19141914 if (!info ) {
19151915 WARN_ONCE (1 , "%s: Missing encapsulation instructions\n" ,
@@ -1924,6 +1924,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
19241924 else
19251925 remote_ip .sin6 .sin6_addr = info -> key .u .ipv6 .dst ;
19261926 dst = & remote_ip ;
1927+ dst_cache = & info -> dst_cache ;
19271928 }
19281929
19291930 if (vxlan_addr_any (dst )) {
@@ -1976,7 +1977,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
19761977 rt = vxlan_get_route (vxlan , skb ,
19771978 rdst ? rdst -> remote_ifindex : 0 , tos ,
19781979 dst -> sin .sin_addr .s_addr , & saddr ,
1979- rdst ? & rdst -> dst_cache : NULL , info );
1980+ dst_cache , info );
19801981 if (IS_ERR (rt )) {
19811982 netdev_dbg (dev , "no route to %pI4\n" ,
19821983 & dst -> sin .sin_addr .s_addr );
@@ -2029,7 +2030,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
20292030 ndst = vxlan6_get_route (vxlan , skb ,
20302031 rdst ? rdst -> remote_ifindex : 0 ,
20312032 & dst -> sin6 .sin6_addr , & saddr ,
2032- rdst ? & rdst -> dst_cache : NULL );
2033+ dst_cache );
20332034 if (IS_ERR (ndst )) {
20342035 netdev_dbg (dev , "no route to %pI6\n" ,
20352036 & dst -> sin6 .sin6_addr );
0 commit comments