Skip to content

Commit f859b0f

Browse files
ebiedermdavem330
authored andcommitted
ipv4: Cache net in iptunnel_xmit
Store net in a variable in ip_tunnel_xmit so it does not need to be recomputed when it is used again. Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7928833 commit f859b0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv4/ip_tunnel_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
5353
__u8 tos, __u8 ttl, __be16 df, bool xnet)
5454
{
5555
int pkt_len = skb->len - skb_inner_network_offset(skb);
56+
struct net *net = dev_net(rt->dst.dev);
5657
struct iphdr *iph;
5758
int err;
5859

@@ -76,8 +77,7 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
7677
iph->daddr = dst;
7778
iph->saddr = src;
7879
iph->ttl = ttl;
79-
__ip_select_ident(dev_net(rt->dst.dev), iph,
80-
skb_shinfo(skb)->gso_segs ?: 1);
80+
__ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1);
8181

8282
err = ip_local_out(sk, skb);
8383
if (unlikely(net_xmit_eval(err)))

0 commit comments

Comments
 (0)