@@ -411,7 +411,7 @@ struct ipvl_addr *ipvlan_addr_lookup(struct ipvl_port *port, void *lyr3h,
411411 return addr ;
412412}
413413
414- static int ipvlan_process_v4_outbound (struct sk_buff * skb )
414+ static noinline_for_stack int ipvlan_process_v4_outbound (struct sk_buff * skb )
415415{
416416 const struct iphdr * ip4h = ip_hdr (skb );
417417 struct net_device * dev = skb -> dev ;
@@ -453,13 +453,11 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
453453}
454454
455455#if IS_ENABLED (CONFIG_IPV6 )
456- static int ipvlan_process_v6_outbound (struct sk_buff * skb )
456+
457+ static noinline_for_stack int
458+ ipvlan_route_v6_outbound (struct net_device * dev , struct sk_buff * skb )
457459{
458460 const struct ipv6hdr * ip6h = ipv6_hdr (skb );
459- struct net_device * dev = skb -> dev ;
460- struct net * net = dev_net (dev );
461- struct dst_entry * dst ;
462- int err , ret = NET_XMIT_DROP ;
463461 struct flowi6 fl6 = {
464462 .flowi6_oif = dev -> ifindex ,
465463 .daddr = ip6h -> daddr ,
@@ -469,27 +467,38 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
469467 .flowi6_mark = skb -> mark ,
470468 .flowi6_proto = ip6h -> nexthdr ,
471469 };
470+ struct dst_entry * dst ;
471+ int err ;
472472
473- dst = ip6_route_output (net , NULL , & fl6 );
474- if ( dst -> error ) {
475- ret = dst -> error ;
473+ dst = ip6_route_output (dev_net ( dev ) , NULL , & fl6 );
474+ err = dst -> error ;
475+ if ( err ) {
476476 dst_release (dst );
477- goto err ;
477+ return err ;
478478 }
479479 skb_dst_set (skb , dst );
480+ return 0 ;
481+ }
482+
483+ static int ipvlan_process_v6_outbound (struct sk_buff * skb )
484+ {
485+ struct net_device * dev = skb -> dev ;
486+ int err , ret = NET_XMIT_DROP ;
487+
488+ err = ipvlan_route_v6_outbound (dev , skb );
489+ if (unlikely (err )) {
490+ DEV_STATS_INC (dev , tx_errors );
491+ kfree_skb (skb );
492+ return err ;
493+ }
480494
481495 memset (IP6CB (skb ), 0 , sizeof (* IP6CB (skb )));
482496
483- err = ip6_local_out (net , skb -> sk , skb );
497+ err = ip6_local_out (dev_net ( dev ) , skb -> sk , skb );
484498 if (unlikely (net_xmit_eval (err )))
485499 DEV_STATS_INC (dev , tx_errors );
486500 else
487501 ret = NET_XMIT_SUCCESS ;
488- goto out ;
489- err :
490- DEV_STATS_INC (dev , tx_errors );
491- kfree_skb (skb );
492- out :
493502 return ret ;
494503}
495504#else
0 commit comments