Commit f61759e6 authored by Julian Anastasov's avatar Julian Anastasov Committed by David S. Miller

ipv4: make sure RTO_ONLINK is saved in routing cache

__mkroute_output fails to work with the original tos
and uses value with stripped RTO_ONLINK bit. Make sure we put
the original TOS bits into rt_key_tos because it used to match
cached route.
Signed-off-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5983fe2b
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
#include <net/secure_seq.h> #include <net/secure_seq.h>
#define RT_FL_TOS(oldflp4) \ #define RT_FL_TOS(oldflp4) \
((u32)(oldflp4->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))) ((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))
#define IP_MAX_MTU 0xFFF0 #define IP_MAX_MTU 0xFFF0
...@@ -2441,11 +2441,11 @@ EXPORT_SYMBOL(ip_route_input_common); ...@@ -2441,11 +2441,11 @@ EXPORT_SYMBOL(ip_route_input_common);
static struct rtable *__mkroute_output(const struct fib_result *res, static struct rtable *__mkroute_output(const struct fib_result *res,
const struct flowi4 *fl4, const struct flowi4 *fl4,
__be32 orig_daddr, __be32 orig_saddr, __be32 orig_daddr, __be32 orig_saddr,
int orig_oif, struct net_device *dev_out, int orig_oif, __u8 orig_rtos,
struct net_device *dev_out,
unsigned int flags) unsigned int flags)
{ {
struct fib_info *fi = res->fi; struct fib_info *fi = res->fi;
u32 tos = RT_FL_TOS(fl4);
struct in_device *in_dev; struct in_device *in_dev;
u16 type = res->type; u16 type = res->type;
struct rtable *rth; struct rtable *rth;
...@@ -2496,7 +2496,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, ...@@ -2496,7 +2496,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_genid = rt_genid(dev_net(dev_out)); rth->rt_genid = rt_genid(dev_net(dev_out));
rth->rt_flags = flags; rth->rt_flags = flags;
rth->rt_type = type; rth->rt_type = type;
rth->rt_key_tos = tos; rth->rt_key_tos = orig_rtos;
rth->rt_dst = fl4->daddr; rth->rt_dst = fl4->daddr;
rth->rt_src = fl4->saddr; rth->rt_src = fl4->saddr;
rth->rt_route_iif = 0; rth->rt_route_iif = 0;
...@@ -2546,7 +2546,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, ...@@ -2546,7 +2546,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
{ {
struct net_device *dev_out = NULL; struct net_device *dev_out = NULL;
u32 tos = RT_FL_TOS(fl4); __u8 tos = RT_FL_TOS(fl4);
unsigned int flags = 0; unsigned int flags = 0;
struct fib_result res; struct fib_result res;
struct rtable *rth; struct rtable *rth;
...@@ -2722,7 +2722,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) ...@@ -2722,7 +2722,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
make_route: make_route:
rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif,
dev_out, flags); tos, dev_out, flags);
if (!IS_ERR(rth)) { if (!IS_ERR(rth)) {
unsigned int hash; unsigned int hash;
......
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