El 15/11/25 a les 21:19, Samuel Thibault ha escrit:

We don't want to blindly expose the linuxish value of
IP_PKTINFO (8), because normally the Hurd follows the BSD macro values,
and 8 is already taken by IP_RETOPTS. Apparently BSD has some
compatibility layer to support pktinfo, but a quick grep in the BSD
source didn't show something, we should probably contact BSD maintainers
to know which value is used there for IP_PKTINFO. We can then teach
pfinet the value and let it support it too.

I've been doing a small research, to avoid writing maintainers. This is what I found:

1. Dhcpcd uses IP_PKTINFO to get the interface index from and incoming UDP paket, it's not used for anything else.

2. Different BSDs have different ways to approach this:

- NetBSD: IP_PKTINFO supported, set to 25. It also defines IP_RECVPKTINFO
- https://github.com/NetBSD/src/blob/829f43c8342b070d5881af4288058a4593bf5cea/sys/netinet/in.h#L297 - https://man.freebsd.org/cgi/man.cgi?query=ip&apropos=0&sektion=4&manpath=NetBSD+10.1&arch=default&format=html

- OpenBSD: No way to get the interface index that I know
- https://man.freebsd.org/cgi/man.cgi?query=ip&apropos=0&sektion=4&manpath=OpenBSD+7.8&arch=default&format=html

- FreeBSD:
- Natively, they support IP_RECVIF + struct sockaddr_dl (dhcpcd supports this as well) - https://man.freebsd.org/cgi/man.cgi?query=ip&apropos=0&sektion=4&manpath=FreeBSD+16.0-CURRENT&arch=default&format=html
  - Linux compatibility layer:
    - They set IP_PKTINFO to 8
- https://github.com/freebsd/freebsd-src/blob/main/sys/compat/linux/linux_socket.h#L216
    - But they don't support it:
- https://github.com/freebsd/freebsd-src/blob/main/sys/compat/linux/linux_socket.c#L192

From this info, I'd say we need to set a new value, for instance 14, which is unused. WDYT?



Reply via email to