Commit 5c04c819 authored by Michael Smith's avatar Michael Smith Committed by David S. Miller

fib_validate_source(): pass sk_buff instead of mark

This makes sk_buff available for other use in fib_validate_source().
Signed-off-by: default avatarMichael Smith <msmith@cbnco.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5325e92f
...@@ -227,9 +227,9 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id); ...@@ -227,9 +227,9 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id);
/* Exported by fib_frontend.c */ /* Exported by fib_frontend.c */
extern const struct nla_policy rtm_ipv4_policy[]; extern const struct nla_policy rtm_ipv4_policy[];
extern void ip_fib_init(void); extern void ip_fib_init(void);
extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
struct net_device *dev, __be32 *spec_dst, u8 tos, int oif, struct net_device *dev,
u32 *itag, u32 mark); __be32 *spec_dst, u32 *itag);
extern void fib_select_default(struct fib_result *res); extern void fib_select_default(struct fib_result *res);
/* Exported by fib_semantics.c */ /* Exported by fib_semantics.c */
......
...@@ -188,9 +188,9 @@ EXPORT_SYMBOL(inet_dev_addr_type); ...@@ -188,9 +188,9 @@ EXPORT_SYMBOL(inet_dev_addr_type);
* - check, that packet arrived from expected physical interface. * - check, that packet arrived from expected physical interface.
* called with rcu_read_lock() * called with rcu_read_lock()
*/ */
int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos,
struct net_device *dev, __be32 *spec_dst, int oif, struct net_device *dev, __be32 *spec_dst,
u32 *itag, u32 mark) u32 *itag)
{ {
struct in_device *in_dev; struct in_device *in_dev;
struct flowi4 fl4; struct flowi4 fl4;
...@@ -202,7 +202,6 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, ...@@ -202,7 +202,6 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
fl4.flowi4_oif = 0; fl4.flowi4_oif = 0;
fl4.flowi4_iif = oif; fl4.flowi4_iif = oif;
fl4.flowi4_mark = mark;
fl4.daddr = src; fl4.daddr = src;
fl4.saddr = dst; fl4.saddr = dst;
fl4.flowi4_tos = tos; fl4.flowi4_tos = tos;
...@@ -214,8 +213,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, ...@@ -214,8 +213,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
no_addr = in_dev->ifa_list == NULL; no_addr = in_dev->ifa_list == NULL;
rpf = IN_DEV_RPFILTER(in_dev); rpf = IN_DEV_RPFILTER(in_dev);
accept_local = IN_DEV_ACCEPT_LOCAL(in_dev); accept_local = IN_DEV_ACCEPT_LOCAL(in_dev);
if (mark && !IN_DEV_SRC_VMARK(in_dev)) fl4.flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0;
fl4.flowi4_mark = 0;
} }
if (in_dev == NULL) if (in_dev == NULL)
......
...@@ -1871,8 +1871,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -1871,8 +1871,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
goto e_inval; goto e_inval;
spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
} else { } else {
err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst, err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &spec_dst,
&itag, 0); &itag);
if (err < 0) if (err < 0)
goto e_err; goto e_err;
} }
...@@ -1981,8 +1981,8 @@ static int __mkroute_input(struct sk_buff *skb, ...@@ -1981,8 +1981,8 @@ static int __mkroute_input(struct sk_buff *skb,
} }
err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(*res), err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res),
in_dev->dev, &spec_dst, &itag, skb->mark); in_dev->dev, &spec_dst, &itag);
if (err < 0) { if (err < 0) {
ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
saddr); saddr);
...@@ -2150,9 +2150,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -2150,9 +2150,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
goto brd_input; goto brd_input;
if (res.type == RTN_LOCAL) { if (res.type == RTN_LOCAL) {
err = fib_validate_source(saddr, daddr, tos, err = fib_validate_source(skb, saddr, daddr, tos,
net->loopback_dev->ifindex, net->loopback_dev->ifindex,
dev, &spec_dst, &itag, skb->mark); dev, &spec_dst, &itag);
if (err < 0) if (err < 0)
goto martian_source_keep_err; goto martian_source_keep_err;
if (err) if (err)
...@@ -2176,8 +2176,8 @@ out: return err; ...@@ -2176,8 +2176,8 @@ out: return err;
if (ipv4_is_zeronet(saddr)) if (ipv4_is_zeronet(saddr))
spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
else { else {
err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst, err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &spec_dst,
&itag, skb->mark); &itag);
if (err < 0) if (err < 0)
goto martian_source_keep_err; goto martian_source_keep_err;
if (err) if (err)
......
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