unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: David Edmondson <dme@dme.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] fix conv_lisp_to_sockaddr for AF_INET6 addresses
Date: Sun, 07 Feb 2016 12:45:01 +1100	[thread overview]
Message-ID: <8737t5jntu.fsf@gnus.org> (raw)
In-Reply-To: <m2twll6cxy.fsf@heart-of-gold.hh.sledj.net> (David Edmondson's message of "Sat, 06 Feb 2016 16:06:17 +0000")

David Edmondson <dme@dme.org> writes:

> AF_INET6 addresses are converted to a list of 16 bit quantities by
> conv_sockaddr_to_lisp(). conv_lisp_to_sockaddr() should follow the
> same scheme rather than expecting a (longer) list of 8 bit quantities.

Hm...  The way IPv6 addresses in the IP lists are distinguished from
IPv4 addresses is by the length of the lists.  For instance:

get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp)
{
  register struct Lisp_Vector *p;

  if (VECTORP (address))
    {
      p = XVECTOR (address);
      if (p->header.size == 5)
	{
	  *familyp = AF_INET;
	  return sizeof (struct sockaddr_in);
	}
#ifdef AF_INET6
      else if (p->header.size == 9)
	{
	  *familyp = AF_INET6;
	  return sizeof (struct sockaddr_in6);
	}
#endif
    }

So the list should be 8 8-bit numbers, not 4 16-bit numbers.  So I think
the error is in both conv_sockaddr_to_lisp (which should create 8 byte
arrays) and conv_lisp_to_sockaddr (which should treat the numbers as
bytes).

I think?

Weird that this hasn't been seen before at all...  aren't anybody using
IPv6?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



  reply	other threads:[~2016-02-07  1:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-06 16:06 [PATCH] fix conv_lisp_to_sockaddr for AF_INET6 addresses David Edmondson
2016-02-07  1:45 ` Lars Ingebrigtsen [this message]
2016-02-07  1:50   ` Lars Ingebrigtsen
2016-02-07 17:52 ` John Wiegley
2016-02-08  1:29   ` Lars Ingebrigtsen
2016-02-08  3:34     ` Eli Zaretskii
2016-02-08  3:59       ` Lars Ingebrigtsen
2016-02-08  4:01       ` Lars Ingebrigtsen
2016-02-08  4:07         ` Lars Ingebrigtsen
2016-02-08  7:03           ` Michael Albinus
2016-02-08  7:26             ` Lars Ingebrigtsen
2016-02-08 17:04           ` Eli Zaretskii
2016-02-08 23:17             ` Lars Ingebrigtsen
2016-02-09 19:13               ` Eli Zaretskii
2016-02-09 23:07                 ` Lars Ingebrigtsen
2016-02-10 20:08                   ` Eli Zaretskii
2016-02-10 20:31                     ` Eli Zaretskii
2016-02-11  3:54                       ` Lars Ingebrigtsen
2016-02-13 13:19                         ` Eli Zaretskii
2016-02-08  3:43     ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737t5jntu.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=dme@dme.org \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).