named-data / YaNFD

Yet another Named Data Networking Forwarding Daemon
https://pkg.go.dev/github.com/named-data/YaNFD
MIT License
12 stars 10 forks source link

face: ensure first UDP packet has incoming FaceID #13

Closed yoursunny closed 2 years ago

yoursunny commented 2 years ago

When UDPListener receives a packet, it constructs LinkService, then performs these two actions:

  1. The current packet is passed to LinkService, which may further pass it to forwarding.
  2. The face is added to FaceTable, which assigns it a FaceID.

Previously, action 1 is performed before action 2. This causes the first packet to be dropped by forwarding, with the following error message:

 ERROR[0002] [FwThread-0] Non-existent incoming FaceID=0 for Interest=/localhost - DROP

This change swaps the order, so that action 1 is performed after action 2. This ensures FaceID is already assigned when forwarding sees the packet, so that the packet can be processed successfully.

yoursunny commented 2 years ago

A related open issue is a misleading FaceID=0 in the log message, because MakeUnicastUDPTransport calls t.changeState(ndn.Up) before FaceID is assigned.

  INFO[0426] [UnicastUDPTransport, FaceID=0, RemoteURI=udp4://127.0.0.1:53704, LocalURI=udp4://127.0.0.1:6363] 
state: Down -> Up

This problem is cosmetic and does not affect packet processing. I'm unable to resolve this issue at this moment.