Thanks for the replies. The problem was indeed that there was only two bytes headroom. Talmon -----Original Message----- From: Sourav Sen [mailto:sourav@csa.iisc.ernet.in] Sent: Wednesday, September 05, 2001 7:21 PM To: Roger McGregor Cc: kernelnewbies@nl.linux.org Subject: Re: Problem with skb_push > Hi > > I need to do a quick hack in the ethernet driver > (3c59x.c), ie. to insert 4 bytes bewteen the ethernet > header and the IP header. > I save the packet then do skb_push, then copy the > packet back into skb->data > > I tried the following: > > unsigned char temp_buf[2000]; > unsigned char *temp_ptr; > int temp_len, i; > char *fourbytes = "abcd"; > > temp_ptr = skb->data; > temp_len = skb->len; > > memcpy(temp_buf, skb->data, skb->len); > > skb_push(skb, 4) Hi, Whats the gurantee that when the skb->data pointer is decremented by 4 (in skb_push), it is not going below the address returned on alloc_skb() (i.e., skb->head)? So, first check how much space is there with skb_headroom(). HTH sourav > > memcpy(temp_ptr, temp_buf, dev->hard_header_len); > > temp_ptr = skb->data + dev->hard_header_len; > > memcpy(temp_ptr, fourbytes, 4); > > temp_ptr += 4; > > memcpy(temp_ptr, temp_buf + dev->hard_header_len, > temp_len - dev->hard_header_len); > > > > For some reason when I call skb_push(), the system > hangs (kernel panic - Aiee killing interupt handler). > What am I doing wrong? > > TIA > Roger > > PS. I know I could do something similar using a raw > ethernet socket from user space, but I need to do it > in the driver because I want to operate on packets > coming down through the stack. > > __________________________________________________ > Do You Yahoo!? > Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger > http://im.yahoo.com > - > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > IRC Channel: irc.openprojects.net / #kernelnewbies > Web Page: http://www.kernelnewbies.org/ > - Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/