Release 4.9 include/net/dst_metadata.h
#ifndef __NET_DST_METADATA_H
#define __NET_DST_METADATA_H 1
#include <linux/skbuff.h>
#include <net/ip_tunnels.h>
#include <net/dst.h>
struct metadata_dst {
struct dst_entry dst;
union {
struct ip_tunnel_info tun_info;
}
u;
};
static inline struct metadata_dst *skb_metadata_dst(struct sk_buff *skb)
{
struct metadata_dst *md_dst = (struct metadata_dst *) skb_dst(skb);
if (md_dst && md_dst->dst.flags & DST_METADATA)
return md_dst;
return NULL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas graf | thomas graf | 47 | 100.00% | 1 | 100.00% |
| Total | 47 | 100.00% | 1 | 100.00% |
static inline struct ip_tunnel_info *skb_tunnel_info(struct sk_buff *skb)
{
struct metadata_dst *md_dst = skb_metadata_dst(skb);
struct dst_entry *dst;
if (md_dst)
return &md_dst->u.tun_info;
dst = skb_dst(skb);
if (dst && dst->lwtstate)
return lwt_tun_info(dst->lwtstate);
return NULL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas graf | thomas graf | 59 | 88.06% | 2 | 66.67% |
jiri benc | jiri benc | 8 | 11.94% | 1 | 33.33% |
| Total | 67 | 100.00% | 3 | 100.00% |
static inline bool skb_valid_dst(const struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
return dst && !(dst->flags & DST_METADATA);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas graf | thomas graf | 35 | 100.00% | 1 | 100.00% |
| Total | 35 | 100.00% | 1 | 100.00% |
static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a,
const struct sk_buff *skb_b)
{
const struct metadata_dst *a, *b;
if (!(skb_a->_skb_refdst | skb_b->_skb_refdst))
return 0;
a = (const struct metadata_dst *) skb_dst(skb_a);
b = (const struct metadata_dst *) skb_dst(skb_b);
if (!a != !b || a->u.tun_info.options_len != b->u.tun_info.options_len)
return 1;
return memcmp(&a->u.tun_info, &b->u.tun_info,
sizeof(a->u.tun_info) + a->u.tun_info.options_len);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
jesse gross | jesse gross | 132 | 100.00% | 1 | 100.00% |
| Total | 132 | 100.00% | 1 | 100.00% |
void metadata_dst_free(struct metadata_dst *);
struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags);
struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags);
static inline struct metadata_dst *tun_rx_dst(int md_size)
{
struct metadata_dst *tun_dst;
tun_dst = metadata_dst_alloc(md_size, GFP_ATOMIC);
if (!tun_dst)
return NULL;
tun_dst->u.tun_info.options_len = 0;
tun_dst->u.tun_info.mode = 0;
return tun_dst;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pravin b shelar | pravin b shelar | 57 | 100.00% | 2 | 100.00% |
| Total | 57 | 100.00% | 2 | 100.00% |
static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)
{
struct metadata_dst *md_dst = skb_metadata_dst(skb);
int md_size;
struct metadata_dst *new_md;
if (!md_dst)
return ERR_PTR(-EINVAL);
md_size = md_dst->u.tun_info.options_len;
new_md = metadata_dst_alloc(md_size, GFP_ATOMIC);
if (!new_md)
return ERR_PTR(-ENOMEM);
memcpy(&new_md->u.tun_info, &md_dst->u.tun_info,
sizeof(struct ip_tunnel_info) + md_size);
skb_dst_drop(skb);
dst_hold(&new_md->dst);
skb_dst_set(skb, &new_md->dst);
return new_md;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pravin b shelar | pravin b shelar | 116 | 92.06% | 1 | 50.00% |
tobias klauser | tobias klauser | 10 | 7.94% | 1 | 50.00% |
| Total | 126 | 100.00% | 2 | 100.00% |
static inline struct ip_tunnel_info *skb_tunnel_info_unclone(struct sk_buff *skb)
{
struct metadata_dst *dst;
dst = tun_dst_unclone(skb);
if (IS_ERR(dst))
return NULL;
return &dst->u.tun_info;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pravin b shelar | pravin b shelar | 44 | 100.00% | 1 | 100.00% |
| Total | 44 | 100.00% | 1 | 100.00% |
static inline struct metadata_dst *__ip_tun_set_dst(__be32 saddr,
__be32 daddr,
__u8 tos, __u8 ttl,
__be16 flags,
__be64 tunnel_id,
int md_size)
{
struct metadata_dst *tun_dst;
tun_dst = tun_rx_dst(md_size);
if (!tun_dst)
return NULL;
ip_tunnel_key_init(&tun_dst->u.tun_info.key,
saddr, daddr, tos, ttl,
0, 0, 0, tunnel_id, flags);
return tun_dst;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pravin b shelar | pravin b shelar | 69 | 83.13% | 2 | 50.00% |
amir vadai | amir vadai | 12 | 14.46% | 1 | 25.00% |
daniel borkmann | daniel borkmann | 2 | 2.41% | 1 | 25.00% |
| Total | 83 | 100.00% | 4 | 100.00% |
static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb,
__be16 flags,
__be64 tunnel_id,
int md_size)
{
const struct iphdr *iph = ip_hdr(skb);
return __ip_tun_set_dst(iph->saddr, iph->daddr, iph->tos, iph->ttl,
flags, tunnel_id, md_size);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
amir vadai | amir vadai | 31 | 51.67% | 1 | 50.00% |
pravin b shelar | pravin b shelar | 29 | 48.33% | 1 | 50.00% |
| Total | 60 | 100.00% | 2 | 100.00% |
static inline struct metadata_dst *__ipv6_tun_set_dst(const struct in6_addr *saddr,
const struct in6_addr *daddr,
__u8 tos, __u8 ttl,
__be32 label,
__be16 flags,
__be64 tunnel_id,
int md_size)
{
struct metadata_dst *tun_dst;
struct ip_tunnel_info *info;
tun_dst = tun_rx_dst(md_size);
if (!tun_dst)
return NULL;
info = &tun_dst->u.tun_info;
info->mode = IP_TUNNEL_INFO_IPV6;
info->key.tun_flags = flags;
info->key.tun_id = tunnel_id;
info->key.tp_src = 0;
info->key.tp_dst = 0;
info->key.u.ipv6.src = *saddr;
info->key.u.ipv6.dst = *daddr;
info->key.tos = tos;
info->key.ttl = ttl;
info->key.label = label;
return tun_dst;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pravin b shelar | pravin b shelar | 110 | 67.07% | 2 | 50.00% |
amir vadai | amir vadai | 48 | 29.27% | 1 | 25.00% |
daniel borkmann | daniel borkmann | 6 | 3.66% | 1 | 25.00% |
| Total | 164 | 100.00% | 4 | 100.00% |
static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb,
__be16 flags,
__be64 tunnel_id,
int md_size)
{
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
return __ipv6_tun_set_dst(&ip6h->saddr, &ip6h->daddr,
ipv6_get_dsfield(ip6h), ip6h->hop_limit,
ip6_flowlabel(ip6h), flags, tunnel_id,
md_size);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
amir vadai | amir vadai | 62 | 91.18% | 1 | 33.33% |
daniel borkmann | daniel borkmann | 4 | 5.88% | 1 | 33.33% |
pravin b shelar | pravin b shelar | 2 | 2.94% | 1 | 33.33% |
| Total | 68 | 100.00% | 3 | 100.00% |
#endif /* __NET_DST_METADATA_H */
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pravin b shelar | pravin b shelar | 427 | 44.81% | 3 | 23.08% |
thomas graf | thomas graf | 190 | 19.94% | 3 | 23.08% |
amir vadai | amir vadai | 153 | 16.05% | 1 | 7.69% |
jesse gross | jesse gross | 132 | 13.85% | 1 | 7.69% |
alexei starovoitov | alexei starovoitov | 13 | 1.36% | 1 | 7.69% |
daniel borkmann | daniel borkmann | 12 | 1.26% | 1 | 7.69% |
tobias klauser | tobias klauser | 10 | 1.05% | 1 | 7.69% |
jiri benc | jiri benc | 8 | 0.84% | 1 | 7.69% |
paolo abeni | paolo abeni | 8 | 0.84% | 1 | 7.69% |
| Total | 953 | 100.00% | 13 | 100.00% |