summaryrefslogtreecommitdiffstats
path: root/include/net/dst.h
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2016-03-16 01:42:50 +0100
committerDavid S. Miller <davem@davemloft.net>2016-03-18 19:38:46 -0400
commit808c1b697c3c4dd2a7132882424c390b0d0acfb9 (patch)
treec43c9d8bd383b1c6063110c26c1ff495a37b5827 /include/net/dst.h
parent09c37a2c5bbc28b5fbc07a01db4bccdbd0a5d8a2 (diff)
downloadblackbird-op-linux-808c1b697c3c4dd2a7132882424c390b0d0acfb9.tar.gz
blackbird-op-linux-808c1b697c3c4dd2a7132882424c390b0d0acfb9.zip
bpf, dst: add and use dst_tclassid helper
We can just add a small helper dst_tclassid() for retrieving the dst->tclassid value. It makes the code a bit better in that we can get rid of the ifdef from filter.c by moving this into the header. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dst.h')
-rw-r--r--include/net/dst.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/dst.h b/include/net/dst.h
index c7329dcd90cc..5c98443c1c9e 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -398,6 +398,18 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev,
__skb_tunnel_rx(skb, dev, net);
}
+static inline u32 dst_tclassid(const struct sk_buff *skb)
+{
+#ifdef CONFIG_IP_ROUTE_CLASSID
+ const struct dst_entry *dst;
+
+ dst = skb_dst(skb);
+ if (dst)
+ return dst->tclassid;
+#endif
+ return 0;
+}
+
int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
static inline int dst_discard(struct sk_buff *skb)
{
OpenPOWER on IntegriCloud