Skip to contentSkip to conversation

dev_queue_xmit and sockets

DISCUSSION Marjan Schiller 1 participant 1 message Jan 18, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi!

I am currently developing a netfilter module which passes incoming and outgoing ethernet packages from one interface to an another interface ( a tun device ). This works very well, the tcpdump shows correct packages on the destination device and PING and ARP works good.

But i get into trouble if i want to create a socket connection with these packages. It seams to me that the packages are only "useable" within the kernel space and not the user space. Did i miss something there? Do i have to prepare the SKB for user mode or something like that?

I can establish a connection between the client socket and the server socket, but the server socket does not read any data ( But the packet with the data has reached the interface ).

Here is an example how i pass the packaged to the tun device:

static unsigned int send_ethernet_package( struct sk_buff * in_skb, void * data, int len, struct net_device * dev ) {
struct sk_buff *skb;

  skb = alloc_skb( len , GFP_ATOMIC);
  skb_put( skb, len );
  skb->pkt_type = PACKET_HOST;
  skb->dev = dev;
  memcpy(skb->head, data , len );
  dev_queue_xmit( skb );

return 0;
}

The data parameter is a well formed ethernet package.

Someone how has a guess whats wrong with this?

Thanks for help

Marjan

Signature · 2 lines
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail