[haiku-development] Re: [haiku-development]

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 09 Jul 2023 07:42:03 +0000

9 juillet 2023 à 04:29 "Swan Geon" <swangeon@xxxxxxxxx> a écrit:


I got the semaphore problem settled but now I am having a problem where the 
packet is going back and forth from the interface, the driver, and the 
application, however, the application that sent a packet through the 
interface is not receiving the packet. Through some debugging, I found out 
that the interface, when it goes into device_consumer_thread for getting the 
receive function, it fails here 
https://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/network/stack/device_interfaces.cpp#n119
 . Looking deeper into when that interface->receive_funcs element gets 
assigned I found the function here 
https://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/network/stack/device_interfaces.cpp#n648
  which I realized is never called when I call ifconfig to set up the 
interface. I was wondering if anyone had a way to get that function to call 
on the setup of the tun interface? I was thinking it's possibly a use of 
`get_module` in the driver but I don't really know where to start with 
solving this after I've debugged it. I debugged it through dprintf's that I 
put in both functions. One last thing is that on Wireshark and tcpdump both 
show the packet being sent and received on the interface if that means much 
of anything.


Hello,

register_device_handler is the way to get packets received from an interface up 
to the "link" protocols in the network stack.

The binding depends on the interface type as well as the protocol type (in the 
case of ethernet that would be the "ethertype" field in the ethernet header).

So, first of all, which types are we looking at? Is it a new frame type similar 
to loopback frame, and IPv4? If so, did you add that pair of protocols in 
src/add-ons/kernel/network/stack/stack.cpp in init_stack? There is a series of 
calls to register_domain_datalink_protocol there that should set things up. 
Ideally, there would be a more dynamic way for protocols to discover each 
other, but for now this part is fully static and fixed by the network stack. Or 
are we looking at registration problems for higher layers? (for example ICMP on 
top of IPv4?)

-- 
Adrien.

Other related posts: