Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111993
b: refs/heads/master
c: a210d01
h: refs/heads/master
i:
  111991: 0b022cd
v: v3
  • Loading branch information
Julian Anastasov authored and David S. Miller committed Oct 1, 2008
1 parent 239e7a6 commit bc5e239
Show file tree
Hide file tree
Showing 3 changed files with 16 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: 4edd87ad5cad8e159e0db3ce3131b3d97219c9cd
refs/heads/master: a210d01ae3ee006b59e54e772a7f212486e0f021
2 changes: 2 additions & 0 deletions trunk/include/net/flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct flowi {
#define fl4_scope nl_u.ip4_u.scope

__u8 proto;
__u8 flags;
#define FLOWI_FLAG_ANYSRC 0x01
union {
struct {
__be16 sport;
Expand Down
20 changes: 13 additions & 7 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2361,11 +2361,6 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
ipv4_is_zeronet(oldflp->fl4_src))
goto out;

/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
dev_out = ip_dev_find(net, oldflp->fl4_src);
if (dev_out == NULL)
goto out;

/* I removed check for oif == dev_out->oif here.
It was wrong for two reasons:
1. ip_dev_find(net, saddr) can return wrong iface, if saddr
Expand All @@ -2377,6 +2372,11 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
if (oldflp->oif == 0
&& (ipv4_is_multicast(oldflp->fl4_dst) ||
oldflp->fl4_dst == htonl(0xFFFFFFFF))) {
/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
dev_out = ip_dev_find(net, oldflp->fl4_src);
if (dev_out == NULL)
goto out;

/* Special hack: user can direct multicasts
and limited broadcast via necessary interface
without fiddling with IP_MULTICAST_IF or IP_PKTINFO.
Expand All @@ -2395,9 +2395,15 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
fl.oif = dev_out->ifindex;
goto make_route;
}
if (dev_out)

if (!(oldflp->flags & FLOWI_FLAG_ANYSRC)) {
/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
dev_out = ip_dev_find(net, oldflp->fl4_src);
if (dev_out == NULL)
goto out;
dev_put(dev_out);
dev_out = NULL;
dev_out = NULL;
}
}


Expand Down

0 comments on commit bc5e239

Please sign in to comment.