ipv4: raw: add drop reasons
[ Upstream commit 42186e6c00
]
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>
Stable-dep-of: e622502c310f ("ipmr: fix kernel panic when forwarding mcast packets")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d54e4da98b
commit
03dc5b73af
|
@ -286,11 +286,13 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
|
||||||
|
|
||||||
static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
|
enum skb_drop_reason reason;
|
||||||
|
|
||||||
/* Charge it to the socket. */
|
/* Charge it to the socket. */
|
||||||
|
|
||||||
ipv4_pktinfo_prepare(sk, skb);
|
ipv4_pktinfo_prepare(sk, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +303,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) {
|
if (!xfrm4_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;
|
||||||
}
|
}
|
||||||
nf_reset_ct(skb);
|
nf_reset_ct(skb);
|
||||||
|
|
Loading…
Reference in New Issue