Commit 7a3198a8 authored by Jiri Benc's avatar Jiri Benc Committed by David S. Miller

ipv6: helper function to get tclass

Implement helper inline function to get traffic class from IPv6 header.
Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72e60278
...@@ -233,6 +233,11 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) ...@@ -233,6 +233,11 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
return (struct ipv6hdr *)skb_transport_header(skb); return (struct ipv6hdr *)skb_transport_header(skb);
} }
static inline __u8 ipv6_tclass(const struct ipv6hdr *iph)
{
return (ntohl(*(__be32 *)iph) >> 20) & 0xff;
}
/* /*
This structure contains results of exthdrs parsing This structure contains results of exthdrs parsing
as offsets from skb->nh. as offsets from skb->nh.
......
...@@ -485,7 +485,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) ...@@ -485,7 +485,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
} }
if (np->rxopt.bits.rxtclass) { if (np->rxopt.bits.rxtclass) {
int tclass = (ntohl(*(__be32 *)ipv6_hdr(skb)) >> 20) & 0xff; int tclass = ipv6_tclass(ipv6_hdr(skb));
put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
} }
......
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