emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix conv_lisp_to_sockaddr for AF_INET6 addresses


From: Lars Ingebrigtsen
Subject: Re: [PATCH] fix conv_lisp_to_sockaddr for AF_INET6 addresses
Date: Sun, 07 Feb 2016 12:45:01 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux)

David Edmondson <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]