Hi you probably got a kernel_under_panic. at the stage you put your code in - in the NIC driver, the data pointer is usually either pointing to the beginning of the allocated skb or 2 bytes further to create IP header 16 bytes alignment. if you try using skb_push you take the data pointer 4 bytes back putting it below the allocated memory for this skb. you could try using skb_put instead, but it still doesnt promise you anything - if the buffer was allocated at the real size of the packet without any bytes to spare - your skb_put will encounter skb_over_panic - the tail pointer exceeds the allocated memory. you could consider catching the packet at an earlier stage, i.e. right before forming the IP header or even at the point the data is being copied to the packet and put your code there and also avoid the extra copy. another option you can consider is using skb_copy_expand which can enlarge the packet for you - but beware of exceeding the maximum allowed Ethernet frame. Hilik -----Original Message----- From: owner-kernelnewbies@nl.linux.org [mailto:owner-kernelnewbies@nl.linux.org]On Behalf Of Roger McGregor Sent: Wednesday, September 05, 2001 3:15 PM To: kernelnewbies@nl.linux.org Subject: 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) 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/