Re: How to get Ethernet data from Socket buffer.

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

 



Hi,
     Can you tell in which hook you are copying data? You can only do this at NF_IP_PRE_ROUTING or NF_IP_POST_ROUTING. you said your computer hang that mean you got oops message right?
regards,
Parag.

On 10 Dec 2005 15:55:09 -0500, Nhan Thanh Le <ltnhan@xxxxxxxxxx> wrote:
Hi All,

  My kernel module get data socket buffer from Netfilter, When I try to
copy data from socket buffer filed skb->mac.raw or skb->mac.ethernet to
my ethernet data then my computer will be hang on. Would you please show
me how to fix this? Or please help me to how fill my ethernet header
when I get data from socket buffer. Thank you very much and appreciate
for help.

Both function bellow is not work properly.

inline static int build_ethernet(const struct sk_buff *skb, struct
ethhdr vs_hdr)
{
  struct ethhdr *eth_header;
  eth_header=(struct ethhdr *)skb->mac.raw;
  if (eth_header == NULL)
    return -1;
  memcpy(&vs_hdr,skb->mac.raw,sizeof(struct ethhdr));

  return 0;
}

inline static int build_ethernet(const struct sk_buff *skb,  struct
ethhdr vs_hdr)
{
  struct ethhdr *eth_header;
  eth_header=skb->mac.ethernet;
  if (eth_header == NULL)
    return -1;
  memcpy(&vs_hdr,skb->mac.ethernet,sizeof(struct ethhdr));

  return 0;
}

Nhanle


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