logo       


Re: netif_rx(): msg#00005

Subject: Re: netif_rx()
On Mon, 12 Apr 2004, Robert Denier wrote:

> Does anyone recall any special rules for dealing with the function?  I
> had a function that sent fake arp packets back working, but now I've
> apparently got a mess.

Obviously the first step should be to check what changes broke it.

> If I allow that function to be executed rather than commenting it out I
> goet a DEBUG_PAGEALLOC error.  (Almost all the kernel debugging routines
> are enabled.)

I think you misinterpret the error message.  Maybe it comes from die()
in arch/i386/kernel/traps.c, but then it merely indicates that
DEBUG_PAGEALLOC is enabled.

> Basically what i'm doing for right now is the following.
>
> in orinoco_xmit()

You may want to reschedule the function that returns the packet.  The
networking layer has its own locks and may not expect to receive a packet
at this point.  I think it's not a problem, but it's one of things to try
if nothing else helps.

> 1) Find out if its a broadcast packet.
> 2) If so is it an arp packet?  If its an arp packet, is it an arp
> request packet?  If so do the following.
>
> (This is a simplified version.)
>
> struct sk_buff * skb_out = dev_alloc_skb( 28 ) ;
>
> /* Packet structure is as follows.  I create a struct that has all this
> with the packed attribute and set all the field correctly. */
>
> memcpy(skb_put(skb_out,28),&mystruct,28);

It would be much safer to use sizeof rather than a fixed number.

> /* Format of resulting skb */
> [8 byte arp response header][sender mac][sender
> ipv4][targetmac][targetipv4]
>
> I set the protocol and ip_summed as follows.
>
> skb_resp->protocol=ntohs(ETH_P_ARP);  //network to host byte order
> skb_resp->ip_summed = CHECKSUM_NONE;

Don't forget other fields, such as dev and pkt_type.  Also, see the
sources for other things that a done at this point, such as setting
dev->last_rx and updating stats.

> And then do a netif_rx(skb_out) making sure not to clear it since other
> code does that..
>
> Am I missing something obvious? If I leave netif_rx not commented out
> things rapidly crash as soon as I do a ping (The EIP is at netif_rx if
> that helps.), yet if i do a dump of that skb the packet looks fine and
> is 28 bytes in length.  (It has no ethernet header, but then it
> shouldn't need one right?)

Maybe you should start with the ethernet headers and use eth_type_trans()
to set protocol.

-- 
Regards,
Pavel Roskin


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe