* dev_add_pack() duplicate skb ?
@ 2013-02-13 12:11 Felipe Dias
2013-02-13 15:05 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Dias @ 2013-02-13 12:11 UTC (permalink / raw)
To: netdev
Hi, someone might try to tell me what I'm doing wrong, please?
I have a simple module and I registered one packet handler, in init function:
---
pseudo_proto.type = htons(ETH_P_ALL);
pseudo_proto.dev = NULL;
pseudo_proto.func = packet_handler;
dev_add_pack(&pseudo_proto);
---
My packet_handler, is a simple function just to print in dmesg info
about the packet:
---
...
switch (ntohs(eth_hdr(skb)->h_proto))
{
case ETH_P_IPV6:
printk(KERN_INFO "%s: (%s %d %s, %s %d) Packet\n",
THIS_MODULE->name,
skb->dev->name,
skb->dev->type,
ntohs(eth_hdr(skb)->h_proto,
ipv6_hdr(skb)->nexthdr,
skb->len);
break;
...
---
When I sent a icmpv6 with a ping6 -c1 ::1 , this in my tcpdump show
only 2 packets (icmp request and icmp reply), but in my dmesg I see
4!:
---
595:[30469.099222] test: (lo 772 0x86dd, 0x3a 118) Packet
596:[30469.099226] test: (lo 772 0x86dd, 0x3a 104) Packet
597:[30469.099234] test: (lo 772 0x86dd, 0x3a 118) Packet
598:[30469.099236] test: (lo 772 0x86dd, 0x3a 104) Packet
---
This show 4 packets in ipv4 too. What I'm doing wrong ?
Best Regards,
fd.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: dev_add_pack() duplicate skb ?
2013-02-13 12:11 dev_add_pack() duplicate skb ? Felipe Dias
@ 2013-02-13 15:05 ` Eric Dumazet
2013-02-13 16:09 ` Felipe Dias
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2013-02-13 15:05 UTC (permalink / raw)
To: Felipe Dias; +Cc: netdev
On Wed, 2013-02-13 at 10:11 -0200, Felipe Dias wrote:
> Hi, someone might try to tell me what I'm doing wrong, please?
>
>
> I have a simple module and I registered one packet handler, in init function:
> ---
> pseudo_proto.type = htons(ETH_P_ALL);
> pseudo_proto.dev = NULL;
> pseudo_proto.func = packet_handler;
> dev_add_pack(&pseudo_proto);
> ---
>
> My packet_handler, is a simple function just to print in dmesg info
> about the packet:
>
> ---
> ...
>
> switch (ntohs(eth_hdr(skb)->h_proto))
> {
> case ETH_P_IPV6:
> printk(KERN_INFO "%s: (%s %d %s, %s %d) Packet\n",
> THIS_MODULE->name,
> skb->dev->name,
> skb->dev->type,
> ntohs(eth_hdr(skb)->h_proto,
> ipv6_hdr(skb)->nexthdr,
> skb->len);
> break;
> ...
> ---
>
> When I sent a icmpv6 with a ping6 -c1 ::1 , this in my tcpdump show
> only 2 packets (icmp request and icmp reply), but in my dmesg I see
> 4!:
>
> ---
> 595:[30469.099222] test: (lo 772 0x86dd, 0x3a 118) Packet
> 596:[30469.099226] test: (lo 772 0x86dd, 0x3a 104) Packet
> 597:[30469.099234] test: (lo 772 0x86dd, 0x3a 118) Packet
> 598:[30469.099236] test: (lo 772 0x86dd, 0x3a 104) Packet
> ---
>
> This show 4 packets in ipv4 too. What I'm doing wrong ?
The ICMP request is sent, _and_ received : 2 packets
The ICMP response is sent, _and_ received : 2 packets
Total : 4 packets.
af_packet has special code to avoid seeing packets twice on loopback, as
it would be a bit annoying.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: dev_add_pack() duplicate skb ?
2013-02-13 15:05 ` Eric Dumazet
@ 2013-02-13 16:09 ` Felipe Dias
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Dias @ 2013-02-13 16:09 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
On Wed, Feb 13, 2013 at 1:05 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2013-02-13 at 10:11 -0200, Felipe Dias wrote:
>> This show 4 packets in ipv4 too. What I'm doing wrong ?
>
> The ICMP request is sent, _and_ received : 2 packets
> The ICMP response is sent, _and_ received : 2 packets
>
> Total : 4 packets.
>
> af_packet has special code to avoid seeing packets twice on loopback, as
> it would be a bit annoying.
Of course. Thank you so much.
Att
fd.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-13 16:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 12:11 dev_add_pack() duplicate skb ? Felipe Dias
2013-02-13 15:05 ` Eric Dumazet
2013-02-13 16:09 ` Felipe Dias
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox