netfilter_queue reinjecting packets

aton aton at packetdropped.org
Sun Mar 12 15:10:54 CET 2006


has anyone used netfilter_queue and successfully re-injected packets into the net?

i want to write sort of a userspace routing application. 

host A is my workstation, it has host B as default gateway.

on host B my routing application runs. 
it receives packets from netfilter_queue using libnetfilter_queue.
this works very well and i can display the whole packets.

now i just want to send them back into the net, so that they reach their destination.

i modified the main loop in the source of nfqnl_test.c in the libnetfilter_queue package:

	while ((rv=recv(fd, buf, sizeof(buf), 0)) >= 0)
	{
		printf("pkt received:\n");
		
		printf("sending packet back\n");
		
		if ((sv=send(fd, buf, sizeof(buf), 0))==-1)
		{
			perror("send");
			exit(EXIT_FAILURE);
		}
		printf("done\n");
	}

this should send every packet back to... where? 
it seems the packets are just sent into nirvana, i cannot sniff them, and i dont get an error from send().

is this the way to go, or should i make two raw sockets, one for tcp and one for udp packets and send the incoming packets on these?

greetings, aton
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/netfilter-devel/attachments/20060312/29197939/attachment.pgp


More information about the netfilter-devel mailing list