Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202653
b: refs/heads/master
c: b5f7e75
h: refs/heads/master
i:
  202651: 22ed61f
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jun 3, 2010
1 parent ed0cec7 commit f8c0fed
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 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: 8cbccbe76168a0c627d2274e4a322116804db30f
refs/heads/master: b5f7e7554753e2cc3ef3bef0271fdb32027df2ba
1 change: 1 addition & 0 deletions trunk/include/linux/snmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ enum
LINUX_MIB_TCPBACKLOGDROP,
LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
LINUX_MIB_TCPDEFERACCEPTDROP,
LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
__LINUX_MIB_MAX
};

Expand Down
6 changes: 4 additions & 2 deletions trunk/net/ipv4/fib_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
if (no_addr)
goto last_resort;
if (rpf == 1)
goto e_inval;
goto e_rpf;
fl.oif = dev->ifindex;

ret = 0;
Expand All @@ -299,7 +299,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,

last_resort:
if (rpf)
goto e_inval;
goto e_rpf;
*spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
*itag = 0;
return 0;
Expand All @@ -308,6 +308,8 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
fib_res_put(&res);
e_inval:
return -EINVAL;
e_rpf:
return -EXDEV;
}

static inline __be32 sk_extract_addr(struct sockaddr *addr)
Expand Down
3 changes: 3 additions & 0 deletions trunk/net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ static int ip_rcv_finish(struct sk_buff *skb)
else if (err == -ENETUNREACH)
IP_INC_STATS_BH(dev_net(skb->dev),
IPSTATS_MIB_INNOROUTES);
else if (err == -EXDEV)
NET_INC_STATS_BH(dev_net(skb->dev),
LINUX_MIB_IPRPFILTER);
goto drop;
}
}
Expand Down
1 change: 1 addition & 0 deletions trunk/net/ipv4/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ static const struct snmp_mib snmp4_net_list[] = {
SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP),
SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP),
SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP),
SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER),
SNMP_MIB_SENTINEL
};

Expand Down
31 changes: 18 additions & 13 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
__be32 spec_dst;
struct in_device *in_dev = in_dev_get(dev);
u32 itag = 0;
int err;

/* Primary sanity checks. */

Expand All @@ -1865,10 +1866,12 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
if (!ipv4_is_local_multicast(daddr))
goto e_inval;
spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
} else if (fib_validate_source(saddr, 0, tos, 0,
dev, &spec_dst, &itag, 0) < 0)
goto e_inval;

} else {
err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
&itag, 0);
if (err < 0)
goto e_err;
}
rth = dst_alloc(&ipv4_dst_ops);
if (!rth)
goto e_nobufs;
Expand Down Expand Up @@ -1920,8 +1923,10 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
return -ENOBUFS;

e_inval:
err = -EINVAL;
e_err:
in_dev_put(in_dev);
return -EINVAL;
return err;
}


Expand Down Expand Up @@ -1985,7 +1990,6 @@ static int __mkroute_input(struct sk_buff *skb,
ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
saddr);

err = -EINVAL;
goto cleanup;
}

Expand Down Expand Up @@ -2157,13 +2161,12 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
goto brd_input;

if (res.type == RTN_LOCAL) {
int result;
result = fib_validate_source(saddr, daddr, tos,
err = fib_validate_source(saddr, daddr, tos,
net->loopback_dev->ifindex,
dev, &spec_dst, &itag, skb->mark);
if (result < 0)
goto martian_source;
if (result)
if (err < 0)
goto martian_source_keep_err;
if (err)
flags |= RTCF_DIRECTSRC;
spec_dst = daddr;
goto local_input;
Expand Down Expand Up @@ -2191,7 +2194,7 @@ out: return err;
err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
&itag, skb->mark);
if (err < 0)
goto martian_source;
goto martian_source_keep_err;
if (err)
flags |= RTCF_DIRECTSRC;
}
Expand Down Expand Up @@ -2272,8 +2275,10 @@ out: return err;
goto done;

martian_source:
err = -EINVAL;
martian_source_keep_err:
ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
goto e_inval;
goto done;
}

int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
Expand Down

0 comments on commit f8c0fed

Please sign in to comment.