Reputation: 4024
I have net_device
which has the ndo_start_xmit
function implemented.
When the ndo_start_xmit
function is called I have an skb
that contains the IP packet. I'll need to overt the packet with IP+UDP
headers and send it back to the routing system.
The problem is that, when I call the dst_input(skb)
or dst_output(skb)
, I'll catch the NULL
pointer dereference error. It seems that I can't use this functions to push the encapsulated packet into the network stack.
What is the solution?
Upvotes: 2
Views: 682
Reputation: 1222
During packet transmission (from driver to network link)
Copy data from the socket buffer (skb->data) to the driver kernel buffer (inside the hard_start_xmit function).
During packet reception (from network link to driver)
Create a skb buffer.Copy data from the driver kernel buffer to the socket buffer and hand over to the kernel network stack using the netif_rx() function.
Upvotes: 3
Reputation: 4509
If you want to push an skb into the kernel stack, just use the netif_rx(skb) function.
Upvotes: 2