bugzilla-daemon@netfilter.org
2003-Apr-25 06:13 UTC
[Bug 85] New: couldn't write file ,call syscall ,ex. sys_open
https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=85 Summary: couldn't write file ,call syscall ,ex. sys_open Product: netfilter/iptables Version: linux-2.4.x Platform: i386 OS/Version: RedHat Linux Status: NEW Severity: major Priority: P2 Component: ip_tables (kernel) AssignedTo: zpeak@163.com ReportedBy: zpeak@163.com CC: netfilter-buglog@lists.netfilter.org Hello: I program the firewall used the iptable under linux ,The kernel is 2.4.18 , I coun't call the system call ,example sys_open ,sys_close, The problem is i could't write file ,what can i do , the error is : error .... kernel panic :Aiee,killing interrupt handler! In interrupt handler - not syncing Please help me ,Thank you . yours zpeak /*------------------------------------------------------------------------------ ----------------------- *Atteched the source and the problem -------------------------------------------------------------------------------- --------------------*/ #ifndef __KERNEL__ #define __KERNEL__ #endif #ifndef MODULE #define MODULE #endif #include <linux/module.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <linux/config.h> #include <linux/ip.h> #include <linux/tcp.h> #include <linux/udp.h> #include <linux/spinlock.h> #include <asm-i386/segment.h> #include <asm-i386/uaccess.h> #include <linux/netfilter_ipv4.h> static unsigned int myfirewall(unsigned int hooknum,struct sk_buff **skb, const struct net_device *in, const struct net_device *out,int (*okfn)(struct sk_buff*)) { mm_segment_t old_fs =get_fs() ; mm_segment_t new_fs =get_ds(); printk("The old fs is [%lu]\n",old_fs.seg) ; printk("The neww fs is [%lu]\n ",new_fs.seg) ; /* I found the old_fs and new_fs is in the same address * But in other module is different ,why,can you tell me */ int fd = 0; char pathname[50] ="/test/log/8.mail" ; set_fs(new_fs) ; fd = sys_open(pathname,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR); printk("fd is [%d]",fd); sys_write(fd,"Mail has develope sucesses , ",20) ; sys_close(fd); set_fs(old_fs) ; return NF_ACCEPT; } static struct nf_hook_ops iplimitfilter{ {NULL,NULL}, myfirewall, PF_INET, NF_IP_PRE_ROUTING, NF_IP_PRI_FILTER }; int init_module(void) { mm_segment_t old_fs =get_fs() ; mm_segment_t new_fs =get_ds(); printk("The** old fs is [%lu]\n",old_fs.seg) ; printk("The** neww fs is [%lu]\n ",new_fs.seg) ; return nf_register_hook(&iplimitfilter); } void cleanup_module(void) { nf_unregister_hook(&iplimitfilter); } ------------------------------------------------------------ gcc -D__KERNEL__ -WALL -I /usr/src/linux.2.4.18/include myfirewall.c ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.