Messages in this thread Patch in this message | | | From | Menglong Dong <> | Date | Thu, 17 Mar 2022 13:57:47 +0800 | Subject | Re: [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.
| |