lkml.org 
[lkml]   [2022]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH net-next v3 3/3] net: icmp: add reasons of the skb drops to icmp protocol
On Thu, Mar 17, 2022 at 11:18 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
[......]
> > -bool ping_rcv(struct sk_buff *skb)
> > +enum skb_drop_reason ping_rcv(struct sk_buff *skb)
> > {
> > + enum skb_drop_reason reason = SKB_DROP_REASON_NO_SOCKET;
> > struct sock *sk;
> > struct net *net = dev_net(skb->dev);
> > struct icmphdr *icmph = icmp_hdr(skb);
> > - bool rc = false;
> >
> > /* We assume the packet has already been checked by icmp_rcv */
> >
> > @@ -980,15 +980,17 @@ bool ping_rcv(struct sk_buff *skb)
> > struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
> >
> > pr_debug("rcv on socket %p\n", sk);
> > - if (skb2 && !ping_queue_rcv_skb(sk, skb2))
> > - rc = true;
> > + if (skb2)
> > + reason = __ping_queue_rcv_skb(sk, skb2);
> > + else
> > + reason = SKB_DROP_REASON_NOMEM;
> > sock_put(sk);
> > }
> >
> > - if (!rc)
> > + if (reason)
> > pr_debug("no socket, dropping\n");
>
> This is going to be printed on memory allocation failures now as well.

Enn...This logic is not changed. In the previous, skb2==NULL means
rc is false, and this message is printed too.

Seems this can be optimized by the way? Printing the message only for
no socket found.

\
 
 \ /
  Last update: 2022-03-17 07:16    [W:0.919 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site