Commit 26a949db authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

ipv4: Only compute net once in ip_do_fragment

Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cc4c851e
...@@ -531,9 +531,11 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb, ...@@ -531,9 +531,11 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
int offset; int offset;
__be16 not_last_frag; __be16 not_last_frag;
struct rtable *rt = skb_rtable(skb); struct rtable *rt = skb_rtable(skb);
struct net *net;
int err = 0; int err = 0;
dev = rt->dst.dev; dev = rt->dst.dev;
net = dev_net(dev);
/* /*
* Point into the IP datagram header. * Point into the IP datagram header.
...@@ -626,7 +628,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb, ...@@ -626,7 +628,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
err = output(sk, skb); err = output(sk, skb);
if (!err) if (!err)
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); IP_INC_STATS(net, IPSTATS_MIB_FRAGCREATES);
if (err || !frag) if (err || !frag)
break; break;
...@@ -636,7 +638,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb, ...@@ -636,7 +638,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
} }
if (err == 0) { if (err == 0) {
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); IP_INC_STATS(net, IPSTATS_MIB_FRAGOKS);
return 0; return 0;
} }
...@@ -645,7 +647,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb, ...@@ -645,7 +647,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
kfree_skb(frag); kfree_skb(frag);
frag = skb; frag = skb;
} }
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS);
return err; return err;
slow_path_clean: slow_path_clean:
...@@ -767,15 +769,15 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb, ...@@ -767,15 +769,15 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
if (err) if (err)
goto fail; goto fail;
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); IP_INC_STATS(net, IPSTATS_MIB_FRAGCREATES);
} }
consume_skb(skb); consume_skb(skb);
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); IP_INC_STATS(net, IPSTATS_MIB_FRAGOKS);
return err; return err;
fail: fail:
kfree_skb(skb); kfree_skb(skb);
IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS);
return err; return err;
} }
EXPORT_SYMBOL(ip_do_fragment); EXPORT_SYMBOL(ip_do_fragment);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment