Commit f206351a authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[NETNS]: Add namespace parameter to ip_route_output_key.

Needed to propagate it down to the ip_route_output_flow.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1b050bf
...@@ -158,7 +158,7 @@ static void addr_send_arp(struct sockaddr_in *dst_in) ...@@ -158,7 +158,7 @@ static void addr_send_arp(struct sockaddr_in *dst_in)
memset(&fl, 0, sizeof fl); memset(&fl, 0, sizeof fl);
fl.nl_u.ip4_u.daddr = dst_ip; fl.nl_u.ip4_u.daddr = dst_ip;
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
return; return;
neigh_event_send(rt->u.dst.neighbour, NULL); neigh_event_send(rt->u.dst.neighbour, NULL);
...@@ -179,7 +179,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in, ...@@ -179,7 +179,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in,
memset(&fl, 0, sizeof fl); memset(&fl, 0, sizeof fl);
fl.nl_u.ip4_u.daddr = dst_ip; fl.nl_u.ip4_u.daddr = dst_ip;
fl.nl_u.ip4_u.saddr = src_ip; fl.nl_u.ip4_u.saddr = src_ip;
ret = ip_route_output_key(&rt, &fl); ret = ip_route_output_key(&init_net, &rt, &fl);
if (ret) if (ret)
goto out; goto out;
......
...@@ -2517,7 +2517,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) ...@@ -2517,7 +2517,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
fl.fl4_dst = targets[i]; fl.fl4_dst = targets[i];
fl.fl4_tos = RTO_ONLINK; fl.fl4_tos = RTO_ONLINK;
rv = ip_route_output_key(&rt, &fl); rv = ip_route_output_key(&init_net, &rt, &fl);
if (rv) { if (rv) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_WARNING DRV_NAME printk(KERN_WARNING DRV_NAME
......
...@@ -111,7 +111,7 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, ...@@ -111,7 +111,7 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
__be32 src, struct net_device *dev); __be32 src, struct net_device *dev);
extern void rt_cache_flush(int how); extern void rt_cache_flush(int how);
extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
extern int ip_route_output_key(struct rtable **, struct flowi *flp); extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin);
extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
......
...@@ -534,7 +534,7 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip) ...@@ -534,7 +534,7 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
unlink_clip_vcc(clip_vcc); unlink_clip_vcc(clip_vcc);
return 0; return 0;
} }
error = ip_route_output_key(&rt, &fl); error = ip_route_output_key(&init_net, &rt, &fl);
if (error) if (error)
return error; return error;
neigh = __neigh_lookup(&clip_tbl, &ip, rt->u.dst.dev, 1); neigh = __neigh_lookup(&clip_tbl, &ip, rt->u.dst.dev, 1);
......
...@@ -353,7 +353,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb) ...@@ -353,7 +353,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
if (err != -EHOSTUNREACH || !in_dev || IN_DEV_FORWARD(in_dev)) if (err != -EHOSTUNREACH || !in_dev || IN_DEV_FORWARD(in_dev))
goto free_skb; goto free_skb;
if (!ip_route_output_key(&rt, &fl)) { if (!ip_route_output_key(&init_net, &rt, &fl)) {
/* - Bridged-and-DNAT'ed traffic doesn't /* - Bridged-and-DNAT'ed traffic doesn't
* require ip_forwarding. */ * require ip_forwarding. */
if (((struct dst_entry *)rt)->dev == dev) { if (((struct dst_entry *)rt)->dev == dev) {
......
...@@ -424,7 +424,7 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) ...@@ -424,7 +424,7 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
int flag = 0; int flag = 0;
/*unsigned long now; */ /*unsigned long now; */
if (ip_route_output_key(&rt, &fl) < 0) if (ip_route_output_key(&init_net, &rt, &fl) < 0)
return 1; return 1;
if (rt->u.dst.dev != dev) { if (rt->u.dst.dev != dev) {
NET_INC_STATS_BH(LINUX_MIB_ARPFILTER); NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
...@@ -1002,7 +1002,7 @@ static int arp_req_set(struct net *net, struct arpreq *r, ...@@ -1002,7 +1002,7 @@ static int arp_req_set(struct net *net, struct arpreq *r,
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip,
.tos = RTO_ONLINK } } }; .tos = RTO_ONLINK } } };
struct rtable * rt; struct rtable * rt;
if ((err = ip_route_output_key(&rt, &fl)) != 0) if ((err = ip_route_output_key(net, &rt, &fl)) != 0)
return err; return err;
dev = rt->u.dst.dev; dev = rt->u.dst.dev;
ip_rt_put(rt); ip_rt_put(rt);
...@@ -1109,7 +1109,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, ...@@ -1109,7 +1109,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip,
.tos = RTO_ONLINK } } }; .tos = RTO_ONLINK } } };
struct rtable * rt; struct rtable * rt;
if ((err = ip_route_output_key(&rt, &fl)) != 0) if ((err = ip_route_output_key(net, &rt, &fl)) != 0)
return err; return err;
dev = rt->u.dst.dev; dev = rt->u.dst.dev;
ip_rt_put(rt); ip_rt_put(rt);
......
...@@ -405,7 +405,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) ...@@ -405,7 +405,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
.tos = RT_TOS(ip_hdr(skb)->tos) } }, .tos = RT_TOS(ip_hdr(skb)->tos) } },
.proto = IPPROTO_ICMP }; .proto = IPPROTO_ICMP };
security_skb_classify_flow(skb, &fl); security_skb_classify_flow(skb, &fl);
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
goto out_unlock; goto out_unlock;
} }
if (icmpv4_xrlim_allow(rt, icmp_param->data.icmph.type, if (icmpv4_xrlim_allow(rt, icmp_param->data.icmph.type,
...@@ -598,7 +598,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) ...@@ -598,7 +598,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
struct dst_entry *odst; struct dst_entry *odst;
fl2.fl4_dst = fl.fl4_src; fl2.fl4_dst = fl.fl4_src;
if (ip_route_output_key(&rt2, &fl2)) if (ip_route_output_key(&init_net, &rt2, &fl2))
goto out_unlock; goto out_unlock;
/* Ugh! */ /* Ugh! */
......
...@@ -301,7 +301,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) ...@@ -301,7 +301,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
.nl_u = { .ip4_u = { .nl_u = { .ip4_u = {
.daddr = IGMPV3_ALL_MCR } }, .daddr = IGMPV3_ALL_MCR } },
.proto = IPPROTO_IGMP }; .proto = IPPROTO_IGMP };
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
kfree_skb(skb); kfree_skb(skb);
return NULL; return NULL;
} }
...@@ -645,7 +645,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, ...@@ -645,7 +645,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
struct flowi fl = { .oif = dev->ifindex, struct flowi fl = { .oif = dev->ifindex,
.nl_u = { .ip4_u = { .daddr = dst } }, .nl_u = { .ip4_u = { .daddr = dst } },
.proto = IPPROTO_IGMP }; .proto = IPPROTO_IGMP };
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
return -1; return -1;
} }
if (rt->rt_src == 0) { if (rt->rt_src == 0) {
...@@ -1401,7 +1401,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr) ...@@ -1401,7 +1401,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr)
dev_put(dev); dev_put(dev);
} }
if (!dev && !ip_route_output_key(&rt, &fl)) { if (!dev && !ip_route_output_key(&init_net, &rt, &fl)) {
dev = rt->u.dst.dev; dev = rt->u.dst.dev;
ip_rt_put(rt); ip_rt_put(rt);
} }
......
...@@ -480,7 +480,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info) ...@@ -480,7 +480,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
fl.fl4_dst = eiph->saddr; fl.fl4_dst = eiph->saddr;
fl.fl4_tos = RT_TOS(eiph->tos); fl.fl4_tos = RT_TOS(eiph->tos);
fl.proto = IPPROTO_GRE; fl.proto = IPPROTO_GRE;
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
kfree_skb(skb2); kfree_skb(skb2);
return; return;
} }
...@@ -493,7 +493,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info) ...@@ -493,7 +493,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
fl.fl4_dst = eiph->daddr; fl.fl4_dst = eiph->daddr;
fl.fl4_src = eiph->saddr; fl.fl4_src = eiph->saddr;
fl.fl4_tos = eiph->tos; fl.fl4_tos = eiph->tos;
if (ip_route_output_key(&rt, &fl) || if (ip_route_output_key(&init_net, &rt, &fl) ||
rt->u.dst.dev->type != ARPHRD_IPGRE) { rt->u.dst.dev->type != ARPHRD_IPGRE) {
ip_rt_put(rt); ip_rt_put(rt);
kfree_skb(skb2); kfree_skb(skb2);
...@@ -748,7 +748,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -748,7 +748,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
.saddr = tiph->saddr, .saddr = tiph->saddr,
.tos = RT_TOS(tos) } }, .tos = RT_TOS(tos) } },
.proto = IPPROTO_GRE }; .proto = IPPROTO_GRE };
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
tunnel->stat.tx_carrier_errors++; tunnel->stat.tx_carrier_errors++;
goto tx_error; goto tx_error;
} }
...@@ -921,7 +921,7 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev) ...@@ -921,7 +921,7 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev)
.tos = RT_TOS(iph->tos) } }, .tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_GRE }; .proto = IPPROTO_GRE };
struct rtable *rt; struct rtable *rt;
if (!ip_route_output_key(&rt, &fl)) { if (!ip_route_output_key(&init_net, &rt, &fl)) {
tdev = rt->u.dst.dev; tdev = rt->u.dst.dev;
ip_rt_put(rt); ip_rt_put(rt);
} }
...@@ -1177,7 +1177,7 @@ static int ipgre_open(struct net_device *dev) ...@@ -1177,7 +1177,7 @@ static int ipgre_open(struct net_device *dev)
.tos = RT_TOS(t->parms.iph.tos) } }, .tos = RT_TOS(t->parms.iph.tos) } },
.proto = IPPROTO_GRE }; .proto = IPPROTO_GRE };
struct rtable *rt; struct rtable *rt;
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
dev = rt->u.dst.dev; dev = rt->u.dst.dev;
ip_rt_put(rt); ip_rt_put(rt);
......
...@@ -1379,7 +1379,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar ...@@ -1379,7 +1379,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
.dport = tcp_hdr(skb)->source } }, .dport = tcp_hdr(skb)->source } },
.proto = sk->sk_protocol }; .proto = sk->sk_protocol };
security_skb_classify_flow(skb, &fl); security_skb_classify_flow(skb, &fl);
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
return; return;
} }
......
...@@ -405,7 +405,7 @@ static int ipip_err(struct sk_buff *skb, u32 info) ...@@ -405,7 +405,7 @@ static int ipip_err(struct sk_buff *skb, u32 info)
fl.fl4_daddr = eiph->saddr; fl.fl4_daddr = eiph->saddr;
fl.fl4_tos = RT_TOS(eiph->tos); fl.fl4_tos = RT_TOS(eiph->tos);
fl.proto = IPPROTO_IPIP; fl.proto = IPPROTO_IPIP;
if (ip_route_output_key(&rt, &key)) { if (ip_route_output_key(&init_net, &rt, &key)) {
kfree_skb(skb2); kfree_skb(skb2);
return 0; return 0;
} }
...@@ -418,7 +418,7 @@ static int ipip_err(struct sk_buff *skb, u32 info) ...@@ -418,7 +418,7 @@ static int ipip_err(struct sk_buff *skb, u32 info)
fl.fl4_daddr = eiph->daddr; fl.fl4_daddr = eiph->daddr;
fl.fl4_src = eiph->saddr; fl.fl4_src = eiph->saddr;
fl.fl4_tos = eiph->tos; fl.fl4_tos = eiph->tos;
if (ip_route_output_key(&rt, &fl) || if (ip_route_output_key(&init_net, &rt, &fl) ||
rt->u.dst.dev->type != ARPHRD_TUNNEL) { rt->u.dst.dev->type != ARPHRD_TUNNEL) {
ip_rt_put(rt); ip_rt_put(rt);
kfree_skb(skb2); kfree_skb(skb2);
...@@ -547,7 +547,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -547,7 +547,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
.saddr = tiph->saddr, .saddr = tiph->saddr,
.tos = RT_TOS(tos) } }, .tos = RT_TOS(tos) } },
.proto = IPPROTO_IPIP }; .proto = IPPROTO_IPIP };
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
tunnel->stat.tx_carrier_errors++; tunnel->stat.tx_carrier_errors++;
goto tx_error_icmp; goto tx_error_icmp;
} }
...@@ -668,7 +668,7 @@ static void ipip_tunnel_bind_dev(struct net_device *dev) ...@@ -668,7 +668,7 @@ static void ipip_tunnel_bind_dev(struct net_device *dev)
.tos = RT_TOS(iph->tos) } }, .tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_IPIP }; .proto = IPPROTO_IPIP };
struct rtable *rt; struct rtable *rt;
if (!ip_route_output_key(&rt, &fl)) { if (!ip_route_output_key(&init_net, &rt, &fl)) {
tdev = rt->u.dst.dev; tdev = rt->u.dst.dev;
ip_rt_put(rt); ip_rt_put(rt);
} }
......
...@@ -1185,7 +1185,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) ...@@ -1185,7 +1185,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
.saddr = vif->local, .saddr = vif->local,
.tos = RT_TOS(iph->tos) } }, .tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_IPIP }; .proto = IPPROTO_IPIP };
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
goto out_free; goto out_free;
encap = sizeof(struct iphdr); encap = sizeof(struct iphdr);
} else { } else {
...@@ -1194,7 +1194,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) ...@@ -1194,7 +1194,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
{ .daddr = iph->daddr, { .daddr = iph->daddr,
.tos = RT_TOS(iph->tos) } }, .tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_IPIP }; .proto = IPPROTO_IPIP };
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
goto out_free; goto out_free;
} }
......
...@@ -78,7 +78,7 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos) ...@@ -78,7 +78,7 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos)
.tos = rtos, } }, .tos = rtos, } },
}; };
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
spin_unlock(&dest->dst_lock); spin_unlock(&dest->dst_lock);
IP_VS_DBG_RL("ip_route_output error, " IP_VS_DBG_RL("ip_route_output error, "
"dest: %u.%u.%u.%u\n", "dest: %u.%u.%u.%u\n",
...@@ -101,7 +101,7 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos) ...@@ -101,7 +101,7 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos)
.tos = rtos, } }, .tos = rtos, } },
}; };
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
IP_VS_DBG_RL("ip_route_output error, dest: " IP_VS_DBG_RL("ip_route_output error, dest: "
"%u.%u.%u.%u\n", NIPQUAD(cp->daddr)); "%u.%u.%u.%u\n", NIPQUAD(cp->daddr));
return NULL; return NULL;
...@@ -170,7 +170,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, ...@@ -170,7 +170,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
EnterFunction(10); EnterFunction(10);
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
IP_VS_DBG_RL("ip_vs_bypass_xmit(): ip_route_output error, " IP_VS_DBG_RL("ip_vs_bypass_xmit(): ip_route_output error, "
"dest: %u.%u.%u.%u\n", NIPQUAD(iph->daddr)); "dest: %u.%u.%u.%u\n", NIPQUAD(iph->daddr));
goto tx_error_icmp; goto tx_error_icmp;
......
...@@ -33,7 +33,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) ...@@ -33,7 +33,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
fl.nl_u.ip4_u.tos = RT_TOS(iph->tos); fl.nl_u.ip4_u.tos = RT_TOS(iph->tos);
fl.oif = skb->sk ? skb->sk->sk_bound_dev_if : 0; fl.oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
fl.mark = skb->mark; fl.mark = skb->mark;
if (ip_route_output_key(&rt, &fl) != 0) if (ip_route_output_key(&init_net, &rt, &fl) != 0)
return -1; return -1;
/* Drop old route. */ /* Drop old route. */
...@@ -43,7 +43,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) ...@@ -43,7 +43,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
/* non-local src, find valid iif to satisfy /* non-local src, find valid iif to satisfy
* rp-filter when calling ip_route_input. */ * rp-filter when calling ip_route_input. */
fl.nl_u.ip4_u.daddr = iph->saddr; fl.nl_u.ip4_u.daddr = iph->saddr;
if (ip_route_output_key(&rt, &fl) != 0) if (ip_route_output_key(&init_net, &rt, &fl) != 0)
return -1; return -1;
odst = skb->dst; odst = skb->dst;
...@@ -187,7 +187,7 @@ EXPORT_SYMBOL(nf_ip_checksum); ...@@ -187,7 +187,7 @@ EXPORT_SYMBOL(nf_ip_checksum);
static int nf_ip_route(struct dst_entry **dst, struct flowi *fl) static int nf_ip_route(struct dst_entry **dst, struct flowi *fl)
{ {
return ip_route_output_key((struct rtable **)dst, fl); return ip_route_output_key(&init_net, (struct rtable **)dst, fl);
} }
static const struct nf_afinfo nf_ip_afinfo = { static const struct nf_afinfo nf_ip_afinfo = {
......
...@@ -97,7 +97,7 @@ static void warn_if_extra_mangle(__be32 dstip, __be32 srcip) ...@@ -97,7 +97,7 @@ static void warn_if_extra_mangle(__be32 dstip, __be32 srcip)
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dstip } } }; struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dstip } } };
struct rtable *rt; struct rtable *rt;
if (ip_route_output_key(&rt, &fl) != 0) if (ip_route_output_key(&init_net, &rt, &fl) != 0)
return; return;
if (rt->rt_src != srcip && !warned) { if (rt->rt_src != srcip && !warned) {
......
...@@ -2559,9 +2559,9 @@ int ip_route_output_flow(struct net *net, struct rtable **rp, struct flowi *flp, ...@@ -2559,9 +2559,9 @@ int ip_route_output_flow(struct net *net, struct rtable **rp, struct flowi *flp,
EXPORT_SYMBOL_GPL(ip_route_output_flow); EXPORT_SYMBOL_GPL(ip_route_output_flow);
int ip_route_output_key(struct rtable **rp, struct flowi *flp) int ip_route_output_key(struct net *net, struct rtable **rp, struct flowi *flp)
{ {
return ip_route_output_flow(&init_net, rp, flp, NULL, 0); return ip_route_output_flow(net, rp, flp, NULL, 0);
} }
static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
...@@ -2728,7 +2728,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void ...@@ -2728,7 +2728,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
}, },
.oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0, .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0,
}; };
err = ip_route_output_key(&rt, &fl); err = ip_route_output_key(&init_net, &rt, &fl);
} }
if (err) if (err)
......
...@@ -264,7 +264,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, ...@@ -264,7 +264,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
{ .sport = th->dest, { .sport = th->dest,
.dport = th->source } } }; .dport = th->source } } };
security_req_classify_flow(req, &fl); security_req_classify_flow(req, &fl);
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
reqsk_free(req); reqsk_free(req);
goto out; goto out;
} }
......
...@@ -533,7 +533,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -533,7 +533,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
fl.fl4_dst = eiph->saddr; fl.fl4_dst = eiph->saddr;
fl.fl4_tos = RT_TOS(eiph->tos); fl.fl4_tos = RT_TOS(eiph->tos);
fl.proto = IPPROTO_IPIP; fl.proto = IPPROTO_IPIP;
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&init_net, &rt, &fl))
goto out; goto out;
skb2->dev = rt->u.dst.dev; skb2->dev = rt->u.dst.dev;
...@@ -545,7 +545,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -545,7 +545,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
fl.fl4_dst = eiph->daddr; fl.fl4_dst = eiph->daddr;
fl.fl4_src = eiph->saddr; fl.fl4_src = eiph->saddr;
fl.fl4_tos = eiph->tos; fl.fl4_tos = eiph->tos;
if (ip_route_output_key(&rt, &fl) || if (ip_route_output_key(&init_net, &rt, &fl) ||
rt->u.dst.dev->type != ARPHRD_TUNNEL) { rt->u.dst.dev->type != ARPHRD_TUNNEL) {
ip_rt_put(rt); ip_rt_put(rt);
goto out; goto out;
......
...@@ -557,7 +557,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -557,7 +557,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
.tos = RT_TOS(tos) } }, .tos = RT_TOS(tos) } },
.oif = tunnel->parms.link, .oif = tunnel->parms.link,
.proto = IPPROTO_IPV6 }; .proto = IPPROTO_IPV6 };
if (ip_route_output_key(&rt, &fl)) { if (ip_route_output_key(&init_net, &rt, &fl)) {
tunnel->stat.tx_carrier_errors++; tunnel->stat.tx_carrier_errors++;
goto tx_error_icmp; goto tx_error_icmp;
} }
...@@ -686,7 +686,7 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev) ...@@ -686,7 +686,7 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
.oif = tunnel->parms.link, .oif = tunnel->parms.link,
.proto = IPPROTO_IPV6 }; .proto = IPPROTO_IPV6 };
struct rtable *rt; struct rtable *rt;
if (!ip_route_output_key(&rt, &fl)) { if (!ip_route_output_key(&init_net, &rt, &fl)) {
tdev = rt->u.dst.dev; tdev = rt->u.dst.dev;
ip_rt_put(rt); ip_rt_put(rt);
} }
......
...@@ -57,7 +57,7 @@ static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer) ...@@ -57,7 +57,7 @@ static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer)
BUG(); BUG();
} }
ret = ip_route_output_key(&rt, &fl); ret = ip_route_output_key(&init_net, &rt, &fl);
if (ret < 0) { if (ret < 0) {
_leave(" [route err %d]", ret); _leave(" [route err %d]", ret);
return; return;
......
...@@ -454,7 +454,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, ...@@ -454,7 +454,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
__FUNCTION__, NIPQUAD(fl.fl4_dst), __FUNCTION__, NIPQUAD(fl.fl4_dst),
NIPQUAD(fl.fl4_src)); NIPQUAD(fl.fl4_src));
if (!ip_route_output_key(&rt, &fl)) { if (!ip_route_output_key(&init_net, &rt, &fl)) {
dst = &rt->u.dst; dst = &rt->u.dst;
} }
...@@ -497,7 +497,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, ...@@ -497,7 +497,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
if ((laddr->state == SCTP_ADDR_SRC) && if ((laddr->state == SCTP_ADDR_SRC) &&
(AF_INET == laddr->a.sa.sa_family)) { (AF_INET == laddr->a.sa.sa_family)) {
fl.fl4_src = laddr->a.v4.sin_addr.s_addr; fl.fl4_src = laddr->a.v4.sin_addr.s_addr;
if (!ip_route_output_key(&rt, &fl)) { if (!ip_route_output_key(&init_net, &rt, &fl)) {
dst = &rt->u.dst; dst = &rt->u.dst;
goto out_unlock; goto out_unlock;
} }
......
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