Re: [PATCH 1/1] tidbits: net-udp: solicit new client for server mode

Philippe Gerum <[email protected]> Tue, 21 Jul 2026 22:15:35 +0200
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
Hannes Diethelm <[email protected]> writes:

> Am 20.07.26 um 16:27 schrieb Philippe Gerum:
>
> An option would be either to support of oob_ioctl() for SIOCGARP. Or create something like
> evl_net_routeinfo(s, addr) returning flags would make probing obsolete.
>

Not entirely. The issue with solely having SIOCGARP or any probe-only
explicit request is that you would have to pair two syscalls at each
transmit at least, one to probe for the sender address before possibly
soliciting that peer if absent from the oob cache, another one for
sending the message eventually. i.e., for every packet:

    ioctl(SIOCGARP)
         !ATF_COM? -> evl_net_solicit()
    oob_sendmsg(..., 0)

OTOH, with the latest attempt to address this issue, we can send a
probe-only request by passing MSG_PROBE (EHOSTUNREACH), or a request
that does not attempt to defer transmit to the inband stage on probe
failure by passing MSG_DONTWAIT (EWOULDBLOCK). i.e., for every packet

redo:
    oob_sendmsg(..., MSG_DONTWAIT)
         EWOULDBLOCK?
               oob_sendmsg(..., MSG_PROBE)
                  EHOSTUNREACH?
                      evl_net_solicit()
                      goto redo
                  otherwise assume ENOMEM
         otherwise all done

IOW, using a proper combination of MSG_DONTWAIT and MSG_PROBE in the
right sequence would either succeed to send the packet immediately on
the first oob_sendmsg() call, otherwise fail on memory shortage or
missing route from the oob cache. In the latter case, which could only
happen once for each new peer under normal circumstances, we could
disambiguate the EWOULDBLOCK status using an explicit probe.

A better way to do this in a single step unambiguously would require the
addition of another operation flag, like MSG_DONTDEFER, preventing the
deferral to inband on failed probe and causing oob_sendmsg() to return
with a specific error code. e.g. something as simple as the following
would cover all requirements:

     oob_sendmsg(..., MSG_DONTDEFER) -> EADDRNOTAVAIL on failed probe.

Now, we might also piggyback off of MSG_OOB instead of defining yet
another operation flag, as a way to say "oob only, don't relay to
inband", but I'm still pondering whether this would be nicely witty or
utterly confusing..

-- 
Philippe.