Joan Lledó, le mar. 11 nov. 2025 21:22:40 +0100, a ecrit:
> 
> 
> On 10/14/25 00:40, Samuel Thibault wrote:
> > > > FMI, Which ones exactly? seems like an oversight in the Hurd pfinet.
> > > 
> > >  From `#include <lwip/posix/inet.h>`
> > > 
> > > ```
> > > #ifdef LWIP_UNIX_HURD
> > > #define IP_PKTINFO  8
> > > 
> > > struct in_pktinfo {
> > >    unsigned int   ipi_ifindex;  /* Interface index */
> > >    struct in_addr ipi_addr;     /* Destination (from header) address */
> > > };
> > > #endif /* LWIP_UNIX_HURD */
> > > 
> > > ```
> > 
> > pfinet indeed doesn't really support pktinfo currently.
> > 
> > The sad thing here is that lwip's and linux' struct in_pktinfo are not
> > the same, linux adds the ipi_spec_dst field, so using lwip's structure
> > would not really allow us to add this field later on.
> > 
> > We'd rather introduce our own header that exposes the API/ABI that we
> > expect tcp/ip translators to expose for struct in_pktinfo (translating
> > that from/to their internal implementation if needed).
> 
> I've been checking this. So we should:
> 
> 1. Add the definitions to `i386-gnu/bits/in.h` (That's where other IP_*
> macros are)
> 2. Don't define `ipi_spec_dst` since lwip doesn't support it and pfinet
> doesn't support pktinfo in general.

We'd want to be able to add the field later on, so better add it, and
make lwip support it by putting in it the address of the interface.

> 3. The lwip package already #includes <netinet/in.h> so it would use the new
> definition.
> 4. About pfinet, since pktinfo is not supported, I guess the only thing we
> can do is to return an EOPNOTSUP from somewhere when the client tries to use
> pktinfo (is this already done?).

The linux stack in pfinet actually already supports it, it's just
that we don't currently expose a IP_PKTINFO macro for applications to
make use of it. 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.

Samuel

Reply via email to