]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/net/dst_metadata.h
route: Extend flow representation with tunnel key
[mirror_ubuntu-bionic-kernel.git] / include / net / dst_metadata.h
CommitLineData
f38a9eb1
TG
1#ifndef __NET_DST_METADATA_H
2#define __NET_DST_METADATA_H 1
3
4#include <linux/skbuff.h>
5#include <net/ip_tunnels.h>
6#include <net/dst.h>
7
8struct metadata_dst {
9 struct dst_entry dst;
10 size_t opts_len;
ee122c79
TG
11 union {
12 struct ip_tunnel_info tun_info;
13 } u;
f38a9eb1
TG
14};
15
16static inline struct metadata_dst *skb_metadata_dst(struct sk_buff *skb)
17{
18 struct metadata_dst *md_dst = (struct metadata_dst *) skb_dst(skb);
19
20 if (md_dst && md_dst->dst.flags & DST_METADATA)
21 return md_dst;
22
23 return NULL;
24}
25
ee122c79
TG
26static inline struct ip_tunnel_info *skb_tunnel_info(struct sk_buff *skb)
27{
28 struct metadata_dst *md_dst = skb_metadata_dst(skb);
29
30 if (md_dst)
31 return &md_dst->u.tun_info;
32
33 return NULL;
34}
35
f38a9eb1
TG
36static inline bool skb_valid_dst(const struct sk_buff *skb)
37{
38 struct dst_entry *dst = skb_dst(skb);
39
40 return dst && !(dst->flags & DST_METADATA);
41}
42
43struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags);
44
45#endif /* __NET_DST_METADATA_H */