Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2nd May 2008, 10:12 AM
Maninder Offline
Registered User
 
Join Date: Nov 2007
Posts: 23
cant register my own QUEUE handler..

Hi,

I am practising writing my own queue handler instead of using ip_queue like this:

#include<linux/module.h>
#include<linux/netfilter_ipv4.h>
#include<linux/netdevice.h>
#include<linux/ip.h>
#include<linux/delay.h>
#include<linux/kthread.h>

static int usercontrol(struct sk_buff*, struct nf_info*, unsigned int , void* );

static struct nf_queue_handler myqhandler= {
.name = "USERCONTROL",
.outfn = &usercontrol,
};

static int __init first(void)
{

int ret;
ret = nf_register_queue_handler(PF_INET, &myqhandler);
if(ret < 0)
{
printk(KERN_INFO "\n~~~Could not register queue handler~~~\n");
return 0;
}
printk(KERN_INFO "\n~~~Registering the module~~~~\n");

return 0;
}

static void __exit sec(void)
{
nf_unregister_queue_handlers(&myqhandler);
}

static int usercontrol(struct sk_buff *skb, struct nf_info *info, unsigned int queuenum, void *data)
{


printk(KERN_INFO "Queue handler called");
nf_reinject(skb, 0, NF_QUEUE);
return 1;
}

module_init(first);
module_exit(sec);
MODULE_LICENSE("GPL");




Now, for testing i did this:

first i gave command iptables -A INPUT -j QUEUE and then pinged localhost .. No reply came because queue handler was not there... and then i flushed the rule using iptables -F

then after making this module, i insmoded this module. then i gave iptables -A INPUT -j QUEUE command. But Kernel suddenly hanged. this is happeningg everytime i try this.

What could be the problem? plz suggest if you know.

Last edited by Maninder; 2nd May 2008 at 10:17 AM.
Reply With Quote
  #2  
Old 2nd May 2008, 01:51 PM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,346
Maninder - no offense, but this question is not Fedora specific. You're welcome to ask the questions here, but you'd get a far better response on some networking/kernel programming forum.
Reply With Quote
Reply

Tags
handler, queue, register

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
making own netfilter queue handler Maninder Servers & Networking 1 15th May 2008 01:24 PM
SPARC register to register movement clearer Programming & Packaging 1 15th October 2007 04:46 AM
Assigning HID Handler? zenox Hardware & Laptops 0 31st August 2006 08:22 PM


Current GMT-time: 22:51 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat