Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79528
b: refs/heads/master
c: b592191
h: refs/heads/master
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Jan 28, 2008
1 parent 56e7829 commit 11c6c23
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eee80592c3c1f7381c04913d9d3eb6e3c3c87628
refs/heads/master: b5921910a1de4ba82add59154976c3dc7352c8c2
2 changes: 1 addition & 1 deletion trunk/include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ extern int __ip_route_output_key(struct net *, struct rtable **, const struct f
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_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 net *net, struct iphdr *iph, unsigned short new_mtu);
extern void ip_rt_send_redirect(struct sk_buff *skb);

extern unsigned inet_addr_type(struct net *net, __be32 addr);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ static void icmp_unreach(struct sk_buff *skb)
"and DF set.\n",
NIPQUAD(iph->daddr));
} else {
info = ip_rt_frag_needed(iph,
info = ip_rt_frag_needed(&init_net, iph,
ntohs(icmph->un.frag.mtu));
if (!info)
goto out;
Expand Down
21 changes: 16 additions & 5 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,11 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
(fl1->iif ^ fl2->iif)) == 0;
}

static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
{
return rt1->u.dst.dev->nd_net == rt2->u.dst.dev->nd_net;
}

/*
* Perform a full scan of hash table and free all entries.
* Can be called by a softirq or a process.
Expand Down Expand Up @@ -961,7 +966,7 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)

spin_lock_bh(rt_hash_lock_addr(hash));
while ((rth = *rthp) != NULL) {
if (compare_keys(&rth->fl, &rt->fl)) {
if (compare_keys(&rth->fl, &rt->fl) && compare_netns(rth, rt)) {
/* Put it first */
*rthp = rth->u.dst.rt_next;
/*
Expand Down Expand Up @@ -1415,7 +1420,8 @@ static __inline__ unsigned short guess_mtu(unsigned short old_mtu)
return 68;
}

unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu)
unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
unsigned short new_mtu)
{
int i;
unsigned short old_mtu = ntohs(iph->tot_len);
Expand All @@ -1438,7 +1444,8 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu)
rth->rt_dst == daddr &&
rth->rt_src == iph->saddr &&
rth->fl.iif == 0 &&
!(dst_metric_locked(&rth->u.dst, RTAX_MTU))) {
!(dst_metric_locked(&rth->u.dst, RTAX_MTU)) &&
rth->u.dst.dev->nd_net == net) {
unsigned short mtu = new_mtu;

if (new_mtu < 68 || new_mtu >= old_mtu) {
Expand Down Expand Up @@ -2049,7 +2056,9 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
struct rtable * rth;
unsigned hash;
int iif = dev->ifindex;
struct net *net;

net = skb->dev->nd_net;
tos &= IPTOS_RT_MASK;
hash = rt_hash(daddr, saddr, iif);

Expand All @@ -2061,7 +2070,8 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->fl.iif == iif &&
rth->fl.oif == 0 &&
rth->fl.mark == skb->mark &&
rth->fl.fl4_tos == tos) {
rth->fl.fl4_tos == tos &&
rth->u.dst.dev->nd_net == net) {
dst_use(&rth->u.dst, jiffies);
RT_CACHE_STAT_INC(in_hit);
rcu_read_unlock();
Expand Down Expand Up @@ -2460,7 +2470,8 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
rth->fl.oif == flp->oif &&
rth->fl.mark == flp->mark &&
!((rth->fl.fl4_tos ^ flp->fl4_tos) &
(IPTOS_RT_MASK | RTO_ONLINK))) {
(IPTOS_RT_MASK | RTO_ONLINK)) &&
rth->u.dst.dev->nd_net == net) {
dst_use(&rth->u.dst, jiffies);
RT_CACHE_STAT_INC(out_hit);
rcu_read_unlock_bh();
Expand Down

0 comments on commit 11c6c23

Please sign in to comment.