mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 05:04:09 +08:00
ipv6: raw: add drop reasons
Use existing helpers and drop reason codes for RAW input path. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
dfefcb0c04
commit
8d8ebd77f5
@ -355,17 +355,19 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
|
|||||||
|
|
||||||
static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
|
enum skb_drop_reason reason;
|
||||||
|
|
||||||
if ((raw6_sk(sk)->checksum || rcu_access_pointer(sk->sk_filter)) &&
|
if ((raw6_sk(sk)->checksum || rcu_access_pointer(sk->sk_filter)) &&
|
||||||
skb_checksum_complete(skb)) {
|
skb_checksum_complete(skb)) {
|
||||||
atomic_inc(&sk->sk_drops);
|
atomic_inc(&sk->sk_drops);
|
||||||
kfree_skb(skb);
|
kfree_skb_reason(skb, SKB_DROP_REASON_SKB_CSUM);
|
||||||
return NET_RX_DROP;
|
return NET_RX_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Charge it to the socket. */
|
/* Charge it to the socket. */
|
||||||
skb_dst_drop(skb);
|
skb_dst_drop(skb);
|
||||||
if (sock_queue_rcv_skb(sk, skb) < 0) {
|
if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) {
|
||||||
kfree_skb(skb);
|
kfree_skb_reason(skb, reason);
|
||||||
return NET_RX_DROP;
|
return NET_RX_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +388,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
|
|||||||
|
|
||||||
if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) {
|
if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) {
|
||||||
atomic_inc(&sk->sk_drops);
|
atomic_inc(&sk->sk_drops);
|
||||||
kfree_skb(skb);
|
kfree_skb_reason(skb, SKB_DROP_REASON_XFRM_POLICY);
|
||||||
return NET_RX_DROP;
|
return NET_RX_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +412,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
|
|||||||
if (inet->hdrincl) {
|
if (inet->hdrincl) {
|
||||||
if (skb_checksum_complete(skb)) {
|
if (skb_checksum_complete(skb)) {
|
||||||
atomic_inc(&sk->sk_drops);
|
atomic_inc(&sk->sk_drops);
|
||||||
kfree_skb(skb);
|
kfree_skb_reason(skb, SKB_DROP_REASON_SKB_CSUM);
|
||||||
return NET_RX_DROP;
|
return NET_RX_DROP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user