From: "Eric S. Raymond" <esr@thyrsus.com>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: netdev@vger.kernel.org
Subject: Re: Is it possible to get device information via CMSG?
Date: Mon, 28 May 2018 17:02:50 -0400 [thread overview]
Message-ID: <20180528210250.GA26453@thyrsus.com> (raw)
In-Reply-To: <20180528065701.dqdjbrqb34zfsfvo@unicorn.suse.cz>
Michal Kubecek <mkubecek@suse.cz>:
> > 1. Is there a cmsg_level/cmsg_type combination that will return the
> > name of the device the packet arrived through?
>
> Not name directly, AFAIK, but you can set SOL_IP / IP_PKTINFO (or
> SOL_IPV6 / IPV6_RECVPKTINFO) socket option and get IP_PKTINFO
> (IPV6_PKTINFO) message with recvmsg(). This will tell you incoming
> interface index so that you can look the name up. See ip(7) or ipv6(7)
> for format of the message (struct ip_pktinfo, struct in6_pktinfo).
Thanks, that confirms something I found on Stack Overflow after I
queried your list.
> However, I suspect that userspace application is not really interested
> in incoming interface name but rather in destination address of the
> incoming packet which is also provided in IP_PKTINFO / IPV6_PKTINFO
> message.
NTP is weird that way. My group, NTPsec, inherited the reference
Mills codebase (what we now call "NTP Classic") which really does have
a filter-by-interface-name feature *in addition to* local address
filtering.
We want to simplify the way it works without discarding that feature,
because we've made promises about backward compatibility that we mean
to keep. We don't throw away features unless either they're security
holes or we are *dead certain* they are obsolete.
In case it's of interest to you, NTPsec is a drop-in replacement for
NTP Classic that solves its chronic security problems by stripping out
unused features and legacy code. We've actually shrunk the codebase
size by a factor of 4x. We have better monitoring and admin tools, too.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.
prev parent reply other threads:[~2018-05-28 21:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-26 9:39 Is it possible to get device information via CMSG? Eric S. Raymond
2018-05-28 6:57 ` Michal Kubecek
2018-05-28 21:02 ` Eric S. Raymond [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180528210250.GA26453@thyrsus.com \
--to=esr@thyrsus.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).