thanks
anishakaul thank you for the reply,
I'll try the explain what I'm trying to do ,
I'm trying to write a function that filters ip packets (L2) and decides either to drop them or to write them to a serial port (ttySx). All inside the kernel space.
I found a way to write to serial port :
void x()
{
char buf[20]={"SOMETHING ...\0"};
loff_t pos = 0;
mm_segment_t old_fs;
struct file *my_filp;
my_filp = filp_open("/dev/ttyS2",O_RDWR|O_LARGEFILE,0);
if (my_filp == NULL)
printk("filp_open error!!.\n");
old_fs=get_fs();
set_fs(get_ds());
vfs_write(my_filp, buf, sizeof(buf), &pos);
set_fs(old_fs);
filp_close(my_filp,NULL);
}
and a place to filter the packages in net/core/dev.c - netif_receive_skb
but when trying to open/write into the serial from the function netif_receive_skb the linux crashes ( probably cause the function above is called in interrupt context ),
Have any suggestions on how to resolve this ?
thanks in advance.
|