@@ -412,7 +412,7 @@ struct ipvl_addr *ipvlan_addr_lookup(struct ipvl_port *port, void *lyr3h,
412412	return  addr ;
413413}
414414
415- static  int  ipvlan_process_v4_outbound (struct  sk_buff  * skb )
415+ static  noinline_for_stack   int  ipvlan_process_v4_outbound (struct  sk_buff  * skb )
416416{
417417	const  struct  iphdr  * ip4h  =  ip_hdr (skb );
418418	struct  net_device  * dev  =  skb -> dev ;
@@ -454,13 +454,11 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
454454}
455455
456456#if  IS_ENABLED (CONFIG_IPV6 )
457- static  int  ipvlan_process_v6_outbound (struct  sk_buff  * skb )
457+ 
458+ static  noinline_for_stack  int 
459+ ipvlan_route_v6_outbound (struct  net_device  * dev , struct  sk_buff  * skb )
458460{
459461	const  struct  ipv6hdr  * ip6h  =  ipv6_hdr (skb );
460- 	struct  net_device  * dev  =  skb -> dev ;
461- 	struct  net  * net  =  dev_net (dev );
462- 	struct  dst_entry  * dst ;
463- 	int  err , ret  =  NET_XMIT_DROP ;
464462	struct  flowi6  fl6  =  {
465463		.flowi6_oif  =  dev -> ifindex ,
466464		.daddr  =  ip6h -> daddr ,
@@ -470,27 +468,38 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
470468		.flowi6_mark  =  skb -> mark ,
471469		.flowi6_proto  =  ip6h -> nexthdr ,
472470	};
471+ 	struct  dst_entry  * dst ;
472+ 	int  err ;
473473
474- 	dst  =  ip6_route_output (net , NULL , & fl6 );
475- 	if  ( dst -> error ) { 
476- 		 ret   =   dst -> error ; 
474+ 	dst  =  ip6_route_output (dev_net ( dev ) , NULL , & fl6 );
475+ 	err   =   dst -> error ; 
476+ 	if  ( err ) { 
477477		dst_release (dst );
478- 		goto  err ;
478+ 		return  err ;
479479	}
480480	skb_dst_set (skb , dst );
481+ 	return  0 ;
482+ }
483+ 
484+ static  int  ipvlan_process_v6_outbound (struct  sk_buff  * skb )
485+ {
486+ 	struct  net_device  * dev  =  skb -> dev ;
487+ 	int  err , ret  =  NET_XMIT_DROP ;
488+ 
489+ 	err  =  ipvlan_route_v6_outbound (dev , skb );
490+ 	if  (unlikely (err )) {
491+ 		DEV_STATS_INC (dev , tx_errors );
492+ 		kfree_skb (skb );
493+ 		return  err ;
494+ 	}
481495
482496	memset (IP6CB (skb ), 0 , sizeof (* IP6CB (skb )));
483497
484- 	err  =  ip6_local_out (net , skb -> sk , skb );
498+ 	err  =  ip6_local_out (dev_net ( dev ) , skb -> sk , skb );
485499	if  (unlikely (net_xmit_eval (err )))
486500		DEV_STATS_INC (dev , tx_errors );
487501	else 
488502		ret  =  NET_XMIT_SUCCESS ;
489- 	goto out ;
490- err :
491- 	DEV_STATS_INC (dev , tx_errors );
492- 	kfree_skb (skb );
493- out :
494503	return  ret ;
495504}
496505#else 
0 commit comments