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
|
|