From: "Pali Rohár" <pali@kernel.org>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH] netdevice.7: Update documentation for SIOCGIFADDR SIOCSIFADDR SIOCDIFADDR
Date: Sat, 2 Jan 2021 19:10:54 +0100 [thread overview]
Message-ID: <20210102181054.pspqz7tj24wviu5i@pali> (raw)
In-Reply-To: <486b1176-d12b-4f6f-0890-f3d4e8483eb7@gmail.com>
Hello!
On Saturday 02 January 2021 19:04:06 Alejandro Colomar (man-pages) wrote:
> Hi Pali,
>
> Please, see some comments below.
>
> On 1/2/21 3:02 PM, Pali Rohár wrote:
> > Also add description for struct in6_ifreq which is used for IPv6 addresses.
> >
> > SIOCSIFADDR and SIOCDIFADDR can be used to add or delete IPv6 address and
> > pppd is using these ioctls for a long time. Surprisingly SIOCDIFADDR cannot
> > be used for deleting IPv4 address but only for IPv6 addresses.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> > man7/netdevice.7 | 36 +++++++++++++++++++++++++++++-------
> > 1 file changed, 29 insertions(+), 7 deletions(-)
> >
> > diff --git a/man7/netdevice.7 b/man7/netdevice.7
> > index 488e83d9a..5b68e4988 100644
> > --- a/man7/netdevice.7
> > +++ b/man7/netdevice.7
> > @@ -55,9 +55,27 @@ struct ifreq {
> > .EE
> > .in
> > .PP
> > +Exception is
> > +.B AF_INET6
> > +socket for which is used
> > +.I in6_ifreq
> > +structure:
>
> Wording fix:
>
> [
> AF_INET6 is an exception.
> It passes an
> .I in6_ifreq
> structure:
> ]
Ok, I will fix it.
> Are there more exceptions?
> Or is it the only one?
I really do not know. I played only with the IPv4 and IPv6 sockets.
I come across this incompatibility during reading pppd source code that
it has different structures for IPv4 and IPv6 which are passed to
SIOCSIFADDR ioctl.
> > +.PP
> > +.in +4n
> > +.EX
> > +struct in6_ifreq {
> > + struct in6_addr ifr6_addr;
> > + u32 ifr6_prefixlen;
> > + int ifr6_ifindex; /* Interface index */
> > +};
> > +.EE
> > +.in
> > +.PP
> > Normally, the user specifies which device to affect by setting
> > .I ifr_name
> > -to the name of the interface.
> > +to the name of the interface or
> > +.I ifr6_ifindex
> > +to the index of the interface.
>
> I've seen there's ifr_ifindex too (see SIOCGIFNAME).
> Can it be used in the same way as ifr6_ifindex?
Sorry, I do not know too. In all applications I saw that they are using
ifr_name for IPv4 stuff.
This needs to be tested if ifr_ifindex instead of ifr_name works for
specifying IPv4 address.
> > All other members of the structure may
> > share memory.
> > .SS Ioctls
> > @@ -142,13 +160,17 @@ IFF_ISATAP:Interface is RFC4214 ISATAP interface.
> > .PP
> > Setting the extended (private) interface flags is a privileged operation.
> > .TP
> > -.BR SIOCGIFADDR ", " SIOCSIFADDR
> > -Get or set the address of the device using
> > -.IR ifr_addr .
> > -Setting the interface address is a privileged operation.
> > -For compatibility, only
> > +.BR SIOCGIFADDR ", " SIOCSIFADDR ", " SIOCDIFADDR
> > +Get, set or delete the address of the device using
> > +.IR ifr_addr " or " ifr6_addr " with " ifr6_prefixlen .
>
> Generally, we place each name on a single line.
> The line after .TP is an exception, as you can see above.
> So this would be:
>
> [
> .IR ifr_addr ,
> or
> .I ifr6_addr
> with
> .IR ifr6_prefixlen .
> ]
Ok, I will change it.
> > +Setting or deleting the interface address is a privileged operation.
> > +For compatibility,
> > +.BR SIOCGIFADDR " returns only " AF_INET " addresses, "
> > +.BR SIOCSIFADDR " accepts " AF_INET " and " AF_INET6 " addresses and "
> > +.BR SIOCDIFADDR " deletes only " AF_INET6 " addresses. "
>
> See above.
>
> > .B AF_INET
> > -addresses are accepted or returned.
> > +address can be deleted by setting zero address via
> > +.BR SIOCSIFADDR .
> > .TP
> > .BR SIOCGIFDSTADDR ", " SIOCSIFDSTADDR
> > Get or set the destination address of a point-to-point device using
> >
>
> Thanks,
>
> Alex
>
> --
> Alejandro Colomar
> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> http://www.alejandro-colomar.es/
next prev parent reply other threads:[~2021-01-02 18:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-02 14:02 [PATCH] netdevice.7: Update documentation for SIOCGIFADDR SIOCSIFADDR SIOCDIFADDR Pali Rohár
2021-01-02 18:04 ` Alejandro Colomar (man-pages)
2021-01-02 18:10 ` Pali Rohár [this message]
2021-01-02 18:36 ` Pali Rohár
2021-01-02 18:39 ` [PATCH v2] " Pali Rohár
2021-01-10 16:38 ` Pali Rohár
2021-01-10 19:57 ` Alejandro Colomar (man-pages)
2021-01-12 19:26 ` Pali Rohár
2021-01-16 0:41 ` Alejandro Colomar (man-pages)
2021-01-16 22:35 ` Pali Rohár
2021-01-11 8:13 ` Michael Kerrisk (man-pages)
2021-01-10 17:47 ` Dmitry V. Levin
2021-01-12 17:51 ` Pali Rohár
2021-01-16 22:36 ` [PATCH v3] " Pali Rohár
2021-01-19 20:18 ` Alejandro Colomar (man-pages)
2021-01-27 19:29 ` Pali Rohár
2021-01-28 14:05 ` Alejandro Colomar (man-pages)
2021-01-28 14:04 ` Alejandro Colomar (man-pages)
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=20210102181054.pspqz7tj24wviu5i@pali \
--to=pali@kernel.org \
--cc=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/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).