Re: reading skb at interrupt handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I should not be any problem in reading skb there. But who is setting
skb->nh->ip pointers. Because as long as I remember, nh and ip pointers are
not set before netif_rx.

Regards
Mohanlal

----- Original Message -----
From: <naoya@matsulab.is.titech.ac.jp>
To: <kernelnewbies@nl.linux.org>
Sent: Thursday, April 15, 2004 3:20 AM
Subject: reading skb at interrupt handler


Hi,

I'm wondering whether it is possible to read the values of skb just
before execution of netif_rx. As a simple experiment, I inserted my own
code between an interrupt handler of NIC driver and netif_rx (e.g., for
the pcnet32 driver, between pcnet32_rx and netif_rx).  It reads
skb->protocol and, if the protocol is IP, reads skb->nh->ip->protocol.
And if the IP protocol is IP_PROTO_ICMP, it drops that. Otherwise, it
simply passes it to netif_rx. After I actually installed that code into a
running machine. I tested it by executing the ping commands from other
hosts to the machine. Although the machine is supposed not
to answer the ICMP requests, it _sometimes_ did, not all the time. So I
imagines that reading such values in the interrupt handler doesn't work
properly. Is this assumption right?

Here is the snippet of my code:

in pcnet32_rx, pcnet32.c:
        netif_rx(skb);

-->
        /* netif_rx(skb); */
        my_code(skb);

void my_code(struct sk_buff *skb)
{
        if (ntohs(skb->protocol) == ETH_P_IP) {
                ...
                if (ntohs(skb->nh.iph->protocol) == IPPROTO_ICMP) {
                        /* drop */
                        kfree_skb(skb);
                } else {
                        netif_rx(skb);
                }
        } else {
                netif_rx(skb);
        }
        return;
}


Thanks in advance

Naoya Maruyama
Tokyo Institute of Technology







--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux