mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
route: Extend flow representation with tunnel key
Add a new flowi_tunnel structure which is a subset of ip_tunnel_key to allow routes to match on tunnel metadata. For now, the tunnel id is added to flowi_tunnel which allows for routes to be bound to specific virtual tunnels. Signed-off-by: Thomas Graf <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
ee122c79d4
commit
1b7179d3ad
3 changed files with 18 additions and 0 deletions
|
|
@ -280,6 +280,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)
|
|||
fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos);
|
||||
fl4.flowi4_scope = scope;
|
||||
fl4.flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0;
|
||||
fl4.flowi4_tun_key.tun_id = 0;
|
||||
if (!fib_lookup(net, &fl4, &res, 0))
|
||||
return FIB_RES_PREFSRC(net, res);
|
||||
} else {
|
||||
|
|
@ -313,6 +314,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
|
|||
fl4.saddr = dst;
|
||||
fl4.flowi4_tos = tos;
|
||||
fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
|
||||
fl4.flowi4_tun_key.tun_id = 0;
|
||||
|
||||
no_addr = idev->ifa_list == NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/jhash.h>
|
||||
#include <net/dst.h>
|
||||
#include <net/dst_metadata.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/protocol.h>
|
||||
#include <net/ip.h>
|
||||
|
|
@ -110,6 +111,7 @@
|
|||
#include <linux/kmemleak.h>
|
||||
#endif
|
||||
#include <net/secure_seq.h>
|
||||
#include <net/ip_tunnels.h>
|
||||
|
||||
#define RT_FL_TOS(oldflp4) \
|
||||
((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))
|
||||
|
|
@ -1673,6 +1675,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||
{
|
||||
struct fib_result res;
|
||||
struct in_device *in_dev = __in_dev_get_rcu(dev);
|
||||
struct ip_tunnel_info *tun_info;
|
||||
struct flowi4 fl4;
|
||||
unsigned int flags = 0;
|
||||
u32 itag = 0;
|
||||
|
|
@ -1690,6 +1693,11 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||
by fib_lookup.
|
||||
*/
|
||||
|
||||
tun_info = skb_tunnel_info(skb);
|
||||
if (tun_info && tun_info->mode == IP_TUNNEL_INFO_RX)
|
||||
fl4.flowi4_tun_key.tun_id = tun_info->key.tun_id;
|
||||
else
|
||||
fl4.flowi4_tun_key.tun_id = 0;
|
||||
skb_dst_drop(skb);
|
||||
|
||||
if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr))
|
||||
|
|
|
|||
Loading…
Reference in a new issue