From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] fix conv_lisp_to_sockaddr for AF_INET6 addresses Date: Sun, 07 Feb 2016 12:45:01 +1100 Message-ID: <8737t5jntu.fsf@gnus.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454809562 4155 80.91.229.3 (7 Feb 2016 01:46:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Feb 2016 01:46:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Edmondson Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 07 02:45:52 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aSEQB-0003PO-TU for ged-emacs-devel@m.gmane.org; Sun, 07 Feb 2016 02:45:52 +0100 Original-Received: from localhost ([::1]:58263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSEQA-00089v-PG for ged-emacs-devel@m.gmane.org; Sat, 06 Feb 2016 20:45:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSEPu-00089p-0W for emacs-devel@gnu.org; Sat, 06 Feb 2016 20:45:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSEPq-0006Ui-JP for emacs-devel@gnu.org; Sat, 06 Feb 2016 20:45:33 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:48974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSEPp-0006Ue-Vz for emacs-devel@gnu.org; Sat, 06 Feb 2016 20:45:30 -0500 Original-Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aSEPT-0002uG-3N; Sun, 07 Feb 2016 02:45:07 +0100 In-Reply-To: (David Edmondson's message of "Sat, 06 Feb 2016 16:06:17 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux) X-MailScanner-ID: 1aSEPT-0002uG-3N MailScanner-NULL-Check: 1455414308.39539@6iyKOPJUhr6WgKgkthvbUQ X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199433 Archived-At: David Edmondson 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