Commit 57c4bf85 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

ipvlan: Cache net in ipvlan_process_v4_outbound and ipvlan_process_v6_outbound

Compute net once in ipvlan_process_v4_outbound and
ipvlan_process_v6_outbound and store it in a variable so that net does
not need to be recomputed next time it is used.
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7093fef
...@@ -344,6 +344,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) ...@@ -344,6 +344,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
{ {
const struct iphdr *ip4h = ip_hdr(skb); const struct iphdr *ip4h = ip_hdr(skb);
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct net *net = dev_net(dev);
struct rtable *rt; struct rtable *rt;
int err, ret = NET_XMIT_DROP; int err, ret = NET_XMIT_DROP;
struct flowi4 fl4 = { struct flowi4 fl4 = {
...@@ -354,7 +355,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) ...@@ -354,7 +355,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
.saddr = ip4h->saddr, .saddr = ip4h->saddr,
}; };
rt = ip_route_output_flow(dev_net(dev), &fl4, NULL); rt = ip_route_output_flow(net, &fl4, NULL);
if (IS_ERR(rt)) if (IS_ERR(rt))
goto err; goto err;
...@@ -381,6 +382,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) ...@@ -381,6 +382,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
{ {
const struct ipv6hdr *ip6h = ipv6_hdr(skb); const struct ipv6hdr *ip6h = ipv6_hdr(skb);
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct net *net = dev_net(dev);
struct dst_entry *dst; struct dst_entry *dst;
int err, ret = NET_XMIT_DROP; int err, ret = NET_XMIT_DROP;
struct flowi6 fl6 = { struct flowi6 fl6 = {
...@@ -393,7 +395,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) ...@@ -393,7 +395,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
.flowi6_proto = ip6h->nexthdr, .flowi6_proto = ip6h->nexthdr,
}; };
dst = ip6_route_output(dev_net(dev), NULL, &fl6); dst = ip6_route_output(net, NULL, &fl6);
if (dst->error) { if (dst->error) {
ret = dst->error; ret = dst->error;
dst_release(dst); dst_release(dst);
......
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