From fredrik@REDACTED Fri Feb 1 08:58:54 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 1 Feb 2013 08:58:54 +0100 Subject: [erlang-patches] How to get Data Types section in documentation? In-Reply-To: <1359474652.4832.125.camel@sekic1152.rnd.ki.sw.ericsson.se> References: <1359474652.4832.125.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: <510B75BE.6090109@erlang.org> On 01/29/2013 04:50 PM, Bengt Kleberg wrote: > Greetings, > > What should I do to the module slave.erl to get a Data Types section in > the documentation? > > I am updating the slave module documentation. I have added some data > types. There is no Data Types section in the current documentation. As > an example of how to do I am looking at the array module. It has a Data > types section in the documentation. I can not find anything in array.erl > that tells the documentation builder to add the Data Types section. How > is it done? > > For slave.erl I do get a link from my type > (lib/stdlib-1.19/doc/html/slave.html#type-start_options), but there is > no target for that link. > > > bengt > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello Bengt and sorry for the late answer. You'll have to have a look at in doc/src directory. In the example you are given, you can see in the stdlib/doc/src/array.xml that you can specify the datatype with ".." Then you'll have to rebuild the documentation with make release_docs Hope this exaplains it :) -- BR Fredrik Gustafsson Erlang OTP Team From vladdu55@REDACTED Fri Feb 1 09:58:54 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 1 Feb 2013 09:58:54 +0100 Subject: [erlang-patches] trivial bug in jinterface Message-ID: Hi! I found a small problem in jinterface. It has been around for a while now, it happens in a corner case that probably nobody ever uses. In OtpErlangTuple(OtpErlangObject[], int, int), when the size of the slice used is 0, then the elems fields remains uninitialized, it is the parameter that gets assigned. I used master as base, I hope it's still possible to do that. git fetch git://github.com/vladdu/otp.git tuple_constructor_bug https://github.com/vladdu/otp/compare/tuple_constructor_bug https://github.com/vladdu/otp/compare/tuple_constructor_bug.patch Given that there are no other tests for jinterface at this level, do you want me to write one for this case? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From nico.kruber@REDACTED Fri Feb 1 11:13:33 2013 From: nico.kruber@REDACTED (Nico Kruber) Date: Fri, 01 Feb 2013 11:13:33 +0100 Subject: [erlang-patches] trivial bug in jinterface In-Reply-To: References: Message-ID: <4172679.kZgBQRGhLO@csr-pc40.zib.de> On Friday 01 Feb 2013 09:58:54 Vlad Dumitrescu wrote: > Hi! > > I found a small problem in jinterface. It has been around for a while now, > it happens in a corner case that probably nobody ever uses. > > In OtpErlangTuple(OtpErlangObject[], int, int), when the size of the slice > used is 0, then the elems fields remains uninitialized, it is the parameter > that gets assigned. > > I used master as base, I hope it's still possible to do that. > > git fetch git://github.com/vladdu/otp.git tuple_constructor_bug > > https://github.com/vladdu/otp/compare/tuple_constructor_bug > https://github.com/vladdu/otp/compare/tuple_constructor_bug.patch > > Given that there are no other tests for jinterface at this level, do you > want me to write one for this case? > > best regards, > Vlad your branch is outdated so the diff is not clean, i.e. contains a lot of other commits -> please rebase your branch see https://github.com/erlang/otp/wiki/Submitting-patches it would probably also be good to base it on maint - but someone from the otp team needs to decide here :) your commit though seems reasonable https://github.com/vladdu/otp/commit/ee29a8aa733fbf1a1666b2f85a9fd6ff19d777b3 Nico From fredrik@REDACTED Fri Feb 1 11:24:57 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 1 Feb 2013 11:24:57 +0100 Subject: [erlang-patches] trivial bug in jinterface In-Reply-To: <4172679.kZgBQRGhLO@csr-pc40.zib.de> References: <4172679.kZgBQRGhLO@csr-pc40.zib.de> Message-ID: <510B97F9.1020903@erlang.org> On 02/01/2013 11:13 AM, Nico Kruber wrote: > On Friday 01 Feb 2013 09:58:54 Vlad Dumitrescu wrote: >> Hi! >> >> I found a small problem in jinterface. It has been around for a while now, >> it happens in a corner case that probably nobody ever uses. >> >> In OtpErlangTuple(OtpErlangObject[], int, int), when the size of the slice >> used is 0, then the elems fields remains uninitialized, it is the parameter >> that gets assigned. >> >> I used master as base, I hope it's still possible to do that. >> >> git fetch git://github.com/vladdu/otp.git tuple_constructor_bug >> >> https://github.com/vladdu/otp/compare/tuple_constructor_bug >> https://github.com/vladdu/otp/compare/tuple_constructor_bug.patch >> >> Given that there are no other tests for jinterface at this level, do you >> want me to write one for this case? >> >> best regards, >> Vlad > your branch is outdated so the diff is not clean, i.e. contains a lot of other > commits > -> please rebase your branch > see https://github.com/erlang/otp/wiki/Submitting-patches > > it would probably also be good to base it on maint - but someone from the otp > team needs to decide here :) > > your commit though seems reasonable > https://github.com/vladdu/otp/commit/ee29a8aa733fbf1a1666b2f85a9fd6ff19d777b3 > > > Nico > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello, Just rebase it on master will work fine for me. -- BR Fredrik Gustafsson Erlang OTP Team From tuncer.ayaz@REDACTED Fri Feb 1 11:24:44 2013 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Fri, 1 Feb 2013 11:24:44 +0100 Subject: [erlang-patches] trivial bug in jinterface In-Reply-To: <4172679.kZgBQRGhLO@csr-pc40.zib.de> References: <4172679.kZgBQRGhLO@csr-pc40.zib.de> Message-ID: On Fri, Feb 1, 2013 at 11:13 AM, Nico Kruber wrote: > On Friday 01 Feb 2013 09:58:54 Vlad Dumitrescu wrote: >> Hi! >> >> I found a small problem in jinterface. It has been around for a >> while now, it happens in a corner case that probably nobody ever >> uses. >> >> In OtpErlangTuple(OtpErlangObject[], int, int), when the size of >> the slice used is 0, then the elems fields remains uninitialized, >> it is the parameter that gets assigned. >> >> I used master as base, I hope it's still possible to do that. >> >> git fetch git://github.com/vladdu/otp.git tuple_constructor_bug >> >> https://github.com/vladdu/otp/compare/tuple_constructor_bug >> https://github.com/vladdu/otp/compare/tuple_constructor_bug.patch >> >> Given that there are no other tests for jinterface at this level, >> do you want me to write one for this case? >> >> best regards, >> Vlad > > your branch is outdated so the diff is not clean, i.e. contains a > lot of other commits > -> please rebase your branch > see https://github.com/erlang/otp/wiki/Submitting-patches > > it would probably also be good to base it on maint - but someone > from the otp team needs to decide here :) Right now master is the branch to base patches on. Once R16B is out, there will most probably be different maint and master again. > your commit though seems reasonable > https://github.com/vladdu/otp/commit/ee29a8aa733fbf1 The right thing would be to keep master (or maint) in sync with upstream/master (upstream/maint). That way the branch comparison link will provide a more useful result. Also, you can change the default branch on github if you want to omit the 'master...' (or 'maint...') part. Hope this helps :). From vladdu55@REDACTED Fri Feb 1 11:37:15 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 1 Feb 2013 11:37:15 +0100 Subject: [erlang-patches] trivial bug in jinterface In-Reply-To: <510B97F9.1020903@erlang.org> References: <4172679.kZgBQRGhLO@csr-pc40.zib.de> <510B97F9.1020903@erlang.org> Message-ID: Hi, It already is on master (but I just had some git issues, so you might have to refetch). /Vlad On Fri, Feb 1, 2013 at 11:24 AM, Fredrik wrote: > On 02/01/2013 11:13 AM, Nico Kruber wrote: > >> On Friday 01 Feb 2013 09:58:54 Vlad Dumitrescu wrote: >> >>> Hi! >>> >>> I found a small problem in jinterface. It has been around for a while >>> now, >>> it happens in a corner case that probably nobody ever uses. >>> >>> In OtpErlangTuple(**OtpErlangObject[], int, int), when the size of the >>> slice >>> used is 0, then the elems fields remains uninitialized, it is the >>> parameter >>> that gets assigned. >>> >>> I used master as base, I hope it's still possible to do that. >>> >>> git fetch git://github.com/vladdu/otp.**gittuple_constructor_bug >>> >>> https://github.com/vladdu/otp/**compare/tuple_constructor_bug >>> https://github.com/vladdu/otp/**compare/tuple_constructor_bug.**patch >>> >>> Given that there are no other tests for jinterface at this level, do you >>> want me to write one for this case? >>> >>> best regards, >>> Vlad >>> >> your branch is outdated so the diff is not clean, i.e. contains a lot of >> other >> commits >> -> please rebase your branch >> see https://github.com/erlang/otp/**wiki/Submitting-patches >> >> it would probably also be good to base it on maint - but someone from the >> otp >> team needs to decide here :) >> >> your commit though seems reasonable >> https://github.com/vladdu/otp/**commit/**ee29a8aa733fbf1a1666b2f85a9fd6** >> ff19d777b3 >> >> >> Nico >> ______________________________**_________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-patches >> > Hello, > Just rebase it on master will work fine for me. > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > > ______________________________**_________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/**listinfo/erlang-patches > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Fri Feb 1 11:44:28 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 1 Feb 2013 11:44:28 +0100 Subject: [erlang-patches] jinterface: bug detecting user home directory on windows Message-ID: Hi, Jinterface uses System.getProperty("user.home") to locate the user's home and the cookie file. On Windows, the result might be different than the value used by Erlang, which looks first to the HOMEDRIVE and HOMEPATH variables. The fix makes jinterface use the same logic to locate the cookie file. The branch is based on master. git fetch git://github.com/vladdu/otp.git jinterface_windows_cookie https://github.com/vladdu/otp/compare/jinterface_windows_cookie https://github.com/vladdu/otp/compare/jinterface_windows_cookie.patch Writing a test for this would require running it with different environment settings and how to do it depends on how you run your tests at OTP. I would need guidance to implement it. The fix has been in the erlide code base for a while and I didn't see any problems. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Fri Feb 1 11:44:55 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 1 Feb 2013 11:44:55 +0100 Subject: [erlang-patches] trivial bug in jinterface In-Reply-To: References: <4172679.kZgBQRGhLO@csr-pc40.zib.de> <510B97F9.1020903@erlang.org> Message-ID: <510B9CA7.7050909@erlang.org> On 02/01/2013 11:37 AM, Vlad Dumitrescu wrote: > Hi, > > It already is on master (but I just had some git issues, so you might > have to refetch). > > /Vlad > > > On Fri, Feb 1, 2013 at 11:24 AM, Fredrik > wrote: > > On 02/01/2013 11:13 AM, Nico Kruber wrote: > > On Friday 01 Feb 2013 09:58:54 Vlad Dumitrescu wrote: > > Hi! > > I found a small problem in jinterface. It has been around > for a while now, > it happens in a corner case that probably nobody ever uses. > > In OtpErlangTuple(OtpErlangObject[], int, int), when the > size of the slice > used is 0, then the elems fields remains uninitialized, it > is the parameter > that gets assigned. > > I used master as base, I hope it's still possible to do that. > > git fetch git://github.com/vladdu/otp.git > tuple_constructor_bug > > https://github.com/vladdu/otp/compare/tuple_constructor_bug > https://github.com/vladdu/otp/compare/tuple_constructor_bug.patch > > Given that there are no other tests for jinterface at this > level, do you > want me to write one for this case? > > best regards, > Vlad > > your branch is outdated so the diff is not clean, i.e. > contains a lot of other > commits > -> please rebase your branch > see https://github.com/erlang/otp/wiki/Submitting-patches > > it would probably also be good to base it on maint - but > someone from the otp > team needs to decide here :) > > your commit though seems reasonable > https://github.com/vladdu/otp/commit/ee29a8aa733fbf1a1666b2f85a9fd6ff19d777b3 > > > Nico > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > > Hello, > Just rebase it on master will work fine for me. > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > > Re-fetched the patch, I don't remember how the how-to is describing on the comparison-links but you should write it like this instead https://github.com/vladdu/otp/compare/erlang:master...tuple_constructor_bug So, the branch you are based upon should be in the link ('erlang:master...' or when it is maint 'erlang:maint...'). This will make a proper link for us to examine. -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Fri Feb 1 11:48:06 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 1 Feb 2013 11:48:06 +0100 Subject: [erlang-patches] jinterface: bug detecting user home directory on windows In-Reply-To: References: Message-ID: Fixed comparison links https://github.com/vladdu/otp/compare/erlang:master...jinterface_windows_cookie https://github.com/vladdu/otp/compare/erlang:master...jinterface_windows_cookie.patch /Vlad On Fri, Feb 1, 2013 at 11:44 AM, Vlad Dumitrescu wrote: > Hi, > > Jinterface uses System.getProperty("user.home") to locate the user's home > and the cookie file. On Windows, the result might be different than the > value used by Erlang, which looks first to the HOMEDRIVE and HOMEPATH > variables. > > The fix makes jinterface use the same logic to locate the cookie file. > > The branch is based on master. > > git fetch git://github.com/vladdu/otp.git jinterface_windows_cookie > > https://github.com/vladdu/otp/compare/jinterface_windows_cookie > https://github.com/vladdu/otp/compare/jinterface_windows_cookie.patch > > Writing a test for this would require running it with different > environment settings and how to do it depends on how you run your tests at > OTP. I would need guidance to implement it. > > The fix has been in the erlide code base for a while and I didn't see any > problems. > > best regards, > Vlad > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Fri Feb 1 11:56:26 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 1 Feb 2013 11:56:26 +0100 Subject: [erlang-patches] jinterface: bug detecting user home directory on windows In-Reply-To: References: Message-ID: <510B9F5A.1050609@erlang.org> On 02/01/2013 11:44 AM, Vlad Dumitrescu wrote: > Hi, > > Jinterface uses System.getProperty("user.home") to locate the user's > home and the cookie file. On Windows, the result might be different > than the value used by Erlang, which looks first to the HOMEDRIVE and > HOMEPATH variables. > > The fix makes jinterface use the same logic to locate the cookie file. > > The branch is based on master. > > git fetch git://github.com/vladdu/otp.git > jinterface_windows_cookie > > https://github.com/vladdu/otp/compare/jinterface_windows_cookie > https://github.com/vladdu/otp/compare/jinterface_windows_cookie.patch > > Writing a test for this would require running it with different > environment settings and how to do it depends on how you run your > tests at OTP. I would need guidance to implement it. > > The fix has been in the erlide code base for a while and I didn't see > any problems. > > best regards, > Vlad > > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Your patch is now cooking in the 'master-pu' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Fri Feb 1 11:58:14 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 1 Feb 2013 11:58:14 +0100 Subject: [erlang-patches] trivial bug in jinterface In-Reply-To: <510B9CA7.7050909@erlang.org> References: <4172679.kZgBQRGhLO@csr-pc40.zib.de> <510B97F9.1020903@erlang.org> <510B9CA7.7050909@erlang.org> Message-ID: Ok, thanks. This syntax is not described in the how-to, and it should probably be, because it's easier to not forget to update the default branch at github I updated the wiki with the following: Additionally include the following two links for viewing the changes:
https://github.com/mygithub/otp/compare/erlang:BASE...my-cool-updates
https://github.com/mygithub/otp/compare/erlang:BASE...my-cool-updates.patch
where BASE should be the base branch, @maint@ or @master@REDACTED /Vlad On Fri, Feb 1, 2013 at 11:44 AM, Fredrik wrote: > On 02/01/2013 11:37 AM, Vlad Dumitrescu wrote: > > Hi, > > It already is on master (but I just had some git issues, so you might > have to refetch). > > /Vlad > > > On Fri, Feb 1, 2013 at 11:24 AM, Fredrik wrote: > >> On 02/01/2013 11:13 AM, Nico Kruber wrote: >> >>> On Friday 01 Feb 2013 09:58:54 Vlad Dumitrescu wrote: >>> >>>> Hi! >>>> >>>> I found a small problem in jinterface. It has been around for a while >>>> now, >>>> it happens in a corner case that probably nobody ever uses. >>>> >>>> In OtpErlangTuple(OtpErlangObject[], int, int), when the size of the >>>> slice >>>> used is 0, then the elems fields remains uninitialized, it is the >>>> parameter >>>> that gets assigned. >>>> >>>> I used master as base, I hope it's still possible to do that. >>>> >>>> git fetch git://github.com/vladdu/otp.git tuple_constructor_bug >>>> >>>> https://github.com/vladdu/otp/compare/tuple_constructor_bug >>>> https://github.com/vladdu/otp/compare/tuple_constructor_bug.patch >>>> >>>> Given that there are no other tests for jinterface at this level, do you >>>> want me to write one for this case? >>>> >>>> best regards, >>>> Vlad >>>> >>> your branch is outdated so the diff is not clean, i.e. contains a lot of >>> other >>> commits >>> -> please rebase your branch >>> see https://github.com/erlang/otp/wiki/Submitting-patches >>> >>> it would probably also be good to base it on maint - but someone from >>> the otp >>> team needs to decide here :) >>> >>> your commit though seems reasonable >>> >>> https://github.com/vladdu/otp/commit/ee29a8aa733fbf1a1666b2f85a9fd6ff19d777b3 >>> >>> >>> Nico >>> _______________________________________________ >>> erlang-patches mailing list >>> erlang-patches@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-patches >>> >> Hello, >> Just rebase it on master will work fine for me. >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/listinfo/erlang-patches >> > > Re-fetched the patch, I don't remember how the how-to is describing on > the comparison-links but you should write it like this instead > https://github.com/vladdu/otp/compare/erlang:master...tuple_constructor_bug > So, > the branch you are based upon should be in the link ('erlang:master...' or > when it is maint 'erlang:maint...'). > This will make a proper link for us to examine. > > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Fri Feb 1 12:05:30 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 1 Feb 2013 12:05:30 +0100 Subject: [erlang-patches] trivial bug in jinterface In-Reply-To: References: <4172679.kZgBQRGhLO@csr-pc40.zib.de> <510B97F9.1020903@erlang.org> <510B9CA7.7050909@erlang.org> Message-ID: <510BA17A.6030700@erlang.org> On 02/01/2013 11:58 AM, Vlad Dumitrescu wrote: > Ok, thanks. This syntax is not described in the how-to, and it should > probably be, because it's easier to not forget to update the default > branch at github > > I updated the wiki with the following: > > Additionally include the following two links for viewing the changes: >
> https://github.com/mygithub/otp/compare/erlang:BASE...my-cool-updates
> https://github.com/mygithub/otp/compare/erlang:BASE...my-cool-updates.patch
> 
> where BASE should be the base branch, @maint@ or @master@REDACTED > > /Vlad > > > > On Fri, Feb 1, 2013 at 11:44 AM, Fredrik > wrote: > > On 02/01/2013 11:37 AM, Vlad Dumitrescu wrote: >> Hi, >> >> It already is on master (but I just had some git issues, so you >> might have to refetch). >> >> /Vlad >> >> >> On Fri, Feb 1, 2013 at 11:24 AM, Fredrik > > wrote: >> >> On 02/01/2013 11:13 AM, Nico Kruber wrote: >> >> On Friday 01 Feb 2013 09:58:54 Vlad Dumitrescu wrote: >> >> Hi! >> >> I found a small problem in jinterface. It has been >> around for a while now, >> it happens in a corner case that probably nobody ever >> uses. >> >> In OtpErlangTuple(OtpErlangObject[], int, int), when >> the size of the slice >> used is 0, then the elems fields remains >> uninitialized, it is the parameter >> that gets assigned. >> >> I used master as base, I hope it's still possible to >> do that. >> >> git fetch git://github.com/vladdu/otp.git >> tuple_constructor_bug >> >> https://github.com/vladdu/otp/compare/tuple_constructor_bug >> https://github.com/vladdu/otp/compare/tuple_constructor_bug.patch >> >> Given that there are no other tests for jinterface at >> this level, do you >> want me to write one for this case? >> >> best regards, >> Vlad >> >> your branch is outdated so the diff is not clean, i.e. >> contains a lot of other >> commits >> -> please rebase your branch >> see https://github.com/erlang/otp/wiki/Submitting-patches >> >> it would probably also be good to base it on maint - but >> someone from the otp >> team needs to decide here :) >> >> your commit though seems reasonable >> https://github.com/vladdu/otp/commit/ee29a8aa733fbf1a1666b2f85a9fd6ff19d777b3 >> >> >> Nico >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/listinfo/erlang-patches >> >> Hello, >> Just rebase it on master will work fine for me. >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/listinfo/erlang-patches >> >> > Re-fetched the patch, I don't remember how the how-to is > describing on the comparison-links but you should write it like > this instead > https://github.com/vladdu/otp/compare/erlang:master...tuple_constructor_bug > So, > the branch you are based upon should be in the link > ('erlang:master...' or when it is maint 'erlang:maint...'). > This will make a proper link for us to examine. > > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > Thanks, looks very understandable. -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Fri Feb 1 22:14:44 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 1 Feb 2013 22:14:44 +0100 Subject: [erlang-patches] add code:get_mode/0 Message-ID: Hi! It looks like this patch went forgotten after the discussions I had with Henrik offline and after I had problems running the test suites. It went well with R16A. A new function code:get_mode() can be used to detect how the code servers behaves, returning 'embedded' or 'interactive'. Rationale: Some applications (like erlide) have code to be loaded dynamically on a node. It may be slow to load everything upfront every time, so if the node is in interactive mode, we would like to just append to the load path. Currently, there is no direct way to detect if the node is running in embedded mode or not so that we can do the right thing. git fetch git://github.com/vladdu/otp.git code_get_mode https://github.com/vladdu/otp/compare/erlang:master...code_get_mode https://github.com/vladdu/otp/compare/erlang:master...code_get_mode.patch Github shows a whitespace diff, but in my editor the whitespace is exactly like on the line above. Maybe git does soemthing to it? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Sun Feb 3 03:28:47 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sun, 3 Feb 2013 03:28:47 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: References: Message-ID: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> I may have a fix for this: git fetch https://github.com/nox/otp.git fix-seq-opt https://github.com/nox/otp/compare/erlang:master...fix-seq-opt https://github.com/nox/otp/compare/erlang:master...fix-seq-opt.patch Your bug seems to come from the Core Erlang to Kernel Erlang pass not coping with multiple values into sequences' arguments, that is expressions which values aren't used. My branch adds a new check to core_lint to detect that kind of invalid code and fixes sys_core_fold so that it doesn't generate it anymore when optimizing away unused values. To check that this is indeed sys_core_fold's optimizations that makes the compilation fail, do: erlc +no_copt sample.erl To enable the Core Erlang linting pass, do: erlc +clint sample.erl Regards, -- Anthony Ramine Le 2 f?vr. 2013 ? 21:42, Jos? Valim a ?crit : > Hello everyone, > > The following module fails to compile using both R15B03-01 and R16A: > > -module(sample). > -export([hello/1]). > > hello(X) -> > case do_something(X) of > false -> > A = false; > Res -> > { A, B } = Res, > do_something(A), > do_something(B) > end, > ThisShouldNotFail = A, > ok. > > do_something(X) -> > external:do_something(X). > > With the following exception: > > crash reason: {function_clause, > [{v3_kernel,lit_vars, > [{ivalues, > [11,{file,"sample.erl"}], > [{k_var,[],ker4},{k_atom,[],ok}]}], > [{file,"v3_kernel.erl"},{line,1749}]}, > {v3_kernel,uexpr,3,[{file,"v3_kernel.erl"},{line,1628}]}, > {v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1408}]}, > {v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1409}]}, > {v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1716}]}, > {v3_kernel,'-umatch_list/3-anonymous-0-',3, > [{file,"v3_kernel.erl"},{line,1735}]}, > {v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1711}]}, > {v3_kernel,'-umatch_list/3-anonymous-0-',3, > [{file,"v3_kernel.erl"},{line,1735}]}]} > > The code and exceptions are also available here: https://gist.github.com/7bd4eea30cd187e68caa > > Removing the `ThisShouldNotFail` assignment makes it work correctly, although I wouldn't expect it to explode with that line and just output a couple warnings instead. > > This snippet was extract from a more complex code. The name of the functions, module and variables do not seem to affect the failure. > > I tried to further debug the issue but I could not pinpoint the failure. Let me know if I can help any further. > > Thank you for your time, > > > Jos? Valim > www.plataformatec.com.br > Founder and Lead Developer > > > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs From bgustavsson@REDACTED Sun Feb 3 10:58:09 2013 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Sun, 3 Feb 2013 10:58:09 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> References: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> Message-ID: Yes, your fix seems to be correct. Do you think you could write a test case and provide some details in the commit message? (Personally I would put everything into one commit.) I suggest that you end your commit message with: Reported-by: Jos? Valim On Sun, Feb 3, 2013 at 3:28 AM, Anthony Ramine wrote: > I may have a fix for this: > > git fetch https://github.com/nox/otp.git fix-seq-opt > > https://github.com/nox/otp/compare/erlang:master...fix-seq-opt > > https://github.com/nox/otp/compare/erlang:master...fix-seq-opt.patch > > Your bug seems to come from the Core Erlang to Kernel Erlang pass not > coping with > multiple values into sequences' arguments, that is expressions which > values aren't > used. > > My branch adds a new check to core_lint to detect that kind of invalid > code and > fixes sys_core_fold so that it doesn't generate it anymore when optimizing > away > unused values. > > To check that this is indeed sys_core_fold's optimizations that makes the > compilation fail, do: > > erlc +no_copt sample.erl > > To enable the Core Erlang linting pass, do: > > erlc +clint sample.erl > > Regards, > > -- > Anthony Ramine > > Le 2 f?vr. 2013 ? 21:42, Jos? Valim a ?crit : > > > Hello everyone, > > > > The following module fails to compile using both R15B03-01 and R16A: > > > > -module(sample). > > -export([hello/1]). > > > > hello(X) -> > > case do_something(X) of > > false -> > > A = false; > > Res -> > > { A, B } = Res, > > do_something(A), > > do_something(B) > > end, > > ThisShouldNotFail = A, > > ok. > > > > do_something(X) -> > > external:do_something(X). > > > > With the following exception: > > > > crash reason: {function_clause, > > [{v3_kernel,lit_vars, > > [{ivalues, > > [11,{file,"sample.erl"}], > > [{k_var,[],ker4},{k_atom,[],ok}]}], > > [{file,"v3_kernel.erl"},{line,1749}]}, > > > {v3_kernel,uexpr,3,[{file,"v3_kernel.erl"},{line,1628}]}, > > > {v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1408}]}, > > > {v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1409}]}, > > > {v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1716}]}, > > {v3_kernel,'-umatch_list/3-anonymous-0-',3, > > [{file,"v3_kernel.erl"},{line,1735}]}, > > > {v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1711}]}, > > {v3_kernel,'-umatch_list/3-anonymous-0-',3, > > [{file,"v3_kernel.erl"},{line,1735}]}]} > > > > The code and exceptions are also available here: > https://gist.github.com/7bd4eea30cd187e68caa > > > > Removing the `ThisShouldNotFail` assignment makes it work correctly, > although I wouldn't expect it to explode with that line and just output a > couple warnings instead. > > > > This snippet was extract from a more complex code. The name of the > functions, module and variables do not seem to affect the failure. > > > > I tried to further debug the issue but I could not pinpoint the failure. > Let me know if I can help any further. > > > > Thank you for your time, > > > > > > Jos? Valim > > www.plataformatec.com.br > > Founder and Lead Developer > > > > > > _______________________________________________ > > erlang-bugs mailing list > > erlang-bugs@REDACTED > > http://erlang.org/mailman/listinfo/erlang-bugs > > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Sun Feb 3 12:32:15 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sun, 3 Feb 2013 12:32:15 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: References: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> Message-ID: Hi, I've added some details and squashed the two commits together, please refetch. In which suite should I put such a test case? Regards, -- Anthony Ramine Le 3 f?vr. 2013 ? 10:58, Bj?rn Gustavsson a ?crit : > Yes, your fix seems to be correct. > > Do you think you could write a test case and > provide some details in the commit message? > (Personally I would put everything into one > commit.) > > I suggest that you end your commit message > with: > > Reported-by: Jos? Valim > > > > On Sun, Feb 3, 2013 at 3:28 AM, Anthony Ramine wrote: > I may have a fix for this: > > git fetch https://github.com/nox/otp.git fix-seq-opt > > https://github.com/nox/otp/compare/erlang:master...fix-seq-opt > https://github.com/nox/otp/compare/erlang:master...fix-seq-opt.patch > > Your bug seems to come from the Core Erlang to Kernel Erlang pass not coping with > multiple values into sequences' arguments, that is expressions which values aren't > used. > > My branch adds a new check to core_lint to detect that kind of invalid code and > fixes sys_core_fold so that it doesn't generate it anymore when optimizing away > unused values. > > To check that this is indeed sys_core_fold's optimizations that makes the > compilation fail, do: > > erlc +no_copt sample.erl > > To enable the Core Erlang linting pass, do: > > erlc +clint sample.erl > > Regards, > > -- > Anthony Ramine > > Le 2 f?vr. 2013 ? 21:42, Jos? Valim a ?crit : > > > Hello everyone, > > > > The following module fails to compile using both R15B03-01 and R16A: > > > > -module(sample). > > -export([hello/1]). > > > > hello(X) -> > > case do_something(X) of > > false -> > > A = false; > > Res -> > > { A, B } = Res, > > do_something(A), > > do_something(B) > > end, > > ThisShouldNotFail = A, > > ok. > > > > do_something(X) -> > > external:do_something(X). > > > > With the following exception: > > > > crash reason: {function_clause, > > [{v3_kernel,lit_vars, > > [{ivalues, > > [11,{file,"sample.erl"}], > > [{k_var,[],ker4},{k_atom,[],ok}]}], > > [{file,"v3_kernel.erl"},{line,1749}]}, > > {v3_kernel,uexpr,3,[{file,"v3_kernel.erl"},{line,1628}]}, > > {v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1408}]}, > > {v3_kernel,ubody,3,[{file,"v3_kernel.erl"},{line,1409}]}, > > {v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1716}]}, > > {v3_kernel,'-umatch_list/3-anonymous-0-',3, > > [{file,"v3_kernel.erl"},{line,1735}]}, > > {v3_kernel,umatch,3,[{file,"v3_kernel.erl"},{line,1711}]}, > > {v3_kernel,'-umatch_list/3-anonymous-0-',3, > > [{file,"v3_kernel.erl"},{line,1735}]}]} > > > > The code and exceptions are also available here: https://gist.github.com/7bd4eea30cd187e68caa > > > > Removing the `ThisShouldNotFail` assignment makes it work correctly, although I wouldn't expect it to explode with that line and just output a couple warnings instead. > > > > This snippet was extract from a more complex code. The name of the functions, module and variables do not seem to affect the failure. > > > > I tried to further debug the issue but I could not pinpoint the failure. Let me know if I can help any further. > > > > Thank you for your time, > > > > > > Jos? Valim > > www.plataformatec.com.br > > Founder and Lead Developer > > > > > > _______________________________________________ > > erlang-bugs mailing list > > erlang-bugs@REDACTED > > http://erlang.org/mailman/listinfo/erlang-bugs > > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs > > > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Mon Feb 4 07:17:45 2013 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 4 Feb 2013 07:17:45 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: References: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> Message-ID: On Sun, Feb 3, 2013 at 12:32 PM, Anthony Ramine wrote: > Hi, > > I've added some details and squashed the two commits together, > please refetch. > > In which suite should I put such a test case? > > I suggest core_fold_SUITE. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Mon Feb 4 08:25:22 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 4 Feb 2013 08:25:22 +0100 Subject: [erlang-patches] add code:get_mode/0 In-Reply-To: References: Message-ID: <510F6262.5050606@erlang.org> On 02/01/2013 10:14 PM, Vlad Dumitrescu wrote: > git fetch git://github.com/vladdu/otp.git > code_get_mode Hello, The only information I got was that we needed testcase and documentation. Which is included in this patch. It is now cooking in the master-pu branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Mon Feb 4 12:16:15 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 4 Feb 2013 12:16:15 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: References: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> Message-ID: <02DCDA11-8D9B-44BC-895C-7F8F6855A3CD@gmail.com> I added a commit with two test cases, please refetch. -- Anthony Ramine Le 4 f?vr. 2013 ? 07:17, Bj?rn Gustavsson a ?crit : > > On Sun, Feb 3, 2013 at 12:32 PM, Anthony Ramine wrote: > Hi, > > I've added some details and squashed the two commits together, > please refetch. > > In which suite should I put such a test case? > > > I suggest core_fold_SUITE. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Mon Feb 4 14:43:08 2013 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 4 Feb 2013 14:43:08 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: <02DCDA11-8D9B-44BC-895C-7F8F6855A3CD@gmail.com> References: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> <02DCDA11-8D9B-44BC-895C-7F8F6855A3CD@gmail.com> Message-ID: Thanks for test suite. There are a few issues, though. First, the new test cases are not correctly listed in the lists in the groups/0 function, so they will not actually be run. Second, being very paranoid when writing test cases, I would make sure that the compiled code atually works (in this case, that the function with side effects is actually called). Here is my suggestion how it can be done. If you are fine with my changes, we can simply squash my commit into yours. https://github.com/bjorng/otp/commit/4e21e16ebc1c012ac52b89ba1b38d6f98cfbac2c Note that since there is no good reason for keeping the test case case in a separate file, I have put all code for unused_multiple_values into core_fold_SUITE itself. On Mon, Feb 4, 2013 at 12:16 PM, Anthony Ramine wrote: > I added a commit with two test cases, please refetch. > > -- > Anthony Ramine > > Le 4 f?vr. 2013 ? 07:17, Bj?rn Gustavsson a ?crit : > > > > > On Sun, Feb 3, 2013 at 12:32 PM, Anthony Ramine > wrote: > > Hi, > > > > I've added some details and squashed the two commits together, > > please refetch. > > > > In which suite should I put such a test case? > > > > > > I suggest core_fold_SUITE. > > > > -- > > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Mon Feb 4 15:46:23 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 4 Feb 2013 15:46:23 +0100 Subject: [erlang-patches] Return end locations in erl_scan In-Reply-To: <50F02757.4070304@erlang.org> References: <50F02757.4070304@erlang.org> Message-ID: <12C66F49-EF58-4CB3-B4AE-85071C7D9EA1@gmail.com> As there been an answer? Will this be in R16B? -- Anthony Ramine Le 11 janv. 2013 ? 15:53, Fredrik a ?crit : > Hello Anthony, > I don't see a reply on this patch, but it is in our systems and currently being reviewed. > You will get an answer when I know more about it. > > BR Fredrik Gustafsson > Erlang OTP Team > On 11/10/2012 04:28 PM, Anthony Ramine wrote: >> Hi, >> >> This branch adds a new option "end" to erl_scan. If set, it tracks and >> returns end locations of each scanned token in their attributes as >> `{'end', {EndLine, EndCol}}`. >> >> https://github.com/nox/otp/compare/scan-end-locations >> https://github.com/nox/otp/compare/scan-end-locations.patch >> >> git fetch https://github.com/nox/otp scan-end-locations >> >> Regards, >> > From n.oxyde@REDACTED Mon Feb 4 15:50:10 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 4 Feb 2013 15:50:10 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: References: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> <02DCDA11-8D9B-44BC-895C-7F8F6855A3CD@gmail.com> Message-ID: <98AB97FB-CA23-45D7-BDBD-7C7C065A9B31@gmail.com> I squashed your commit with mine; please refetch. -- Anthony Ramine Le 4 f?vr. 2013 ? 14:43, Bj?rn Gustavsson a ?crit : > Thanks for test suite. > > There are a few issues, though. > > First, the new test cases are not correctly listed > in the lists in the groups/0 function, so they will > not actually be run. > > Second, being very paranoid when writing test > cases, I would make sure that the compiled > code atually works (in this case, that the function > with side effects is actually called). > > Here is my suggestion how it can be done. If > you are fine with my changes, we can simply > squash my commit into yours. > > https://github.com/bjorng/otp/commit/4e21e16ebc1c012ac52b89ba1b38d6f98cfbac2c > > Note that since there is no good reason for > keeping the test case case in a separate file, > I have put all code for unused_multiple_values > into core_fold_SUITE itself. > > > > On Mon, Feb 4, 2013 at 12:16 PM, Anthony Ramine wrote: > I added a commit with two test cases, please refetch. > > -- > Anthony Ramine > > Le 4 f?vr. 2013 ? 07:17, Bj?rn Gustavsson a ?crit : > > > > > On Sun, Feb 3, 2013 at 12:32 PM, Anthony Ramine wrote: > > Hi, > > > > I've added some details and squashed the two commits together, > > please refetch. > > > > In which suite should I put such a test case? > > > > > > I suggest core_fold_SUITE. > > > > -- > > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > > > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From fredrik@REDACTED Mon Feb 4 16:59:00 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 4 Feb 2013 16:59:00 +0100 Subject: [erlang-patches] Return end locations in erl_scan In-Reply-To: <12C66F49-EF58-4CB3-B4AE-85071C7D9EA1@gmail.com> References: <50F02757.4070304@erlang.org> <12C66F49-EF58-4CB3-B4AE-85071C7D9EA1@gmail.com> Message-ID: <510FDAC4.5030505@erlang.org> On 02/04/2013 03:46 PM, Anthony Ramine wrote: > As there been an answer? Will this be in R16B? > Bumped it, Will give you notice when I know more. -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 4 16:59:47 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 4 Feb 2013 16:59:47 +0100 Subject: [erlang-patches] [erlang-bugs] Unused variable causing v3_kernel crash In-Reply-To: <98AB97FB-CA23-45D7-BDBD-7C7C065A9B31@gmail.com> References: <91A4A766-3342-4736-990C-1A2E3B7F448E@gmail.com> <02DCDA11-8D9B-44BC-895C-7F8F6855A3CD@gmail.com> <98AB97FB-CA23-45D7-BDBD-7C7C065A9B31@gmail.com> Message-ID: <510FDAF3.1070401@erlang.org> On 02/04/2013 03:50 PM, Anthony Ramine wrote: > I squashed your commit with mine; please refetch. > Re-fetched. Thanks! -- BR Fredrik Gustafsson Erlang OTP Team From n.oxyde@REDACTED Tue Feb 5 13:51:00 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Tue, 5 Feb 2013 13:51:00 +0100 Subject: [erlang-patches] EEP37: Funs with names In-Reply-To: <466D4B3A-8B3C-4AA7-9A2B-B85EA5EA2A90@gmail.com> References: <50A4FAA9.1070706@erlang.org> <466D4B3A-8B3C-4AA7-9A2B-B85EA5EA2A90@gmail.com> Message-ID: <819C7547-3B43-4F8E-A4E0-91B77C547600@gmail.com> Hi, Rebased against latest master?which I gather is now for R17. Please refetch. Regards, -- Anthony Ramine Le 21 nov. 2012 ? 15:36, Anthony Ramine a ?crit : > Hi, > > I had forgotten to update the abstract format documentation, named_fun is > now mentioned in absform.xml in the doc commit. > > Please refetch, > > -- > Anthony Ramine > > Le 15 nov. 2012 ? 15:22, Henrik Nord a ?crit : > >> I will add this patch to 'master-pu'. >> >> Thank you for your contribution! >> >> >> On 2012-11-14 17:42, Anthony Ramine wrote: >>> This patch implements EEP37: Funs with names >>> >>> This adds optional names to fun expressions. A named fun expression >>> is parsed as a tuple `{named_fun,Loc,Name,Clauses}` in erl_parse. >>> >>> If a fun expression has a name, it must be present and be the same in >>> every of its clauses. The function name shadows the environment of the >>> expression shadowing the environment and it is shadowed by the >>> environment of the clauses' arguments. An unused function name triggers >>> a warning unless it is prefixed by _, just as every variable. >>> Variable _ is allowed as a function name. >>> >>> It is not an error to put a named function in a record field default >>> value. >>> >>> When transforming to Core Erlang, the named fun Fun is changed into >>> the following expression: >>> >>> letrec 'Fun'/Arity = >>> fun (Args) -> >>> let = 'Fun'/Arity >>> in Case >>> in 'Fun'/Arity >>> >>> where Args is the list of arguments of 'Fun'/Arity and Case the >>> Core Erlang expression corresponding to the clauses of Fun. >>> >>> This transformation allows us to entirely skip any k_var to k_local >>> transformation in the fun's clauses bodies. >>> >>> https://github.com/nox/otp/compare/erlang:master...eep37 >>> https://github.com/nox/otp/compare/erlang:master...eep37.patch >>> >>> git fetch https://github.com/nox/otp eep37 >>> >>> Regards, >>> >> >> -- >> /Henrik Nord Erlang/OTP >> > From BWhittle@REDACTED Wed Feb 6 04:27:50 2013 From: BWhittle@REDACTED (Blaine Whittle) Date: Wed, 6 Feb 2013 03:27:50 +0000 Subject: [erlang-patches] Win64 memory corruption fix Message-ID: git fetch git://github.com/bwhittle/otp.git win-64-pointer-fix https://github.com/bwhittle/otp/commit/1d21ce8d0287a0a50b2e42631d361f43ce14e23e This patch should fix a number of memory corruption issues and / or crashes on Win64 that can potential occur when the Erlang VM exceeds 4 GB of ram. The problem stems from casting pointers to unsigned long and assuming long is type that is always large enough to hold a pointer. This assumption holds up for all platforms except windows. Nix 32 (unsigned long) -> 32 bit (pointer size = unsigned long) Nix 64 (unsigned long) -> 64 bit (pointer size = unsigned long) Win 32 (unsigned long) -> 32 bit (pointer size = unsigned long) Win 64 (unsigned long) -> 32 bit (pointer size != unsigned long) To compound the problem these casts can appear to be fine on Win64 as only those pointers that reference memory above the 32 bit address space will lead to issues. Which means you need Erlang to allocate ~ 4 GB of memory before you even have a chance or running into problems. The issue is if you have a pointer that reference memory above the 32 bit address space on Win64 and then type cast it to a long (i.e. 32 bits) and then turn around and use that type cast value as a pointer then you'll be referencing a different memory location. Most of the time the incorrect pointer will still reference a valid location as memory is allocated bottom up which can lead to memory corruption. This patch has been tested heavily and has been used on production systems. I made the changes a year ago when the Win64 Erlang VM was released (just didn't mean to wait so long to submit it.) The patch submission page recommends that I create new test cases which I have not done. However I have a small registry change that should be applied on any systems that execute Erlang Win64 smoke and / or unit tests. The registry change instructs Windows to allocate memory from top down, meaning that any valid memory pointers will require a 64 bit value and any attempt to cast them to a 32 bit value followed by a dereference will produce an access violation. http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473(v=vs.85).aspx To apply the registry setting just copy and paste the following section and place it into a .reg file and import it on each test machines followed by a reboot. ============================================================= Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] "AllocationPreference"=dword:00100000. ============================================================= With this registry change Erlang's existing unit tests should be able to catch any incorrect pointer casts by causing the VM to crash. Every pointer will reference memory above the 32 value so type casting it to a 32 bit value and then dereferencing causes an access violation. One potential issue with using this registry setting is that if your test machines rely on 3rd party Win64 apps it's possible they may crash on startup (that is if they contain similar type casting bugs.) -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Wed Feb 6 10:51:12 2013 From: fredrik@REDACTED (Fredrik) Date: Wed, 6 Feb 2013 10:51:12 +0100 Subject: [erlang-patches] Win64 memory corruption fix In-Reply-To: References: Message-ID: <51122790.1030305@erlang.org> Hello, I will put it in the 'master-pu' branch for building and testing! BR Fredrik Gustafsson (Terran player) Erlang OTP Team On 02/06/2013 04:27 AM, Blaine Whittle wrote: > > git fetch git://github.com/bwhittle/otp.git win-64-pointer-fix > > https://github.com/bwhittle/otp/commit/1d21ce8d0287a0a50b2e42631d361f43ce14e23e > > This patch should fix a number of memory corruption issues and / or > crashes on Win64 that can potential occur when the Erlang VM exceeds 4 > GB of ram. The problem stems from casting pointers to unsigned long > and assuming long is type that is always large enough to hold a > pointer. This assumption holds up for all platforms except windows. > > Nix 32 (unsigned long) -> 32 bit (pointer size = > unsigned long) > > Nix 64 (unsigned long) -> 64 bit (pointer size = > unsigned long) > > Win 32 (unsigned long) -> 32 bit (pointer size = > unsigned long) > > Win 64 (unsigned long) -> 32 bit (pointer size != > unsigned long) > > To compound the problem these casts can appear to be fine on Win64 as > only those pointers that reference memory above the 32 bit address > space will lead to issues. Which means you need Erlang to allocate > ~ 4 GB of memory before you even have a chance or running into > problems. The issue is if you have a pointer that reference memory > above the 32 bit address space on Win64 and then type cast it to a > long (i.e. 32 bits) and then turn around and use that type cast value > as a pointer then you'll be referencing a different memory location. > Most of the time the incorrect pointer will still reference a valid > location as memory is allocated bottom up which can lead to memory > corruption. > > This patch has been tested heavily and has been used on production > systems. I made the changes a year ago when the Win64 Erlang VM was > released (just didn't mean to wait so long to submit it.) > > The patch submission page recommends that I create new test cases > which I have not done. However I have a small registry change that > should be applied on any systems that execute Erlang Win64 smoke and / > or unit tests. > > The registry change instructs Windows to allocate memory from top > down, meaning that any valid memory pointers will require a 64 bit > value and any attempt to cast them to a 32 bit value followed by a > dereference will produce an access violation. > > http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473(v=vs.85).aspx > > To apply the registry setting just copy and paste the following > section and place it into a .reg file and import it on each > test machines followed by a reboot. > > ============================================================= > > Windows Registry Editor Version 5.00 > > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session > Manager\Memory Management] > > "AllocationPreference"=dword:00100000. > > ============================================================= > > With this registry change Erlang's existing unit tests should be able > to catch any incorrect pointer casts by causing the VM to crash. > Every pointer will reference memory above the 32 value so type casting > it to a 32 bit value and then dereferencing causes an access violation. > > One potential issue with using this registry setting is that if your > test machines rely on 3rd party Win64 apps it's possible they may > crash on startup (that is if they contain similar type casting bugs.) > > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Wed Feb 6 23:39:47 2013 From: sean@REDACTED (Sean Cribbs) Date: Wed, 6 Feb 2013 16:39:47 -0600 Subject: [erlang-patches] Fix type of error Reason on gen_tcp:send/2 Message-ID: When the TCP socket is in passive mode, it is possible that a close message has not been delivered to the controlling process before calling send/2. This results in the returning {error, closed} to the caller, in the same way that recv/2,3 does. This patch adjusts the type of the error "Reason" to include the atom 'closed'. As this is more of a documentation concern, I have based the patch off 'maint'. git fetch git://github.com/seancribbs/otp.git gen_tcp_send_error_closed https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed.patch -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ From sverker.eriksson@REDACTED Thu Feb 7 15:41:22 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Thu, 7 Feb 2013 15:41:22 +0100 Subject: [erlang-patches] Win64 memory corruption fix In-Reply-To: <51122790.1030305@erlang.org> References: <51122790.1030305@erlang.org> Message-ID: <5113BD12.2010308@erix.ericsson.se> We have to reject this patch in its current state. Type Uint is not same size as a pointer on halfword emulator. You should have used type UWord instead for a pointer-sized integer. And to printf pointer variables I think we should use %p and pass the pointers without the need of any integer type casts. /Sverker, Erlang/OTP Fredrik wrote: > Hello, > I will put it in the 'master-pu' branch for building and testing! > > BR Fredrik Gustafsson (Terran player) > Erlang OTP Team > On 02/06/2013 04:27 AM, Blaine Whittle wrote: >> >> git fetch git://github.com/bwhittle/otp.git win-64-pointer-fix >> >> https://github.com/bwhittle/otp/commit/1d21ce8d0287a0a50b2e42631d361f43ce14e23e >> >> >> This patch should fix a number of memory corruption issues and / or >> crashes on Win64 that can potential occur when the Erlang VM exceeds >> 4 GB of ram. The problem stems from casting pointers to unsigned >> long and assuming long is type that is always large enough to hold a >> pointer. This assumption holds up for all platforms except windows. >> >> Nix 32 (unsigned long) -> 32 bit (pointer size = >> unsigned long) >> >> Nix 64 (unsigned long) -> 64 bit (pointer size = >> unsigned long) >> >> Win 32 (unsigned long) -> 32 bit (pointer size = >> unsigned long) >> >> Win 64 (unsigned long) -> 32 bit (pointer size != >> unsigned long) >> >> To compound the problem these casts can appear to be fine on Win64 as >> only those pointers that reference memory above the 32 bit address >> space will lead to issues. Which means you need Erlang to allocate >> ~ 4 GB of memory before you even have a chance or running into >> problems. The issue is if you have a pointer that reference >> memory above the 32 bit address space on Win64 and then type cast it >> to a long (i.e. 32 bits) and then turn around and use that type cast >> value as a pointer then you'll be referencing a different memory >> location. Most of the time the incorrect pointer will still >> reference a valid location as memory is allocated bottom up which can >> lead to memory corruption. >> >> This patch has been tested heavily and has been used on production >> systems. I made the changes a year ago when the Win64 Erlang VM was >> released (just didn't mean to wait so long to submit it.) >> >> The patch submission page recommends that I create new test cases >> which I have not done. However I have a small registry change that >> should be applied on any systems that execute Erlang Win64 smoke and >> / or unit tests. >> >> The registry change instructs Windows to allocate memory from top >> down, meaning that any valid memory pointers will require a 64 bit >> value and any attempt to cast them to a 32 bit value followed by a >> dereference will produce an access violation. >> >> http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473(v=vs.85).aspx >> >> >> To apply the registry setting just copy and paste the following >> section and place it into a .reg file and import it on >> each test machines followed by a reboot. >> >> ============================================================= >> >> Windows Registry Editor Version 5.00 >> >> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session >> Manager\Memory Management] >> >> "AllocationPreference"=dword:00100000. >> >> ============================================================= >> >> With this registry change Erlang's existing unit tests should be able >> to catch any incorrect pointer casts by causing the VM to crash. >> Every pointer will reference memory above the 32 value so type >> casting it to a 32 bit value and then dereferencing causes an access >> violation. >> >> One potential issue with using this registry setting is that if your >> test machines rely on 3rd party Win64 apps it's possible they may >> crash on startup (that is if they contain similar type casting bugs.) >> >> >> >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/listinfo/erlang-patches > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > From paul.joseph.davis@REDACTED Fri Feb 8 00:58:49 2013 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Thu, 7 Feb 2013 17:58:49 -0600 Subject: [erlang-patches] [PATCH] - Add NIF function enif_phash2 Message-ID: git fetch git://github.com/davisp/otp.git enif_phash2 https://github.com/davisp/otp/compare/maint...enif_phash2 https://github.com/davisp/otp/compare/maint...enif_phash2.patch This patch exposes the phash2 function to NIFs. It is exactly equivalent to: erlang:phash2(Term, 16#100000000) Thanks, Paul Davis From fredrik@REDACTED Fri Feb 8 09:31:01 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 8 Feb 2013 09:31:01 +0100 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <20121106144100.GA30360@ioctl> References: <20120807231358.GA30451@ioctl> <20121103144956.GF29060@ioctl> <50991C42.9040302@erlang.org> <20121106144100.GA30360@ioctl> Message-ID: <5114B7C5.5070109@erlang.org> Could you rebase this patch upon the current 'master' branch? Thanks, On 11/06/2012 03:41 PM, Michael Santos wrote: > On Tue, Nov 06, 2012 at 03:18:42PM +0100, Henrik Nord wrote: >> Does not compile under windows, >> >> >> epmd_cli.c(145) : error C2037: left of 'sin6_family' specifies undefined struct/union 'sockaddr_in6' >> epmd_cli.c(145) : error C2037: left of 'sin6_addr' specifies undefined struct/union 'sockaddr_in6' >> epmd_cli.c(145) : error C2065: 'in6addr_loopback' : undeclared identifier >> epmd_cli.c(145) : error C2037: left of 'sin6_port' specifies undefined struct/union 'sockaddr_in6' >> epmd_cli.c(146) : error C2027: use of undefined type 'sockaddr_in6' >> epmd_cli.c(146) : see declaration of 'sockaddr_in6' > Seems Windows defines sockaddr_in6 in ws2tcpip.h. Something like this > should get the compile working a bit further: > > diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h > index 14d05c3..ae7cbcb 100644 > --- a/erts/epmd/src/epmd_int.h > +++ b/erts/epmd/src/epmd_int.h > @@ -49,6 +49,7 @@ > # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H > # include > # endif > +# include > # include > # include > #endif > > I'll regenerate the patch. Sorry for the problem! No windows systems to > test with here. > >> On 11/03/2012 03:49 PM, Michael Santos wrote: >>> On Tue, Aug 07, 2012 at 07:13:58PM -0400, Michael Santos wrote: >>>> Allow IPv6 nodes to register with and query epmd. On systems with >>>> IPv6 support: >>>> >>>> * epmd listens on the IPv4 and IPv6 ANY or loopback sockets >>>> >>>> * the epmd cli client connects to epmd using the IPv6 loopback >>>> >>>> * distributed nodes started with "-proto_dist inet6_tcp" will register >>>> with epmd over IPv6 >>> ping! (or should that be ICMP6_ECHO_REQUEST ...) >>> >>>> --- >>>> erts/doc/src/epmd.xml | 2 +- >>>> erts/doc/src/erl.xml | 22 +++++ >>>> erts/epmd/src/epmd.c | 6 +- >>>> erts/epmd/src/epmd_cli.c | 11 ++- >>>> erts/epmd/src/epmd_int.h | 37 ++++---- >>>> erts/epmd/src/epmd_srv.c | 184 +++++++++++++++++++++++++------------ >>>> erts/epmd/test/epmd_SUITE.erl | 33 ++++++- >>>> lib/kernel/src/erl_epmd.erl | 18 ++-- >>>> lib/kernel/src/inet6_tcp_dist.erl | 2 +- >>>> 9 files changed, 222 insertions(+), 93 deletions(-) >>> _______________________________________________ >>> erlang-patches mailing list >>> erlang-patches@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-patches >> -- >> /Henrik Nord Erlang/OTP >> > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Fri Feb 8 09:34:02 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 8 Feb 2013 09:34:02 +0100 Subject: [erlang-patches] [PATCH] - Add NIF function enif_phash2 In-Reply-To: References: Message-ID: <5114B87A.1070709@erlang.org> On 02/08/2013 12:58 AM, Paul Davis wrote: > git fetch git://github.com/davisp/otp.git enif_phash2 > > https://github.com/davisp/otp/compare/maint...enif_phash2 > https://github.com/davisp/otp/compare/maint...enif_phash2.patch > > This patch exposes the phash2 function to NIFs. It is exactly equivalent to: > > erlang:phash2(Term, 16#100000000) > > Thanks, > Paul Davis > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Please rebase this patch upon the current 'master' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team From n.oxyde@REDACTED Fri Feb 8 12:47:34 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Fri, 8 Feb 2013 12:47:34 +0100 Subject: [erlang-patches] [erlang-bugs] Minor annoyance after 'make clean' In-Reply-To: <5114E1C0.10901@cs.ntua.gr> References: <5114E1C0.10901@cs.ntua.gr> Message-ID: Hi, It can, and here is a fix. git fetch https://github.com/nox/otp.git fix-ssh-html-doc https://github.com/nox/otp/compare/erlang:master...fix-ssh-html-doc https://github.com/nox/otp/compare/erlang:master...fix-ssh-html-doc.patch Regards, -- Anthony Ramine Le 8 f?vr. 2013 ? 12:30, Kostis Sagonas a ?crit : > Every time I issue a 'make clean' the file > > lib/ssh/doc/html/SSH_protocols.png > > which apparently is part of the code base of the master branch, gets deleted. Is this intentional? > > The problem is that after the 'make clean', a subsequent 'git status' command shows the following: > > # On branch master > # Changed but not updated: > # (use "git add/rm ..." to update what will be committed) > # (use "git checkout -- ..." to discard changes in working directory) > # > # deleted: lib/ssh/doc/html/SSH_protocols.png > # > > > Can this be fixed? > > Kostis > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs From sverker.eriksson@REDACTED Fri Feb 8 14:39:06 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Fri, 8 Feb 2013 14:39:06 +0100 Subject: [erlang-patches] [PATCH] - Add NIF function enif_phash2 In-Reply-To: <5114B87A.1070709@erlang.org> References: <5114B87A.1070709@erlang.org> Message-ID: <5114FFFA.9090700@erix.ericsson.se> Fredrik wrote: > On 02/08/2013 12:58 AM, Paul Davis wrote: >> git fetch git://github.com/davisp/otp.git enif_phash2 >> >> https://github.com/davisp/otp/compare/maint...enif_phash2 >> https://github.com/davisp/otp/compare/maint...enif_phash2.patch >> >> This patch exposes the phash2 function to NIFs. It is exactly >> equivalent to: >> >> erlang:phash2(Term, 16#100000000) >> >> Thanks, >> Paul Davis >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/listinfo/erlang-patches > Please rebase this patch upon the current 'master' branch. > Thanks, > Also read the comments in erl_nif_api_funcs.h of how to add new functions. You do not have to increase ERL_NIF_MINOR_VERSION as I've already done that for R16B. I guess you have a real use case for enif_phash2 and why erlang:phash2 is not enough. /Sverker From paul.joseph.davis@REDACTED Fri Feb 8 21:19:38 2013 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Fri, 8 Feb 2013 14:19:38 -0600 Subject: [erlang-patches] [PATCH] - Add NIF function enif_phash2 In-Reply-To: <5114FFFA.9090700@erix.ericsson.se> References: <5114B87A.1070709@erlang.org> <5114FFFA.9090700@erix.ericsson.se> Message-ID: Fredrik, Rebased against master: git fetch git://github.com/davisp/otp.git enif_phash2 https://github.com/davisp/otp/compare/master...enif_phash2 https://github.com/davisp/otp/compare/master...enif_phash2.patch Sverker, I've updated the function ordering as per the comment in erl_nif_api_funcs.h. For use case, I'm implementing a couple data structures that use hash tables to speed up some hot loops. I can get away for awhile using erlang:phash2/2 in Erlang and passing that value into the NIF but this breaks down when I don't know a priori which terms (or subterms) I may need to hash in the NIF. A similar example would be trying to reimplement ets without this. Either I'd have to store enough information in the Erlang term representing the table to be able to know which elements of the tuple to hash or I'd have to ask the table what to hash before passing the term off to the NIF. There are definitely work arounds to not having access to phash2 but they aren't pretty. Thanks, Paul Davis On Fri, Feb 8, 2013 at 7:39 AM, Sverker Eriksson wrote: > Fredrik wrote: >> >> On 02/08/2013 12:58 AM, Paul Davis wrote: >>> >>> git fetch git://github.com/davisp/otp.git enif_phash2 >>> >>> https://github.com/davisp/otp/compare/maint...enif_phash2 >>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch >>> >>> This patch exposes the phash2 function to NIFs. It is exactly equivalent >>> to: >>> >>> erlang:phash2(Term, 16#100000000) >>> >>> Thanks, >>> Paul Davis >>> _______________________________________________ >>> erlang-patches mailing list >>> erlang-patches@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-patches >> >> Please rebase this patch upon the current 'master' branch. >> Thanks, >> > Also read the comments in erl_nif_api_funcs.h of how to add new functions. > You do not have to increase ERL_NIF_MINOR_VERSION as I've already done that > for R16B. > > I guess you have a real use case for enif_phash2 and why erlang:phash2 is > not enough. > > /Sverker From n.oxyde@REDACTED Sat Feb 9 14:01:47 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sat, 9 Feb 2013 14:01:47 +0100 Subject: [erlang-patches] [erlang-bugs] R16A: Small inconvenience with Unicode strings in the shell In-Reply-To: <51098739.8020308@ninenines.eu> References: <51098739.8020308@ninenines.eu> Message-ID: Hi, I've got a fix: git fetch https://github.com/nox/otp.git wide-chars https://github.com/nox/otp/compare/erlang:master...wide-chars https://github.com/nox/otp/compare/erlang:master...wide-chars.patch I can't test the win32 part though. Bj?rn, should I add some autoconf machinery to know whether wcwidth() is available? Regards, -- Anthony Ramine Le 30 janv. 2013 ? 21:48, Lo?c Hoguin a ?crit : > Erlang R16A (erts-5.10) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V5.10 (abort with ^G) > 1> "aaa". > "aaa" > 2> "??". > "??" > 3>3>3>3>3>3>3>3>3>3>3>3>3>3>3>3>3>3> > > In 1> I wrote an ASCII string, got the result, then tried to up-down-up-down-up-down-up-down and it adds/remove "aaa" as intended. > > Then in 2> I wrote an Unicode string, got the result (nice!), then tried to do the same up-down mimic except everytime I did down when the Unicode text was printed, it added a 3> on the line. It only does so for the Unicode and not for ASCII. > > Thinking there's some missing cleanup there. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs From fredrik@REDACTED Mon Feb 11 10:23:38 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 11 Feb 2013 10:23:38 +0100 Subject: [erlang-patches] [PATCH] - Add NIF function enif_phash2 In-Reply-To: References: <5114B87A.1070709@erlang.org> <5114FFFA.9090700@erix.ericsson.se> Message-ID: <5118B89A.3050309@erlang.org> On 02/08/2013 09:19 PM, Paul Davis wrote: > Fredrik, > > Rebased against master: > > git fetch git://github.com/davisp/otp.git enif_phash2 > > https://github.com/davisp/otp/compare/master...enif_phash2 > https://github.com/davisp/otp/compare/master...enif_phash2.patch > > Sverker, > > I've updated the function ordering as per the comment in > erl_nif_api_funcs.h. For use case, I'm implementing a couple data > structures that use hash tables to speed up some hot loops. I can get > away for awhile using erlang:phash2/2 in Erlang and passing that value > into the NIF but this breaks down when I don't know a priori which > terms (or subterms) I may need to hash in the NIF. > > A similar example would be trying to reimplement ets without this. > Either I'd have to store enough information in the Erlang term > representing the table to be able to know which elements of the tuple > to hash or I'd have to ask the table what to hash before passing the > term off to the NIF. There are definitely work arounds to not having > access to phash2 but they aren't pretty. > > Thanks, > Paul Davis > > On Fri, Feb 8, 2013 at 7:39 AM, Sverker Eriksson > wrote: >> Fredrik wrote: >>> On 02/08/2013 12:58 AM, Paul Davis wrote: >>>> git fetch git://github.com/davisp/otp.git enif_phash2 >>>> >>>> https://github.com/davisp/otp/compare/maint...enif_phash2 >>>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch >>>> >>>> This patch exposes the phash2 function to NIFs. It is exactly equivalent >>>> to: >>>> >>>> erlang:phash2(Term, 16#100000000) >>>> >>>> Thanks, >>>> Paul Davis >>>> _______________________________________________ >>>> erlang-patches mailing list >>>> erlang-patches@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-patches >>> Please rebase this patch upon the current 'master' branch. >>> Thanks, >>> >> Also read the comments in erl_nif_api_funcs.h of how to add new functions. >> You do not have to increase ERL_NIF_MINOR_VERSION as I've already done that >> for R16B. >> >> I guess you have a real use case for enif_phash2 and why erlang:phash2 is >> not enough. >> >> /Sverker Re-fetched. Currently cooking in the 'master-pu' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 11 10:28:46 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 11 Feb 2013 10:28:46 +0100 Subject: [erlang-patches] [erlang-bugs] R16A: Small inconvenience with Unicode strings in the shell In-Reply-To: References: <51098739.8020308@ninenines.eu> Message-ID: <5118B9CE.3040606@erlang.org> On 02/09/2013 02:01 PM, Anthony Ramine wrote: > Hi, > > I've got a fix: > > git fetch https://github.com/nox/otp.git wide-chars > > https://github.com/nox/otp/compare/erlang:master...wide-chars > https://github.com/nox/otp/compare/erlang:master...wide-chars.patch > > I can't test the win32 part though. > > Bj?rn, should I add some autoconf machinery to know whether wcwidth() is > available? > > Regards, > Thanks, It is currently cooking in the 'master-pu' branch. -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 11 10:56:03 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 11 Feb 2013 10:56:03 +0100 Subject: [erlang-patches] [erlang-bugs] R16A: Small inconvenience with Unicode strings in the shell In-Reply-To: References: <51098739.8020308@ninenines.eu> Message-ID: <5118C033.5050301@erlang.org> On 02/09/2013 02:01 PM, Anthony Ramine wrote: > Hi, > > I've got a fix: > > git fetch https://github.com/nox/otp.git wide-chars > > https://github.com/nox/otp/compare/erlang:master...wide-chars > https://github.com/nox/otp/compare/erlang:master...wide-chars.patch > > I can't test the win32 part though. > > Bj?rn, should I add some autoconf machinery to know whether wcwidth() is > available? > > Regards, > Your patch is failing on windows: error LNK2019: unresolved external symbol wcwidth referenced in function check_buf_size Could you please have a look at this? -- BR Fredrik Gustafsson Erlang OTP Team From n.oxyde@REDACTED Mon Feb 11 11:58:41 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 11 Feb 2013 11:58:41 +0100 Subject: [erlang-patches] [erlang-bugs] R16A: Small inconvenience with Unicode strings in the shell In-Reply-To: <5118C033.5050301@erlang.org> References: <51098739.8020308@ninenines.eu> <5118C033.5050301@erlang.org> Message-ID: <31E120F8-73EB-4BF3-86AE-CBBC9085E2A1@gmail.com> Hi, There is no wcwidth() in Windows, I'll add some autoconf magic to conditionally use it. -- Anthony Ramine Le 11 f?vr. 2013 ? 10:56, Fredrik a ?crit : > On 02/09/2013 02:01 PM, Anthony Ramine wrote: >> Hi, >> >> I've got a fix: >> >> git fetch https://github.com/nox/otp.git wide-chars >> >> https://github.com/nox/otp/compare/erlang:master...wide-chars >> https://github.com/nox/otp/compare/erlang:master...wide-chars.patch >> >> I can't test the win32 part though. >> >> Bj?rn, should I add some autoconf machinery to know whether wcwidth() is >> available? >> >> Regards, >> > Your patch is failing on windows: > > error LNK2019: unresolved external symbol wcwidth referenced in function check_buf_size > > > Could you please have a look at this? > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > From magnus@REDACTED Mon Feb 11 12:16:49 2013 From: magnus@REDACTED (Magnus Henoch) Date: Mon, 11 Feb 2013 11:16:49 +0000 Subject: [erlang-patches] Fix Flymake dependency in erlang-pkg.el Message-ID: I just tried installing the Emacs Erlang mode using the package definition in erlang-pkg.el, and found that the dependency declaration on "flymake-mode" is incorrect - it should be "flymake" instead. I also decreased the version requirement, as erlang-flymake.el works well with flymake version 0.3 (the one that comes with Emacs). git fetch git://github.com/legoscia/otp.git fix-emacs-pkg-flymake-dep https://github.com/legoscia/otp/compare/erlang:master...legoscia:fix-emacs-pkg-flymake-dep https://github.com/legoscia/otp/compare/erlang:master...legoscia:fix-emacs-pkg-flymake-dep.patch Regards, Magnus From fredrik@REDACTED Mon Feb 11 14:23:02 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 11 Feb 2013 14:23:02 +0100 Subject: [erlang-patches] Fix Flymake dependency in erlang-pkg.el In-Reply-To: References: Message-ID: <5118F0B6.7080204@erlang.org> On 02/11/2013 12:16 PM, Magnus Henoch wrote: > I just tried installing the Emacs Erlang mode using the package > definition in erlang-pkg.el, and found that the dependency declaration > on "flymake-mode" is incorrect - it should be "flymake" instead. I also > decreased the version requirement, as erlang-flymake.el works well with > flymake version 0.3 (the one that comes with Emacs). > > git fetch git://github.com/legoscia/otp.git fix-emacs-pkg-flymake-dep > > https://github.com/legoscia/otp/compare/erlang:master...legoscia:fix-emacs-pkg-flymake-dep > https://github.com/legoscia/otp/compare/erlang:master...legoscia:fix-emacs-pkg-flymake-dep.patch > > Regards, > Magnus > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Thanks, Currently cooking in the 'master-pu' branch. Will run further tests on the patch also. -- BR Fredrik Gustafsson Erlang OTP Team From sean@REDACTED Mon Feb 11 15:15:04 2013 From: sean@REDACTED (Sean Cribbs) Date: Mon, 11 Feb 2013 08:15:04 -0600 Subject: [erlang-patches] Fix type of error Reason on gen_tcp:send/2 In-Reply-To: References: Message-ID: ping On Wed, Feb 6, 2013 at 4:39 PM, Sean Cribbs wrote: > When the TCP socket is in passive mode, it is possible that a close > message has not been delivered to the controlling process before > calling send/2. This results in the returning {error, closed} to the > caller, in the same way that recv/2,3 does. This patch adjusts the > type of the error "Reason" to include the atom 'closed'. > > As this is more of a documentation concern, I have based the patch off 'maint'. > > git fetch git://github.com/seancribbs/otp.git gen_tcp_send_error_closed > > https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed > https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed.patch > > -- > Sean Cribbs > Software Engineer > Basho Technologies, Inc. > http://basho.com/ -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ From fredrik@REDACTED Mon Feb 11 15:42:09 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 11 Feb 2013 15:42:09 +0100 Subject: [erlang-patches] Fix type of error Reason on gen_tcp:send/2 In-Reply-To: References: Message-ID: <51190341.2030100@erlang.org> On 02/11/2013 03:15 PM, Sean Cribbs wrote: > ping > > On Wed, Feb 6, 2013 at 4:39 PM, Sean Cribbs wrote: >> When the TCP socket is in passive mode, it is possible that a close >> message has not been delivered to the controlling process before >> calling send/2. This results in the returning {error, closed} to the >> caller, in the same way that recv/2,3 does. This patch adjusts the >> type of the error "Reason" to include the atom 'closed'. >> >> As this is more of a documentation concern, I have based the patch off 'maint'. >> >> git fetch git://github.com/seancribbs/otp.git gen_tcp_send_error_closed >> >> https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed >> https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed.patch >> >> -- >> Sean Cribbs >> Software Engineer >> Basho Technologies, Inc. >> http://basho.com/ > > Hello, Please rebase this patch upon current 'master' branch. -- BR Fredrik Gustafsson Erlang OTP Team From kostis@REDACTED Mon Feb 11 15:45:13 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 11 Feb 2013 15:45:13 +0100 Subject: [erlang-patches] Cleanup of documentation of the type language Message-ID: <511903F9.1000303@cs.ntua.gr> The subject title (and the two commit messages, included below) should explain what this patch is about. ========================================================================== Clean up of documentation of type language Prompted by noticing that the type language description was a bit vague in its explanation of the syntax and semantics of bitstring types, I decided to add this information. While at it, a general clean up and rephrasing was performed. The binary() type is now described as an alias, as it should be, and a bitstring() type is also described as a built-in alias. ========================================================================== Add support for printing <<_:_*1>> as bitstring() ========================================================================== Please include: git fetch git://github.com/kostis/otp.git type-doc-cleanup Kostis From fredrik@REDACTED Mon Feb 11 16:06:41 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 11 Feb 2013 16:06:41 +0100 Subject: [erlang-patches] Cleanup of documentation of the type language In-Reply-To: <511903F9.1000303@cs.ntua.gr> References: <511903F9.1000303@cs.ntua.gr> Message-ID: <51190901.6080508@erlang.org> On 02/11/2013 03:45 PM, Kostis Sagonas wrote: > git fetch git://github.com/kostis/otp.git type-doc-cleanup Hello Kostis, Your patch is currently cooking in the 'master-pu' branch. -- BR Fredrik Gustafsson Erlang OTP Team From sean@REDACTED Mon Feb 11 17:21:06 2013 From: sean@REDACTED (Sean Cribbs) Date: Mon, 11 Feb 2013 10:21:06 -0600 Subject: [erlang-patches] Fix type of error Reason on gen_tcp:send/2 In-Reply-To: <51190341.2030100@erlang.org> References: <51190341.2030100@erlang.org> Message-ID: Fredrik, I have rebased that branch atop current master. git fetch git://github.com/seancribbs/otp.git gen_tcp_send_error_closed https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed.patch On Mon, Feb 11, 2013 at 8:42 AM, Fredrik wrote: > On 02/11/2013 03:15 PM, Sean Cribbs wrote: >> >> ping >> >> On Wed, Feb 6, 2013 at 4:39 PM, Sean Cribbs wrote: >>> >>> When the TCP socket is in passive mode, it is possible that a close >>> message has not been delivered to the controlling process before >>> calling send/2. This results in the returning {error, closed} to the >>> caller, in the same way that recv/2,3 does. This patch adjusts the >>> type of the error "Reason" to include the atom 'closed'. >>> >>> As this is more of a documentation concern, I have based the patch off >>> 'maint'. >>> >>> git fetch git://github.com/seancribbs/otp.git gen_tcp_send_error_closed >>> >>> >>> https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed >>> >>> https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed.patch >>> >>> -- >>> Sean Cribbs >>> Software Engineer >>> Basho Technologies, Inc. >>> http://basho.com/ >> >> >> > Hello, > Please rebase this patch upon current 'master' branch. > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ From fredrik@REDACTED Mon Feb 11 17:26:18 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 11 Feb 2013 17:26:18 +0100 Subject: [erlang-patches] Fix type of error Reason on gen_tcp:send/2 In-Reply-To: References: <51190341.2030100@erlang.org> Message-ID: <51191BAA.10403@erlang.org> On 02/11/2013 05:21 PM, Sean Cribbs wrote: > Fredrik, > > I have rebased that branch atop current master. > > git fetch git://github.com/seancribbs/otp.git gen_tcp_send_error_closed > > https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed > https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed.patch > > On Mon, Feb 11, 2013 at 8:42 AM, Fredrik wrote: >> On 02/11/2013 03:15 PM, Sean Cribbs wrote: >>> ping >>> >>> On Wed, Feb 6, 2013 at 4:39 PM, Sean Cribbs wrote: >>>> When the TCP socket is in passive mode, it is possible that a close >>>> message has not been delivered to the controlling process before >>>> calling send/2. This results in the returning {error, closed} to the >>>> caller, in the same way that recv/2,3 does. This patch adjusts the >>>> type of the error "Reason" to include the atom 'closed'. >>>> >>>> As this is more of a documentation concern, I have based the patch off >>>> 'maint'. >>>> >>>> git fetch git://github.com/seancribbs/otp.git gen_tcp_send_error_closed >>>> >>>> >>>> https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed >>>> >>>> https://github.com/seancribbs/otp/compare/erlang:maint...gen_tcp_send_error_closed.patch >>>> >>>> -- >>>> Sean Cribbs >>>> Software Engineer >>>> Basho Technologies, Inc. >>>> http://basho.com/ >>> >>> >> Hello, >> Please rebase this patch upon current 'master' branch. >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> > > Thanks, Currently cooking in the 'master-pu' branch. -- BR Fredrik Gustafsson Erlang OTP Team From sverker.eriksson@REDACTED Tue Feb 12 19:27:25 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Tue, 12 Feb 2013 19:27:25 +0100 Subject: [erlang-patches] Win64 memory corruption fix In-Reply-To: References: Message-ID: <511A898D.2000206@erix.ericsson.se> Does this patch solve a real issue that you have seen, or is it more of a potential problem stemming from code analysis? We really appreciate patches like this, but we need to prioritize it for inclusion in R16B or not. And it seems to me the patch mostly deals with type casts for diagnostic printing of internal states, where a wrong type cast just mean we get a wrong value printed. /Sverker, Erlang/OTP Blaine Whittle wrote: > git fetch git://github.com/bwhittle/otp.git win-64-pointer-fix > > https://github.com/bwhittle/otp/commit/1d21ce8d0287a0a50b2e42631d361f43ce14e23e > > This patch should fix a number of memory corruption issues and / or crashes on Win64 that can potential occur when the Erlang VM exceeds 4 GB of ram. The problem stems from casting pointers to unsigned long and assuming long is type that is always large enough to hold a pointer. This assumption holds up for all platforms except windows. > > Nix 32 (unsigned long) -> 32 bit (pointer size = unsigned long) > Nix 64 (unsigned long) -> 64 bit (pointer size = unsigned long) > Win 32 (unsigned long) -> 32 bit (pointer size = unsigned long) > Win 64 (unsigned long) -> 32 bit (pointer size != unsigned long) > > To compound the problem these casts can appear to be fine on Win64 as only those pointers that reference memory above the 32 bit address space will lead to issues. Which means you need Erlang to allocate ~ 4 GB of memory before you even have a chance or running into problems. The issue is if you have a pointer that reference memory above the 32 bit address space on Win64 and then type cast it to a long (i.e. 32 bits) and then turn around and use that type cast value as a pointer then you'll be referencing a different memory location. Most of the time the incorrect pointer will still reference a valid location as memory is allocated bottom up which can lead to memory corruption. > > This patch has been tested heavily and has been used on production systems. I made the changes a year ago when the Win64 Erlang VM was released (just didn't mean to wait so long to submit it.) > > The patch submission page recommends that I create new test cases which I have not done. However I have a small registry change that should be applied on any systems that execute Erlang Win64 smoke and / or unit tests. > > The registry change instructs Windows to allocate memory from top down, meaning that any valid memory pointers will require a 64 bit value and any attempt to cast them to a 32 bit value followed by a dereference will produce an access violation. > > http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473(v=vs.85).aspx > > To apply the registry setting just copy and paste the following section and place it into a .reg file and import it on each test machines followed by a reboot. > ============================================================= > Windows Registry Editor Version 5.00 > > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] > "AllocationPreference"=dword:00100000. > ============================================================= > > With this registry change Erlang's existing unit tests should be able to catch any incorrect pointer casts by causing the VM to crash. Every pointer will reference memory above the 32 value so type casting it to a 32 bit value and then dereferencing causes an access violation. > > One potential issue with using this registry setting is that if your test machines rely on 3rd party Win64 apps it's possible they may crash on startup (that is if they contain similar type casting bugs.) > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > From BWhittle@REDACTED Tue Feb 12 20:32:17 2013 From: BWhittle@REDACTED (Blaine Whittle) Date: Tue, 12 Feb 2013 19:32:17 +0000 Subject: [erlang-patches] Win64 memory corruption fix In-Reply-To: <511A898D.2000206@erix.ericsson.se> References: <511A898D.2000206@erix.ericsson.se> Message-ID: When the Win64 emulator was released we switched to it as a solution to our memory problem. We were bumping into the 3 GB limit and our solution was to run multiple VMs on the same machine. However once we started using the Win64 we noticed it was stable as long as memory usage was low, but if it started approaching or passing the 4 GB line odd problems started showing up, which turned out to be memory corruption. We were getting a number of function_clause and bad_match exceptions and when we reviewed the code and the data we found cases that should be impossible. Code wise, I looked at all uses of the type long regardless of the code section. I agree that the majority of the patch is just formatting code with bad casts which should only result in incorrect memory reads and not writes (however I believe the issue could result in erl_misc_utils.c a write) After the changes, the memory corruption issues went away. Unfortunately I don't really know which specific casts caused memory corruption. As mentioned in my original email, applying the top down memory allocation registry setting can help trace down any of these potential problems as the erlang VM will GPF. With the memory allocation in place, the Win64 Erlang will not fully build. Erl.exe will be built, but the first attempt to compile a .erl file will result in a GPF where the stack trace will show the source as one of the printf functions. With the patch applied, the Erlang VM runs fine with the top down memory allocation applied. -----Original Message----- From: Sverker Eriksson [mailto:sverker.eriksson@REDACTED] Sent: Tuesday, February 12, 2013 10:27 AM To: Blaine Whittle Cc: erlang-patches@REDACTED Subject: Re: [erlang-patches] Win64 memory corruption fix Does this patch solve a real issue that you have seen, or is it more of a potential problem stemming from code analysis? We really appreciate patches like this, but we need to prioritize it for inclusion in R16B or not. And it seems to me the patch mostly deals with type casts for diagnostic printing of internal states, where a wrong type cast just mean we get a wrong value printed. /Sverker, Erlang/OTP Blaine Whittle wrote: > git fetch git://github.com/bwhittle/otp.git win-64-pointer-fix > > https://github.com/bwhittle/otp/commit/1d21ce8d0287a0a50b2e42631d361f4 > 3ce14e23e > > This patch should fix a number of memory corruption issues and / or crashes on Win64 that can potential occur when the Erlang VM exceeds 4 GB of ram. The problem stems from casting pointers to unsigned long and assuming long is type that is always large enough to hold a pointer. This assumption holds up for all platforms except windows. > > Nix 32 (unsigned long) -> 32 bit (pointer size = unsigned long) > Nix 64 (unsigned long) -> 64 bit (pointer size = unsigned long) > Win 32 (unsigned long) -> 32 bit (pointer size = unsigned long) > Win 64 (unsigned long) -> 32 bit (pointer size != unsigned long) > > To compound the problem these casts can appear to be fine on Win64 as only those pointers that reference memory above the 32 bit address space will lead to issues. Which means you need Erlang to allocate ~ 4 GB of memory before you even have a chance or running into problems. The issue is if you have a pointer that reference memory above the 32 bit address space on Win64 and then type cast it to a long (i.e. 32 bits) and then turn around and use that type cast value as a pointer then you'll be referencing a different memory location. Most of the time the incorrect pointer will still reference a valid location as memory is allocated bottom up which can lead to memory corruption. > > This patch has been tested heavily and has been used on production > systems. I made the changes a year ago when the Win64 Erlang VM was > released (just didn't mean to wait so long to submit it.) > > The patch submission page recommends that I create new test cases which I have not done. However I have a small registry change that should be applied on any systems that execute Erlang Win64 smoke and / or unit tests. > > The registry change instructs Windows to allocate memory from top down, meaning that any valid memory pointers will require a 64 bit value and any attempt to cast them to a 32 bit value followed by a dereference will produce an access violation. > > http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473(v=vs. > 85).aspx > > To apply the registry setting just copy and paste the following section and place it into a .reg file and import it on each test machines followed by a reboot. > ============================================================= > Windows Registry Editor Version 5.00 > > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session > Manager\Memory Management] "AllocationPreference"=dword:00100000. > ============================================================= > > With this registry change Erlang's existing unit tests should be able to catch any incorrect pointer casts by causing the VM to crash. Every pointer will reference memory above the 32 value so type casting it to a 32 bit value and then dereferencing causes an access violation. > > One potential issue with using this registry setting is that if your > test machines rely on 3rd party Win64 apps it's possible they may > crash on startup (that is if they contain similar type casting bugs.) > > > ---------------------------------------------------------------------- > -- > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > From kostis@REDACTED Wed Feb 13 09:17:40 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 13 Feb 2013 09:17:40 +0100 Subject: [erlang-patches] Change the return value of hipe_bifs:remove_refs_from/1 Message-ID: <511B4C24.9060806@cs.ntua.gr> Please include: git fetch git://github.com/kostis/otp.git hipe_bif-remove_refs_from Kostis From aschultz@REDACTED Wed Feb 13 09:19:08 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Wed, 13 Feb 2013 09:19:08 +0100 (CET) Subject: [erlang-patches] TLS: add PSK and SRP cipher suites In-Reply-To: <397956462.337258.1358774184655.JavaMail.root@tpip.net> References: <243075147.49636.1348679990473.JavaMail.root@tpip.net> <5077E4FA.9060609@erlang.org> <50ED8DBD.8080305@erlang.org> <554152829.218007.1358277582556.JavaMail.root@tpip.net> <50F66C6C.8000108@erlang.org> <1636541866.231783.1358338828351.JavaMail.root@tpip.net> <50FD3E19.4050309@erlang.org> <397956462.337258.1358774184655.JavaMail.root@tpip.net> Message-ID: <886771634.835678.1360743548656.JavaMail.root@tpip.net> Hi, Klaus Trainer @ github found some spelling errors. I have pushed a fixed version. Please refetch. Thanks Andreas ----- Original Message ----- > Hi, > > patch is rebased. > > Andreas > > ----- Original Message ----- > > Hello, > > Could you rebase this patch upon the current 'master' branch? > > > > BR Fredrik Gustafsson > > Erlang OTP Team > > On 01/16/2013 01:20 PM, Andreas Schultz wrote: > > > Hi Fredrik, > > > > > > I just realized that I'm still using the ?line macro in the new SRP > > > crypto > > > test. > > > > > > Should I remove it? > > > > > > Andreas > > > > > > ----- Original Message ----- > > >> Thanks, > > >> I have re-fetched and building it now with the rest of the patches in > > >> the 'master-pu' branch. > > >> > > >> BR Fredrik Gustafsson > > >> Erlang OTP Team > > >> On 01/15/2013 08:19 PM, Andreas Schultz wrote: > > >>> Hi, > > >>> > > >>> I have address the issues: > > >>> > > >>> * documentation for SSL API options added > > >>> * header files internalized > > >>> * crypto function generalized and support for multiple SRP variants > > >>> > > >>> New version can be found here: > > >>> > > >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites > > >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch > > >>> > > >>> > > >>> Even if the PSK and SRP do not make it into R16, could you consider the > > >>> first two > > >>> changesets from this series, please? They are mostly code > > >>> consolidations, > > >>> making > > >>> adding new key exchange algorithms much simpler. > > >>> > > >>> https://github.com/RoadRunnr/otp/compare/master...cf4512a > > >>> https://github.com/RoadRunnr/otp/compare/master...cf4512a.patch > > >>> > > >>> Andreas > > >>> > > >>> ----- Original Message ----- > > >>>> Hello Andreas, > > >>>> Your patch has finally been into review and the response was: > > >>>> " > > >>>> > > >>>> * The patch introduces new API options without documenting them. > > >>>> * The patch introduces new include file ssl_srp.hrl that I think > > >>>> shall > > >>>> be internal and put in src. It is undesirable to have records in > > >>>> the > > >>>> user API as it makes the user application compile time dependent > > >>>> on > > >>>> our code, better to use a proplist and then create the record > > >>>> internally. (Yes "sslsocket" is a record due to legacy) > > >>>> * The patch introduces new include file ssl_srp_primes.hrl I think > > >>>> it > > >>>> feels better to input such values as atoms and internaly uses > > >>>> the > > >>>> macros defined in this file, that would be more consistent with > > >>>> the > > >>>> rest of the API. > > >>>> * Functions in crypto being named TLS something seems a little > > >>>> strange, is this necessary?! > > >>>> > > >>>> " > > >>>> Please correct this and give me a notice when it is done. > > >>>> > > >>>> BR Fredrik Gustafsson > > >>>> Erlang OTP Team > > >>>> On 10/12/2012 11:38 AM, Henrik Nord wrote: > > >>>>> refetching > > >>>>> > > >>>>> On 10/12/2012 10:27 AM, Andreas Schultz wrote: > > >>>>>> Hi Henrik, > > >>>>>> > > >>>>>> When I rebased my changes to the current master, a change crept in > > >>>>>> that > > >>>>>> shouldn't have: > > >>>>>> > > >>>>>> https://github.com/erlang/otp/commit/747ce9191f4dc7558e12e2b6e5696396392ffbd8 > > >>>>>> > > >>>>>> > > >>>>>> I have removed it from my tree and pushed it. > > >>>>>> > > >>>>>> Andreas > > >>>>>> > > >>>>>> ----- Original Message ----- > > >>>>>>> Thanks, I will refetch! > > >>>>>>> On 10/11/2012 12:49 PM, Andreas Schultz wrote: > > >>>>>>>> Hi, > > >>>>>>>> > > >>>>>>>> I have pushed a change that should fix the compile error. The > > >>>>>>>> buffer has > > >>>>>>>> a fixed length now. > > >>>>>>>> > > >>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2 > > >>>>>>>> > > >>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2.patch > > >>>>>>>> > > >>>>>>>> > > >>>>>>>> Andreas > > >>>>>>>> > > >>>>>>>> ----- Original Message ----- > > >>>>>>>>> Does not compile on Windows. > > >>>>>>>>> > > >>>>>>>>> Function SHA1_Update_PAD in crypto.c is not correct. Arrays with > > >>>>>>>>> dynamic > > >>>>>>>>> size is not supported by the C standard we use. > > >>>>>>>>> Use a static array instead, presuming that there is a reasonable > > >>>>>>>>> upper > > >>>>>>>>> limit of its size. > > >>>>>>>>> > > >>>>>>>>> /Sverker, Erlang/OTP > > >>>>>>>>> > > >>>>>>>>> > > >>>>>>>>> > > >>>>>>>>> Henrik Nord wrote: > > >>>>>>>>>> Hi > > >>>>>>>>>> > > >>>>>>>>>> I have added your branch to 'master'pu' for testing. > > >>>>>>>>>> Thank you for your contribution! > > >>>>>>>>>> > > >>>>>>>>>> On 10/04/2012 06:29 PM, Andreas Schultz wrote: > > >>>>>>>>>>> Hi, > > >>>>>>>>>>> > > >>>>>>>>>>> Tree is rebased onto latest master. > > >>>>>>>>>>> > > >>>>>>>>>>> Andreas > > >>>>>>>>>>> > > >>>>>>>>>>> ----- Original Message ----- > > >>>>>>>>>>>> Would you be so kind as to rebase this branch upon the latest > > >>>>>>>>>>>> 'master' > > >>>>>>>>>>>> > > >>>>>>>>>>>> Thank you for your contribution! > > >>>>>>>>>>>> > > >>>>>>>>>>>> > > >>>>>>>>>>>> > > >>>>>>>>>>>> On 09/26/2012 07:19 PM, Andreas Schultz wrote: > > >>>>>>>>>>>>> Hi, > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> I have implemented the more interesting parts of RFC 4279, > > >>>>>>>>>>>>> RFC > > >>>>>>>>>>>>> 5487 > > >>>>>>>>>>>>> and RFC 5054 (aka TLS PSK and SRP ciphers). The use and > > >>>>>>>>>>>>> usefulness > > >>>>>>>>>>>>> of those ciphers is rather limited, the one notable exception > > >>>>>>>>>>>>> being > > >>>>>>>>>>>>> the eID server protocol for German national identity cards > > >>>>>>>>>>>>> (nPA). > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> The test suite can only verify some PSK suites against > > >>>>>>>>>>>>> openssl > > >>>>>>>>>>>>> as > > >>>>>>>>>>>>> currently no openssl version supports them all. There is > > >>>>>>>>>>>>> patch > > >>>>>>>>>>>>> that add some to openssl, but it has not been incorporated > > >>>>>>>>>>>>> into > > >>>>>>>>>>>>> upstream. GNU-TLS implements some more (but not all) PSK > > >>>>>>>>>>>>> suites > > >>>>>>>>>>>>> and I have manually tested interoperability. > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> Patch info: > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> git fetch git://github.com/RoadRunnr/otp.git > > >>>>>>>>>>>>> tls-psk-srp-suites > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> Regards > > >>>>>>>>>>>>> Andreas > > >>>>>>>>>>>> -- > > >>>>>>>>>>>> /Henrik Nord Erlang/OTP > > >>>>>>>>>>>> > > >>>>>>>>>>>> > > >>>>>>> -- > > >>>>>>> /Henrik Nord Erlang/OTP > > >>>>>>> > > >>>>>>> > > >> > > > > > > -- > -- > Dipl. Inform. > Andreas Schultz > > email: as@REDACTED > phone: +49-391-819099-224 > mobil: +49-170-2226073 > > ------------------ managed broadband access ------------------ > > Travelping GmbH phone: +49-391-8190990 > Roentgenstr. 13 fax: +49-391-819099299 > D-39108 Magdeburg email: info@REDACTED > GERMANY web: http://www.travelping.com > > Company Registration: HRB21276 Handelsregistergericht Chemnitz > Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 > -------------------------------------------------------------- > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From fredrik@REDACTED Wed Feb 13 10:44:02 2013 From: fredrik@REDACTED (Fredrik) Date: Wed, 13 Feb 2013 10:44:02 +0100 Subject: [erlang-patches] Change the return value of hipe_bifs:remove_refs_from/1 In-Reply-To: <511B4C24.9060806@cs.ntua.gr> References: <511B4C24.9060806@cs.ntua.gr> Message-ID: <511B6062.4000701@erlang.org> On 02/13/2013 09:17 AM, Kostis Sagonas wrote: > Please include: > > git fetch git://github.com/kostis/otp.git hipe_bif-remove_refs_from > > Kostis > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello Kostis, I've included your patch in the 'master-pu' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Wed Feb 13 10:44:22 2013 From: fredrik@REDACTED (Fredrik) Date: Wed, 13 Feb 2013 10:44:22 +0100 Subject: [erlang-patches] TLS: add PSK and SRP cipher suites In-Reply-To: <886771634.835678.1360743548656.JavaMail.root@tpip.net> References: <243075147.49636.1348679990473.JavaMail.root@tpip.net> <5077E4FA.9060609@erlang.org> <50ED8DBD.8080305@erlang.org> <554152829.218007.1358277582556.JavaMail.root@tpip.net> <50F66C6C.8000108@erlang.org> <1636541866.231783.1358338828351.JavaMail.root@tpip.net> <50FD3E19.4050309@erlang.org> <397956462.337258.1358774184655.JavaMail.root@tpip.net> <886771634.835678.1360743548656.JavaMail.root@tpip.net> Message-ID: <511B6076.2030304@erlang.org> On 02/13/2013 09:19 AM, Andreas Schultz wrote: > Hi, > > Klaus Trainer @ github found some spelling errors. I have pushed a fixed > version. Please refetch. > > Thanks > Andreas > > ----- Original Message ----- >> Hi, >> >> patch is rebased. >> >> Andreas >> >> ----- Original Message ----- >>> Hello, >>> Could you rebase this patch upon the current 'master' branch? >>> >>> BR Fredrik Gustafsson >>> Erlang OTP Team >>> On 01/16/2013 01:20 PM, Andreas Schultz wrote: >>>> Hi Fredrik, >>>> >>>> I just realized that I'm still using the ?line macro in the new SRP >>>> crypto >>>> test. >>>> >>>> Should I remove it? >>>> >>>> Andreas >>>> >>>> ----- Original Message ----- >>>>> Thanks, >>>>> I have re-fetched and building it now with the rest of the patches in >>>>> the 'master-pu' branch. >>>>> >>>>> BR Fredrik Gustafsson >>>>> Erlang OTP Team >>>>> On 01/15/2013 08:19 PM, Andreas Schultz wrote: >>>>>> Hi, >>>>>> >>>>>> I have address the issues: >>>>>> >>>>>> * documentation for SSL API options added >>>>>> * header files internalized >>>>>> * crypto function generalized and support for multiple SRP variants >>>>>> >>>>>> New version can be found here: >>>>>> >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch >>>>>> >>>>>> >>>>>> Even if the PSK and SRP do not make it into R16, could you consider the >>>>>> first two >>>>>> changesets from this series, please? They are mostly code >>>>>> consolidations, >>>>>> making >>>>>> adding new key exchange algorithms much simpler. >>>>>> >>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a >>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a.patch >>>>>> >>>>>> Andreas >>>>>> >>>>>> ----- Original Message ----- >>>>>>> Hello Andreas, >>>>>>> Your patch has finally been into review and the response was: >>>>>>> " >>>>>>> >>>>>>> * The patch introduces new API options without documenting them. >>>>>>> * The patch introduces new include file ssl_srp.hrl that I think >>>>>>> shall >>>>>>> be internal and put in src. It is undesirable to have records in >>>>>>> the >>>>>>> user API as it makes the user application compile time dependent >>>>>>> on >>>>>>> our code, better to use a proplist and then create the record >>>>>>> internally. (Yes "sslsocket" is a record due to legacy) >>>>>>> * The patch introduces new include file ssl_srp_primes.hrl I think >>>>>>> it >>>>>>> feels better to input such values as atoms and internaly uses >>>>>>> the >>>>>>> macros defined in this file, that would be more consistent with >>>>>>> the >>>>>>> rest of the API. >>>>>>> * Functions in crypto being named TLS something seems a little >>>>>>> strange, is this necessary?! >>>>>>> >>>>>>> " >>>>>>> Please correct this and give me a notice when it is done. >>>>>>> >>>>>>> BR Fredrik Gustafsson >>>>>>> Erlang OTP Team >>>>>>> On 10/12/2012 11:38 AM, Henrik Nord wrote: >>>>>>>> refetching >>>>>>>> >>>>>>>> On 10/12/2012 10:27 AM, Andreas Schultz wrote: >>>>>>>>> Hi Henrik, >>>>>>>>> >>>>>>>>> When I rebased my changes to the current master, a change crept in >>>>>>>>> that >>>>>>>>> shouldn't have: >>>>>>>>> >>>>>>>>> https://github.com/erlang/otp/commit/747ce9191f4dc7558e12e2b6e5696396392ffbd8 >>>>>>>>> >>>>>>>>> >>>>>>>>> I have removed it from my tree and pushed it. >>>>>>>>> >>>>>>>>> Andreas >>>>>>>>> >>>>>>>>> ----- Original Message ----- >>>>>>>>>> Thanks, I will refetch! >>>>>>>>>> On 10/11/2012 12:49 PM, Andreas Schultz wrote: >>>>>>>>>>> Hi, >>>>>>>>>>> >>>>>>>>>>> I have pushed a change that should fix the compile error. The >>>>>>>>>>> buffer has >>>>>>>>>>> a fixed length now. >>>>>>>>>>> >>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2 >>>>>>>>>>> >>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2.patch >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Andreas >>>>>>>>>>> >>>>>>>>>>> ----- Original Message ----- >>>>>>>>>>>> Does not compile on Windows. >>>>>>>>>>>> >>>>>>>>>>>> Function SHA1_Update_PAD in crypto.c is not correct. Arrays with >>>>>>>>>>>> dynamic >>>>>>>>>>>> size is not supported by the C standard we use. >>>>>>>>>>>> Use a static array instead, presuming that there is a reasonable >>>>>>>>>>>> upper >>>>>>>>>>>> limit of its size. >>>>>>>>>>>> >>>>>>>>>>>> /Sverker, Erlang/OTP >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Henrik Nord wrote: >>>>>>>>>>>>> Hi >>>>>>>>>>>>> >>>>>>>>>>>>> I have added your branch to 'master'pu' for testing. >>>>>>>>>>>>> Thank you for your contribution! >>>>>>>>>>>>> >>>>>>>>>>>>> On 10/04/2012 06:29 PM, Andreas Schultz wrote: >>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>> >>>>>>>>>>>>>> Tree is rebased onto latest master. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Andreas >>>>>>>>>>>>>> >>>>>>>>>>>>>> ----- Original Message ----- >>>>>>>>>>>>>>> Would you be so kind as to rebase this branch upon the latest >>>>>>>>>>>>>>> 'master' >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Thank you for your contribution! >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> On 09/26/2012 07:19 PM, Andreas Schultz wrote: >>>>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> I have implemented the more interesting parts of RFC 4279, >>>>>>>>>>>>>>>> RFC >>>>>>>>>>>>>>>> 5487 >>>>>>>>>>>>>>>> and RFC 5054 (aka TLS PSK and SRP ciphers). The use and >>>>>>>>>>>>>>>> usefulness >>>>>>>>>>>>>>>> of those ciphers is rather limited, the one notable exception >>>>>>>>>>>>>>>> being >>>>>>>>>>>>>>>> the eID server protocol for German national identity cards >>>>>>>>>>>>>>>> (nPA). >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> The test suite can only verify some PSK suites against >>>>>>>>>>>>>>>> openssl >>>>>>>>>>>>>>>> as >>>>>>>>>>>>>>>> currently no openssl version supports them all. There is >>>>>>>>>>>>>>>> patch >>>>>>>>>>>>>>>> that add some to openssl, but it has not been incorporated >>>>>>>>>>>>>>>> into >>>>>>>>>>>>>>>> upstream. GNU-TLS implements some more (but not all) PSK >>>>>>>>>>>>>>>> suites >>>>>>>>>>>>>>>> and I have manually tested interoperability. >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Patch info: >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> git fetch git://github.com/RoadRunnr/otp.git >>>>>>>>>>>>>>>> tls-psk-srp-suites >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Regards >>>>>>>>>>>>>>>> Andreas >>>>>>>>>>>>>>> -- >>>>>>>>>>>>>>> /Henrik Nord Erlang/OTP >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> /Henrik Nord Erlang/OTP >>>>>>>>>> >>>>>>>>>> >>> >> -- >> -- >> Dipl. Inform. >> Andreas Schultz >> >> email: as@REDACTED >> phone: +49-391-819099-224 >> mobil: +49-170-2226073 >> >> ------------------ managed broadband access ------------------ >> >> Travelping GmbH phone: +49-391-8190990 >> Roentgenstr. 13 fax: +49-391-819099299 >> D-39108 Magdeburg email: info@REDACTED >> GERMANY web: http://www.travelping.com >> >> Company Registration: HRB21276 Handelsregistergericht Chemnitz >> Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 >> -------------------------------------------------------------- >> >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/listinfo/erlang-patches >> Hello! Re-fetched, Thanks. -- BR Fredrik Gustafsson Erlang OTP Team From niticin@REDACTED Wed Feb 13 11:26:00 2013 From: niticin@REDACTED (Anton Nikitin) Date: Wed, 13 Feb 2013 14:26:00 +0400 Subject: [erlang-patches] Patch for inets-5.9.3 Content-length:0 HTTP/1.1 Bug Message-ID: Hi, here is the patch for the previously submitted bug: http://erlang.org/pipermail/erlang-bugs/2013-February/003391.html git fetch git://github.com/antonnikitin/otp.git http11_content_length_zero https://github.com/antonnikitin/otp/compare/erlang:maint...http11_content_length_zero https://github.com/antonnikitin/otp/compare/erlang:maint...http11_content_length_zero.patch Best Regards, Anton Nikitin Reksoft -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Wed Feb 13 11:36:26 2013 From: fredrik@REDACTED (Fredrik) Date: Wed, 13 Feb 2013 11:36:26 +0100 Subject: [erlang-patches] Patch for inets-5.9.3 Content-length:0 HTTP/1.1 Bug In-Reply-To: References: Message-ID: <511B6CAA.5090801@erlang.org> On 02/13/2013 11:26 AM, Anton Nikitin wrote: > Hi, > > here is the patch for the previously submitted bug: > http://erlang.org/pipermail/erlang-bugs/2013-February/003391.html > > git fetch git://github.com/antonnikitin/otp.git http11_content_length_zero > > https://github.com/antonnikitin/otp/compare/erlang:maint...http11_content_length_zero > https://github.com/antonnikitin/otp/compare/erlang:maint...http11_content_length_zero.patch > > Best Regards, > Anton Nikitin > Reksoft > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello, Could you please rebase your patch upon the current 'master' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From niticin@REDACTED Wed Feb 13 11:41:39 2013 From: niticin@REDACTED (Anton Nikitin) Date: Wed, 13 Feb 2013 14:41:39 +0400 Subject: [erlang-patches] Patch for inets-5.9.3 Content-length:0 HTTP/1.1 Bug In-Reply-To: <511B6CAA.5090801@erlang.org> References: , <511B6CAA.5090801@erlang.org> Message-ID: Hi Frederik, ok, done. Best Regards, Anton Nikitin Reksoft Date: Wed, 13 Feb 2013 11:36:26 +0100 From: fredrik@REDACTED To: niticin@REDACTED CC: erlang-patches@REDACTED Subject: Re: [erlang-patches] Patch for inets-5.9.3 Content-length:0 HTTP/1.1 Bug On 02/13/2013 11:26 AM, Anton Nikitin wrote: Hi, here is the patch for the previously submitted bug: http://erlang.org/pipermail/erlang-bugs/2013-February/003391.html git fetch git://github.com/antonnikitin/otp.git http11_content_length_zero https://github.com/antonnikitin/otp/compare/erlang:maint...http11_content_length_zero https://github.com/antonnikitin/otp/compare/erlang:maint...http11_content_length_zero.patch Best Regards, Anton Nikitin Reksoft _______________________________________________ erlang-patches mailing list erlang-patches@REDACTED http://erlang.org/mailman/listinfo/erlang-patches Hello, Could you please rebase your patch upon the current 'master' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From jani.j.hakala@REDACTED Wed Feb 13 22:13:20 2013 From: jani.j.hakala@REDACTED (Jani Hakala) Date: Wed, 13 Feb 2013 23:13:20 +0200 Subject: [erlang-patches] Win64 memory corruption fix References: <511A898D.2000206@erix.ericsson.se> Message-ID: <87a9r7c2vw.fsf@pingviini.dyndns.org> Blaine Whittle writes: > Code wise, I looked at all uses of the type long regardless of the > code section. I agree that the majority of the patch is just > formatting code with bad casts which should only result in incorrect > memory reads and not writes (however I believe the issue could result > in erl_misc_utils.c a write) > I looked at the patch and these original lines looked the most suspicious to me: in erts/lib_src/common/erl_printf_format.c 825: unsigned long eterm; 836: eterm = va_arg(ap, unsigned long); 840: res = (*erts_printf_eterm_func)(noop_fn, NULL, eterm, prec, eterm_base); erts_printf_eterm_func is assigned as erts_printf_term, which calls print_term. print_term probably uses eterm as a pointer at some point which causes invalid memory access with top-down memory allocation. Jani Hakala From kostis@REDACTED Thu Feb 14 13:03:14 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 14 Feb 2013 13:03:14 +0100 Subject: [erlang-patches] xcomp file for cross-compiling on Blue Gene/Q Message-ID: <511CD282.2050309@cs.ntua.gr> Please include: git fetch git://github.com/kostis/otp.git xcomp-powerpc64-bgq Kostis From fredrik@REDACTED Thu Feb 14 15:25:43 2013 From: fredrik@REDACTED (Fredrik) Date: Thu, 14 Feb 2013 15:25:43 +0100 Subject: [erlang-patches] [PATCH] - Add NIF function enif_phash2 In-Reply-To: References: <5114B87A.1070709@erlang.org> <5114FFFA.9090700@erix.ericsson.se> Message-ID: <511CF3E7.4070402@erlang.org> On 02/08/2013 09:19 PM, Paul Davis wrote: > Fredrik, > > Rebased against master: > > git fetch git://github.com/davisp/otp.git enif_phash2 > > https://github.com/davisp/otp/compare/master...enif_phash2 > https://github.com/davisp/otp/compare/master...enif_phash2.patch > > Sverker, > > I've updated the function ordering as per the comment in > erl_nif_api_funcs.h. For use case, I'm implementing a couple data > structures that use hash tables to speed up some hot loops. I can get > away for awhile using erlang:phash2/2 in Erlang and passing that value > into the NIF but this breaks down when I don't know a priori which > terms (or subterms) I may need to hash in the NIF. > > A similar example would be trying to reimplement ets without this. > Either I'd have to store enough information in the Erlang term > representing the table to be able to know which elements of the tuple > to hash or I'd have to ask the table what to hash before passing the > term off to the NIF. There are definitely work arounds to not having > access to phash2 but they aren't pretty. > > Thanks, > Paul Davis > > On Fri, Feb 8, 2013 at 7:39 AM, Sverker Eriksson > wrote: >> Fredrik wrote: >>> On 02/08/2013 12:58 AM, Paul Davis wrote: >>>> git fetch git://github.com/davisp/otp.git enif_phash2 >>>> >>>> https://github.com/davisp/otp/compare/maint...enif_phash2 >>>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch >>>> >>>> This patch exposes the phash2 function to NIFs. It is exactly equivalent >>>> to: >>>> >>>> erlang:phash2(Term, 16#100000000) >>>> >>>> Thanks, >>>> Paul Davis >>>> _______________________________________________ >>>> erlang-patches mailing list >>>> erlang-patches@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-patches >>> Please rebase this patch upon the current 'master' branch. >>> Thanks, >>> >> Also read the comments in erl_nif_api_funcs.h of how to add new functions. >> You do not have to increase ERL_NIF_MINOR_VERSION as I've already done that >> for R16B. >> >> I guess you have a real use case for enif_phash2 and why erlang:phash2 is >> not enough. >> >> /Sverker Hello could you rebase this upon the current 'master' branch on github Thanks, -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Thu Feb 14 15:29:32 2013 From: fredrik@REDACTED (Fredrik) Date: Thu, 14 Feb 2013 15:29:32 +0100 Subject: [erlang-patches] xcomp file for cross-compiling on Blue Gene/Q In-Reply-To: <511CD282.2050309@cs.ntua.gr> References: <511CD282.2050309@cs.ntua.gr> Message-ID: <511CF4CC.2090609@erlang.org> On 02/14/2013 01:03 PM, Kostis Sagonas wrote: > Please include: > > git fetch git://github.com/kostis/otp.git xcomp-powerpc64-bgq > > Kostis > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello Kostis, The patch is now cooking in the 'master-pu' branch -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Fri Feb 15 09:36:42 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 15 Feb 2013 09:36:42 +0100 Subject: [erlang-patches] TLS: add PSK and SRP cipher suites In-Reply-To: <886771634.835678.1360743548656.JavaMail.root@tpip.net> References: <243075147.49636.1348679990473.JavaMail.root@tpip.net> <5077E4FA.9060609@erlang.org> <50ED8DBD.8080305@erlang.org> <554152829.218007.1358277582556.JavaMail.root@tpip.net> <50F66C6C.8000108@erlang.org> <1636541866.231783.1358338828351.JavaMail.root@tpip.net> <50FD3E19.4050309@erlang.org> <397956462.337258.1358774184655.JavaMail.root@tpip.net> <886771634.835678.1360743548656.JavaMail.root@tpip.net> Message-ID: <511DF39A.2030109@erlang.org> On 02/13/2013 09:19 AM, Andreas Schultz wrote: > Hi, > > Klaus Trainer @ github found some spelling errors. I have pushed a fixed > version. Please refetch. > > Thanks > Andreas > > ----- Original Message ----- >> Hi, >> >> patch is rebased. >> >> Andreas >> >> ----- Original Message ----- >>> Hello, >>> Could you rebase this patch upon the current 'master' branch? >>> >>> BR Fredrik Gustafsson >>> Erlang OTP Team >>> On 01/16/2013 01:20 PM, Andreas Schultz wrote: >>>> Hi Fredrik, >>>> >>>> I just realized that I'm still using the ?line macro in the new SRP >>>> crypto >>>> test. >>>> >>>> Should I remove it? >>>> >>>> Andreas >>>> >>>> ----- Original Message ----- >>>>> Thanks, >>>>> I have re-fetched and building it now with the rest of the patches in >>>>> the 'master-pu' branch. >>>>> >>>>> BR Fredrik Gustafsson >>>>> Erlang OTP Team >>>>> On 01/15/2013 08:19 PM, Andreas Schultz wrote: >>>>>> Hi, >>>>>> >>>>>> I have address the issues: >>>>>> >>>>>> * documentation for SSL API options added >>>>>> * header files internalized >>>>>> * crypto function generalized and support for multiple SRP variants >>>>>> >>>>>> New version can be found here: >>>>>> >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch >>>>>> >>>>>> >>>>>> Even if the PSK and SRP do not make it into R16, could you consider the >>>>>> first two >>>>>> changesets from this series, please? They are mostly code >>>>>> consolidations, >>>>>> making >>>>>> adding new key exchange algorithms much simpler. >>>>>> >>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a >>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a.patch >>>>>> >>>>>> Andreas >>>>>> >>>>>> ----- Original Message ----- >>>>>>> Hello Andreas, >>>>>>> Your patch has finally been into review and the response was: >>>>>>> " >>>>>>> >>>>>>> * The patch introduces new API options without documenting them. >>>>>>> * The patch introduces new include file ssl_srp.hrl that I think >>>>>>> shall >>>>>>> be internal and put in src. It is undesirable to have records in >>>>>>> the >>>>>>> user API as it makes the user application compile time dependent >>>>>>> on >>>>>>> our code, better to use a proplist and then create the record >>>>>>> internally. (Yes "sslsocket" is a record due to legacy) >>>>>>> * The patch introduces new include file ssl_srp_primes.hrl I think >>>>>>> it >>>>>>> feels better to input such values as atoms and internaly uses >>>>>>> the >>>>>>> macros defined in this file, that would be more consistent with >>>>>>> the >>>>>>> rest of the API. >>>>>>> * Functions in crypto being named TLS something seems a little >>>>>>> strange, is this necessary?! >>>>>>> >>>>>>> " >>>>>>> Please correct this and give me a notice when it is done. >>>>>>> >>>>>>> BR Fredrik Gustafsson >>>>>>> Erlang OTP Team >>>>>>> On 10/12/2012 11:38 AM, Henrik Nord wrote: >>>>>>>> refetching >>>>>>>> >>>>>>>> On 10/12/2012 10:27 AM, Andreas Schultz wrote: >>>>>>>>> Hi Henrik, >>>>>>>>> >>>>>>>>> When I rebased my changes to the current master, a change crept in >>>>>>>>> that >>>>>>>>> shouldn't have: >>>>>>>>> >>>>>>>>> https://github.com/erlang/otp/commit/747ce9191f4dc7558e12e2b6e5696396392ffbd8 >>>>>>>>> >>>>>>>>> >>>>>>>>> I have removed it from my tree and pushed it. >>>>>>>>> >>>>>>>>> Andreas >>>>>>>>> >>>>>>>>> ----- Original Message ----- >>>>>>>>>> Thanks, I will refetch! >>>>>>>>>> On 10/11/2012 12:49 PM, Andreas Schultz wrote: >>>>>>>>>>> Hi, >>>>>>>>>>> >>>>>>>>>>> I have pushed a change that should fix the compile error. The >>>>>>>>>>> buffer has >>>>>>>>>>> a fixed length now. >>>>>>>>>>> >>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2 >>>>>>>>>>> >>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2.patch >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Andreas >>>>>>>>>>> >>>>>>>>>>> ----- Original Message ----- >>>>>>>>>>>> Does not compile on Windows. >>>>>>>>>>>> >>>>>>>>>>>> Function SHA1_Update_PAD in crypto.c is not correct. Arrays with >>>>>>>>>>>> dynamic >>>>>>>>>>>> size is not supported by the C standard we use. >>>>>>>>>>>> Use a static array instead, presuming that there is a reasonable >>>>>>>>>>>> upper >>>>>>>>>>>> limit of its size. >>>>>>>>>>>> >>>>>>>>>>>> /Sverker, Erlang/OTP >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Henrik Nord wrote: >>>>>>>>>>>>> Hi >>>>>>>>>>>>> >>>>>>>>>>>>> I have added your branch to 'master'pu' for testing. >>>>>>>>>>>>> Thank you for your contribution! >>>>>>>>>>>>> >>>>>>>>>>>>> On 10/04/2012 06:29 PM, Andreas Schultz wrote: >>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>> >>>>>>>>>>>>>> Tree is rebased onto latest master. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Andreas >>>>>>>>>>>>>> >>>>>>>>>>>>>> ----- Original Message ----- >>>>>>>>>>>>>>> Would you be so kind as to rebase this branch upon the latest >>>>>>>>>>>>>>> 'master' >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Thank you for your contribution! >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> On 09/26/2012 07:19 PM, Andreas Schultz wrote: >>>>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> I have implemented the more interesting parts of RFC 4279, >>>>>>>>>>>>>>>> RFC >>>>>>>>>>>>>>>> 5487 >>>>>>>>>>>>>>>> and RFC 5054 (aka TLS PSK and SRP ciphers). The use and >>>>>>>>>>>>>>>> usefulness >>>>>>>>>>>>>>>> of those ciphers is rather limited, the one notable exception >>>>>>>>>>>>>>>> being >>>>>>>>>>>>>>>> the eID server protocol for German national identity cards >>>>>>>>>>>>>>>> (nPA). >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> The test suite can only verify some PSK suites against >>>>>>>>>>>>>>>> openssl >>>>>>>>>>>>>>>> as >>>>>>>>>>>>>>>> currently no openssl version supports them all. There is >>>>>>>>>>>>>>>> patch >>>>>>>>>>>>>>>> that add some to openssl, but it has not been incorporated >>>>>>>>>>>>>>>> into >>>>>>>>>>>>>>>> upstream. GNU-TLS implements some more (but not all) PSK >>>>>>>>>>>>>>>> suites >>>>>>>>>>>>>>>> and I have manually tested interoperability. >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Patch info: >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> git fetch git://github.com/RoadRunnr/otp.git >>>>>>>>>>>>>>>> tls-psk-srp-suites >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Regards >>>>>>>>>>>>>>>> Andreas >>>>>>>>>>>>>>> -- >>>>>>>>>>>>>>> /Henrik Nord Erlang/OTP >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> /Henrik Nord Erlang/OTP >>>>>>>>>> >>>>>>>>>> >>> >> -- >> -- >> Dipl. Inform. >> Andreas Schultz >> >> email: as@REDACTED >> phone: +49-391-819099-224 >> mobil: +49-170-2226073 >> >> ------------------ managed broadband access ------------------ >> >> Travelping GmbH phone: +49-391-8190990 >> Roentgenstr. 13 fax: +49-391-819099299 >> D-39108 Magdeburg email: info@REDACTED >> GERMANY web: http://www.travelping.com >> >> Company Registration: HRB21276 Handelsregistergericht Chemnitz >> Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 >> -------------------------------------------------------------- >> >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://erlang.org/mailman/listinfo/erlang-patches >> Hello, Could you rebase this patch upon the current 'master' branch? Thanks, -- BR Fredrik Gustafsson Erlang OTP Team From aronisstav@REDACTED Fri Feb 15 17:28:55 2013 From: aronisstav@REDACTED (Stavros Aronis) Date: Fri, 15 Feb 2013 17:28:55 +0100 Subject: [erlang-patches] Dialyzer fixes: User defined types with same name and different arity and documentation inconsistencies Message-ID: Hi! Here is a patch that takes care of the following 2 issues from the past: http://erlang.org/pipermail/erlang-bugs/2013-January/003306.html http://erlang.org/pipermail/erlang-bugs/2012-November/003180.html git fetch git://github.com/aronisstav/otp.git dialyzer-types-arity Thanks for reporting! Stavros -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus@REDACTED Fri Feb 15 18:22:30 2013 From: magnus@REDACTED (Magnus Henoch) Date: Fri, 15 Feb 2013 17:22:30 +0000 Subject: [erlang-patches] Use "open" as default crash dump browser on Mac OS X Message-ID: On Mac OS X, "open" can be used to open a URL in the system's configured default browser: git fetch git://github.com/legoscia/otp.git cdv-osx-default-browser https://github.com/legoscia/otp/compare/erlang:master...legoscia:cdv-osx-default-browser https://github.com/legoscia/otp/compare/erlang:master...legoscia:cdv-osx-default-browser.patch Regards, Magnus From sean.mcevoy@REDACTED Thu Feb 14 23:50:48 2013 From: sean.mcevoy@REDACTED (sean mcevoy) Date: Thu, 14 Feb 2013 22:50:48 +0000 Subject: [erlang-patches] typo in mnesia documentation Message-ID: Hi All, Just found a minor typo in the mnesia documentation on page: http://www.erlang.org/doc/man/mnesia.html In the description of the function: dirty_update_counter I think the sentence: "If Key don't exits, a new record is created..." Should read: "If Key doesn't exist, a new record is created..." //Sean. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhssler@REDACTED Fri Feb 15 20:07:18 2013 From: mhssler@REDACTED (=?ISO-8859-1?Q?Martin_H=E4ssler?=) Date: Fri, 15 Feb 2013 20:07:18 +0100 Subject: [erlang-patches] Fix doc for ssh:connect Message-ID: A small fix of the ssh:connect doc in ssh.xml: git fetch git://github.com/mhssler/otp.git fix-ssh-connect-doc https://github.com/mhssler/otp/compare/erlang:maint...fix-ssh-connect-doc https://github.com/mhssler/otp/compare/erlang:maint...fix-ssh-connect-doc.patch -- Regards, /Martin From aschultz@REDACTED Sat Feb 16 12:04:31 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Sat, 16 Feb 2013 12:04:31 +0100 (CET) Subject: [erlang-patches] TLS: add PSK and SRP cipher suites In-Reply-To: <511DF39A.2030109@erlang.org> References: <243075147.49636.1348679990473.JavaMail.root@tpip.net> <554152829.218007.1358277582556.JavaMail.root@tpip.net> <50F66C6C.8000108@erlang.org> <1636541866.231783.1358338828351.JavaMail.root@tpip.net> <50FD3E19.4050309@erlang.org> <397956462.337258.1358774184655.JavaMail.root@tpip.net> <886771634.835678.1360743548656.JavaMail.root@tpip.net> <511DF39A.2030109@erlang.org> Message-ID: <1100135309.938689.1361012671813.JavaMail.root@tpip.net> Hi, Patch rebased on current master. Andreas ----- Original Message ----- > On 02/13/2013 09:19 AM, Andreas Schultz wrote: > > Hi, > > > > Klaus Trainer @ github found some spelling errors. I have pushed a fixed > > version. Please refetch. > > > > Thanks > > Andreas > > > > ----- Original Message ----- > >> Hi, > >> > >> patch is rebased. > >> > >> Andreas > >> > >> ----- Original Message ----- > >>> Hello, > >>> Could you rebase this patch upon the current 'master' branch? > >>> > >>> BR Fredrik Gustafsson > >>> Erlang OTP Team > >>> On 01/16/2013 01:20 PM, Andreas Schultz wrote: > >>>> Hi Fredrik, > >>>> > >>>> I just realized that I'm still using the ?line macro in the new SRP > >>>> crypto > >>>> test. > >>>> > >>>> Should I remove it? > >>>> > >>>> Andreas > >>>> > >>>> ----- Original Message ----- > >>>>> Thanks, > >>>>> I have re-fetched and building it now with the rest of the patches in > >>>>> the 'master-pu' branch. > >>>>> > >>>>> BR Fredrik Gustafsson > >>>>> Erlang OTP Team > >>>>> On 01/15/2013 08:19 PM, Andreas Schultz wrote: > >>>>>> Hi, > >>>>>> > >>>>>> I have address the issues: > >>>>>> > >>>>>> * documentation for SSL API options added > >>>>>> * header files internalized > >>>>>> * crypto function generalized and support for multiple SRP > >>>>>> variants > >>>>>> > >>>>>> New version can be found here: > >>>>>> > >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites > >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch > >>>>>> > >>>>>> > >>>>>> Even if the PSK and SRP do not make it into R16, could you consider > >>>>>> the > >>>>>> first two > >>>>>> changesets from this series, please? They are mostly code > >>>>>> consolidations, > >>>>>> making > >>>>>> adding new key exchange algorithms much simpler. > >>>>>> > >>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a > >>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a.patch > >>>>>> > >>>>>> Andreas > >>>>>> > >>>>>> ----- Original Message ----- > >>>>>>> Hello Andreas, > >>>>>>> Your patch has finally been into review and the response was: > >>>>>>> " > >>>>>>> > >>>>>>> * The patch introduces new API options without documenting them. > >>>>>>> * The patch introduces new include file ssl_srp.hrl that I think > >>>>>>> shall > >>>>>>> be internal and put in src. It is undesirable to have records > >>>>>>> in > >>>>>>> the > >>>>>>> user API as it makes the user application compile time > >>>>>>> dependent > >>>>>>> on > >>>>>>> our code, better to use a proplist and then create the record > >>>>>>> internally. (Yes "sslsocket" is a record due to legacy) > >>>>>>> * The patch introduces new include file ssl_srp_primes.hrl I > >>>>>>> think > >>>>>>> it > >>>>>>> feels better to input such values as atoms and internaly uses > >>>>>>> the > >>>>>>> macros defined in this file, that would be more consistent > >>>>>>> with > >>>>>>> the > >>>>>>> rest of the API. > >>>>>>> * Functions in crypto being named TLS something seems a little > >>>>>>> strange, is this necessary?! > >>>>>>> > >>>>>>> " > >>>>>>> Please correct this and give me a notice when it is done. > >>>>>>> > >>>>>>> BR Fredrik Gustafsson > >>>>>>> Erlang OTP Team > >>>>>>> On 10/12/2012 11:38 AM, Henrik Nord wrote: > >>>>>>>> refetching > >>>>>>>> > >>>>>>>> On 10/12/2012 10:27 AM, Andreas Schultz wrote: > >>>>>>>>> Hi Henrik, > >>>>>>>>> > >>>>>>>>> When I rebased my changes to the current master, a change crept in > >>>>>>>>> that > >>>>>>>>> shouldn't have: > >>>>>>>>> > >>>>>>>>> https://github.com/erlang/otp/commit/747ce9191f4dc7558e12e2b6e5696396392ffbd8 > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> I have removed it from my tree and pushed it. > >>>>>>>>> > >>>>>>>>> Andreas > >>>>>>>>> > >>>>>>>>> ----- Original Message ----- > >>>>>>>>>> Thanks, I will refetch! > >>>>>>>>>> On 10/11/2012 12:49 PM, Andreas Schultz wrote: > >>>>>>>>>>> Hi, > >>>>>>>>>>> > >>>>>>>>>>> I have pushed a change that should fix the compile error. The > >>>>>>>>>>> buffer has > >>>>>>>>>>> a fixed length now. > >>>>>>>>>>> > >>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2 > >>>>>>>>>>> > >>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2.patch > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> Andreas > >>>>>>>>>>> > >>>>>>>>>>> ----- Original Message ----- > >>>>>>>>>>>> Does not compile on Windows. > >>>>>>>>>>>> > >>>>>>>>>>>> Function SHA1_Update_PAD in crypto.c is not correct. Arrays with > >>>>>>>>>>>> dynamic > >>>>>>>>>>>> size is not supported by the C standard we use. > >>>>>>>>>>>> Use a static array instead, presuming that there is a reasonable > >>>>>>>>>>>> upper > >>>>>>>>>>>> limit of its size. > >>>>>>>>>>>> > >>>>>>>>>>>> /Sverker, Erlang/OTP > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> Henrik Nord wrote: > >>>>>>>>>>>>> Hi > >>>>>>>>>>>>> > >>>>>>>>>>>>> I have added your branch to 'master'pu' for testing. > >>>>>>>>>>>>> Thank you for your contribution! > >>>>>>>>>>>>> > >>>>>>>>>>>>> On 10/04/2012 06:29 PM, Andreas Schultz wrote: > >>>>>>>>>>>>>> Hi, > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> Tree is rebased onto latest master. > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> Andreas > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> ----- Original Message ----- > >>>>>>>>>>>>>>> Would you be so kind as to rebase this branch upon the latest > >>>>>>>>>>>>>>> 'master' > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> Thank you for your contribution! > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> On 09/26/2012 07:19 PM, Andreas Schultz wrote: > >>>>>>>>>>>>>>>> Hi, > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> I have implemented the more interesting parts of RFC 4279, > >>>>>>>>>>>>>>>> RFC > >>>>>>>>>>>>>>>> 5487 > >>>>>>>>>>>>>>>> and RFC 5054 (aka TLS PSK and SRP ciphers). The use and > >>>>>>>>>>>>>>>> usefulness > >>>>>>>>>>>>>>>> of those ciphers is rather limited, the one notable > >>>>>>>>>>>>>>>> exception > >>>>>>>>>>>>>>>> being > >>>>>>>>>>>>>>>> the eID server protocol for German national identity cards > >>>>>>>>>>>>>>>> (nPA). > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> The test suite can only verify some PSK suites against > >>>>>>>>>>>>>>>> openssl > >>>>>>>>>>>>>>>> as > >>>>>>>>>>>>>>>> currently no openssl version supports them all. There is > >>>>>>>>>>>>>>>> patch > >>>>>>>>>>>>>>>> that add some to openssl, but it has not been incorporated > >>>>>>>>>>>>>>>> into > >>>>>>>>>>>>>>>> upstream. GNU-TLS implements some more (but not all) PSK > >>>>>>>>>>>>>>>> suites > >>>>>>>>>>>>>>>> and I have manually tested interoperability. > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> Patch info: > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> git fetch git://github.com/RoadRunnr/otp.git > >>>>>>>>>>>>>>>> tls-psk-srp-suites > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>> Regards > >>>>>>>>>>>>>>>> Andreas > >>>>>>>>>>>>>>> -- > >>>>>>>>>>>>>>> /Henrik Nord Erlang/OTP > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> > >>>>>>>>>> -- > >>>>>>>>>> /Henrik Nord Erlang/OTP > >>>>>>>>>> > >>>>>>>>>> > >>> > >> -- > >> -- > >> Dipl. Inform. > >> Andreas Schultz > >> > >> email: as@REDACTED > >> phone: +49-391-819099-224 > >> mobil: +49-170-2226073 > >> > >> ------------------ managed broadband access ------------------ > >> > >> Travelping GmbH phone: +49-391-8190990 > >> Roentgenstr. 13 fax: +49-391-819099299 > >> D-39108 Magdeburg email: info@REDACTED > >> GERMANY web: http://www.travelping.com > >> > >> Company Registration: HRB21276 Handelsregistergericht Chemnitz > >> Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 > >> -------------------------------------------------------------- > >> > >> _______________________________________________ > >> erlang-patches mailing list > >> erlang-patches@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-patches > >> > Hello, > Could you rebase this patch upon the current 'master' branch? > Thanks, > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From andrey@REDACTED Sat Feb 16 13:26:37 2013 From: andrey@REDACTED (Andrey Tsirulev) Date: Sat, 16 Feb 2013 16:26:37 +0400 Subject: [erlang-patches] observer tv crash on formatting improper lists Message-ID: <511F7AFD.9040208@artplant.no> Hi, Observer table viewer crashes when attempts to display a term containing improper lists (e.g. dict). Quick way to reproduce: run ets:insert(ets:new(test,[]), {1,[h|t]}). then start observer and open test ETS in table viewer. Observer will crash. git fetch git://github.com/artplant/otp.git observer_tv_improper_lists https://github.com/artplant/otp/compare/erlang:master...observer_tv_improper_lists https://github.com/artplant/otp/compare/erlang:master...observer_tv_improper_lists.patch Regards, Andrey From michael.santos@REDACTED Sun Feb 17 00:23:53 2013 From: michael.santos@REDACTED (Michael Santos) Date: Sat, 16 Feb 2013 18:23:53 -0500 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration Message-ID: <20130216232353.GA27511@ioctl> Allow IPv6 nodes to register with and query epmd. On systems with IPv6 support: * epmd listens on the IPv4 and IPv6 ANY or loopback sockets * the epmd cli client connects to epmd using the IPv6 loopback * distributed nodes started with "-proto_dist inet6_tcp" will register with epmd over IPv6 --- erts/doc/src/epmd.xml | 2 +- erts/doc/src/erl.xml | 22 +++++ erts/epmd/src/epmd.c | 6 +- erts/epmd/src/epmd_cli.c | 11 ++- erts/epmd/src/epmd_int.h | 59 ++++++++---- erts/epmd/src/epmd_srv.c | 184 +++++++++++++++++++++++++------------ erts/epmd/test/epmd_SUITE.erl | 33 ++++++- lib/kernel/src/erl_epmd.erl | 18 ++-- lib/kernel/src/inet6_tcp_dist.erl | 2 +- 9 files changed, 244 insertions(+), 93 deletions(-) diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml index 3e70054..3c9313e 100644 --- a/erts/doc/src/epmd.xml +++ b/erts/doc/src/epmd.xml @@ -36,7 +36,7 @@

Erlang Port Mapper Daemon

- +

Starts the port mapper daemon

diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index f354d68..aebf4ff 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -381,6 +381,28 @@ similar to . See code(3).

+ + +

Specify a protocol for Erlang distribution.

+ + inet_tcp + +

TCP over IPv4 (the default)

+
+ inet_ssl + +

distribution over SSL

+
+ inet6_tcp + +

TCP over IPv6

+
+
+

For example, to start up IPv6 distributed nodes:

+
+% erl -name test@REDACTED -proto_dist inet6_tcp
+
+

Starts Erlang with a remote shell connected to .

diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c index 94bb74c..0789cc3 100644 --- a/erts/epmd/src/epmd.c +++ b/erts/epmd/src/epmd.c @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) for (fd = 0; fd < g->max_conn ; fd++) /* close all files ... */ close(fd); /* Syslog on linux will try to write to whatever if we dont - inform it of that the log is closed. */ + inform it that the log is closed. */ closelog(); - /* These chouldn't be needed but for safety... */ + /* These shouldn't be needed but for safety... */ open("/dev/null", O_RDONLY); /* Order is important! */ open("/dev/null", O_WRONLY); @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) close(1); close(2); - /* These chouldn't be needed but for safety... */ + /* These shouldn't be needed but for safety... */ open("nul", O_RDONLY); open("nul", O_WRONLY); diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c index 8817bde..a0dd890 100644 --- a/erts/epmd/src/epmd_cli.c +++ b/erts/epmd/src/epmd_cli.c @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) static int conn_to_epmd(EpmdVars *g) { struct EPMD_SOCKADDR_IN address; + size_t salen = 0; int connect_sock; connect_sock = socket(FAMILY, SOCK_STREAM, 0); @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) { /* store port number in unsigned short */ unsigned short sport = g->port; - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(address, in6addr_loopback, sport); + salen = sizeof(struct sockaddr_in6); +#else + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); + salen = sizeof(struct sockaddr_in); +#endif } - if (connect(connect_sock, (struct sockaddr*)&address, sizeof address) < 0) + if (connect(connect_sock, (struct sockaddr*)&address, salen) < 0) goto error; return connect_sock; diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h index ac354dc..b16c137 100644 --- a/erts/epmd/src/epmd_int.h +++ b/erts/epmd/src/epmd_int.h @@ -49,6 +49,7 @@ # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H # include # endif +# include # include # include #endif @@ -165,33 +166,53 @@ /* ************************************************************************ */ /* Macros that let us use IPv6 */ -#if defined(HAVE_IN6) && defined(AF_INET6) && defined(EPMD6) +#if HAVE_IN6 +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY +# if HAVE_DECL_IN6ADDR_ANY_INIT +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; +# else +static const struct in6_addr in6addr_any = + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; +# endif /* HAVE_IN6ADDR_ANY_INIT */ +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ + +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT +static const struct in6_addr in6addr_loopback = + { { IN6ADDR_LOOPBACK_INIT } }; +# else +static const struct in6_addr in6addr_loopback = + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ +#endif /* HAVE_IN6 */ + +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) + +#if defined(HAVE_IN6) && defined(AF_INET6) -#define EPMD_SOCKADDR_IN sockaddr_in6 -#define EPMD_IN_ADDR in6_addr -#define EPMD_S_ADDR s6_addr -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr -#define EPMD_ADDR_ANY in6addr_any.s6_addr +#define EPMD_SOCKADDR_IN sockaddr_storage #define FAMILY AF_INET6 -#define SET_ADDR(dst, addr, port) do { \ - memset((char*)&(dst), 0, sizeof(dst)); \ - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ - (dst).sin6_family = AF_INET6; \ - (dst).sin6_flowinfo = 0; \ - (dst).sin6_port = htons(port); \ +#define SET_ADDR6(dst, addr, port) do { \ + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ + memset(sa, 0, sizeof(dst)); \ + sa->sin6_family = AF_INET6; \ + sa->sin6_addr = (addr); \ + sa->sin6_port = htons(port); \ } while(0) -#define IS_ADDR_LOOPBACK(addr) \ - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) +#define SET_ADDR(dst, addr, port) do { \ + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ + memset(sa, 0, sizeof(dst)); \ + sa->sin_family = AF_INET; \ + sa->sin_addr.s_addr = (addr); \ + sa->sin_port = htons(port); \ + } while(0) #else /* Not IP v6 */ #define EPMD_SOCKADDR_IN sockaddr_in -#define EPMD_IN_ADDR in_addr -#define EPMD_S_ADDR s_addr -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) -#define EPMD_ADDR_ANY htonl(INADDR_ANY) #define FAMILY AF_INET #define SET_ADDR(dst, addr, port) do { \ @@ -201,8 +222,6 @@ (dst).sin_port = htons(port); \ } while(0) -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) - #endif /* Not IP v6 */ /* ************************************************************************ */ diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c index 90df7cc..1c34f5f 100644 --- a/erts/epmd/src/epmd_srv.c +++ b/erts/epmd/src/epmd_srv.c @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); static Connection *conn_init(EpmdVars*); static int conn_open(EpmdVars*,int); +static int conn_local_peer_check(EpmdVars*, int); static int conn_close_fd(EpmdVars*,int); static void node_init(EpmdVars*); @@ -200,7 +201,7 @@ void run(EpmdVars *g) { struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; int listensock[MAX_LISTEN_SOCKETS]; - int num_sockets; + int num_sockets = 0; int i; int opt; unsigned short sport = g->port; @@ -213,64 +214,82 @@ void run(EpmdVars *g) if (g->addresses != NULL && /* String contains non-separator characters if: */ g->addresses[strspn(g->addresses," ,")] != '\000') { - char *tmp; - char *token; - int loopback_ok = 0; + char *tmp = NULL; + char *token = NULL; + + /* Always listen on the loopback. */ + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); + num_sockets++; +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); + num_sockets++; +#endif - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) + if ((tmp = strdup(g->addresses)) == NULL) { dbg_perror(g,"cannot allocate memory"); epmd_cleanup_exit(g,1); } - strcpy(tmp,g->addresses); - for(token = strtok(tmp,", "), num_sockets = 0; + for(token = strtok(tmp,", "); token != NULL; - token = strtok(NULL,", "), num_sockets++) + token = strtok(NULL,", ")) { - struct EPMD_IN_ADDR addr; -#ifdef HAVE_INET_PTON - int ret; + struct in_addr addr; +#if defined(HAVE_IN6) && defined(AF_INET6) + struct in6_addr addr6; + struct sockaddr_storage *sa = &iserv_addr[num_sockets]; - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) + if (inet_pton(AF_INET,token,&addr) == 1) { - dbg_perror(g,"cannot convert IP address to network format"); - epmd_cleanup_exit(g,1); + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); + } + else if (inet_pton(AF_INET6,token,&addr6) == 1) + { + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); + } + else +#else + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) + { + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); } - else if (ret == 0) -#elif !defined(EPMD6) - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) + else #endif { dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); epmd_cleanup_exit(g,1); } +#if defined(HAVE_IN6) && defined(AF_INET6) + if (sa->ss_family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&addr6)) + continue; + + if (sa->ss_family == AF_INET) +#endif if (IS_ADDR_LOOPBACK(addr)) - loopback_ok = 1; + continue; - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) + num_sockets++; + + if (num_sockets >= MAX_LISTEN_SOCKETS) { dbg_tty_printf(g,0,"cannot listen on more than %d IP addresses", MAX_LISTEN_SOCKETS); epmd_cleanup_exit(g,1); } - - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); } free(tmp); - - if (!loopback_ok) - { - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); - num_sockets++; - } } else { - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); - num_sockets = 1; + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); + num_sockets++; +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); + num_sockets++; +#endif } #if !defined(__WIN32__) @@ -291,13 +310,33 @@ void run(EpmdVars *g) for (i = 0; i < num_sockets; i++) { - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0)) < 0) + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; +#if defined(HAVE_IN6) && defined(AF_INET6) + size_t salen = (sa->sa_family == AF_INET6 ? + sizeof(struct sockaddr_in6) : + sizeof(struct sockaddr_in)); +#else + size_t salen = sizeof(struct sockaddr_in); +#endif + + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0)) < 0) { dbg_perror(g,"error opening stream socket"); epmd_cleanup_exit(g,1); } g->listenfd[i] = listensock[i]; - + +#if defined(HAVE_IN6) && defined(AF_INET6) + opt = 1; + if (sa->sa_family == AF_INET6 && + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, + sizeof(opt)) <0) + { + dbg_perror(g,"can't set IPv6 only socket option"); + epmd_cleanup_exit(g,1); + } +#endif + /* * Note that we must not enable the SO_REUSEADDR on Windows, * because addresses will be reused even if they are still in use. @@ -329,8 +368,7 @@ void run(EpmdVars *g) dbg_perror(g,"failed to set non-blocking mode of listening socket %d", listensock[i]); - if (bind(listensock[i], (struct sockaddr*) &iserv_addr[i], - sizeof(iserv_addr[i])) < 0) + if (bind(listensock[i], (struct sockaddr*) &iserv_addr[i], salen) < 0) { if (errno == EADDRINUSE) { @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) for (i = 0; i < g->max_conn; i++) { if (g->conn[i].open == EPMD_FALSE) { - struct sockaddr_in si; - struct sockaddr_in di; -#ifdef HAVE_SOCKLEN_T - socklen_t st; -#else - int st; -#endif - st = sizeof(si); - g->active_conn++; s = &g->conn[i]; @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) s->open = EPMD_TRUE; s->keep = EPMD_FALSE; - /* Determine if connection is from localhost */ - if (getpeername(s->fd,(struct sockaddr*) &si,&st) || - st < sizeof(si)) { - /* Failure to get peername is regarded as non local host */ - s->local_peer = EPMD_FALSE; - } else { - /* Only 127.x.x.x and connections from the host's IP address - allowed, no false positives */ - s->local_peer = - (((((unsigned) ntohl(si.sin_addr.s_addr)) & 0xFF000000U) == - 0x7F000000U) || - (getsockname(s->fd,(struct sockaddr*) &di,&st) ? - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); - } + s->local_peer = conn_local_peer_check(g, s->fd); dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : "Non-local peer connected"); @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) s->got = 0; s->mod_time = current_time(g); /* Note activity */ - s->buf = (char *)malloc(INBUF_SIZE); + s->buf = malloc(INBUF_SIZE); if (s->buf == NULL) { dbg_printf(g,0,"epmd: Insufficient memory"); @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) return EPMD_FALSE; } +static int conn_local_peer_check(EpmdVars *g, int fd) +{ + struct EPMD_SOCKADDR_IN si; + struct EPMD_SOCKADDR_IN di; + + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; + +#if defined(HAVE_IN6) && defined(AF_INET6) + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; +#endif + +#ifdef HAVE_SOCKLEN_T + socklen_t st; +#else + int st; +#endif + + st = sizeof(si); + + /* Determine if connection is from localhost */ + if (getpeername(fd,(struct sockaddr*) &si,&st) || + st > sizeof(si)) { + /* Failure to get peername is regarded as non local host */ + return EPMD_FALSE; + } + + /* Only 127.x.x.x and connections from the host's IP address + allowed, no false positives */ +#if defined(HAVE_IN6) && defined(AF_INET6) + if (si.ss_family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) + return EPMD_TRUE; + + if (si.ss_family == AF_INET) +#endif + if ((((unsigned) ntohl(si4->sin_addr.s_addr)) & 0xFF000000U) == + 0x7F000000U) + return EPMD_TRUE; + + if (getsockname(fd,(struct sockaddr*) &di,&st)) + return EPMD_FALSE; + +#if defined(HAVE_IN6) && defined(AF_INET6) + if (si.ss_family == AF_INET6) + return IN6_ARE_ADDR_EQUAL( &(si6->sin6_addr), &(di6->sin6_addr)); + if (si.ss_family == AF_INET) +#endif + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; +#if defined(HAVE_IN6) && defined(AF_INET6) + return EPMD_FALSE; +#endif +} + static int conn_close_fd(EpmdVars *g,int fd) { int i; diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl index cc24a55..ddfe5ab 100644 --- a/erts/epmd/test/epmd_SUITE.erl +++ b/erts/epmd/test/epmd_SUITE.erl @@ -42,6 +42,7 @@ -export( [ register_name/1, + register_name_ipv6/1, register_names_1/1, register_names_2/1, register_duplicate_name/1, @@ -108,7 +109,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [register_name, register_names_1, register_names_2, + [register_name, register_name_ipv6, + register_names_1, register_names_2, register_duplicate_name, unicode_name, long_unicode_name, get_port_nr, slow_get_port_nr, unregister_others_name_1, unregister_others_name_2, @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> ?line ok = close(Sock), % Unregister ok. +register_name_ipv6(doc) -> + ["Register a name over IPv6"]; +register_name_ipv6(suite) -> + []; +register_name_ipv6(Config) when is_list(Config) -> + % Test if the host has an IPv6 loopback address + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), + case Res of + {ok,LSock} -> + gen_tcp:close(LSock), + ?line ok = epmdrun(), + ?line {ok,Sock} = register_node6("foobar6"), + ?line ok = close(Sock), % Unregister + ok; + _Error -> + {skip, "Host does not have an IPv6 loopback address"} + end. + register_names_1(doc) -> ["Register and unregister two nodes"]; register_names_1(suite) -> @@ -238,13 +258,18 @@ register_node(Name) -> register_node(Name,Port) -> register_node_v2(Port,$M,0,5,5,Name,""). +register_node6(Name) -> + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). + register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, Name, Extra). +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> Utf8Name = unicode:characters_to_binary(Name), Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, put16(HVsn), put16(LVsn), put16(size(Utf8Name)), binary_to_list(Utf8Name), size16(Extra), Extra], - case send_req(Req) of + case send_req(Req, Addr) of {ok,Sock} -> case recv(Sock,4) of {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> end. send_req(Req) -> - case connect() of + send_req(Req, "localhost"). +send_req(Req, Addr) -> + case connect(Addr) of {ok,Sock} -> case send(Sock, [size16(Req), Req]) of ok -> diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl index 91af49f..21a3dec 100644 --- a/lib/kernel/src/erl_epmd.erl +++ b/lib/kernel/src/erl_epmd.erl @@ -31,7 +31,7 @@ %% External exports -export([start/0, start_link/0, stop/0, port_please/2, port_please/3, names/0, names/1, - register_node/2, open/0, open/1, open/2]). + register_node/2, register_node/3, open/0, open/1, open/2]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -106,7 +106,9 @@ names1(HostName) -> register_node(Name, PortNo) -> - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). + register_node(Name, PortNo, inet). +register_node(Name, PortNo, Family) -> + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity). %%%---------------------------------------------------------------------- %%% Callback functions from gen_server @@ -124,10 +126,10 @@ init(_) -> -spec handle_call(calls(), term(), state()) -> {'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}. -handle_call({register, Name, PortNo}, _From, State) -> +handle_call({register, Name, PortNo, Family}, _From, State) -> case State#state.socket of P when P < 0 -> - case do_register_node(Name, PortNo) of + case do_register_node(Name, PortNo, Family) of {alive, Socket, Creation} -> S = State#state{socket = Socket, port_no = PortNo, @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) -> close(Socket) -> gen_tcp:close(Socket). -do_register_node(NodeName, TcpPort) -> - case open() of +do_register_node(NodeName, TcpPort, Family) -> + Localhost = case Family of + inet -> open({127,0,0,1}); + inet6 -> open({0,0,0,0,0,0,0,1}) + end, + case Localhost of {ok, Socket} -> Name = to_string(NodeName), Extra = "", diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl index 2315a56..bba4d87 100644 --- a/lib/kernel/src/inet6_tcp_dist.erl +++ b/lib/kernel/src/inet6_tcp_dist.erl @@ -71,7 +71,7 @@ listen(Name) -> {ok, Socket} -> TcpAddress = get_tcp_address(Socket), {_,Port} = TcpAddress#net_address.address, - case erl_epmd:register_node(Name, Port) of + case erl_epmd:register_node(Name, Port, inet6) of {ok, Creation} -> {ok, {Socket, TcpAddress, Creation}}; Error -> -- 1.7.9.5 From fredrik@REDACTED Mon Feb 18 10:04:01 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 10:04:01 +0100 Subject: [erlang-patches] Dialyzer fixes: User defined types with same name and different arity and documentation inconsistencies In-Reply-To: References: Message-ID: <5121EE81.2010805@erlang.org> On 02/15/2013 05:28 PM, Stavros Aronis wrote: > Hi! > > Here is a patch that takes care of the following 2 issues from the past: > > http://erlang.org/pipermail/erlang-bugs/2013-January/003306.html > http://erlang.org/pipermail/erlang-bugs/2012-November/003180.html > > git fetch git://github.com/aronisstav/otp.git > dialyzer-types-arity > > Thanks for reporting! > > Stavros > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Currently cooking in the 'master-pu' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Mon Feb 18 10:04:39 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 10:04:39 +0100 Subject: [erlang-patches] Use "open" as default crash dump browser on Mac OS X In-Reply-To: References: Message-ID: <5121EEA7.4030702@erlang.org> On 02/15/2013 06:22 PM, Magnus Henoch wrote: > On Mac OS X, "open" can be used to open a URL in the system's configured > default browser: > > git fetch git://github.com/legoscia/otp.git cdv-osx-default-browser > > https://github.com/legoscia/otp/compare/erlang:master...legoscia:cdv-osx-default-browser > https://github.com/legoscia/otp/compare/erlang:master...legoscia:cdv-osx-default-browser.patch > > Regards, > Magnus > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Fetched. Thanks. -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 18 10:05:20 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 10:05:20 +0100 Subject: [erlang-patches] Fix doc for ssh:connect In-Reply-To: References: Message-ID: <5121EED0.20701@erlang.org> On 02/15/2013 08:07 PM, Martin H?ssler wrote: > A small fix of the ssh:connect doc in ssh.xml: > > git fetch git://github.com/mhssler/otp.git fix-ssh-connect-doc > > https://github.com/mhssler/otp/compare/erlang:maint...fix-ssh-connect-doc > https://github.com/mhssler/otp/compare/erlang:maint...fix-ssh-connect-doc.patch > > -- > Regards, > /Martin > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello, Currently cooking in the 'master-pu' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 18 10:06:56 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 10:06:56 +0100 Subject: [erlang-patches] TLS: add PSK and SRP cipher suites In-Reply-To: <1100135309.938689.1361012671813.JavaMail.root@tpip.net> References: <243075147.49636.1348679990473.JavaMail.root@tpip.net> <554152829.218007.1358277582556.JavaMail.root@tpip.net> <50F66C6C.8000108@erlang.org> <1636541866.231783.1358338828351.JavaMail.root@tpip.net> <50FD3E19.4050309@erlang.org> <397956462.337258.1358774184655.JavaMail.root@tpip.net> <886771634.835678.1360743548656.JavaMail.root@tpip.net> <511DF39A.2030109@erlang.org> <1100135309.938689.1361012671813.JavaMail.root@tpip.net> Message-ID: <5121EF30.5030508@erlang.org> On 02/16/2013 12:04 PM, Andreas Schultz wrote: > Hi, > > Patch rebased on current master. > > Andreas > > ----- Original Message ----- >> On 02/13/2013 09:19 AM, Andreas Schultz wrote: >>> Hi, >>> >>> Klaus Trainer @ github found some spelling errors. I have pushed a fixed >>> version. Please refetch. >>> >>> Thanks >>> Andreas >>> >>> ----- Original Message ----- >>>> Hi, >>>> >>>> patch is rebased. >>>> >>>> Andreas >>>> >>>> ----- Original Message ----- >>>>> Hello, >>>>> Could you rebase this patch upon the current 'master' branch? >>>>> >>>>> BR Fredrik Gustafsson >>>>> Erlang OTP Team >>>>> On 01/16/2013 01:20 PM, Andreas Schultz wrote: >>>>>> Hi Fredrik, >>>>>> >>>>>> I just realized that I'm still using the ?line macro in the new SRP >>>>>> crypto >>>>>> test. >>>>>> >>>>>> Should I remove it? >>>>>> >>>>>> Andreas >>>>>> >>>>>> ----- Original Message ----- >>>>>>> Thanks, >>>>>>> I have re-fetched and building it now with the rest of the patches in >>>>>>> the 'master-pu' branch. >>>>>>> >>>>>>> BR Fredrik Gustafsson >>>>>>> Erlang OTP Team >>>>>>> On 01/15/2013 08:19 PM, Andreas Schultz wrote: >>>>>>>> Hi, >>>>>>>> >>>>>>>> I have address the issues: >>>>>>>> >>>>>>>> * documentation for SSL API options added >>>>>>>> * header files internalized >>>>>>>> * crypto function generalized and support for multiple SRP >>>>>>>> variants >>>>>>>> >>>>>>>> New version can be found here: >>>>>>>> >>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites >>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch >>>>>>>> >>>>>>>> >>>>>>>> Even if the PSK and SRP do not make it into R16, could you consider >>>>>>>> the >>>>>>>> first two >>>>>>>> changesets from this series, please? They are mostly code >>>>>>>> consolidations, >>>>>>>> making >>>>>>>> adding new key exchange algorithms much simpler. >>>>>>>> >>>>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a >>>>>>>> https://github.com/RoadRunnr/otp/compare/master...cf4512a.patch >>>>>>>> >>>>>>>> Andreas >>>>>>>> >>>>>>>> ----- Original Message ----- >>>>>>>>> Hello Andreas, >>>>>>>>> Your patch has finally been into review and the response was: >>>>>>>>> " >>>>>>>>> >>>>>>>>> * The patch introduces new API options without documenting them. >>>>>>>>> * The patch introduces new include file ssl_srp.hrl that I think >>>>>>>>> shall >>>>>>>>> be internal and put in src. It is undesirable to have records >>>>>>>>> in >>>>>>>>> the >>>>>>>>> user API as it makes the user application compile time >>>>>>>>> dependent >>>>>>>>> on >>>>>>>>> our code, better to use a proplist and then create the record >>>>>>>>> internally. (Yes "sslsocket" is a record due to legacy) >>>>>>>>> * The patch introduces new include file ssl_srp_primes.hrl I >>>>>>>>> think >>>>>>>>> it >>>>>>>>> feels better to input such values as atoms and internaly uses >>>>>>>>> the >>>>>>>>> macros defined in this file, that would be more consistent >>>>>>>>> with >>>>>>>>> the >>>>>>>>> rest of the API. >>>>>>>>> * Functions in crypto being named TLS something seems a little >>>>>>>>> strange, is this necessary?! >>>>>>>>> >>>>>>>>> " >>>>>>>>> Please correct this and give me a notice when it is done. >>>>>>>>> >>>>>>>>> BR Fredrik Gustafsson >>>>>>>>> Erlang OTP Team >>>>>>>>> On 10/12/2012 11:38 AM, Henrik Nord wrote: >>>>>>>>>> refetching >>>>>>>>>> >>>>>>>>>> On 10/12/2012 10:27 AM, Andreas Schultz wrote: >>>>>>>>>>> Hi Henrik, >>>>>>>>>>> >>>>>>>>>>> When I rebased my changes to the current master, a change crept in >>>>>>>>>>> that >>>>>>>>>>> shouldn't have: >>>>>>>>>>> >>>>>>>>>>> https://github.com/erlang/otp/commit/747ce9191f4dc7558e12e2b6e5696396392ffbd8 >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> I have removed it from my tree and pushed it. >>>>>>>>>>> >>>>>>>>>>> Andreas >>>>>>>>>>> >>>>>>>>>>> ----- Original Message ----- >>>>>>>>>>>> Thanks, I will refetch! >>>>>>>>>>>> On 10/11/2012 12:49 PM, Andreas Schultz wrote: >>>>>>>>>>>>> Hi, >>>>>>>>>>>>> >>>>>>>>>>>>> I have pushed a change that should fix the compile error. The >>>>>>>>>>>>> buffer has >>>>>>>>>>>>> a fixed length now. >>>>>>>>>>>>> >>>>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2 >>>>>>>>>>>>> >>>>>>>>>>>>> https://github.com/RoadRunnr/otp/commit/ad73b09d948d0414132bfca2f67ff0de729fa7b2.patch >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Andreas >>>>>>>>>>>>> >>>>>>>>>>>>> ----- Original Message ----- >>>>>>>>>>>>>> Does not compile on Windows. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Function SHA1_Update_PAD in crypto.c is not correct. Arrays with >>>>>>>>>>>>>> dynamic >>>>>>>>>>>>>> size is not supported by the C standard we use. >>>>>>>>>>>>>> Use a static array instead, presuming that there is a reasonable >>>>>>>>>>>>>> upper >>>>>>>>>>>>>> limit of its size. >>>>>>>>>>>>>> >>>>>>>>>>>>>> /Sverker, Erlang/OTP >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> Henrik Nord wrote: >>>>>>>>>>>>>>> Hi >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> I have added your branch to 'master'pu' for testing. >>>>>>>>>>>>>>> Thank you for your contribution! >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> On 10/04/2012 06:29 PM, Andreas Schultz wrote: >>>>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Tree is rebased onto latest master. >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Andreas >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> ----- Original Message ----- >>>>>>>>>>>>>>>>> Would you be so kind as to rebase this branch upon the latest >>>>>>>>>>>>>>>>> 'master' >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> Thank you for your contribution! >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> On 09/26/2012 07:19 PM, Andreas Schultz wrote: >>>>>>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> I have implemented the more interesting parts of RFC 4279, >>>>>>>>>>>>>>>>>> RFC >>>>>>>>>>>>>>>>>> 5487 >>>>>>>>>>>>>>>>>> and RFC 5054 (aka TLS PSK and SRP ciphers). The use and >>>>>>>>>>>>>>>>>> usefulness >>>>>>>>>>>>>>>>>> of those ciphers is rather limited, the one notable >>>>>>>>>>>>>>>>>> exception >>>>>>>>>>>>>>>>>> being >>>>>>>>>>>>>>>>>> the eID server protocol for German national identity cards >>>>>>>>>>>>>>>>>> (nPA). >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> The test suite can only verify some PSK suites against >>>>>>>>>>>>>>>>>> openssl >>>>>>>>>>>>>>>>>> as >>>>>>>>>>>>>>>>>> currently no openssl version supports them all. There is >>>>>>>>>>>>>>>>>> patch >>>>>>>>>>>>>>>>>> that add some to openssl, but it has not been incorporated >>>>>>>>>>>>>>>>>> into >>>>>>>>>>>>>>>>>> upstream. GNU-TLS implements some more (but not all) PSK >>>>>>>>>>>>>>>>>> suites >>>>>>>>>>>>>>>>>> and I have manually tested interoperability. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Patch info: >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> git fetch git://github.com/RoadRunnr/otp.git >>>>>>>>>>>>>>>>>> tls-psk-srp-suites >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites.patch >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Regards >>>>>>>>>>>>>>>>>> Andreas >>>>>>>>>>>>>>>>> -- >>>>>>>>>>>>>>>>> /Henrik Nord Erlang/OTP >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> /Henrik Nord Erlang/OTP >>>>>>>>>>>> >>>>>>>>>>>> >>>> -- >>>> -- >>>> Dipl. Inform. >>>> Andreas Schultz >>>> >>>> email: as@REDACTED >>>> phone: +49-391-819099-224 >>>> mobil: +49-170-2226073 >>>> >>>> ------------------ managed broadband access ------------------ >>>> >>>> Travelping GmbH phone: +49-391-8190990 >>>> Roentgenstr. 13 fax: +49-391-819099299 >>>> D-39108 Magdeburg email: info@REDACTED >>>> GERMANY web: http://www.travelping.com >>>> >>>> Company Registration: HRB21276 Handelsregistergericht Chemnitz >>>> Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 >>>> -------------------------------------------------------------- >>>> >>>> _______________________________________________ >>>> erlang-patches mailing list >>>> erlang-patches@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-patches >>>> >> Hello, >> Could you rebase this patch upon the current 'master' branch? >> Thanks, >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> Re-fetched. Thanks! -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 18 10:15:06 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 10:15:06 +0100 Subject: [erlang-patches] observer tv crash on formatting improper lists In-Reply-To: <511F7AFD.9040208@artplant.no> References: <511F7AFD.9040208@artplant.no> Message-ID: <5121F11A.2080900@erlang.org> On 02/16/2013 01:26 PM, Andrey Tsirulev wrote: > Hi, > > Observer table viewer crashes when attempts to display a term > containing improper lists (e.g. dict). Quick way to reproduce: run > ets:insert(ets:new(test,[]), {1,[h|t]}). > then start observer and open test ETS in table viewer. Observer will > crash. > > git fetch git://github.com/artplant/otp.git observer_tv_improper_lists > > https://github.com/artplant/otp/compare/erlang:master...observer_tv_improper_lists > > https://github.com/artplant/otp/compare/erlang:master...observer_tv_improper_lists.patch > > > Regards, > Andrey > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello Andrey, Currently in the 'master-pu' branch. Thanks! -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 18 10:25:00 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 10:25:00 +0100 Subject: [erlang-patches] typo in mnesia documentation In-Reply-To: References: Message-ID: <5121F36C.9080403@erlang.org> On 02/14/2013 11:50 PM, sean mcevoy wrote: > Hi All, > > Just found a minor typo in the mnesia documentation on page: > http://www.erlang.org/doc/man/mnesia.html > > In the description of the function: > dirty_update_counter > > I think the sentence: > "If Key don't exits, a new record is created..." > > Should read: > "If Key doesn't exist, a new record is created..." > > //Sean. > > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello, Really appreciated that you found this, but could you please read: https://github.com/erlang/otp/wiki/submitting-patches And get back to the list with your patch! -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Mon Feb 18 11:37:29 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 11:37:29 +0100 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <20130216232353.GA27511@ioctl> References: <20130216232353.GA27511@ioctl> Message-ID: <51220469.7070801@erlang.org> On 02/17/2013 12:23 AM, Michael Santos wrote: > Allow IPv6 nodes to register with and query epmd. On systems with > IPv6 support: > > * epmd listens on the IPv4 and IPv6 ANY or loopback sockets > > * the epmd cli client connects to epmd using the IPv6 loopback > > * distributed nodes started with "-proto_dist inet6_tcp" will register > with epmd over IPv6 > --- > erts/doc/src/epmd.xml | 2 +- > erts/doc/src/erl.xml | 22 +++++ > erts/epmd/src/epmd.c | 6 +- > erts/epmd/src/epmd_cli.c | 11 ++- > erts/epmd/src/epmd_int.h | 59 ++++++++---- > erts/epmd/src/epmd_srv.c | 184 +++++++++++++++++++++++++------------ > erts/epmd/test/epmd_SUITE.erl | 33 ++++++- > lib/kernel/src/erl_epmd.erl | 18 ++-- > lib/kernel/src/inet6_tcp_dist.erl | 2 +- > 9 files changed, 244 insertions(+), 93 deletions(-) > > diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml > index 3e70054..3c9313e 100644 > --- a/erts/doc/src/epmd.xml > +++ b/erts/doc/src/epmd.xml > @@ -36,7 +36,7 @@ > >

Erlang Port Mapper Daemon

> > - > + > >

Starts the port mapper daemon

>
> diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml > index f354d68..aebf4ff 100644 > --- a/erts/doc/src/erl.xml > +++ b/erts/doc/src/erl.xml > @@ -381,6 +381,28 @@ > similar to. See > code(3).

>
> + > + > +

Specify a protocol for Erlang distribution.

> + > + inet_tcp > + > +

TCP over IPv4 (the default)

> +
> + inet_ssl > + > +

distribution over SSL

> +
> + inet6_tcp > + > +

TCP over IPv6

> +
> +
> +

For example, to start up IPv6 distributed nodes:

> +
> +%erl -name test@REDACTED -proto_dist inet6_tcp
> +
> +
> > >

Starts Erlang with a remote shell connected to.

> diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c > index 94bb74c..0789cc3 100644 > --- a/erts/epmd/src/epmd.c > +++ b/erts/epmd/src/epmd.c > @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) > for (fd = 0; fd< g->max_conn ; fd++) /* close all files ... */ > close(fd); > /* Syslog on linux will try to write to whatever if we dont > - inform it of that the log is closed. */ > + inform it that the log is closed. */ > closelog(); > > - /* These chouldn't be needed but for safety... */ > + /* These shouldn't be needed but for safety... */ > > open("/dev/null", O_RDONLY); /* Order is important! */ > open("/dev/null", O_WRONLY); > @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) > close(1); > close(2); > > - /* These chouldn't be needed but for safety... */ > + /* These shouldn't be needed but for safety... */ > > open("nul", O_RDONLY); > open("nul", O_WRONLY); > diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c > index 8817bde..a0dd890 100644 > --- a/erts/epmd/src/epmd_cli.c > +++ b/erts/epmd/src/epmd_cli.c > @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) > static int conn_to_epmd(EpmdVars *g) > { > struct EPMD_SOCKADDR_IN address; > + size_t salen = 0; > int connect_sock; > > connect_sock = socket(FAMILY, SOCK_STREAM, 0); > @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) > > { /* store port number in unsigned short */ > unsigned short sport = g->port; > - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(address, in6addr_loopback, sport); > + salen = sizeof(struct sockaddr_in6); > +#else > + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); > + salen = sizeof(struct sockaddr_in); > +#endif > } > > - if (connect(connect_sock, (struct sockaddr*)&address, sizeof address)< 0) > + if (connect(connect_sock, (struct sockaddr*)&address, salen)< 0) > goto error; > return connect_sock; > > diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h > index ac354dc..b16c137 100644 > --- a/erts/epmd/src/epmd_int.h > +++ b/erts/epmd/src/epmd_int.h > @@ -49,6 +49,7 @@ > # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H > # include > # endif > +# include > # include > # include > #endif > @@ -165,33 +166,53 @@ > /* ************************************************************************ */ > /* Macros that let us use IPv6 */ > > -#if defined(HAVE_IN6)&& defined(AF_INET6)&& defined(EPMD6) > +#if HAVE_IN6 > +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY > +# if HAVE_DECL_IN6ADDR_ANY_INIT > +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; > +# else > +static const struct in6_addr in6addr_any = > + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; > +# endif /* HAVE_IN6ADDR_ANY_INIT */ > +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ > + > +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK > +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT > +static const struct in6_addr in6addr_loopback = > + { { IN6ADDR_LOOPBACK_INIT } }; > +# else > +static const struct in6_addr in6addr_loopback = > + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; > +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ > +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ > +#endif /* HAVE_IN6 */ > + > +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > > -#define EPMD_SOCKADDR_IN sockaddr_in6 > -#define EPMD_IN_ADDR in6_addr > -#define EPMD_S_ADDR s6_addr > -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr > -#define EPMD_ADDR_ANY in6addr_any.s6_addr > +#define EPMD_SOCKADDR_IN sockaddr_storage > #define FAMILY AF_INET6 > > -#define SET_ADDR(dst, addr, port) do { \ > - memset((char*)&(dst), 0, sizeof(dst)); \ > - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ > - (dst).sin6_family = AF_INET6; \ > - (dst).sin6_flowinfo = 0; \ > - (dst).sin6_port = htons(port); \ > +#define SET_ADDR6(dst, addr, port) do { \ > + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ > + memset(sa, 0, sizeof(dst)); \ > + sa->sin6_family = AF_INET6; \ > + sa->sin6_addr = (addr); \ > + sa->sin6_port = htons(port); \ > } while(0) > > -#define IS_ADDR_LOOPBACK(addr) \ > - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) > +#define SET_ADDR(dst, addr, port) do { \ > + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ > + memset(sa, 0, sizeof(dst)); \ > + sa->sin_family = AF_INET; \ > + sa->sin_addr.s_addr = (addr); \ > + sa->sin_port = htons(port); \ > + } while(0) > > #else /* Not IP v6 */ > > #define EPMD_SOCKADDR_IN sockaddr_in > -#define EPMD_IN_ADDR in_addr > -#define EPMD_S_ADDR s_addr > -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) > -#define EPMD_ADDR_ANY htonl(INADDR_ANY) > #define FAMILY AF_INET > > #define SET_ADDR(dst, addr, port) do { \ > @@ -201,8 +222,6 @@ > (dst).sin_port = htons(port); \ > } while(0) > > -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) > - > #endif /* Not IP v6 */ > > /* ************************************************************************ */ > diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c > index 90df7cc..1c34f5f 100644 > --- a/erts/epmd/src/epmd_srv.c > +++ b/erts/epmd/src/epmd_srv.c > @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); > > static Connection *conn_init(EpmdVars*); > static int conn_open(EpmdVars*,int); > +static int conn_local_peer_check(EpmdVars*, int); > static int conn_close_fd(EpmdVars*,int); > > static void node_init(EpmdVars*); > @@ -200,7 +201,7 @@ void run(EpmdVars *g) > { > struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; > int listensock[MAX_LISTEN_SOCKETS]; > - int num_sockets; > + int num_sockets = 0; > int i; > int opt; > unsigned short sport = g->port; > @@ -213,64 +214,82 @@ void run(EpmdVars *g) > if (g->addresses != NULL&& /* String contains non-separator characters if: */ > g->addresses[strspn(g->addresses," ,")] != '\000') > { > - char *tmp; > - char *token; > - int loopback_ok = 0; > + char *tmp = NULL; > + char *token = NULL; > + > + /* Always listen on the loopback. */ > + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); > + num_sockets++; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); > + num_sockets++; > +#endif > > - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) > + if ((tmp = strdup(g->addresses)) == NULL) > { > dbg_perror(g,"cannot allocate memory"); > epmd_cleanup_exit(g,1); > } > - strcpy(tmp,g->addresses); > > - for(token = strtok(tmp,", "), num_sockets = 0; > + for(token = strtok(tmp,", "); > token != NULL; > - token = strtok(NULL,", "), num_sockets++) > + token = strtok(NULL,", ")) > { > - struct EPMD_IN_ADDR addr; > -#ifdef HAVE_INET_PTON > - int ret; > + struct in_addr addr; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + struct in6_addr addr6; > + struct sockaddr_storage *sa =&iserv_addr[num_sockets]; > > - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) > + if (inet_pton(AF_INET,token,&addr) == 1) > { > - dbg_perror(g,"cannot convert IP address to network format"); > - epmd_cleanup_exit(g,1); > + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); > + } > + else if (inet_pton(AF_INET6,token,&addr6) == 1) > + { > + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); > + } > + else > +#else > + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) > + { > + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); > } > - else if (ret == 0) > -#elif !defined(EPMD6) > - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) > + else > #endif > { > dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); > epmd_cleanup_exit(g,1); > } > > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (sa->ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&addr6)) > + continue; > + > + if (sa->ss_family == AF_INET) > +#endif > if (IS_ADDR_LOOPBACK(addr)) > - loopback_ok = 1; > + continue; > > - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) > + num_sockets++; > + > + if (num_sockets>= MAX_LISTEN_SOCKETS) > { > dbg_tty_printf(g,0,"cannot listen on more than %d IP addresses", > MAX_LISTEN_SOCKETS); > epmd_cleanup_exit(g,1); > } > - > - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); > } > > free(tmp); > - > - if (!loopback_ok) > - { > - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); > - num_sockets++; > - } > } > else > { > - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); > - num_sockets = 1; > + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); > + num_sockets++; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); > + num_sockets++; > +#endif > } > > #if !defined(__WIN32__) > @@ -291,13 +310,33 @@ void run(EpmdVars *g) > > for (i = 0; i< num_sockets; i++) > { > - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0))< 0) > + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + size_t salen = (sa->sa_family == AF_INET6 ? > + sizeof(struct sockaddr_in6) : > + sizeof(struct sockaddr_in)); > +#else > + size_t salen = sizeof(struct sockaddr_in); > +#endif > + > + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0))< 0) > { > dbg_perror(g,"error opening stream socket"); > epmd_cleanup_exit(g,1); > } > g->listenfd[i] = listensock[i]; > - > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + opt = 1; > + if (sa->sa_family == AF_INET6&& > + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, > + sizeof(opt))<0) > + { > + dbg_perror(g,"can't set IPv6 only socket option"); > + epmd_cleanup_exit(g,1); > + } > +#endif > + > /* > * Note that we must not enable the SO_REUSEADDR on Windows, > * because addresses will be reused even if they are still in use. > @@ -329,8 +368,7 @@ void run(EpmdVars *g) > dbg_perror(g,"failed to set non-blocking mode of listening socket %d", > listensock[i]); > > - if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], > - sizeof(iserv_addr[i]))< 0) > + if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], salen)< 0) > { > if (errno == EADDRINUSE) > { > @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) > > for (i = 0; i< g->max_conn; i++) { > if (g->conn[i].open == EPMD_FALSE) { > - struct sockaddr_in si; > - struct sockaddr_in di; > -#ifdef HAVE_SOCKLEN_T > - socklen_t st; > -#else > - int st; > -#endif > - st = sizeof(si); > - > g->active_conn++; > s =&g->conn[i]; > > @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) > s->open = EPMD_TRUE; > s->keep = EPMD_FALSE; > > - /* Determine if connection is from localhost */ > - if (getpeername(s->fd,(struct sockaddr*)&si,&st) || > - st< sizeof(si)) { > - /* Failure to get peername is regarded as non local host */ > - s->local_peer = EPMD_FALSE; > - } else { > - /* Only 127.x.x.x and connections from the host's IP address > - allowed, no false positives */ > - s->local_peer = > - (((((unsigned) ntohl(si.sin_addr.s_addr))& 0xFF000000U) == > - 0x7F000000U) || > - (getsockname(s->fd,(struct sockaddr*)&di,&st) ? > - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); > - } > + s->local_peer = conn_local_peer_check(g, s->fd); > dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : > "Non-local peer connected"); > > @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) > s->got = 0; > s->mod_time = current_time(g); /* Note activity */ > > - s->buf = (char *)malloc(INBUF_SIZE); > + s->buf = malloc(INBUF_SIZE); > > if (s->buf == NULL) { > dbg_printf(g,0,"epmd: Insufficient memory"); > @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) > return EPMD_FALSE; > } > > +static int conn_local_peer_check(EpmdVars *g, int fd) > +{ > + struct EPMD_SOCKADDR_IN si; > + struct EPMD_SOCKADDR_IN di; > + > + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; > + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; > + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; > +#endif > + > +#ifdef HAVE_SOCKLEN_T > + socklen_t st; > +#else > + int st; > +#endif > + > + st = sizeof(si); > + > + /* Determine if connection is from localhost */ > + if (getpeername(fd,(struct sockaddr*)&si,&st) || > + st> sizeof(si)) { > + /* Failure to get peername is regarded as non local host */ > + return EPMD_FALSE; > + } > + > + /* Only 127.x.x.x and connections from the host's IP address > + allowed, no false positives */ > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (si.ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) > + return EPMD_TRUE; > + > + if (si.ss_family == AF_INET) > +#endif > + if ((((unsigned) ntohl(si4->sin_addr.s_addr))& 0xFF000000U) == > + 0x7F000000U) > + return EPMD_TRUE; > + > + if (getsockname(fd,(struct sockaddr*)&di,&st)) > + return EPMD_FALSE; > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (si.ss_family == AF_INET6) > + return IN6_ARE_ADDR_EQUAL(&(si6->sin6_addr),&(di6->sin6_addr)); > + if (si.ss_family == AF_INET) > +#endif > + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + return EPMD_FALSE; > +#endif > +} > + > static int conn_close_fd(EpmdVars *g,int fd) > { > int i; > diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl > index cc24a55..ddfe5ab 100644 > --- a/erts/epmd/test/epmd_SUITE.erl > +++ b/erts/epmd/test/epmd_SUITE.erl > @@ -42,6 +42,7 @@ > -export( > [ > register_name/1, > + register_name_ipv6/1, > register_names_1/1, > register_names_2/1, > register_duplicate_name/1, > @@ -108,7 +109,8 @@ > suite() -> [{ct_hooks,[ts_install_cth]}]. > > all() -> > - [register_name, register_names_1, register_names_2, > + [register_name, register_name_ipv6, > + register_names_1, register_names_2, > register_duplicate_name, unicode_name, long_unicode_name, > get_port_nr, slow_get_port_nr, > unregister_others_name_1, unregister_others_name_2, > @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> > ?line ok = close(Sock), % Unregister > ok. > > +register_name_ipv6(doc) -> > + ["Register a name over IPv6"]; > +register_name_ipv6(suite) -> > + []; > +register_name_ipv6(Config) when is_list(Config) -> > + % Test if the host has an IPv6 loopback address > + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), > + case Res of > + {ok,LSock} -> > + gen_tcp:close(LSock), > + ?line ok = epmdrun(), > + ?line {ok,Sock} = register_node6("foobar6"), > + ?line ok = close(Sock), % Unregister > + ok; > + _Error -> > + {skip, "Host does not have an IPv6 loopback address"} > + end. > + > register_names_1(doc) -> > ["Register and unregister two nodes"]; > register_names_1(suite) -> > @@ -238,13 +258,18 @@ register_node(Name) -> > register_node(Name,Port) -> > register_node_v2(Port,$M,0,5,5,Name,""). > > +register_node6(Name) -> > + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). > + > register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> > + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, Name, Extra). > +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> > Utf8Name = unicode:characters_to_binary(Name), > Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, > put16(HVsn), put16(LVsn), > put16(size(Utf8Name)), binary_to_list(Utf8Name), > size16(Extra), Extra], > - case send_req(Req) of > + case send_req(Req, Addr) of > {ok,Sock} -> > case recv(Sock,4) of > {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> > @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> > end. > > send_req(Req) -> > - case connect() of > + send_req(Req, "localhost"). > +send_req(Req, Addr) -> > + case connect(Addr) of > {ok,Sock} -> > case send(Sock, [size16(Req), Req]) of > ok -> > diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl > index 91af49f..21a3dec 100644 > --- a/lib/kernel/src/erl_epmd.erl > +++ b/lib/kernel/src/erl_epmd.erl > @@ -31,7 +31,7 @@ > %% External exports > -export([start/0, start_link/0, stop/0, port_please/2, > port_please/3, names/0, names/1, > - register_node/2, open/0, open/1, open/2]). > + register_node/2, register_node/3, open/0, open/1, open/2]). > > %% gen_server callbacks > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > @@ -106,7 +106,9 @@ names1(HostName) -> > > > register_node(Name, PortNo) -> > - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). > + register_node(Name, PortNo, inet). > +register_node(Name, PortNo, Family) -> > + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity). > > %%%---------------------------------------------------------------------- > %%% Callback functions from gen_server > @@ -124,10 +126,10 @@ init(_) -> > -spec handle_call(calls(), term(), state()) -> > {'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}. > > -handle_call({register, Name, PortNo}, _From, State) -> > +handle_call({register, Name, PortNo, Family}, _From, State) -> > case State#state.socket of > P when P< 0 -> > - case do_register_node(Name, PortNo) of > + case do_register_node(Name, PortNo, Family) of > {alive, Socket, Creation} -> > S = State#state{socket = Socket, > port_no = PortNo, > @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) -> > close(Socket) -> > gen_tcp:close(Socket). > > -do_register_node(NodeName, TcpPort) -> > - case open() of > +do_register_node(NodeName, TcpPort, Family) -> > + Localhost = case Family of > + inet -> open({127,0,0,1}); > + inet6 -> open({0,0,0,0,0,0,0,1}) > + end, > + case Localhost of > {ok, Socket} -> > Name = to_string(NodeName), > Extra = "", > diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl > index 2315a56..bba4d87 100644 > --- a/lib/kernel/src/inet6_tcp_dist.erl > +++ b/lib/kernel/src/inet6_tcp_dist.erl > @@ -71,7 +71,7 @@ listen(Name) -> > {ok, Socket} -> > TcpAddress = get_tcp_address(Socket), > {_,Port} = TcpAddress#net_address.address, > - case erl_epmd:register_node(Name, Port) of > + case erl_epmd:register_node(Name, Port, inet6) of > {ok, Creation} -> > {ok, {Socket, TcpAddress, Creation}}; > Error -> Hello, Currently cooking in the 'master-pu' branch. Thanks, -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 18 12:00:09 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 12:00:09 +0100 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <20130216232353.GA27511@ioctl> References: <20130216232353.GA27511@ioctl> Message-ID: <512209B9.8040109@erlang.org> Hello, Your patch does not seem to build: epmd_srv.c(332) : error C2065: 'IPPROTO_IPV6' : undeclared identifier epmd_srv.c(332) : warning C4133: 'function' : incompatible types - from 'int *' to 'const char *' Could you please have a look at this problem? On 02/17/2013 12:23 AM, Michael Santos wrote: > Allow IPv6 nodes to register with and query epmd. On systems with > IPv6 support: > > * epmd listens on the IPv4 and IPv6 ANY or loopback sockets > > * the epmd cli client connects to epmd using the IPv6 loopback > > * distributed nodes started with "-proto_dist inet6_tcp" will register > with epmd over IPv6 > --- > erts/doc/src/epmd.xml | 2 +- > erts/doc/src/erl.xml | 22 +++++ > erts/epmd/src/epmd.c | 6 +- > erts/epmd/src/epmd_cli.c | 11 ++- > erts/epmd/src/epmd_int.h | 59 ++++++++---- > erts/epmd/src/epmd_srv.c | 184 +++++++++++++++++++++++++------------ > erts/epmd/test/epmd_SUITE.erl | 33 ++++++- > lib/kernel/src/erl_epmd.erl | 18 ++-- > lib/kernel/src/inet6_tcp_dist.erl | 2 +- > 9 files changed, 244 insertions(+), 93 deletions(-) > > diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml > index 3e70054..3c9313e 100644 > --- a/erts/doc/src/epmd.xml > +++ b/erts/doc/src/epmd.xml > @@ -36,7 +36,7 @@ > >

Erlang Port Mapper Daemon

> > - > + > >

Starts the port mapper daemon

>
> diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml > index f354d68..aebf4ff 100644 > --- a/erts/doc/src/erl.xml > +++ b/erts/doc/src/erl.xml > @@ -381,6 +381,28 @@ > similar to. See > code(3).

>
> + > + > +

Specify a protocol for Erlang distribution.

> + > + inet_tcp > + > +

TCP over IPv4 (the default)

> +
> + inet_ssl > + > +

distribution over SSL

> +
> + inet6_tcp > + > +

TCP over IPv6

> +
> +
> +

For example, to start up IPv6 distributed nodes:

> +
> +%erl -name test@REDACTED -proto_dist inet6_tcp
> +
> +
> > >

Starts Erlang with a remote shell connected to.

> diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c > index 94bb74c..0789cc3 100644 > --- a/erts/epmd/src/epmd.c > +++ b/erts/epmd/src/epmd.c > @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) > for (fd = 0; fd< g->max_conn ; fd++) /* close all files ... */ > close(fd); > /* Syslog on linux will try to write to whatever if we dont > - inform it of that the log is closed. */ > + inform it that the log is closed. */ > closelog(); > > - /* These chouldn't be needed but for safety... */ > + /* These shouldn't be needed but for safety... */ > > open("/dev/null", O_RDONLY); /* Order is important! */ > open("/dev/null", O_WRONLY); > @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) > close(1); > close(2); > > - /* These chouldn't be needed but for safety... */ > + /* These shouldn't be needed but for safety... */ > > open("nul", O_RDONLY); > open("nul", O_WRONLY); > diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c > index 8817bde..a0dd890 100644 > --- a/erts/epmd/src/epmd_cli.c > +++ b/erts/epmd/src/epmd_cli.c > @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) > static int conn_to_epmd(EpmdVars *g) > { > struct EPMD_SOCKADDR_IN address; > + size_t salen = 0; > int connect_sock; > > connect_sock = socket(FAMILY, SOCK_STREAM, 0); > @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) > > { /* store port number in unsigned short */ > unsigned short sport = g->port; > - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(address, in6addr_loopback, sport); > + salen = sizeof(struct sockaddr_in6); > +#else > + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); > + salen = sizeof(struct sockaddr_in); > +#endif > } > > - if (connect(connect_sock, (struct sockaddr*)&address, sizeof address)< 0) > + if (connect(connect_sock, (struct sockaddr*)&address, salen)< 0) > goto error; > return connect_sock; > > diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h > index ac354dc..b16c137 100644 > --- a/erts/epmd/src/epmd_int.h > +++ b/erts/epmd/src/epmd_int.h > @@ -49,6 +49,7 @@ > # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H > # include > # endif > +# include > # include > # include > #endif > @@ -165,33 +166,53 @@ > /* ************************************************************************ */ > /* Macros that let us use IPv6 */ > > -#if defined(HAVE_IN6)&& defined(AF_INET6)&& defined(EPMD6) > +#if HAVE_IN6 > +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY > +# if HAVE_DECL_IN6ADDR_ANY_INIT > +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; > +# else > +static const struct in6_addr in6addr_any = > + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; > +# endif /* HAVE_IN6ADDR_ANY_INIT */ > +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ > + > +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK > +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT > +static const struct in6_addr in6addr_loopback = > + { { IN6ADDR_LOOPBACK_INIT } }; > +# else > +static const struct in6_addr in6addr_loopback = > + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; > +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ > +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ > +#endif /* HAVE_IN6 */ > + > +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > > -#define EPMD_SOCKADDR_IN sockaddr_in6 > -#define EPMD_IN_ADDR in6_addr > -#define EPMD_S_ADDR s6_addr > -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr > -#define EPMD_ADDR_ANY in6addr_any.s6_addr > +#define EPMD_SOCKADDR_IN sockaddr_storage > #define FAMILY AF_INET6 > > -#define SET_ADDR(dst, addr, port) do { \ > - memset((char*)&(dst), 0, sizeof(dst)); \ > - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ > - (dst).sin6_family = AF_INET6; \ > - (dst).sin6_flowinfo = 0; \ > - (dst).sin6_port = htons(port); \ > +#define SET_ADDR6(dst, addr, port) do { \ > + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ > + memset(sa, 0, sizeof(dst)); \ > + sa->sin6_family = AF_INET6; \ > + sa->sin6_addr = (addr); \ > + sa->sin6_port = htons(port); \ > } while(0) > > -#define IS_ADDR_LOOPBACK(addr) \ > - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) > +#define SET_ADDR(dst, addr, port) do { \ > + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ > + memset(sa, 0, sizeof(dst)); \ > + sa->sin_family = AF_INET; \ > + sa->sin_addr.s_addr = (addr); \ > + sa->sin_port = htons(port); \ > + } while(0) > > #else /* Not IP v6 */ > > #define EPMD_SOCKADDR_IN sockaddr_in > -#define EPMD_IN_ADDR in_addr > -#define EPMD_S_ADDR s_addr > -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) > -#define EPMD_ADDR_ANY htonl(INADDR_ANY) > #define FAMILY AF_INET > > #define SET_ADDR(dst, addr, port) do { \ > @@ -201,8 +222,6 @@ > (dst).sin_port = htons(port); \ > } while(0) > > -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) > - > #endif /* Not IP v6 */ > > /* ************************************************************************ */ > diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c > index 90df7cc..1c34f5f 100644 > --- a/erts/epmd/src/epmd_srv.c > +++ b/erts/epmd/src/epmd_srv.c > @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); > > static Connection *conn_init(EpmdVars*); > static int conn_open(EpmdVars*,int); > +static int conn_local_peer_check(EpmdVars*, int); > static int conn_close_fd(EpmdVars*,int); > > static void node_init(EpmdVars*); > @@ -200,7 +201,7 @@ void run(EpmdVars *g) > { > struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; > int listensock[MAX_LISTEN_SOCKETS]; > - int num_sockets; > + int num_sockets = 0; > int i; > int opt; > unsigned short sport = g->port; > @@ -213,64 +214,82 @@ void run(EpmdVars *g) > if (g->addresses != NULL&& /* String contains non-separator characters if: */ > g->addresses[strspn(g->addresses," ,")] != '\000') > { > - char *tmp; > - char *token; > - int loopback_ok = 0; > + char *tmp = NULL; > + char *token = NULL; > + > + /* Always listen on the loopback. */ > + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); > + num_sockets++; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); > + num_sockets++; > +#endif > > - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) > + if ((tmp = strdup(g->addresses)) == NULL) > { > dbg_perror(g,"cannot allocate memory"); > epmd_cleanup_exit(g,1); > } > - strcpy(tmp,g->addresses); > > - for(token = strtok(tmp,", "), num_sockets = 0; > + for(token = strtok(tmp,", "); > token != NULL; > - token = strtok(NULL,", "), num_sockets++) > + token = strtok(NULL,", ")) > { > - struct EPMD_IN_ADDR addr; > -#ifdef HAVE_INET_PTON > - int ret; > + struct in_addr addr; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + struct in6_addr addr6; > + struct sockaddr_storage *sa =&iserv_addr[num_sockets]; > > - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) > + if (inet_pton(AF_INET,token,&addr) == 1) > { > - dbg_perror(g,"cannot convert IP address to network format"); > - epmd_cleanup_exit(g,1); > + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); > + } > + else if (inet_pton(AF_INET6,token,&addr6) == 1) > + { > + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); > + } > + else > +#else > + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) > + { > + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); > } > - else if (ret == 0) > -#elif !defined(EPMD6) > - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) > + else > #endif > { > dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); > epmd_cleanup_exit(g,1); > } > > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (sa->ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&addr6)) > + continue; > + > + if (sa->ss_family == AF_INET) > +#endif > if (IS_ADDR_LOOPBACK(addr)) > - loopback_ok = 1; > + continue; > > - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) > + num_sockets++; > + > + if (num_sockets>= MAX_LISTEN_SOCKETS) > { > dbg_tty_printf(g,0,"cannot listen on more than %d IP addresses", > MAX_LISTEN_SOCKETS); > epmd_cleanup_exit(g,1); > } > - > - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); > } > > free(tmp); > - > - if (!loopback_ok) > - { > - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); > - num_sockets++; > - } > } > else > { > - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); > - num_sockets = 1; > + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); > + num_sockets++; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); > + num_sockets++; > +#endif > } > > #if !defined(__WIN32__) > @@ -291,13 +310,33 @@ void run(EpmdVars *g) > > for (i = 0; i< num_sockets; i++) > { > - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0))< 0) > + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + size_t salen = (sa->sa_family == AF_INET6 ? > + sizeof(struct sockaddr_in6) : > + sizeof(struct sockaddr_in)); > +#else > + size_t salen = sizeof(struct sockaddr_in); > +#endif > + > + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0))< 0) > { > dbg_perror(g,"error opening stream socket"); > epmd_cleanup_exit(g,1); > } > g->listenfd[i] = listensock[i]; > - > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + opt = 1; > + if (sa->sa_family == AF_INET6&& > + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, > + sizeof(opt))<0) > + { > + dbg_perror(g,"can't set IPv6 only socket option"); > + epmd_cleanup_exit(g,1); > + } > +#endif > + > /* > * Note that we must not enable the SO_REUSEADDR on Windows, > * because addresses will be reused even if they are still in use. > @@ -329,8 +368,7 @@ void run(EpmdVars *g) > dbg_perror(g,"failed to set non-blocking mode of listening socket %d", > listensock[i]); > > - if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], > - sizeof(iserv_addr[i]))< 0) > + if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], salen)< 0) > { > if (errno == EADDRINUSE) > { > @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) > > for (i = 0; i< g->max_conn; i++) { > if (g->conn[i].open == EPMD_FALSE) { > - struct sockaddr_in si; > - struct sockaddr_in di; > -#ifdef HAVE_SOCKLEN_T > - socklen_t st; > -#else > - int st; > -#endif > - st = sizeof(si); > - > g->active_conn++; > s =&g->conn[i]; > > @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) > s->open = EPMD_TRUE; > s->keep = EPMD_FALSE; > > - /* Determine if connection is from localhost */ > - if (getpeername(s->fd,(struct sockaddr*)&si,&st) || > - st< sizeof(si)) { > - /* Failure to get peername is regarded as non local host */ > - s->local_peer = EPMD_FALSE; > - } else { > - /* Only 127.x.x.x and connections from the host's IP address > - allowed, no false positives */ > - s->local_peer = > - (((((unsigned) ntohl(si.sin_addr.s_addr))& 0xFF000000U) == > - 0x7F000000U) || > - (getsockname(s->fd,(struct sockaddr*)&di,&st) ? > - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); > - } > + s->local_peer = conn_local_peer_check(g, s->fd); > dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : > "Non-local peer connected"); > > @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) > s->got = 0; > s->mod_time = current_time(g); /* Note activity */ > > - s->buf = (char *)malloc(INBUF_SIZE); > + s->buf = malloc(INBUF_SIZE); > > if (s->buf == NULL) { > dbg_printf(g,0,"epmd: Insufficient memory"); > @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) > return EPMD_FALSE; > } > > +static int conn_local_peer_check(EpmdVars *g, int fd) > +{ > + struct EPMD_SOCKADDR_IN si; > + struct EPMD_SOCKADDR_IN di; > + > + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; > + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; > + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; > +#endif > + > +#ifdef HAVE_SOCKLEN_T > + socklen_t st; > +#else > + int st; > +#endif > + > + st = sizeof(si); > + > + /* Determine if connection is from localhost */ > + if (getpeername(fd,(struct sockaddr*)&si,&st) || > + st> sizeof(si)) { > + /* Failure to get peername is regarded as non local host */ > + return EPMD_FALSE; > + } > + > + /* Only 127.x.x.x and connections from the host's IP address > + allowed, no false positives */ > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (si.ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) > + return EPMD_TRUE; > + > + if (si.ss_family == AF_INET) > +#endif > + if ((((unsigned) ntohl(si4->sin_addr.s_addr))& 0xFF000000U) == > + 0x7F000000U) > + return EPMD_TRUE; > + > + if (getsockname(fd,(struct sockaddr*)&di,&st)) > + return EPMD_FALSE; > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (si.ss_family == AF_INET6) > + return IN6_ARE_ADDR_EQUAL(&(si6->sin6_addr),&(di6->sin6_addr)); > + if (si.ss_family == AF_INET) > +#endif > + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + return EPMD_FALSE; > +#endif > +} > + > static int conn_close_fd(EpmdVars *g,int fd) > { > int i; > diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl > index cc24a55..ddfe5ab 100644 > --- a/erts/epmd/test/epmd_SUITE.erl > +++ b/erts/epmd/test/epmd_SUITE.erl > @@ -42,6 +42,7 @@ > -export( > [ > register_name/1, > + register_name_ipv6/1, > register_names_1/1, > register_names_2/1, > register_duplicate_name/1, > @@ -108,7 +109,8 @@ > suite() -> [{ct_hooks,[ts_install_cth]}]. > > all() -> > - [register_name, register_names_1, register_names_2, > + [register_name, register_name_ipv6, > + register_names_1, register_names_2, > register_duplicate_name, unicode_name, long_unicode_name, > get_port_nr, slow_get_port_nr, > unregister_others_name_1, unregister_others_name_2, > @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> > ?line ok = close(Sock), % Unregister > ok. > > +register_name_ipv6(doc) -> > + ["Register a name over IPv6"]; > +register_name_ipv6(suite) -> > + []; > +register_name_ipv6(Config) when is_list(Config) -> > + % Test if the host has an IPv6 loopback address > + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), > + case Res of > + {ok,LSock} -> > + gen_tcp:close(LSock), > + ?line ok = epmdrun(), > + ?line {ok,Sock} = register_node6("foobar6"), > + ?line ok = close(Sock), % Unregister > + ok; > + _Error -> > + {skip, "Host does not have an IPv6 loopback address"} > + end. > + > register_names_1(doc) -> > ["Register and unregister two nodes"]; > register_names_1(suite) -> > @@ -238,13 +258,18 @@ register_node(Name) -> > register_node(Name,Port) -> > register_node_v2(Port,$M,0,5,5,Name,""). > > +register_node6(Name) -> > + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). > + > register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> > + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, Name, Extra). > +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> > Utf8Name = unicode:characters_to_binary(Name), > Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, > put16(HVsn), put16(LVsn), > put16(size(Utf8Name)), binary_to_list(Utf8Name), > size16(Extra), Extra], > - case send_req(Req) of > + case send_req(Req, Addr) of > {ok,Sock} -> > case recv(Sock,4) of > {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> > @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> > end. > > send_req(Req) -> > - case connect() of > + send_req(Req, "localhost"). > +send_req(Req, Addr) -> > + case connect(Addr) of > {ok,Sock} -> > case send(Sock, [size16(Req), Req]) of > ok -> > diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl > index 91af49f..21a3dec 100644 > --- a/lib/kernel/src/erl_epmd.erl > +++ b/lib/kernel/src/erl_epmd.erl > @@ -31,7 +31,7 @@ > %% External exports > -export([start/0, start_link/0, stop/0, port_please/2, > port_please/3, names/0, names/1, > - register_node/2, open/0, open/1, open/2]). > + register_node/2, register_node/3, open/0, open/1, open/2]). > > %% gen_server callbacks > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > @@ -106,7 +106,9 @@ names1(HostName) -> > > > register_node(Name, PortNo) -> > - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). > + register_node(Name, PortNo, inet). > +register_node(Name, PortNo, Family) -> > + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity). > > %%%---------------------------------------------------------------------- > %%% Callback functions from gen_server > @@ -124,10 +126,10 @@ init(_) -> > -spec handle_call(calls(), term(), state()) -> > {'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}. > > -handle_call({register, Name, PortNo}, _From, State) -> > +handle_call({register, Name, PortNo, Family}, _From, State) -> > case State#state.socket of > P when P< 0 -> > - case do_register_node(Name, PortNo) of > + case do_register_node(Name, PortNo, Family) of > {alive, Socket, Creation} -> > S = State#state{socket = Socket, > port_no = PortNo, > @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) -> > close(Socket) -> > gen_tcp:close(Socket). > > -do_register_node(NodeName, TcpPort) -> > - case open() of > +do_register_node(NodeName, TcpPort, Family) -> > + Localhost = case Family of > + inet -> open({127,0,0,1}); > + inet6 -> open({0,0,0,0,0,0,0,1}) > + end, > + case Localhost of > {ok, Socket} -> > Name = to_string(NodeName), > Extra = "", > diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl > index 2315a56..bba4d87 100644 > --- a/lib/kernel/src/inet6_tcp_dist.erl > +++ b/lib/kernel/src/inet6_tcp_dist.erl > @@ -71,7 +71,7 @@ listen(Name) -> > {ok, Socket} -> > TcpAddress = get_tcp_address(Socket), > {_,Port} = TcpAddress#net_address.address, > - case erl_epmd:register_node(Name, Port) of > + case erl_epmd:register_node(Name, Port, inet6) of > {ok, Creation} -> > {ok, {Socket, TcpAddress, Creation}}; > Error -> -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Mon Feb 18 12:21:20 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 12:21:20 +0100 Subject: [erlang-patches] Change the return value of hipe_bifs:remove_refs_from/1 In-Reply-To: <511B4C24.9060806@cs.ntua.gr> References: <511B4C24.9060806@cs.ntua.gr> Message-ID: <51220EB0.4040807@erlang.org> On 02/13/2013 09:17 AM, Kostis Sagonas wrote: > Please include: > > git fetch git://github.com/kostis/otp.git hipe_bif-remove_refs_from > > Kostis > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Hello Kostis, Your patch seems to fail testcase: code_SUITE, ext_mod_dep With the reason: not_verified({'$M_EXPR','$F_EXPR',1}, [{lists,foreach,2}, {hipe_unified_loader, mark_referred_from,1}, {hipe_unified_loader,get_refs_from,2}, {hipe_unified_loader,load_common,4}, {hipe_unified_loader,load_module,4}, {hipe_unified_loader,load_native_code, 2}, {code_server,load_native_code,2}, {code_server,try_load_module_1,5}, {code_server,try_load_module,5}, {code_server,do_load_binary,5}, {code_server,handle_call,3}, {code_server,loop,1}, {code_server,system_continue,3}]) After discussions, after discussion you should either use a list comprehension here or add lists:foreach to the testcase. -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Mon Feb 18 12:28:13 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 18 Feb 2013 12:28:13 +0100 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <512209B9.8040109@erlang.org> References: <20130216232353.GA27511@ioctl> <512209B9.8040109@erlang.org> Message-ID: <5122104D.1000309@erlang.org> This happens only on windows I should add to the context also.. BR Fredrik On 02/18/2013 12:00 PM, Fredrik wrote: > Hello, > Your patch does not seem to build: > > epmd_srv.c(332) : error C2065: 'IPPROTO_IPV6' : undeclared identifier > epmd_srv.c(332) : warning C4133: 'function' : incompatible types - > from 'int *' to 'const char *' > > > Could you please have a look at this problem? > > On 02/17/2013 12:23 AM, Michael Santos wrote: >> Allow IPv6 nodes to register with and query epmd. On systems with >> IPv6 support: >> >> * epmd listens on the IPv4 and IPv6 ANY or loopback sockets >> >> * the epmd cli client connects to epmd using the IPv6 loopback >> >> * distributed nodes started with "-proto_dist inet6_tcp" will register >> with epmd over IPv6 >> --- >> erts/doc/src/epmd.xml | 2 +- >> erts/doc/src/erl.xml | 22 +++++ >> erts/epmd/src/epmd.c | 6 +- >> erts/epmd/src/epmd_cli.c | 11 ++- >> erts/epmd/src/epmd_int.h | 59 ++++++++---- >> erts/epmd/src/epmd_srv.c | 184 >> +++++++++++++++++++++++++------------ >> erts/epmd/test/epmd_SUITE.erl | 33 ++++++- >> lib/kernel/src/erl_epmd.erl | 18 ++-- >> lib/kernel/src/inet6_tcp_dist.erl | 2 +- >> 9 files changed, 244 insertions(+), 93 deletions(-) >> >> diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml >> index 3e70054..3c9313e 100644 >> --- a/erts/doc/src/epmd.xml >> +++ b/erts/doc/src/epmd.xml >> @@ -36,7 +36,7 @@ >> >>

Erlang Port Mapper Daemon

>> >> -> [-relaxed_command_check]]]> >> +> [-port No] [-daemon] [-relaxed_command_check]]]> >> >>

Starts the port mapper daemon

>>
>> diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml >> index f354d68..aebf4ff 100644 >> --- a/erts/doc/src/erl.xml >> +++ b/erts/doc/src/erl.xml >> @@ -381,6 +381,28 @@ >> similar to. See >> code(3).

>>
>> + >> + >> +

Specify a protocol for Erlang distribution.

>> + >> + inet_tcp >> + >> +

TCP over IPv4 (the default)

>> +
>> + inet_ssl >> + >> +

distribution over SSL

>> +
>> + inet6_tcp >> + >> +

TCP over IPv6

>> +
>> +
>> +

For example, to start up IPv6 distributed nodes:

>> +
>> +%erl -name test@REDACTED -proto_dist 
>> inet6_tcp
>> +
>> +
>> >> >>

Starts Erlang with a remote shell connected >> to.

>> diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c >> index 94bb74c..0789cc3 100644 >> --- a/erts/epmd/src/epmd.c >> +++ b/erts/epmd/src/epmd.c >> @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) >> for (fd = 0; fd< g->max_conn ; fd++) /* close all files ... */ >> close(fd); >> /* Syslog on linux will try to write to whatever if we dont >> - inform it of that the log is closed. */ >> + inform it that the log is closed. */ >> closelog(); >> >> - /* These chouldn't be needed but for safety... */ >> + /* These shouldn't be needed but for safety... */ >> >> open("/dev/null", O_RDONLY); /* Order is important! */ >> open("/dev/null", O_WRONLY); >> @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) >> close(1); >> close(2); >> >> - /* These chouldn't be needed but for safety... */ >> + /* These shouldn't be needed but for safety... */ >> >> open("nul", O_RDONLY); >> open("nul", O_WRONLY); >> diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c >> index 8817bde..a0dd890 100644 >> --- a/erts/epmd/src/epmd_cli.c >> +++ b/erts/epmd/src/epmd_cli.c >> @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) >> static int conn_to_epmd(EpmdVars *g) >> { >> struct EPMD_SOCKADDR_IN address; >> + size_t salen = 0; >> int connect_sock; >> >> connect_sock = socket(FAMILY, SOCK_STREAM, 0); >> @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) >> >> { /* store port number in unsigned short */ >> unsigned short sport = g->port; >> - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + SET_ADDR6(address, in6addr_loopback, sport); >> + salen = sizeof(struct sockaddr_in6); >> +#else >> + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); >> + salen = sizeof(struct sockaddr_in); >> +#endif >> } >> >> - if (connect(connect_sock, (struct sockaddr*)&address, sizeof >> address)< 0) >> + if (connect(connect_sock, (struct sockaddr*)&address, salen)< 0) >> goto error; >> return connect_sock; >> >> diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h >> index ac354dc..b16c137 100644 >> --- a/erts/epmd/src/epmd_int.h >> +++ b/erts/epmd/src/epmd_int.h >> @@ -49,6 +49,7 @@ >> # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H >> # include >> # endif >> +# include >> # include >> # include >> #endif >> @@ -165,33 +166,53 @@ >> /* >> ************************************************************************ >> */ >> /* Macros that let us use >> IPv6 */ >> >> -#if defined(HAVE_IN6)&& defined(AF_INET6)&& defined(EPMD6) >> +#if HAVE_IN6 >> +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY >> +# if HAVE_DECL_IN6ADDR_ANY_INIT >> +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; >> +# else >> +static const struct in6_addr in6addr_any = >> + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; >> +# endif /* HAVE_IN6ADDR_ANY_INIT */ >> +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ >> + >> +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK >> +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT >> +static const struct in6_addr in6addr_loopback = >> + { { IN6ADDR_LOOPBACK_INIT } }; >> +# else >> +static const struct in6_addr in6addr_loopback = >> + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; >> +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ >> +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ >> +#endif /* HAVE_IN6 */ >> + >> +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == >> htonl(INADDR_LOOPBACK)) >> + >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> >> -#define EPMD_SOCKADDR_IN sockaddr_in6 >> -#define EPMD_IN_ADDR in6_addr >> -#define EPMD_S_ADDR s6_addr >> -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr >> -#define EPMD_ADDR_ANY in6addr_any.s6_addr >> +#define EPMD_SOCKADDR_IN sockaddr_storage >> #define FAMILY AF_INET6 >> >> -#define SET_ADDR(dst, addr, port) do { \ >> - memset((char*)&(dst), 0, sizeof(dst)); \ >> - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ >> - (dst).sin6_family = AF_INET6; \ >> - (dst).sin6_flowinfo = 0; \ >> - (dst).sin6_port = htons(port); \ >> +#define SET_ADDR6(dst, addr, port) do { \ >> + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ >> + memset(sa, 0, sizeof(dst)); \ >> + sa->sin6_family = AF_INET6; \ >> + sa->sin6_addr = (addr); \ >> + sa->sin6_port = htons(port); \ >> } while(0) >> >> -#define IS_ADDR_LOOPBACK(addr) \ >> - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) >> +#define SET_ADDR(dst, addr, port) do { \ >> + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ >> + memset(sa, 0, sizeof(dst)); \ >> + sa->sin_family = AF_INET; \ >> + sa->sin_addr.s_addr = (addr); \ >> + sa->sin_port = htons(port); \ >> + } while(0) >> >> #else /* Not IP v6 */ >> >> #define EPMD_SOCKADDR_IN sockaddr_in >> -#define EPMD_IN_ADDR in_addr >> -#define EPMD_S_ADDR s_addr >> -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) >> -#define EPMD_ADDR_ANY htonl(INADDR_ANY) >> #define FAMILY AF_INET >> >> #define SET_ADDR(dst, addr, port) do { \ >> @@ -201,8 +222,6 @@ >> (dst).sin_port = htons(port); \ >> } while(0) >> >> -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == >> htonl(INADDR_LOOPBACK)) >> - >> #endif /* Not IP v6 */ >> >> /* >> ************************************************************************ >> */ >> diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c >> index 90df7cc..1c34f5f 100644 >> --- a/erts/epmd/src/epmd_srv.c >> +++ b/erts/epmd/src/epmd_srv.c >> @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); >> >> static Connection *conn_init(EpmdVars*); >> static int conn_open(EpmdVars*,int); >> +static int conn_local_peer_check(EpmdVars*, int); >> static int conn_close_fd(EpmdVars*,int); >> >> static void node_init(EpmdVars*); >> @@ -200,7 +201,7 @@ void run(EpmdVars *g) >> { >> struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; >> int listensock[MAX_LISTEN_SOCKETS]; >> - int num_sockets; >> + int num_sockets = 0; >> int i; >> int opt; >> unsigned short sport = g->port; >> @@ -213,64 +214,82 @@ void run(EpmdVars *g) >> if (g->addresses != NULL&& /* String contains non-separator >> characters if: */ >> g->addresses[strspn(g->addresses," ,")] != '\000') >> { >> - char *tmp; >> - char *token; >> - int loopback_ok = 0; >> + char *tmp = NULL; >> + char *token = NULL; >> + >> + /* Always listen on the loopback. */ >> + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); >> + num_sockets++; >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); >> + num_sockets++; >> +#endif >> >> - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) >> + if ((tmp = strdup(g->addresses)) == NULL) >> { >> dbg_perror(g,"cannot allocate memory"); >> epmd_cleanup_exit(g,1); >> } >> - strcpy(tmp,g->addresses); >> >> - for(token = strtok(tmp,", "), num_sockets = 0; >> + for(token = strtok(tmp,", "); >> token != NULL; >> - token = strtok(NULL,", "), num_sockets++) >> + token = strtok(NULL,", ")) >> { >> - struct EPMD_IN_ADDR addr; >> -#ifdef HAVE_INET_PTON >> - int ret; >> + struct in_addr addr; >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + struct in6_addr addr6; >> + struct sockaddr_storage *sa =&iserv_addr[num_sockets]; >> >> - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) >> + if (inet_pton(AF_INET,token,&addr) == 1) >> { >> - dbg_perror(g,"cannot convert IP address to network format"); >> - epmd_cleanup_exit(g,1); >> + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); >> + } >> + else if (inet_pton(AF_INET6,token,&addr6) == 1) >> + { >> + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); >> + } >> + else >> +#else >> + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) >> + { >> + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); >> } >> - else if (ret == 0) >> -#elif !defined(EPMD6) >> - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) >> + else >> #endif >> { >> dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); >> epmd_cleanup_exit(g,1); >> } >> >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + if (sa->ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&addr6)) >> + continue; >> + >> + if (sa->ss_family == AF_INET) >> +#endif >> if (IS_ADDR_LOOPBACK(addr)) >> - loopback_ok = 1; >> + continue; >> >> - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) >> + num_sockets++; >> + >> + if (num_sockets>= MAX_LISTEN_SOCKETS) >> { >> dbg_tty_printf(g,0,"cannot listen on more than %d IP >> addresses", >> MAX_LISTEN_SOCKETS); >> epmd_cleanup_exit(g,1); >> } >> - >> - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); >> } >> >> free(tmp); >> - >> - if (!loopback_ok) >> - { >> - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); >> - num_sockets++; >> - } >> } >> else >> { >> - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); >> - num_sockets = 1; >> + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); >> + num_sockets++; >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); >> + num_sockets++; >> +#endif >> } >> >> #if !defined(__WIN32__) >> @@ -291,13 +310,33 @@ void run(EpmdVars *g) >> >> for (i = 0; i< num_sockets; i++) >> { >> - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0))< 0) >> + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + size_t salen = (sa->sa_family == AF_INET6 ? >> + sizeof(struct sockaddr_in6) : >> + sizeof(struct sockaddr_in)); >> +#else >> + size_t salen = sizeof(struct sockaddr_in); >> +#endif >> + >> + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0))< 0) >> { >> dbg_perror(g,"error opening stream socket"); >> epmd_cleanup_exit(g,1); >> } >> g->listenfd[i] = listensock[i]; >> - >> + >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + opt = 1; >> + if (sa->sa_family == AF_INET6&& >> + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, >> + sizeof(opt))<0) >> + { >> + dbg_perror(g,"can't set IPv6 only socket option"); >> + epmd_cleanup_exit(g,1); >> + } >> +#endif >> + >> /* >> * Note that we must not enable the SO_REUSEADDR on Windows, >> * because addresses will be reused even if they are still in >> use. >> @@ -329,8 +368,7 @@ void run(EpmdVars *g) >> dbg_perror(g,"failed to set non-blocking mode of listening >> socket %d", >> listensock[i]); >> >> - if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], >> - sizeof(iserv_addr[i]))< 0) >> + if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], >> salen)< 0) >> { >> if (errno == EADDRINUSE) >> { >> @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) >> >> for (i = 0; i< g->max_conn; i++) { >> if (g->conn[i].open == EPMD_FALSE) { >> - struct sockaddr_in si; >> - struct sockaddr_in di; >> -#ifdef HAVE_SOCKLEN_T >> - socklen_t st; >> -#else >> - int st; >> -#endif >> - st = sizeof(si); >> - >> g->active_conn++; >> s =&g->conn[i]; >> >> @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) >> s->open = EPMD_TRUE; >> s->keep = EPMD_FALSE; >> >> - /* Determine if connection is from localhost */ >> - if (getpeername(s->fd,(struct sockaddr*)&si,&st) || >> - st< sizeof(si)) { >> - /* Failure to get peername is regarded as non local host */ >> - s->local_peer = EPMD_FALSE; >> - } else { >> - /* Only 127.x.x.x and connections from the host's IP address >> - allowed, no false positives */ >> - s->local_peer = >> - (((((unsigned) ntohl(si.sin_addr.s_addr))& 0xFF000000U) == >> - 0x7F000000U) || >> - (getsockname(s->fd,(struct sockaddr*)&di,&st) ? >> - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); >> - } >> + s->local_peer = conn_local_peer_check(g, s->fd); >> dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : >> "Non-local peer connected"); >> >> @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) >> s->got = 0; >> s->mod_time = current_time(g); /* Note activity */ >> >> - s->buf = (char *)malloc(INBUF_SIZE); >> + s->buf = malloc(INBUF_SIZE); >> >> if (s->buf == NULL) { >> dbg_printf(g,0,"epmd: Insufficient memory"); >> @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) >> return EPMD_FALSE; >> } >> >> +static int conn_local_peer_check(EpmdVars *g, int fd) >> +{ >> + struct EPMD_SOCKADDR_IN si; >> + struct EPMD_SOCKADDR_IN di; >> + >> + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; >> + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; >> + >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; >> + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; >> +#endif >> + >> +#ifdef HAVE_SOCKLEN_T >> + socklen_t st; >> +#else >> + int st; >> +#endif >> + >> + st = sizeof(si); >> + >> + /* Determine if connection is from localhost */ >> + if (getpeername(fd,(struct sockaddr*)&si,&st) || >> + st> sizeof(si)) { >> + /* Failure to get peername is regarded as non local host */ >> + return EPMD_FALSE; >> + } >> + >> + /* Only 127.x.x.x and connections from the host's IP address >> + allowed, no false positives */ >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + if (si.ss_family == AF_INET6&& >> IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) >> + return EPMD_TRUE; >> + >> + if (si.ss_family == AF_INET) >> +#endif >> + if ((((unsigned) ntohl(si4->sin_addr.s_addr))& 0xFF000000U) == >> + 0x7F000000U) >> + return EPMD_TRUE; >> + >> + if (getsockname(fd,(struct sockaddr*)&di,&st)) >> + return EPMD_FALSE; >> + >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + if (si.ss_family == AF_INET6) >> + return IN6_ARE_ADDR_EQUAL(&(si6->sin6_addr),&(di6->sin6_addr)); >> + if (si.ss_family == AF_INET) >> +#endif >> + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; >> +#if defined(HAVE_IN6)&& defined(AF_INET6) >> + return EPMD_FALSE; >> +#endif >> +} >> + >> static int conn_close_fd(EpmdVars *g,int fd) >> { >> int i; >> diff --git a/erts/epmd/test/epmd_SUITE.erl >> b/erts/epmd/test/epmd_SUITE.erl >> index cc24a55..ddfe5ab 100644 >> --- a/erts/epmd/test/epmd_SUITE.erl >> +++ b/erts/epmd/test/epmd_SUITE.erl >> @@ -42,6 +42,7 @@ >> -export( >> [ >> register_name/1, >> + register_name_ipv6/1, >> register_names_1/1, >> register_names_2/1, >> register_duplicate_name/1, >> @@ -108,7 +109,8 @@ >> suite() -> [{ct_hooks,[ts_install_cth]}]. >> >> all() -> >> - [register_name, register_names_1, register_names_2, >> + [register_name, register_name_ipv6, >> + register_names_1, register_names_2, >> register_duplicate_name, unicode_name, long_unicode_name, >> get_port_nr, slow_get_port_nr, >> unregister_others_name_1, unregister_others_name_2, >> @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> >> ?line ok = close(Sock), % Unregister >> ok. >> >> +register_name_ipv6(doc) -> >> + ["Register a name over IPv6"]; >> +register_name_ipv6(suite) -> >> + []; >> +register_name_ipv6(Config) when is_list(Config) -> >> + % Test if the host has an IPv6 loopback address >> + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), >> + case Res of >> + {ok,LSock} -> >> + gen_tcp:close(LSock), >> + ?line ok = epmdrun(), >> + ?line {ok,Sock} = register_node6("foobar6"), >> + ?line ok = close(Sock), % Unregister >> + ok; >> + _Error -> >> + {skip, "Host does not have an IPv6 loopback address"} >> + end. >> + >> register_names_1(doc) -> >> ["Register and unregister two nodes"]; >> register_names_1(suite) -> >> @@ -238,13 +258,18 @@ register_node(Name) -> >> register_node(Name,Port) -> >> register_node_v2(Port,$M,0,5,5,Name,""). >> >> +register_node6(Name) -> >> + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). >> + >> register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> >> + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, >> Name, Extra). >> +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, >> Extra) -> >> Utf8Name = unicode:characters_to_binary(Name), >> Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, >> put16(HVsn), put16(LVsn), >> put16(size(Utf8Name)), binary_to_list(Utf8Name), >> size16(Extra), Extra], >> - case send_req(Req) of >> + case send_req(Req, Addr) of >> {ok,Sock} -> >> case recv(Sock,4) of >> {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> >> @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> >> end. >> >> send_req(Req) -> >> - case connect() of >> + send_req(Req, "localhost"). >> +send_req(Req, Addr) -> >> + case connect(Addr) of >> {ok,Sock} -> >> case send(Sock, [size16(Req), Req]) of >> ok -> >> diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl >> index 91af49f..21a3dec 100644 >> --- a/lib/kernel/src/erl_epmd.erl >> +++ b/lib/kernel/src/erl_epmd.erl >> @@ -31,7 +31,7 @@ >> %% External exports >> -export([start/0, start_link/0, stop/0, port_please/2, >> port_please/3, names/0, names/1, >> - register_node/2, open/0, open/1, open/2]). >> + register_node/2, register_node/3, open/0, open/1, open/2]). >> >> %% gen_server callbacks >> -export([init/1, handle_call/3, handle_cast/2, handle_info/2, >> @@ -106,7 +106,9 @@ names1(HostName) -> >> >> >> register_node(Name, PortNo) -> >> - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). >> + register_node(Name, PortNo, inet). >> +register_node(Name, PortNo, Family) -> >> + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, >> infinity). >> >> >> %%%---------------------------------------------------------------------- >> %%% Callback functions from gen_server >> @@ -124,10 +126,10 @@ init(_) -> >> -spec handle_call(calls(), term(), state()) -> >> {'reply', term(), state()} | {'stop', 'shutdown', 'ok', >> state()}. >> >> -handle_call({register, Name, PortNo}, _From, State) -> >> +handle_call({register, Name, PortNo, Family}, _From, State) -> >> case State#state.socket of >> P when P< 0 -> >> - case do_register_node(Name, PortNo) of >> + case do_register_node(Name, PortNo, Family) of >> {alive, Socket, Creation} -> >> S = State#state{socket = Socket, >> port_no = PortNo, >> @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when >> ?ip6(A,B,C,D,E,F,G,H) -> >> close(Socket) -> >> gen_tcp:close(Socket). >> >> -do_register_node(NodeName, TcpPort) -> >> - case open() of >> +do_register_node(NodeName, TcpPort, Family) -> >> + Localhost = case Family of >> + inet -> open({127,0,0,1}); >> + inet6 -> open({0,0,0,0,0,0,0,1}) >> + end, >> + case Localhost of >> {ok, Socket} -> >> Name = to_string(NodeName), >> Extra = "", >> diff --git a/lib/kernel/src/inet6_tcp_dist.erl >> b/lib/kernel/src/inet6_tcp_dist.erl >> index 2315a56..bba4d87 100644 >> --- a/lib/kernel/src/inet6_tcp_dist.erl >> +++ b/lib/kernel/src/inet6_tcp_dist.erl >> @@ -71,7 +71,7 @@ listen(Name) -> >> {ok, Socket} -> >> TcpAddress = get_tcp_address(Socket), >> {_,Port} = TcpAddress#net_address.address, >> - case erl_epmd:register_node(Name, Port) of >> + case erl_epmd:register_node(Name, Port, inet6) of >> {ok, Creation} -> >> {ok, {Socket, TcpAddress, Creation}}; >> Error -> > > -- BR Fredrik Gustafsson Erlang OTP Team From michael.santos@REDACTED Mon Feb 18 22:01:39 2013 From: michael.santos@REDACTED (Michael Santos) Date: Mon, 18 Feb 2013 16:01:39 -0500 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration Message-ID: <20130218210138.GA29265@ioctl> Allow IPv6 nodes to register with and query epmd. On systems with IPv6 support: * epmd listens on both the IPv4 and IPv6 ANY or loopback sockets * the epmd cli client connects to epmd over the IPv6 loopback * distributed nodes started with "-proto_dist inet6_tcp" will register with epmd over IPv6 The interaction between IPv4 and IPv6 sockets depends on the platform: * FreeBSD allows multiple "specific" sockets to bind the same port (such as 2 sockets listening to the same port on ANY and the loopback). Binding port 4369 to IPv4 and IPv6 sockets simulataneously is allowed. * Linux does not allow the same port to be bound by different sockets. Setting the IPV6_V6ONLY socket option is required. * Windows The behaviour differs depending on the version of Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx According to the site, sockets on Windows XP with Service Pack 1 (SP1) and Windows Server 2003 will only listen on either IPv4 or IPv6, so creating two sockets is required to service IPv4 and IPv6 traffic on the same port. The IPV6_V6ONLY socket option is not supported. For Windows Vista and later, a single socket can handle IPv4 and IPv6 traffic for the same port. The IPV6_V6ONLY socket option is supported and is enabled for IPv6 sockets by default. --- erts/doc/src/epmd.xml | 2 +- erts/doc/src/erl.xml | 22 +++++ erts/epmd/src/epmd.c | 6 +- erts/epmd/src/epmd_cli.c | 11 ++- erts/epmd/src/epmd_int.h | 59 ++++++++---- erts/epmd/src/epmd_srv.c | 184 +++++++++++++++++++++++++------------ erts/epmd/test/epmd_SUITE.erl | 33 ++++++- lib/kernel/src/erl_epmd.erl | 18 ++-- lib/kernel/src/inet6_tcp_dist.erl | 2 +- 9 files changed, 244 insertions(+), 93 deletions(-) diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml index 3e70054..3c9313e 100644 --- a/erts/doc/src/epmd.xml +++ b/erts/doc/src/epmd.xml @@ -36,7 +36,7 @@

Erlang Port Mapper Daemon

- +

Starts the port mapper daemon

diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index f354d68..aebf4ff 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -381,6 +381,28 @@ similar to . See code(3).

+ + +

Specify a protocol for Erlang distribution.

+ + inet_tcp + +

TCP over IPv4 (the default)

+
+ inet_ssl + +

distribution over SSL

+
+ inet6_tcp + +

TCP over IPv6

+
+
+

For example, to start up IPv6 distributed nodes:

+
+% erl -name test@REDACTED -proto_dist inet6_tcp
+
+

Starts Erlang with a remote shell connected to .

diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c index 94bb74c..0789cc3 100644 --- a/erts/epmd/src/epmd.c +++ b/erts/epmd/src/epmd.c @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) for (fd = 0; fd < g->max_conn ; fd++) /* close all files ... */ close(fd); /* Syslog on linux will try to write to whatever if we dont - inform it of that the log is closed. */ + inform it that the log is closed. */ closelog(); - /* These chouldn't be needed but for safety... */ + /* These shouldn't be needed but for safety... */ open("/dev/null", O_RDONLY); /* Order is important! */ open("/dev/null", O_WRONLY); @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) close(1); close(2); - /* These chouldn't be needed but for safety... */ + /* These shouldn't be needed but for safety... */ open("nul", O_RDONLY); open("nul", O_WRONLY); diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c index 8817bde..a0dd890 100644 --- a/erts/epmd/src/epmd_cli.c +++ b/erts/epmd/src/epmd_cli.c @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) static int conn_to_epmd(EpmdVars *g) { struct EPMD_SOCKADDR_IN address; + size_t salen = 0; int connect_sock; connect_sock = socket(FAMILY, SOCK_STREAM, 0); @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) { /* store port number in unsigned short */ unsigned short sport = g->port; - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(address, in6addr_loopback, sport); + salen = sizeof(struct sockaddr_in6); +#else + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); + salen = sizeof(struct sockaddr_in); +#endif } - if (connect(connect_sock, (struct sockaddr*)&address, sizeof address) < 0) + if (connect(connect_sock, (struct sockaddr*)&address, salen) < 0) goto error; return connect_sock; diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h index ac354dc..e7974ae 100644 --- a/erts/epmd/src/epmd_int.h +++ b/erts/epmd/src/epmd_int.h @@ -49,6 +49,7 @@ # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H # include # endif +# include # include # include #endif @@ -165,33 +166,53 @@ /* ************************************************************************ */ /* Macros that let us use IPv6 */ -#if defined(HAVE_IN6) && defined(AF_INET6) && defined(EPMD6) +#if HAVE_IN6 +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY +# if HAVE_DECL_IN6ADDR_ANY_INIT +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; +# else +static const struct in6_addr in6addr_any = + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; +# endif /* HAVE_IN6ADDR_ANY_INIT */ +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ + +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT +static const struct in6_addr in6addr_loopback = + { { IN6ADDR_LOOPBACK_INIT } }; +# else +static const struct in6_addr in6addr_loopback = + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ +#endif /* HAVE_IN6 */ + +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) + +#if defined(HAVE_IN6) && defined(AF_INET6) -#define EPMD_SOCKADDR_IN sockaddr_in6 -#define EPMD_IN_ADDR in6_addr -#define EPMD_S_ADDR s6_addr -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr -#define EPMD_ADDR_ANY in6addr_any.s6_addr +#define EPMD_SOCKADDR_IN sockaddr_storage #define FAMILY AF_INET6 -#define SET_ADDR(dst, addr, port) do { \ - memset((char*)&(dst), 0, sizeof(dst)); \ - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ - (dst).sin6_family = AF_INET6; \ - (dst).sin6_flowinfo = 0; \ - (dst).sin6_port = htons(port); \ +#define SET_ADDR6(dst, addr, port) do { \ + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ + memset(sa, 0, sizeof(dst)); \ + sa->sin6_family = AF_INET6; \ + sa->sin6_addr = (addr); \ + sa->sin6_port = htons(port); \ } while(0) -#define IS_ADDR_LOOPBACK(addr) \ - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) +#define SET_ADDR(dst, addr, port) do { \ + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ + memset(sa, 0, sizeof(dst)); \ + sa->sin_family = AF_INET; \ + sa->sin_addr.s_addr = (addr); \ + sa->sin_port = htons(port); \ + } while(0) #else /* Not IP v6 */ #define EPMD_SOCKADDR_IN sockaddr_in -#define EPMD_IN_ADDR in_addr -#define EPMD_S_ADDR s_addr -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) -#define EPMD_ADDR_ANY htonl(INADDR_ANY) #define FAMILY AF_INET #define SET_ADDR(dst, addr, port) do { \ @@ -201,8 +222,6 @@ (dst).sin_port = htons(port); \ } while(0) -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) - #endif /* Not IP v6 */ /* ************************************************************************ */ diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c index 90df7cc..9b7d931 100644 --- a/erts/epmd/src/epmd_srv.c +++ b/erts/epmd/src/epmd_srv.c @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); static Connection *conn_init(EpmdVars*); static int conn_open(EpmdVars*,int); +static int conn_local_peer_check(EpmdVars*, int); static int conn_close_fd(EpmdVars*,int); static void node_init(EpmdVars*); @@ -200,7 +201,7 @@ void run(EpmdVars *g) { struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; int listensock[MAX_LISTEN_SOCKETS]; - int num_sockets; + int num_sockets = 0; int i; int opt; unsigned short sport = g->port; @@ -213,64 +214,82 @@ void run(EpmdVars *g) if (g->addresses != NULL && /* String contains non-separator characters if: */ g->addresses[strspn(g->addresses," ,")] != '\000') { - char *tmp; - char *token; - int loopback_ok = 0; + char *tmp = NULL; + char *token = NULL; + + /* Always listen on the loopback. */ + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); + num_sockets++; +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); + num_sockets++; +#endif - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) + if ((tmp = strdup(g->addresses)) == NULL) { dbg_perror(g,"cannot allocate memory"); epmd_cleanup_exit(g,1); } - strcpy(tmp,g->addresses); - for(token = strtok(tmp,", "), num_sockets = 0; + for(token = strtok(tmp,", "); token != NULL; - token = strtok(NULL,", "), num_sockets++) + token = strtok(NULL,", ")) { - struct EPMD_IN_ADDR addr; -#ifdef HAVE_INET_PTON - int ret; + struct in_addr addr; +#if defined(HAVE_IN6) && defined(AF_INET6) + struct in6_addr addr6; + struct sockaddr_storage *sa = &iserv_addr[num_sockets]; - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) + if (inet_pton(AF_INET,token,&addr) == 1) { - dbg_perror(g,"cannot convert IP address to network format"); - epmd_cleanup_exit(g,1); + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); + } + else if (inet_pton(AF_INET6,token,&addr6) == 1) + { + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); + } + else +#else + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) + { + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); } - else if (ret == 0) -#elif !defined(EPMD6) - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) + else #endif { dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); epmd_cleanup_exit(g,1); } +#if defined(HAVE_IN6) && defined(AF_INET6) + if (sa->ss_family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&addr6)) + continue; + + if (sa->ss_family == AF_INET) +#endif if (IS_ADDR_LOOPBACK(addr)) - loopback_ok = 1; + continue; - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) + num_sockets++; + + if (num_sockets >= MAX_LISTEN_SOCKETS) { dbg_tty_printf(g,0,"cannot listen on more than %d IP addresses", MAX_LISTEN_SOCKETS); epmd_cleanup_exit(g,1); } - - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); } free(tmp); - - if (!loopback_ok) - { - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); - num_sockets++; - } } else { - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); - num_sockets = 1; + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); + num_sockets++; +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); + num_sockets++; +#endif } #if !defined(__WIN32__) @@ -291,13 +310,33 @@ void run(EpmdVars *g) for (i = 0; i < num_sockets; i++) { - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0)) < 0) + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; +#if defined(HAVE_IN6) && defined(AF_INET6) + size_t salen = (sa->sa_family == AF_INET6 ? + sizeof(struct sockaddr_in6) : + sizeof(struct sockaddr_in)); +#else + size_t salen = sizeof(struct sockaddr_in); +#endif + + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0)) < 0) { dbg_perror(g,"error opening stream socket"); epmd_cleanup_exit(g,1); } g->listenfd[i] = listensock[i]; - + +#if HAVE_DECL_IPV6_V6ONLY + opt = 1; + if (sa->sa_family == AF_INET6 && + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, + sizeof(opt)) <0) + { + dbg_perror(g,"can't set IPv6 only socket option"); + epmd_cleanup_exit(g,1); + } +#endif + /* * Note that we must not enable the SO_REUSEADDR on Windows, * because addresses will be reused even if they are still in use. @@ -329,8 +368,7 @@ void run(EpmdVars *g) dbg_perror(g,"failed to set non-blocking mode of listening socket %d", listensock[i]); - if (bind(listensock[i], (struct sockaddr*) &iserv_addr[i], - sizeof(iserv_addr[i])) < 0) + if (bind(listensock[i], (struct sockaddr*) &iserv_addr[i], salen) < 0) { if (errno == EADDRINUSE) { @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) for (i = 0; i < g->max_conn; i++) { if (g->conn[i].open == EPMD_FALSE) { - struct sockaddr_in si; - struct sockaddr_in di; -#ifdef HAVE_SOCKLEN_T - socklen_t st; -#else - int st; -#endif - st = sizeof(si); - g->active_conn++; s = &g->conn[i]; @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) s->open = EPMD_TRUE; s->keep = EPMD_FALSE; - /* Determine if connection is from localhost */ - if (getpeername(s->fd,(struct sockaddr*) &si,&st) || - st < sizeof(si)) { - /* Failure to get peername is regarded as non local host */ - s->local_peer = EPMD_FALSE; - } else { - /* Only 127.x.x.x and connections from the host's IP address - allowed, no false positives */ - s->local_peer = - (((((unsigned) ntohl(si.sin_addr.s_addr)) & 0xFF000000U) == - 0x7F000000U) || - (getsockname(s->fd,(struct sockaddr*) &di,&st) ? - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); - } + s->local_peer = conn_local_peer_check(g, s->fd); dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : "Non-local peer connected"); @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) s->got = 0; s->mod_time = current_time(g); /* Note activity */ - s->buf = (char *)malloc(INBUF_SIZE); + s->buf = malloc(INBUF_SIZE); if (s->buf == NULL) { dbg_printf(g,0,"epmd: Insufficient memory"); @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) return EPMD_FALSE; } +static int conn_local_peer_check(EpmdVars *g, int fd) +{ + struct EPMD_SOCKADDR_IN si; + struct EPMD_SOCKADDR_IN di; + + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; + +#if defined(HAVE_IN6) && defined(AF_INET6) + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; +#endif + +#ifdef HAVE_SOCKLEN_T + socklen_t st; +#else + int st; +#endif + + st = sizeof(si); + + /* Determine if connection is from localhost */ + if (getpeername(fd,(struct sockaddr*) &si,&st) || + st > sizeof(si)) { + /* Failure to get peername is regarded as non local host */ + return EPMD_FALSE; + } + + /* Only 127.x.x.x and connections from the host's IP address + allowed, no false positives */ +#if defined(HAVE_IN6) && defined(AF_INET6) + if (si.ss_family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) + return EPMD_TRUE; + + if (si.ss_family == AF_INET) +#endif + if ((((unsigned) ntohl(si4->sin_addr.s_addr)) & 0xFF000000U) == + 0x7F000000U) + return EPMD_TRUE; + + if (getsockname(fd,(struct sockaddr*) &di,&st)) + return EPMD_FALSE; + +#if defined(HAVE_IN6) && defined(AF_INET6) + if (si.ss_family == AF_INET6) + return IN6_ARE_ADDR_EQUAL( &(si6->sin6_addr), &(di6->sin6_addr)); + if (si.ss_family == AF_INET) +#endif + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; +#if defined(HAVE_IN6) && defined(AF_INET6) + return EPMD_FALSE; +#endif +} + static int conn_close_fd(EpmdVars *g,int fd) { int i; diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl index cc24a55..ddfe5ab 100644 --- a/erts/epmd/test/epmd_SUITE.erl +++ b/erts/epmd/test/epmd_SUITE.erl @@ -42,6 +42,7 @@ -export( [ register_name/1, + register_name_ipv6/1, register_names_1/1, register_names_2/1, register_duplicate_name/1, @@ -108,7 +109,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [register_name, register_names_1, register_names_2, + [register_name, register_name_ipv6, + register_names_1, register_names_2, register_duplicate_name, unicode_name, long_unicode_name, get_port_nr, slow_get_port_nr, unregister_others_name_1, unregister_others_name_2, @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> ?line ok = close(Sock), % Unregister ok. +register_name_ipv6(doc) -> + ["Register a name over IPv6"]; +register_name_ipv6(suite) -> + []; +register_name_ipv6(Config) when is_list(Config) -> + % Test if the host has an IPv6 loopback address + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), + case Res of + {ok,LSock} -> + gen_tcp:close(LSock), + ?line ok = epmdrun(), + ?line {ok,Sock} = register_node6("foobar6"), + ?line ok = close(Sock), % Unregister + ok; + _Error -> + {skip, "Host does not have an IPv6 loopback address"} + end. + register_names_1(doc) -> ["Register and unregister two nodes"]; register_names_1(suite) -> @@ -238,13 +258,18 @@ register_node(Name) -> register_node(Name,Port) -> register_node_v2(Port,$M,0,5,5,Name,""). +register_node6(Name) -> + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). + register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, Name, Extra). +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> Utf8Name = unicode:characters_to_binary(Name), Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, put16(HVsn), put16(LVsn), put16(size(Utf8Name)), binary_to_list(Utf8Name), size16(Extra), Extra], - case send_req(Req) of + case send_req(Req, Addr) of {ok,Sock} -> case recv(Sock,4) of {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> end. send_req(Req) -> - case connect() of + send_req(Req, "localhost"). +send_req(Req, Addr) -> + case connect(Addr) of {ok,Sock} -> case send(Sock, [size16(Req), Req]) of ok -> diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl index 91af49f..21a3dec 100644 --- a/lib/kernel/src/erl_epmd.erl +++ b/lib/kernel/src/erl_epmd.erl @@ -31,7 +31,7 @@ %% External exports -export([start/0, start_link/0, stop/0, port_please/2, port_please/3, names/0, names/1, - register_node/2, open/0, open/1, open/2]). + register_node/2, register_node/3, open/0, open/1, open/2]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -106,7 +106,9 @@ names1(HostName) -> register_node(Name, PortNo) -> - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). + register_node(Name, PortNo, inet). +register_node(Name, PortNo, Family) -> + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity). %%%---------------------------------------------------------------------- %%% Callback functions from gen_server @@ -124,10 +126,10 @@ init(_) -> -spec handle_call(calls(), term(), state()) -> {'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}. -handle_call({register, Name, PortNo}, _From, State) -> +handle_call({register, Name, PortNo, Family}, _From, State) -> case State#state.socket of P when P < 0 -> - case do_register_node(Name, PortNo) of + case do_register_node(Name, PortNo, Family) of {alive, Socket, Creation} -> S = State#state{socket = Socket, port_no = PortNo, @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) -> close(Socket) -> gen_tcp:close(Socket). -do_register_node(NodeName, TcpPort) -> - case open() of +do_register_node(NodeName, TcpPort, Family) -> + Localhost = case Family of + inet -> open({127,0,0,1}); + inet6 -> open({0,0,0,0,0,0,0,1}) + end, + case Localhost of {ok, Socket} -> Name = to_string(NodeName), Extra = "", diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl index 2315a56..bba4d87 100644 --- a/lib/kernel/src/inet6_tcp_dist.erl +++ b/lib/kernel/src/inet6_tcp_dist.erl @@ -71,7 +71,7 @@ listen(Name) -> {ok, Socket} -> TcpAddress = get_tcp_address(Socket), {_,Port} = TcpAddress#net_address.address, - case erl_epmd:register_node(Name, Port) of + case erl_epmd:register_node(Name, Port, inet6) of {ok, Creation} -> {ok, {Socket, TcpAddress, Creation}}; Error -> -- 1.7.9.5 From fredrik@REDACTED Tue Feb 19 10:29:21 2013 From: fredrik@REDACTED (Fredrik) Date: Tue, 19 Feb 2013 10:29:21 +0100 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <20130218210138.GA29265@ioctl> References: <20130218210138.GA29265@ioctl> Message-ID: <512345F1.8090609@erlang.org> On 02/18/2013 10:01 PM, Michael Santos wrote: > Allow IPv6 nodes to register with and query epmd. On systems with > IPv6 support: > > * epmd listens on both the IPv4 and IPv6 ANY or loopback sockets > > * the epmd cli client connects to epmd over the IPv6 loopback > > * distributed nodes started with "-proto_dist inet6_tcp" will register > with epmd over IPv6 > > The interaction between IPv4 and IPv6 sockets depends on the platform: > > * FreeBSD allows multiple "specific" sockets to bind the same port (such > as 2 sockets listening to the same port on ANY and the loopback). > Binding port 4369 to IPv4 and IPv6 sockets simulataneously is allowed. > > * Linux does not allow the same port to be bound by different sockets. > Setting the IPV6_V6ONLY socket option is required. > > * Windows > > The behaviour differs depending on the version of Windows: > > http://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx > > According to the site, sockets on Windows XP with Service Pack 1 (SP1) > and Windows Server 2003 will only listen on either IPv4 or IPv6, so > creating two sockets is required to service IPv4 and IPv6 traffic on > the same port. The IPV6_V6ONLY socket option is not supported. > > For Windows Vista and later, a single socket can handle IPv4 and IPv6 > traffic for the same port. The IPV6_V6ONLY socket option is supported > and is enabled for IPv6 sockets by default. > --- > erts/doc/src/epmd.xml | 2 +- > erts/doc/src/erl.xml | 22 +++++ > erts/epmd/src/epmd.c | 6 +- > erts/epmd/src/epmd_cli.c | 11 ++- > erts/epmd/src/epmd_int.h | 59 ++++++++---- > erts/epmd/src/epmd_srv.c | 184 +++++++++++++++++++++++++------------ > erts/epmd/test/epmd_SUITE.erl | 33 ++++++- > lib/kernel/src/erl_epmd.erl | 18 ++-- > lib/kernel/src/inet6_tcp_dist.erl | 2 +- > 9 files changed, 244 insertions(+), 93 deletions(-) > > diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml > index 3e70054..3c9313e 100644 > --- a/erts/doc/src/epmd.xml > +++ b/erts/doc/src/epmd.xml > @@ -36,7 +36,7 @@ > >

Erlang Port Mapper Daemon

> > - > + > >

Starts the port mapper daemon

>
> diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml > index f354d68..aebf4ff 100644 > --- a/erts/doc/src/erl.xml > +++ b/erts/doc/src/erl.xml > @@ -381,6 +381,28 @@ > similar to. See > code(3).

>
> + > + > +

Specify a protocol for Erlang distribution.

> + > + inet_tcp > + > +

TCP over IPv4 (the default)

> +
> + inet_ssl > + > +

distribution over SSL

> +
> + inet6_tcp > + > +

TCP over IPv6

> +
> +
> +

For example, to start up IPv6 distributed nodes:

> +
> +%erl -name test@REDACTED -proto_dist inet6_tcp
> +
> +
> > >

Starts Erlang with a remote shell connected to.

> diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c > index 94bb74c..0789cc3 100644 > --- a/erts/epmd/src/epmd.c > +++ b/erts/epmd/src/epmd.c > @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) > for (fd = 0; fd< g->max_conn ; fd++) /* close all files ... */ > close(fd); > /* Syslog on linux will try to write to whatever if we dont > - inform it of that the log is closed. */ > + inform it that the log is closed. */ > closelog(); > > - /* These chouldn't be needed but for safety... */ > + /* These shouldn't be needed but for safety... */ > > open("/dev/null", O_RDONLY); /* Order is important! */ > open("/dev/null", O_WRONLY); > @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) > close(1); > close(2); > > - /* These chouldn't be needed but for safety... */ > + /* These shouldn't be needed but for safety... */ > > open("nul", O_RDONLY); > open("nul", O_WRONLY); > diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c > index 8817bde..a0dd890 100644 > --- a/erts/epmd/src/epmd_cli.c > +++ b/erts/epmd/src/epmd_cli.c > @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) > static int conn_to_epmd(EpmdVars *g) > { > struct EPMD_SOCKADDR_IN address; > + size_t salen = 0; > int connect_sock; > > connect_sock = socket(FAMILY, SOCK_STREAM, 0); > @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) > > { /* store port number in unsigned short */ > unsigned short sport = g->port; > - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(address, in6addr_loopback, sport); > + salen = sizeof(struct sockaddr_in6); > +#else > + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); > + salen = sizeof(struct sockaddr_in); > +#endif > } > > - if (connect(connect_sock, (struct sockaddr*)&address, sizeof address)< 0) > + if (connect(connect_sock, (struct sockaddr*)&address, salen)< 0) > goto error; > return connect_sock; > > diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h > index ac354dc..e7974ae 100644 > --- a/erts/epmd/src/epmd_int.h > +++ b/erts/epmd/src/epmd_int.h > @@ -49,6 +49,7 @@ > # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H > # include > # endif > +# include > # include > # include > #endif > @@ -165,33 +166,53 @@ > /* ************************************************************************ */ > /* Macros that let us use IPv6 */ > > -#if defined(HAVE_IN6)&& defined(AF_INET6)&& defined(EPMD6) > +#if HAVE_IN6 > +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY > +# if HAVE_DECL_IN6ADDR_ANY_INIT > +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; > +# else > +static const struct in6_addr in6addr_any = > + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; > +# endif /* HAVE_IN6ADDR_ANY_INIT */ > +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ > + > +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK > +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT > +static const struct in6_addr in6addr_loopback = > + { { IN6ADDR_LOOPBACK_INIT } }; > +# else > +static const struct in6_addr in6addr_loopback = > + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; > +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ > +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ > +#endif /* HAVE_IN6 */ > + > +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > > -#define EPMD_SOCKADDR_IN sockaddr_in6 > -#define EPMD_IN_ADDR in6_addr > -#define EPMD_S_ADDR s6_addr > -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr > -#define EPMD_ADDR_ANY in6addr_any.s6_addr > +#define EPMD_SOCKADDR_IN sockaddr_storage > #define FAMILY AF_INET6 > > -#define SET_ADDR(dst, addr, port) do { \ > - memset((char*)&(dst), 0, sizeof(dst)); \ > - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ > - (dst).sin6_family = AF_INET6; \ > - (dst).sin6_flowinfo = 0; \ > - (dst).sin6_port = htons(port); \ > +#define SET_ADDR6(dst, addr, port) do { \ > + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ > + memset(sa, 0, sizeof(dst)); \ > + sa->sin6_family = AF_INET6; \ > + sa->sin6_addr = (addr); \ > + sa->sin6_port = htons(port); \ > } while(0) > > -#define IS_ADDR_LOOPBACK(addr) \ > - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) > +#define SET_ADDR(dst, addr, port) do { \ > + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ > + memset(sa, 0, sizeof(dst)); \ > + sa->sin_family = AF_INET; \ > + sa->sin_addr.s_addr = (addr); \ > + sa->sin_port = htons(port); \ > + } while(0) > > #else /* Not IP v6 */ > > #define EPMD_SOCKADDR_IN sockaddr_in > -#define EPMD_IN_ADDR in_addr > -#define EPMD_S_ADDR s_addr > -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) > -#define EPMD_ADDR_ANY htonl(INADDR_ANY) > #define FAMILY AF_INET > > #define SET_ADDR(dst, addr, port) do { \ > @@ -201,8 +222,6 @@ > (dst).sin_port = htons(port); \ > } while(0) > > -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) > - > #endif /* Not IP v6 */ > > /* ************************************************************************ */ > diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c > index 90df7cc..9b7d931 100644 > --- a/erts/epmd/src/epmd_srv.c > +++ b/erts/epmd/src/epmd_srv.c > @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); > > static Connection *conn_init(EpmdVars*); > static int conn_open(EpmdVars*,int); > +static int conn_local_peer_check(EpmdVars*, int); > static int conn_close_fd(EpmdVars*,int); > > static void node_init(EpmdVars*); > @@ -200,7 +201,7 @@ void run(EpmdVars *g) > { > struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; > int listensock[MAX_LISTEN_SOCKETS]; > - int num_sockets; > + int num_sockets = 0; > int i; > int opt; > unsigned short sport = g->port; > @@ -213,64 +214,82 @@ void run(EpmdVars *g) > if (g->addresses != NULL&& /* String contains non-separator characters if: */ > g->addresses[strspn(g->addresses," ,")] != '\000') > { > - char *tmp; > - char *token; > - int loopback_ok = 0; > + char *tmp = NULL; > + char *token = NULL; > + > + /* Always listen on the loopback. */ > + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); > + num_sockets++; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); > + num_sockets++; > +#endif > > - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) > + if ((tmp = strdup(g->addresses)) == NULL) > { > dbg_perror(g,"cannot allocate memory"); > epmd_cleanup_exit(g,1); > } > - strcpy(tmp,g->addresses); > > - for(token = strtok(tmp,", "), num_sockets = 0; > + for(token = strtok(tmp,", "); > token != NULL; > - token = strtok(NULL,", "), num_sockets++) > + token = strtok(NULL,", ")) > { > - struct EPMD_IN_ADDR addr; > -#ifdef HAVE_INET_PTON > - int ret; > + struct in_addr addr; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + struct in6_addr addr6; > + struct sockaddr_storage *sa =&iserv_addr[num_sockets]; > > - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) > + if (inet_pton(AF_INET,token,&addr) == 1) > { > - dbg_perror(g,"cannot convert IP address to network format"); > - epmd_cleanup_exit(g,1); > + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); > + } > + else if (inet_pton(AF_INET6,token,&addr6) == 1) > + { > + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); > + } > + else > +#else > + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) > + { > + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); > } > - else if (ret == 0) > -#elif !defined(EPMD6) > - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) > + else > #endif > { > dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); > epmd_cleanup_exit(g,1); > } > > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (sa->ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&addr6)) > + continue; > + > + if (sa->ss_family == AF_INET) > +#endif > if (IS_ADDR_LOOPBACK(addr)) > - loopback_ok = 1; > + continue; > > - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) > + num_sockets++; > + > + if (num_sockets>= MAX_LISTEN_SOCKETS) > { > dbg_tty_printf(g,0,"cannot listen on more than %d IP addresses", > MAX_LISTEN_SOCKETS); > epmd_cleanup_exit(g,1); > } > - > - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); > } > > free(tmp); > - > - if (!loopback_ok) > - { > - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); > - num_sockets++; > - } > } > else > { > - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); > - num_sockets = 1; > + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); > + num_sockets++; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); > + num_sockets++; > +#endif > } > > #if !defined(__WIN32__) > @@ -291,13 +310,33 @@ void run(EpmdVars *g) > > for (i = 0; i< num_sockets; i++) > { > - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0))< 0) > + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + size_t salen = (sa->sa_family == AF_INET6 ? > + sizeof(struct sockaddr_in6) : > + sizeof(struct sockaddr_in)); > +#else > + size_t salen = sizeof(struct sockaddr_in); > +#endif > + > + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0))< 0) > { > dbg_perror(g,"error opening stream socket"); > epmd_cleanup_exit(g,1); > } > g->listenfd[i] = listensock[i]; > - > + > +#if HAVE_DECL_IPV6_V6ONLY > + opt = 1; > + if (sa->sa_family == AF_INET6&& > + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, > + sizeof(opt))<0) > + { > + dbg_perror(g,"can't set IPv6 only socket option"); > + epmd_cleanup_exit(g,1); > + } > +#endif > + > /* > * Note that we must not enable the SO_REUSEADDR on Windows, > * because addresses will be reused even if they are still in use. > @@ -329,8 +368,7 @@ void run(EpmdVars *g) > dbg_perror(g,"failed to set non-blocking mode of listening socket %d", > listensock[i]); > > - if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], > - sizeof(iserv_addr[i]))< 0) > + if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], salen)< 0) > { > if (errno == EADDRINUSE) > { > @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) > > for (i = 0; i< g->max_conn; i++) { > if (g->conn[i].open == EPMD_FALSE) { > - struct sockaddr_in si; > - struct sockaddr_in di; > -#ifdef HAVE_SOCKLEN_T > - socklen_t st; > -#else > - int st; > -#endif > - st = sizeof(si); > - > g->active_conn++; > s =&g->conn[i]; > > @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) > s->open = EPMD_TRUE; > s->keep = EPMD_FALSE; > > - /* Determine if connection is from localhost */ > - if (getpeername(s->fd,(struct sockaddr*)&si,&st) || > - st< sizeof(si)) { > - /* Failure to get peername is regarded as non local host */ > - s->local_peer = EPMD_FALSE; > - } else { > - /* Only 127.x.x.x and connections from the host's IP address > - allowed, no false positives */ > - s->local_peer = > - (((((unsigned) ntohl(si.sin_addr.s_addr))& 0xFF000000U) == > - 0x7F000000U) || > - (getsockname(s->fd,(struct sockaddr*)&di,&st) ? > - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); > - } > + s->local_peer = conn_local_peer_check(g, s->fd); > dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : > "Non-local peer connected"); > > @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) > s->got = 0; > s->mod_time = current_time(g); /* Note activity */ > > - s->buf = (char *)malloc(INBUF_SIZE); > + s->buf = malloc(INBUF_SIZE); > > if (s->buf == NULL) { > dbg_printf(g,0,"epmd: Insufficient memory"); > @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) > return EPMD_FALSE; > } > > +static int conn_local_peer_check(EpmdVars *g, int fd) > +{ > + struct EPMD_SOCKADDR_IN si; > + struct EPMD_SOCKADDR_IN di; > + > + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; > + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; > + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; > +#endif > + > +#ifdef HAVE_SOCKLEN_T > + socklen_t st; > +#else > + int st; > +#endif > + > + st = sizeof(si); > + > + /* Determine if connection is from localhost */ > + if (getpeername(fd,(struct sockaddr*)&si,&st) || > + st> sizeof(si)) { > + /* Failure to get peername is regarded as non local host */ > + return EPMD_FALSE; > + } > + > + /* Only 127.x.x.x and connections from the host's IP address > + allowed, no false positives */ > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (si.ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) > + return EPMD_TRUE; > + > + if (si.ss_family == AF_INET) > +#endif > + if ((((unsigned) ntohl(si4->sin_addr.s_addr))& 0xFF000000U) == > + 0x7F000000U) > + return EPMD_TRUE; > + > + if (getsockname(fd,(struct sockaddr*)&di,&st)) > + return EPMD_FALSE; > + > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + if (si.ss_family == AF_INET6) > + return IN6_ARE_ADDR_EQUAL(&(si6->sin6_addr),&(di6->sin6_addr)); > + if (si.ss_family == AF_INET) > +#endif > + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; > +#if defined(HAVE_IN6)&& defined(AF_INET6) > + return EPMD_FALSE; > +#endif > +} > + > static int conn_close_fd(EpmdVars *g,int fd) > { > int i; > diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl > index cc24a55..ddfe5ab 100644 > --- a/erts/epmd/test/epmd_SUITE.erl > +++ b/erts/epmd/test/epmd_SUITE.erl > @@ -42,6 +42,7 @@ > -export( > [ > register_name/1, > + register_name_ipv6/1, > register_names_1/1, > register_names_2/1, > register_duplicate_name/1, > @@ -108,7 +109,8 @@ > suite() -> [{ct_hooks,[ts_install_cth]}]. > > all() -> > - [register_name, register_names_1, register_names_2, > + [register_name, register_name_ipv6, > + register_names_1, register_names_2, > register_duplicate_name, unicode_name, long_unicode_name, > get_port_nr, slow_get_port_nr, > unregister_others_name_1, unregister_others_name_2, > @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> > ?line ok = close(Sock), % Unregister > ok. > > +register_name_ipv6(doc) -> > + ["Register a name over IPv6"]; > +register_name_ipv6(suite) -> > + []; > +register_name_ipv6(Config) when is_list(Config) -> > + % Test if the host has an IPv6 loopback address > + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), > + case Res of > + {ok,LSock} -> > + gen_tcp:close(LSock), > + ?line ok = epmdrun(), > + ?line {ok,Sock} = register_node6("foobar6"), > + ?line ok = close(Sock), % Unregister > + ok; > + _Error -> > + {skip, "Host does not have an IPv6 loopback address"} > + end. > + > register_names_1(doc) -> > ["Register and unregister two nodes"]; > register_names_1(suite) -> > @@ -238,13 +258,18 @@ register_node(Name) -> > register_node(Name,Port) -> > register_node_v2(Port,$M,0,5,5,Name,""). > > +register_node6(Name) -> > + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). > + > register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> > + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, Name, Extra). > +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> > Utf8Name = unicode:characters_to_binary(Name), > Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, > put16(HVsn), put16(LVsn), > put16(size(Utf8Name)), binary_to_list(Utf8Name), > size16(Extra), Extra], > - case send_req(Req) of > + case send_req(Req, Addr) of > {ok,Sock} -> > case recv(Sock,4) of > {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> > @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> > end. > > send_req(Req) -> > - case connect() of > + send_req(Req, "localhost"). > +send_req(Req, Addr) -> > + case connect(Addr) of > {ok,Sock} -> > case send(Sock, [size16(Req), Req]) of > ok -> > diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl > index 91af49f..21a3dec 100644 > --- a/lib/kernel/src/erl_epmd.erl > +++ b/lib/kernel/src/erl_epmd.erl > @@ -31,7 +31,7 @@ > %% External exports > -export([start/0, start_link/0, stop/0, port_please/2, > port_please/3, names/0, names/1, > - register_node/2, open/0, open/1, open/2]). > + register_node/2, register_node/3, open/0, open/1, open/2]). > > %% gen_server callbacks > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > @@ -106,7 +106,9 @@ names1(HostName) -> > > > register_node(Name, PortNo) -> > - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). > + register_node(Name, PortNo, inet). > +register_node(Name, PortNo, Family) -> > + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity). > > %%%---------------------------------------------------------------------- > %%% Callback functions from gen_server > @@ -124,10 +126,10 @@ init(_) -> > -spec handle_call(calls(), term(), state()) -> > {'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}. > > -handle_call({register, Name, PortNo}, _From, State) -> > +handle_call({register, Name, PortNo, Family}, _From, State) -> > case State#state.socket of > P when P< 0 -> > - case do_register_node(Name, PortNo) of > + case do_register_node(Name, PortNo, Family) of > {alive, Socket, Creation} -> > S = State#state{socket = Socket, > port_no = PortNo, > @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) -> > close(Socket) -> > gen_tcp:close(Socket). > > -do_register_node(NodeName, TcpPort) -> > - case open() of > +do_register_node(NodeName, TcpPort, Family) -> > + Localhost = case Family of > + inet -> open({127,0,0,1}); > + inet6 -> open({0,0,0,0,0,0,0,1}) > + end, > + case Localhost of > {ok, Socket} -> > Name = to_string(NodeName), > Extra = "", > diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl > index 2315a56..bba4d87 100644 > --- a/lib/kernel/src/inet6_tcp_dist.erl > +++ b/lib/kernel/src/inet6_tcp_dist.erl > @@ -71,7 +71,7 @@ listen(Name) -> > {ok, Socket} -> > TcpAddress = get_tcp_address(Socket), > {_,Port} = TcpAddress#net_address.address, > - case erl_epmd:register_node(Name, Port) of > + case erl_epmd:register_node(Name, Port, inet6) of > {ok, Creation} -> > {ok, {Socket, TcpAddress, Creation}}; > Error -> Still failing to build, this time also on win epmd_srv.o : error LNK2019: unresolved external symbol IN6_ARE_ADDR_EQUAL referenced in function conn_local_peer_check epmd_srv.o : error LNK2019: unresolved external symbol IN6_IS_ADDR_LOOPBACK referenced in function conn_local_peer_check -- BR Fredrik Gustafsson Erlang OTP Team From kostis@REDACTED Tue Feb 19 11:16:28 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 19 Feb 2013 11:16:28 +0100 Subject: [erlang-patches] Change the return value of hipe_bifs:remove_refs_from/1 In-Reply-To: <51220EB0.4040807@erlang.org> References: <511B4C24.9060806@cs.ntua.gr> <51220EB0.4040807@erlang.org> Message-ID: <512350FC.8050409@cs.ntua.gr> On 02/18/2013 12:21 PM, Fredrik wrote: > On 02/13/2013 09:17 AM, Kostis Sagonas wrote: >> Please include: >> >> git fetch git://github.com/kostis/otp.git hipe_bif-remove_refs_from >> >> Kostis >> _______________________________________________ > Hello Kostis, > Your patch seems to fail testcase: > code_SUITE, ext_mod_dep > With the reason: > > not_verified({'$M_EXPR','$F_EXPR',1}, [{lists,foreach,2}, > {hipe_unified_loader, > mark_referred_from,1}, > {hipe_unified_loader,get_refs_from,2}, > ... > {code_server,loop,1}, > {code_server,system_continue,3}]) > > > After discussions, after discussion you should either use a list > comprehension here or add lists:foreach to the testcase. Hi Fredrik, I think I've fixed this particular test case (*). Please re-fetch. Kostis (*) On my PC there is another test of code_SUITE that's failing, but I do not understand why (or how it's related). However, I am sure you will enlighten me if it also fails for you ;) From fredrik@REDACTED Tue Feb 19 12:10:50 2013 From: fredrik@REDACTED (Fredrik) Date: Tue, 19 Feb 2013 12:10:50 +0100 Subject: [erlang-patches] Change the return value of hipe_bifs:remove_refs_from/1 In-Reply-To: <512350FC.8050409@cs.ntua.gr> References: <511B4C24.9060806@cs.ntua.gr> <51220EB0.4040807@erlang.org> <512350FC.8050409@cs.ntua.gr> Message-ID: <51235DBA.6060202@erlang.org> On 02/19/2013 11:16 AM, Kostis Sagonas wrote: > On 02/18/2013 12:21 PM, Fredrik wrote: >> On 02/13/2013 09:17 AM, Kostis Sagonas wrote: >>> Please include: >>> >>> git fetch git://github.com/kostis/otp.git hipe_bif-remove_refs_from >>> >>> Kostis >>> _______________________________________________ >> Hello Kostis, >> Your patch seems to fail testcase: >> code_SUITE, ext_mod_dep >> With the reason: >> >> not_verified({'$M_EXPR','$F_EXPR',1}, [{lists,foreach,2}, >> {hipe_unified_loader, >> mark_referred_from,1}, >> >> {hipe_unified_loader,get_refs_from,2}, >> ... >> {code_server,loop,1}, >> >> {code_server,system_continue,3}]) >> >> >> After discussions, after discussion you should either use a list >> comprehension here or add lists:foreach to the testcase. > > Hi Fredrik, > > I think I've fixed this particular test case (*). Please re-fetch. > > Kostis > > (*) On my PC there is another test of code_SUITE that's failing, but I > do not understand why (or how it's related). However, I am sure you > will enlighten me if it also fails for you ;) Hello Kostis, What particular testcase is it that fails for you? During the days your patch was in our testing environment these tests failed in code_SUITE: big_boot_embedded (on powerpc) ext_mod_dep (as we discussed) native_early_modules -- BR Fredrik Gustafsson Erlang OTP Team From kostis@REDACTED Tue Feb 19 14:08:31 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 19 Feb 2013 14:08:31 +0100 Subject: [erlang-patches] Change the return value of hipe_bifs:remove_refs_from/1 In-Reply-To: <51235DBA.6060202@erlang.org> References: <511B4C24.9060806@cs.ntua.gr> <51220EB0.4040807@erlang.org> <512350FC.8050409@cs.ntua.gr> <51235DBA.6060202@erlang.org> Message-ID: <5123794F.3080500@cs.ntua.gr> On 02/19/2013 12:10 PM, Fredrik wrote: > On 02/19/2013 11:16 AM, Kostis Sagonas wrote: >> >> (*) On my PC there is another test of code_SUITE that's failing, but I >> do not understand why (or how it's related). However, I am sure you >> will enlighten me if it also fails for you ;) > Hello Kostis, > What particular testcase is it that fails for you? > During the days your patch was in our testing environment these tests > failed in code_SUITE: > big_boot_embedded (on powerpc) > ext_mod_dep (as we discussed) > native_early_modules > It was 'clash'. The comments column reads: {code_SUITE,clash,635} {badmatch,false} Kostis PS. By the way, Sverker has a patch cooking that should take care of the 'native_early_modules' failure. That failure is independent of this thread. From kostis@REDACTED Tue Feb 19 14:17:13 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 19 Feb 2013 14:17:13 +0100 Subject: [erlang-patches] Dialyzer changes for R16B Message-ID: <51237B59.2040600@cs.ntua.gr> Please include: git fetch git://github.com/kostis/otp.git dialyzer-R16B-final-fixes Kostis From fredrik@REDACTED Tue Feb 19 14:41:25 2013 From: fredrik@REDACTED (Fredrik) Date: Tue, 19 Feb 2013 14:41:25 +0100 Subject: [erlang-patches] Dialyzer changes for R16B In-Reply-To: <51237B59.2040600@cs.ntua.gr> References: <51237B59.2040600@cs.ntua.gr> Message-ID: <51238105.4090409@erlang.org> On 02/19/2013 02:17 PM, Kostis Sagonas wrote: > Please include: > > git fetch git://github.com/kostis/otp.git dialyzer-R16B-final-fixes > > Kostis > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Thanks, Currently in the 'master-pu' branch. -- BR Fredrik Gustafsson Erlang OTP Team From pan@REDACTED Tue Feb 19 18:08:47 2013 From: pan@REDACTED (Patrik Nyblom) Date: Tue, 19 Feb 2013 18:08:47 +0100 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <5122104D.1000309@erlang.org> References: <20130216232353.GA27511@ioctl> <512209B9.8040109@erlang.org> <5122104D.1000309@erlang.org> Message-ID: <5123B19F.5090907@erlang.org> On 02/18/2013 12:28 PM, Fredrik wrote: > This happens only on windows I should add to the context also.. > > BR Fredrik > On 02/18/2013 12:00 PM, Fredrik wrote: For unknown reasons, you need to drop support for win2k to get IPPROTO_IPV6 from the windows headers. Either we can up the command line -D_WIN32_WINVER to 0x0501 (Windows XP) or you can set (#define it) in epmd_int.h before including winsock2.h. ... #ifdef _WIN32_WINVER #undef _WIN32_WINVER #endif #define _WIN32_WINVER 0x0501 ... But that will probably be the end of any (theoretical) windows 2000 support. We don't support Win 2000 officially, so I think it will be a non-issue. Others might disagree though :) /Patrik >> Hello, >> Your patch does not seem to build: >> >> epmd_srv.c(332) : error C2065: 'IPPROTO_IPV6' : undeclared identifier >> epmd_srv.c(332) : warning C4133: 'function' : incompatible types - >> from 'int *' to 'const char *' >> >> >> Could you please have a look at this problem? >> >> On 02/17/2013 12:23 AM, Michael Santos wrote: >>> Allow IPv6 nodes to register with and query epmd. On systems with >>> IPv6 support: >>> >>> * epmd listens on the IPv4 and IPv6 ANY or loopback sockets >>> >>> * the epmd cli client connects to epmd using the IPv6 loopback >>> >>> * distributed nodes started with "-proto_dist inet6_tcp" will register >>> with epmd over IPv6 >>> --- >>> erts/doc/src/epmd.xml | 2 +- >>> erts/doc/src/erl.xml | 22 +++++ >>> erts/epmd/src/epmd.c | 6 +- >>> erts/epmd/src/epmd_cli.c | 11 ++- >>> erts/epmd/src/epmd_int.h | 59 ++++++++---- >>> erts/epmd/src/epmd_srv.c | 184 >>> +++++++++++++++++++++++++------------ >>> erts/epmd/test/epmd_SUITE.erl | 33 ++++++- >>> lib/kernel/src/erl_epmd.erl | 18 ++-- >>> lib/kernel/src/inet6_tcp_dist.erl | 2 +- >>> 9 files changed, 244 insertions(+), 93 deletions(-) >>> >>> diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml >>> index 3e70054..3c9313e 100644 >>> --- a/erts/doc/src/epmd.xml >>> +++ b/erts/doc/src/epmd.xml >>> @@ -36,7 +36,7 @@ >>> >>>

Erlang Port Mapper Daemon

>>> >>> ->> [-daemon] [-relaxed_command_check]]]> >>> +>> Addresses] [-port No] [-daemon] [-relaxed_command_check]]]> >>> >>>

Starts the port mapper daemon

>>>
>>> diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml >>> index f354d68..aebf4ff 100644 >>> --- a/erts/doc/src/erl.xml >>> +++ b/erts/doc/src/erl.xml >>> @@ -381,6 +381,28 @@ >>> similar to. See >>> code(3).

>>>
>>> + >>> + >>> +

Specify a protocol for Erlang distribution.

>>> + >>> + inet_tcp >>> + >>> +

TCP over IPv4 (the default)

>>> +
>>> + inet_ssl >>> + >>> +

distribution over SSL

>>> +
>>> + inet6_tcp >>> + >>> +

TCP over IPv6

>>> +
>>> +
>>> +

For example, to start up IPv6 distributed nodes:

>>> +
>>> +%erl -name test@REDACTED -proto_dist 
>>> inet6_tcp
>>> +
>>> +
>>> >>> >>>

Starts Erlang with a remote shell connected >>> to.

>>> diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c >>> index 94bb74c..0789cc3 100644 >>> --- a/erts/epmd/src/epmd.c >>> +++ b/erts/epmd/src/epmd.c >>> @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) >>> for (fd = 0; fd< g->max_conn ; fd++) /* close all files ... */ >>> close(fd); >>> /* Syslog on linux will try to write to whatever if we dont >>> - inform it of that the log is closed. */ >>> + inform it that the log is closed. */ >>> closelog(); >>> >>> - /* These chouldn't be needed but for safety... */ >>> + /* These shouldn't be needed but for safety... */ >>> >>> open("/dev/null", O_RDONLY); /* Order is important! */ >>> open("/dev/null", O_WRONLY); >>> @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) >>> close(1); >>> close(2); >>> >>> - /* These chouldn't be needed but for safety... */ >>> + /* These shouldn't be needed but for safety... */ >>> >>> open("nul", O_RDONLY); >>> open("nul", O_WRONLY); >>> diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c >>> index 8817bde..a0dd890 100644 >>> --- a/erts/epmd/src/epmd_cli.c >>> +++ b/erts/epmd/src/epmd_cli.c >>> @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) >>> static int conn_to_epmd(EpmdVars *g) >>> { >>> struct EPMD_SOCKADDR_IN address; >>> + size_t salen = 0; >>> int connect_sock; >>> >>> connect_sock = socket(FAMILY, SOCK_STREAM, 0); >>> @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) >>> >>> { /* store port number in unsigned short */ >>> unsigned short sport = g->port; >>> - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + SET_ADDR6(address, in6addr_loopback, sport); >>> + salen = sizeof(struct sockaddr_in6); >>> +#else >>> + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); >>> + salen = sizeof(struct sockaddr_in); >>> +#endif >>> } >>> >>> - if (connect(connect_sock, (struct sockaddr*)&address, sizeof >>> address)< 0) >>> + if (connect(connect_sock, (struct sockaddr*)&address, salen)< 0) >>> goto error; >>> return connect_sock; >>> >>> diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h >>> index ac354dc..b16c137 100644 >>> --- a/erts/epmd/src/epmd_int.h >>> +++ b/erts/epmd/src/epmd_int.h >>> @@ -49,6 +49,7 @@ >>> # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H >>> # include >>> # endif >>> +# include >>> # include >>> # include >>> #endif >>> @@ -165,33 +166,53 @@ >>> /* >>> ************************************************************************ >>> */ >>> /* Macros that let us use >>> IPv6 */ >>> >>> -#if defined(HAVE_IN6)&& defined(AF_INET6)&& defined(EPMD6) >>> +#if HAVE_IN6 >>> +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY >>> +# if HAVE_DECL_IN6ADDR_ANY_INIT >>> +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; >>> +# else >>> +static const struct in6_addr in6addr_any = >>> + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; >>> +# endif /* HAVE_IN6ADDR_ANY_INIT */ >>> +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ >>> + >>> +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK >>> +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT >>> +static const struct in6_addr in6addr_loopback = >>> + { { IN6ADDR_LOOPBACK_INIT } }; >>> +# else >>> +static const struct in6_addr in6addr_loopback = >>> + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; >>> +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ >>> +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ >>> +#endif /* HAVE_IN6 */ >>> + >>> +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == >>> htonl(INADDR_LOOPBACK)) >>> + >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> >>> -#define EPMD_SOCKADDR_IN sockaddr_in6 >>> -#define EPMD_IN_ADDR in6_addr >>> -#define EPMD_S_ADDR s6_addr >>> -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr >>> -#define EPMD_ADDR_ANY in6addr_any.s6_addr >>> +#define EPMD_SOCKADDR_IN sockaddr_storage >>> #define FAMILY AF_INET6 >>> >>> -#define SET_ADDR(dst, addr, port) do { \ >>> - memset((char*)&(dst), 0, sizeof(dst)); \ >>> - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ >>> - (dst).sin6_family = AF_INET6; \ >>> - (dst).sin6_flowinfo = 0; \ >>> - (dst).sin6_port = htons(port); \ >>> +#define SET_ADDR6(dst, addr, port) do { \ >>> + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ >>> + memset(sa, 0, sizeof(dst)); \ >>> + sa->sin6_family = AF_INET6; \ >>> + sa->sin6_addr = (addr); \ >>> + sa->sin6_port = htons(port); \ >>> } while(0) >>> >>> -#define IS_ADDR_LOOPBACK(addr) \ >>> - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) >>> +#define SET_ADDR(dst, addr, port) do { \ >>> + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ >>> + memset(sa, 0, sizeof(dst)); \ >>> + sa->sin_family = AF_INET; \ >>> + sa->sin_addr.s_addr = (addr); \ >>> + sa->sin_port = htons(port); \ >>> + } while(0) >>> >>> #else /* Not IP v6 */ >>> >>> #define EPMD_SOCKADDR_IN sockaddr_in >>> -#define EPMD_IN_ADDR in_addr >>> -#define EPMD_S_ADDR s_addr >>> -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) >>> -#define EPMD_ADDR_ANY htonl(INADDR_ANY) >>> #define FAMILY AF_INET >>> >>> #define SET_ADDR(dst, addr, port) do { \ >>> @@ -201,8 +222,6 @@ >>> (dst).sin_port = htons(port); \ >>> } while(0) >>> >>> -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == >>> htonl(INADDR_LOOPBACK)) >>> - >>> #endif /* Not IP v6 */ >>> >>> /* >>> ************************************************************************ >>> */ >>> diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c >>> index 90df7cc..1c34f5f 100644 >>> --- a/erts/epmd/src/epmd_srv.c >>> +++ b/erts/epmd/src/epmd_srv.c >>> @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); >>> >>> static Connection *conn_init(EpmdVars*); >>> static int conn_open(EpmdVars*,int); >>> +static int conn_local_peer_check(EpmdVars*, int); >>> static int conn_close_fd(EpmdVars*,int); >>> >>> static void node_init(EpmdVars*); >>> @@ -200,7 +201,7 @@ void run(EpmdVars *g) >>> { >>> struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; >>> int listensock[MAX_LISTEN_SOCKETS]; >>> - int num_sockets; >>> + int num_sockets = 0; >>> int i; >>> int opt; >>> unsigned short sport = g->port; >>> @@ -213,64 +214,82 @@ void run(EpmdVars *g) >>> if (g->addresses != NULL&& /* String contains non-separator >>> characters if: */ >>> g->addresses[strspn(g->addresses," ,")] != '\000') >>> { >>> - char *tmp; >>> - char *token; >>> - int loopback_ok = 0; >>> + char *tmp = NULL; >>> + char *token = NULL; >>> + >>> + /* Always listen on the loopback. */ >>> + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); >>> + num_sockets++; >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); >>> + num_sockets++; >>> +#endif >>> >>> - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) >>> + if ((tmp = strdup(g->addresses)) == NULL) >>> { >>> dbg_perror(g,"cannot allocate memory"); >>> epmd_cleanup_exit(g,1); >>> } >>> - strcpy(tmp,g->addresses); >>> >>> - for(token = strtok(tmp,", "), num_sockets = 0; >>> + for(token = strtok(tmp,", "); >>> token != NULL; >>> - token = strtok(NULL,", "), num_sockets++) >>> + token = strtok(NULL,", ")) >>> { >>> - struct EPMD_IN_ADDR addr; >>> -#ifdef HAVE_INET_PTON >>> - int ret; >>> + struct in_addr addr; >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + struct in6_addr addr6; >>> + struct sockaddr_storage *sa =&iserv_addr[num_sockets]; >>> >>> - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) >>> + if (inet_pton(AF_INET,token,&addr) == 1) >>> { >>> - dbg_perror(g,"cannot convert IP address to network format"); >>> - epmd_cleanup_exit(g,1); >>> + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); >>> + } >>> + else if (inet_pton(AF_INET6,token,&addr6) == 1) >>> + { >>> + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); >>> + } >>> + else >>> +#else >>> + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) >>> + { >>> + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); >>> } >>> - else if (ret == 0) >>> -#elif !defined(EPMD6) >>> - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) >>> + else >>> #endif >>> { >>> dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); >>> epmd_cleanup_exit(g,1); >>> } >>> >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + if (sa->ss_family == AF_INET6&& IN6_IS_ADDR_LOOPBACK(&addr6)) >>> + continue; >>> + >>> + if (sa->ss_family == AF_INET) >>> +#endif >>> if (IS_ADDR_LOOPBACK(addr)) >>> - loopback_ok = 1; >>> + continue; >>> >>> - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) >>> + num_sockets++; >>> + >>> + if (num_sockets>= MAX_LISTEN_SOCKETS) >>> { >>> dbg_tty_printf(g,0,"cannot listen on more than %d IP >>> addresses", >>> MAX_LISTEN_SOCKETS); >>> epmd_cleanup_exit(g,1); >>> } >>> - >>> - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); >>> } >>> >>> free(tmp); >>> - >>> - if (!loopback_ok) >>> - { >>> - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); >>> - num_sockets++; >>> - } >>> } >>> else >>> { >>> - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); >>> - num_sockets = 1; >>> + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); >>> + num_sockets++; >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); >>> + num_sockets++; >>> +#endif >>> } >>> >>> #if !defined(__WIN32__) >>> @@ -291,13 +310,33 @@ void run(EpmdVars *g) >>> >>> for (i = 0; i< num_sockets; i++) >>> { >>> - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0))< 0) >>> + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + size_t salen = (sa->sa_family == AF_INET6 ? >>> + sizeof(struct sockaddr_in6) : >>> + sizeof(struct sockaddr_in)); >>> +#else >>> + size_t salen = sizeof(struct sockaddr_in); >>> +#endif >>> + >>> + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0))< 0) >>> { >>> dbg_perror(g,"error opening stream socket"); >>> epmd_cleanup_exit(g,1); >>> } >>> g->listenfd[i] = listensock[i]; >>> - >>> + >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + opt = 1; >>> + if (sa->sa_family == AF_INET6&& >>> + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, >>> + sizeof(opt))<0) >>> + { >>> + dbg_perror(g,"can't set IPv6 only socket option"); >>> + epmd_cleanup_exit(g,1); >>> + } >>> +#endif >>> + >>> /* >>> * Note that we must not enable the SO_REUSEADDR on Windows, >>> * because addresses will be reused even if they are still >>> in use. >>> @@ -329,8 +368,7 @@ void run(EpmdVars *g) >>> dbg_perror(g,"failed to set non-blocking mode of listening >>> socket %d", >>> listensock[i]); >>> >>> - if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], >>> - sizeof(iserv_addr[i]))< 0) >>> + if (bind(listensock[i], (struct sockaddr*)&iserv_addr[i], >>> salen)< 0) >>> { >>> if (errno == EADDRINUSE) >>> { >>> @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) >>> >>> for (i = 0; i< g->max_conn; i++) { >>> if (g->conn[i].open == EPMD_FALSE) { >>> - struct sockaddr_in si; >>> - struct sockaddr_in di; >>> -#ifdef HAVE_SOCKLEN_T >>> - socklen_t st; >>> -#else >>> - int st; >>> -#endif >>> - st = sizeof(si); >>> - >>> g->active_conn++; >>> s =&g->conn[i]; >>> >>> @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) >>> s->open = EPMD_TRUE; >>> s->keep = EPMD_FALSE; >>> >>> - /* Determine if connection is from localhost */ >>> - if (getpeername(s->fd,(struct sockaddr*)&si,&st) || >>> - st< sizeof(si)) { >>> - /* Failure to get peername is regarded as non local host */ >>> - s->local_peer = EPMD_FALSE; >>> - } else { >>> - /* Only 127.x.x.x and connections from the host's IP address >>> - allowed, no false positives */ >>> - s->local_peer = >>> - (((((unsigned) ntohl(si.sin_addr.s_addr))& 0xFF000000U) == >>> - 0x7F000000U) || >>> - (getsockname(s->fd,(struct sockaddr*)&di,&st) ? >>> - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); >>> - } >>> + s->local_peer = conn_local_peer_check(g, s->fd); >>> dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : >>> "Non-local peer connected"); >>> >>> @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) >>> s->got = 0; >>> s->mod_time = current_time(g); /* Note activity */ >>> >>> - s->buf = (char *)malloc(INBUF_SIZE); >>> + s->buf = malloc(INBUF_SIZE); >>> >>> if (s->buf == NULL) { >>> dbg_printf(g,0,"epmd: Insufficient memory"); >>> @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) >>> return EPMD_FALSE; >>> } >>> >>> +static int conn_local_peer_check(EpmdVars *g, int fd) >>> +{ >>> + struct EPMD_SOCKADDR_IN si; >>> + struct EPMD_SOCKADDR_IN di; >>> + >>> + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; >>> + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; >>> + >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; >>> + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; >>> +#endif >>> + >>> +#ifdef HAVE_SOCKLEN_T >>> + socklen_t st; >>> +#else >>> + int st; >>> +#endif >>> + >>> + st = sizeof(si); >>> + >>> + /* Determine if connection is from localhost */ >>> + if (getpeername(fd,(struct sockaddr*)&si,&st) || >>> + st> sizeof(si)) { >>> + /* Failure to get peername is regarded as non local host */ >>> + return EPMD_FALSE; >>> + } >>> + >>> + /* Only 127.x.x.x and connections from the host's IP address >>> + allowed, no false positives */ >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + if (si.ss_family == AF_INET6&& >>> IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) >>> + return EPMD_TRUE; >>> + >>> + if (si.ss_family == AF_INET) >>> +#endif >>> + if ((((unsigned) ntohl(si4->sin_addr.s_addr))& 0xFF000000U) == >>> + 0x7F000000U) >>> + return EPMD_TRUE; >>> + >>> + if (getsockname(fd,(struct sockaddr*)&di,&st)) >>> + return EPMD_FALSE; >>> + >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + if (si.ss_family == AF_INET6) >>> + return IN6_ARE_ADDR_EQUAL(&(si6->sin6_addr),&(di6->sin6_addr)); >>> + if (si.ss_family == AF_INET) >>> +#endif >>> + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; >>> +#if defined(HAVE_IN6)&& defined(AF_INET6) >>> + return EPMD_FALSE; >>> +#endif >>> +} >>> + >>> static int conn_close_fd(EpmdVars *g,int fd) >>> { >>> int i; >>> diff --git a/erts/epmd/test/epmd_SUITE.erl >>> b/erts/epmd/test/epmd_SUITE.erl >>> index cc24a55..ddfe5ab 100644 >>> --- a/erts/epmd/test/epmd_SUITE.erl >>> +++ b/erts/epmd/test/epmd_SUITE.erl >>> @@ -42,6 +42,7 @@ >>> -export( >>> [ >>> register_name/1, >>> + register_name_ipv6/1, >>> register_names_1/1, >>> register_names_2/1, >>> register_duplicate_name/1, >>> @@ -108,7 +109,8 @@ >>> suite() -> [{ct_hooks,[ts_install_cth]}]. >>> >>> all() -> >>> - [register_name, register_names_1, register_names_2, >>> + [register_name, register_name_ipv6, >>> + register_names_1, register_names_2, >>> register_duplicate_name, unicode_name, long_unicode_name, >>> get_port_nr, slow_get_port_nr, >>> unregister_others_name_1, unregister_others_name_2, >>> @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> >>> ?line ok = close(Sock), % Unregister >>> ok. >>> >>> +register_name_ipv6(doc) -> >>> + ["Register a name over IPv6"]; >>> +register_name_ipv6(suite) -> >>> + []; >>> +register_name_ipv6(Config) when is_list(Config) -> >>> + % Test if the host has an IPv6 loopback address >>> + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), >>> + case Res of >>> + {ok,LSock} -> >>> + gen_tcp:close(LSock), >>> + ?line ok = epmdrun(), >>> + ?line {ok,Sock} = register_node6("foobar6"), >>> + ?line ok = close(Sock), % Unregister >>> + ok; >>> + _Error -> >>> + {skip, "Host does not have an IPv6 loopback address"} >>> + end. >>> + >>> register_names_1(doc) -> >>> ["Register and unregister two nodes"]; >>> register_names_1(suite) -> >>> @@ -238,13 +258,18 @@ register_node(Name) -> >>> register_node(Name,Port) -> >>> register_node_v2(Port,$M,0,5,5,Name,""). >>> >>> +register_node6(Name) -> >>> + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). >>> + >>> register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> >>> + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, >>> Name, Extra). >>> +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, >>> Extra) -> >>> Utf8Name = unicode:characters_to_binary(Name), >>> Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, >>> put16(HVsn), put16(LVsn), >>> put16(size(Utf8Name)), binary_to_list(Utf8Name), >>> size16(Extra), Extra], >>> - case send_req(Req) of >>> + case send_req(Req, Addr) of >>> {ok,Sock} -> >>> case recv(Sock,4) of >>> {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> >>> @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> >>> end. >>> >>> send_req(Req) -> >>> - case connect() of >>> + send_req(Req, "localhost"). >>> +send_req(Req, Addr) -> >>> + case connect(Addr) of >>> {ok,Sock} -> >>> case send(Sock, [size16(Req), Req]) of >>> ok -> >>> diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl >>> index 91af49f..21a3dec 100644 >>> --- a/lib/kernel/src/erl_epmd.erl >>> +++ b/lib/kernel/src/erl_epmd.erl >>> @@ -31,7 +31,7 @@ >>> %% External exports >>> -export([start/0, start_link/0, stop/0, port_please/2, >>> port_please/3, names/0, names/1, >>> - register_node/2, open/0, open/1, open/2]). >>> + register_node/2, register_node/3, open/0, open/1, open/2]). >>> >>> %% gen_server callbacks >>> -export([init/1, handle_call/3, handle_cast/2, handle_info/2, >>> @@ -106,7 +106,9 @@ names1(HostName) -> >>> >>> >>> register_node(Name, PortNo) -> >>> - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). >>> + register_node(Name, PortNo, inet). >>> +register_node(Name, PortNo, Family) -> >>> + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, >>> infinity). >>> >>> %%%---------------------------------------------------------------------- >>> %%% Callback functions from gen_server >>> @@ -124,10 +126,10 @@ init(_) -> >>> -spec handle_call(calls(), term(), state()) -> >>> {'reply', term(), state()} | {'stop', 'shutdown', 'ok', >>> state()}. >>> >>> -handle_call({register, Name, PortNo}, _From, State) -> >>> +handle_call({register, Name, PortNo, Family}, _From, State) -> >>> case State#state.socket of >>> P when P< 0 -> >>> - case do_register_node(Name, PortNo) of >>> + case do_register_node(Name, PortNo, Family) of >>> {alive, Socket, Creation} -> >>> S = State#state{socket = Socket, >>> port_no = PortNo, >>> @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when >>> ?ip6(A,B,C,D,E,F,G,H) -> >>> close(Socket) -> >>> gen_tcp:close(Socket). >>> >>> -do_register_node(NodeName, TcpPort) -> >>> - case open() of >>> +do_register_node(NodeName, TcpPort, Family) -> >>> + Localhost = case Family of >>> + inet -> open({127,0,0,1}); >>> + inet6 -> open({0,0,0,0,0,0,0,1}) >>> + end, >>> + case Localhost of >>> {ok, Socket} -> >>> Name = to_string(NodeName), >>> Extra = "", >>> diff --git a/lib/kernel/src/inet6_tcp_dist.erl >>> b/lib/kernel/src/inet6_tcp_dist.erl >>> index 2315a56..bba4d87 100644 >>> --- a/lib/kernel/src/inet6_tcp_dist.erl >>> +++ b/lib/kernel/src/inet6_tcp_dist.erl >>> @@ -71,7 +71,7 @@ listen(Name) -> >>> {ok, Socket} -> >>> TcpAddress = get_tcp_address(Socket), >>> {_,Port} = TcpAddress#net_address.address, >>> - case erl_epmd:register_node(Name, Port) of >>> + case erl_epmd:register_node(Name, Port, inet6) of >>> {ok, Creation} -> >>> {ok, {Socket, TcpAddress, Creation}}; >>> Error -> >> >> > > From michael.santos@REDACTED Wed Feb 20 13:55:17 2013 From: michael.santos@REDACTED (Michael Santos) Date: Wed, 20 Feb 2013 07:55:17 -0500 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration Message-ID: <20130220125517.GA26728@ioctl> Allow IPv6 nodes to register with and query epmd. On systems with IPv6 support: * epmd listens on both the IPv4 and IPv6 ANY or loopback sockets * the epmd cli client connects to epmd over the IPv6 loopback * distributed nodes started with "-proto_dist inet6_tcp" will register with epmd over IPv6 The interaction between IPv4 and IPv6 sockets depends on the platform: * FreeBSD allows multiple "specific" sockets to bind the same port (such as 2 sockets listening to the same port on ANY and the loopback). Binding port 4369 to IPv4 and IPv6 sockets simulataneously is allowed. * Linux does not allow the same port to be bound by different sockets. Setting the IPV6_V6ONLY socket option is required. * Windows The behaviour differs depending on the version of Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx According to the site, sockets on Windows XP with Service Pack 1 (SP1) and Windows Server 2003 will only listen on either IPv4 or IPv6, so creating two sockets is required to service IPv4 and IPv6 traffic on the same port. The IPV6_V6ONLY socket option is not supported. For Windows Vista and later, a single socket can handle IPv4 and IPv6 traffic for the same port. The IPV6_V6ONLY socket option is supported and is enabled for IPv6 sockets by default. --- erts/doc/src/epmd.xml | 2 +- erts/doc/src/erl.xml | 22 +++++ erts/epmd/src/epmd.c | 6 +- erts/epmd/src/epmd_cli.c | 11 ++- erts/epmd/src/epmd_int.h | 63 +++++++++---- erts/epmd/src/epmd_srv.c | 184 +++++++++++++++++++++++++------------ erts/epmd/test/epmd_SUITE.erl | 33 ++++++- lib/kernel/src/erl_epmd.erl | 18 ++-- lib/kernel/src/inet6_tcp_dist.erl | 2 +- 9 files changed, 248 insertions(+), 93 deletions(-) diff --git a/erts/doc/src/epmd.xml b/erts/doc/src/epmd.xml index 3e70054..3c9313e 100644 --- a/erts/doc/src/epmd.xml +++ b/erts/doc/src/epmd.xml @@ -36,7 +36,7 @@

Erlang Port Mapper Daemon

- +

Starts the port mapper daemon

diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index f354d68..aebf4ff 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -381,6 +381,28 @@ similar to . See code(3).

+ + +

Specify a protocol for Erlang distribution.

+ + inet_tcp + +

TCP over IPv4 (the default)

+
+ inet_ssl + +

distribution over SSL

+
+ inet6_tcp + +

TCP over IPv6

+
+
+

For example, to start up IPv6 distributed nodes:

+
+% erl -name test@REDACTED -proto_dist inet6_tcp
+
+

Starts Erlang with a remote shell connected to .

diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c index 94bb74c..0789cc3 100644 --- a/erts/epmd/src/epmd.c +++ b/erts/epmd/src/epmd.c @@ -335,10 +335,10 @@ static void run_daemon(EpmdVars *g) for (fd = 0; fd < g->max_conn ; fd++) /* close all files ... */ close(fd); /* Syslog on linux will try to write to whatever if we dont - inform it of that the log is closed. */ + inform it that the log is closed. */ closelog(); - /* These chouldn't be needed but for safety... */ + /* These shouldn't be needed but for safety... */ open("/dev/null", O_RDONLY); /* Order is important! */ open("/dev/null", O_WRONLY); @@ -379,7 +379,7 @@ static void run_daemon(EpmdVars *g) close(1); close(2); - /* These chouldn't be needed but for safety... */ + /* These shouldn't be needed but for safety... */ open("nul", O_RDONLY); open("nul", O_WRONLY); diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c index 8817bde..a0dd890 100644 --- a/erts/epmd/src/epmd_cli.c +++ b/erts/epmd/src/epmd_cli.c @@ -135,6 +135,7 @@ void epmd_call(EpmdVars *g,int what) static int conn_to_epmd(EpmdVars *g) { struct EPMD_SOCKADDR_IN address; + size_t salen = 0; int connect_sock; connect_sock = socket(FAMILY, SOCK_STREAM, 0); @@ -143,10 +144,16 @@ static int conn_to_epmd(EpmdVars *g) { /* store port number in unsigned short */ unsigned short sport = g->port; - SET_ADDR(address, EPMD_ADDR_LOOPBACK, sport); +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(address, in6addr_loopback, sport); + salen = sizeof(struct sockaddr_in6); +#else + SET_ADDR(address, htonl(INADDR_LOOPBACK), sport); + salen = sizeof(struct sockaddr_in); +#endif } - if (connect(connect_sock, (struct sockaddr*)&address, sizeof address) < 0) + if (connect(connect_sock, (struct sockaddr*)&address, salen) < 0) goto error; return connect_sock; diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h index ac354dc..d9dcade 100644 --- a/erts/epmd/src/epmd_int.h +++ b/erts/epmd/src/epmd_int.h @@ -46,9 +46,14 @@ #include #ifdef __WIN32__ +# ifdef _WIN32_WINVER +# undef _WIN32_WINVER +# endif +# define _WIN32_WINVER 0x0501 # ifndef WINDOWS_H_INCLUDES_WINSOCK2_H # include # endif +# include # include # include #endif @@ -165,33 +170,53 @@ /* ************************************************************************ */ /* Macros that let us use IPv6 */ -#if defined(HAVE_IN6) && defined(AF_INET6) && defined(EPMD6) +#if HAVE_IN6 +# if ! defined(HAVE_IN6ADDR_ANY) || ! HAVE_IN6ADDR_ANY +# if HAVE_DECL_IN6ADDR_ANY_INIT +static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } }; +# else +static const struct in6_addr in6addr_any = + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; +# endif /* HAVE_IN6ADDR_ANY_INIT */ +# endif /* ! HAVE_DECL_IN6ADDR_ANY */ + +# if ! defined(HAVE_IN6ADDR_LOOPBACK) || ! HAVE_IN6ADDR_LOOPBACK +# if HAVE_DECL_IN6ADDR_LOOPBACK_INIT +static const struct in6_addr in6addr_loopback = + { { IN6ADDR_LOOPBACK_INIT } }; +# else +static const struct in6_addr in6addr_loopback = + { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; +# endif /* HAVE_IN6ADDR_LOOPBACK_INIT */ +# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */ +#endif /* HAVE_IN6 */ + +#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) + +#if defined(HAVE_IN6) && defined(AF_INET6) -#define EPMD_SOCKADDR_IN sockaddr_in6 -#define EPMD_IN_ADDR in6_addr -#define EPMD_S_ADDR s6_addr -#define EPMD_ADDR_LOOPBACK in6addr_loopback.s6_addr -#define EPMD_ADDR_ANY in6addr_any.s6_addr +#define EPMD_SOCKADDR_IN sockaddr_storage #define FAMILY AF_INET6 -#define SET_ADDR(dst, addr, port) do { \ - memset((char*)&(dst), 0, sizeof(dst)); \ - memcpy((char*)&(dst).sin6_addr.s6_addr, (char*)&(addr), 16); \ - (dst).sin6_family = AF_INET6; \ - (dst).sin6_flowinfo = 0; \ - (dst).sin6_port = htons(port); \ +#define SET_ADDR6(dst, addr, port) do { \ + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&(dst); \ + memset(sa, 0, sizeof(dst)); \ + sa->sin6_family = AF_INET6; \ + sa->sin6_addr = (addr); \ + sa->sin6_port = htons(port); \ } while(0) -#define IS_ADDR_LOOPBACK(addr) \ - (memcmp((addr).s6_addr, in6addr_loopback.s6_addr, 16) == 0) +#define SET_ADDR(dst, addr, port) do { \ + struct sockaddr_in *sa = (struct sockaddr_in *)&(dst); \ + memset(sa, 0, sizeof(dst)); \ + sa->sin_family = AF_INET; \ + sa->sin_addr.s_addr = (addr); \ + sa->sin_port = htons(port); \ + } while(0) #else /* Not IP v6 */ #define EPMD_SOCKADDR_IN sockaddr_in -#define EPMD_IN_ADDR in_addr -#define EPMD_S_ADDR s_addr -#define EPMD_ADDR_LOOPBACK htonl(INADDR_LOOPBACK) -#define EPMD_ADDR_ANY htonl(INADDR_ANY) #define FAMILY AF_INET #define SET_ADDR(dst, addr, port) do { \ @@ -201,8 +226,6 @@ (dst).sin_port = htons(port); \ } while(0) -#define IS_ADDR_LOOPBACK(addr) ((addr).s_addr == htonl(INADDR_LOOPBACK)) - #endif /* Not IP v6 */ /* ************************************************************************ */ diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c index 90df7cc..9b7d931 100644 --- a/erts/epmd/src/epmd_srv.c +++ b/erts/epmd/src/epmd_srv.c @@ -70,6 +70,7 @@ static time_t current_time(EpmdVars*); static Connection *conn_init(EpmdVars*); static int conn_open(EpmdVars*,int); +static int conn_local_peer_check(EpmdVars*, int); static int conn_close_fd(EpmdVars*,int); static void node_init(EpmdVars*); @@ -200,7 +201,7 @@ void run(EpmdVars *g) { struct EPMD_SOCKADDR_IN iserv_addr[MAX_LISTEN_SOCKETS]; int listensock[MAX_LISTEN_SOCKETS]; - int num_sockets; + int num_sockets = 0; int i; int opt; unsigned short sport = g->port; @@ -213,64 +214,82 @@ void run(EpmdVars *g) if (g->addresses != NULL && /* String contains non-separator characters if: */ g->addresses[strspn(g->addresses," ,")] != '\000') { - char *tmp; - char *token; - int loopback_ok = 0; + char *tmp = NULL; + char *token = NULL; + + /* Always listen on the loopback. */ + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); + num_sockets++; +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); + num_sockets++; +#endif - if ((tmp = (char *)malloc(strlen(g->addresses) + 1)) == NULL) + if ((tmp = strdup(g->addresses)) == NULL) { dbg_perror(g,"cannot allocate memory"); epmd_cleanup_exit(g,1); } - strcpy(tmp,g->addresses); - for(token = strtok(tmp,", "), num_sockets = 0; + for(token = strtok(tmp,", "); token != NULL; - token = strtok(NULL,", "), num_sockets++) + token = strtok(NULL,", ")) { - struct EPMD_IN_ADDR addr; -#ifdef HAVE_INET_PTON - int ret; + struct in_addr addr; +#if defined(HAVE_IN6) && defined(AF_INET6) + struct in6_addr addr6; + struct sockaddr_storage *sa = &iserv_addr[num_sockets]; - if ((ret = inet_pton(FAMILY,token,&addr)) == -1) + if (inet_pton(AF_INET,token,&addr) == 1) { - dbg_perror(g,"cannot convert IP address to network format"); - epmd_cleanup_exit(g,1); + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); + } + else if (inet_pton(AF_INET6,token,&addr6) == 1) + { + SET_ADDR6(iserv_addr[num_sockets],addr6,sport); + } + else +#else + if ((addr.s_addr = inet_addr(token)) != INADDR_NONE) + { + SET_ADDR(iserv_addr[num_sockets],addr.s_addr,sport); } - else if (ret == 0) -#elif !defined(EPMD6) - if ((addr.EPMD_S_ADDR = inet_addr(token)) == INADDR_NONE) + else #endif { dbg_tty_printf(g,0,"cannot parse IP address \"%s\"",token); epmd_cleanup_exit(g,1); } +#if defined(HAVE_IN6) && defined(AF_INET6) + if (sa->ss_family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&addr6)) + continue; + + if (sa->ss_family == AF_INET) +#endif if (IS_ADDR_LOOPBACK(addr)) - loopback_ok = 1; + continue; - if (num_sockets - loopback_ok == MAX_LISTEN_SOCKETS - 1) + num_sockets++; + + if (num_sockets >= MAX_LISTEN_SOCKETS) { dbg_tty_printf(g,0,"cannot listen on more than %d IP addresses", MAX_LISTEN_SOCKETS); epmd_cleanup_exit(g,1); } - - SET_ADDR(iserv_addr[num_sockets],addr.EPMD_S_ADDR,sport); } free(tmp); - - if (!loopback_ok) - { - SET_ADDR(iserv_addr[num_sockets],EPMD_ADDR_LOOPBACK,sport); - num_sockets++; - } } else { - SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport); - num_sockets = 1; + SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_ANY),sport); + num_sockets++; +#if defined(HAVE_IN6) && defined(AF_INET6) + SET_ADDR6(iserv_addr[num_sockets],in6addr_any,sport); + num_sockets++; +#endif } #if !defined(__WIN32__) @@ -291,13 +310,33 @@ void run(EpmdVars *g) for (i = 0; i < num_sockets; i++) { - if ((listensock[i] = socket(FAMILY,SOCK_STREAM,0)) < 0) + struct sockaddr *sa = (struct sockaddr *)&iserv_addr[i]; +#if defined(HAVE_IN6) && defined(AF_INET6) + size_t salen = (sa->sa_family == AF_INET6 ? + sizeof(struct sockaddr_in6) : + sizeof(struct sockaddr_in)); +#else + size_t salen = sizeof(struct sockaddr_in); +#endif + + if ((listensock[i] = socket(sa->sa_family,SOCK_STREAM,0)) < 0) { dbg_perror(g,"error opening stream socket"); epmd_cleanup_exit(g,1); } g->listenfd[i] = listensock[i]; - + +#if HAVE_DECL_IPV6_V6ONLY + opt = 1; + if (sa->sa_family == AF_INET6 && + setsockopt(listensock[i],IPPROTO_IPV6,IPV6_V6ONLY,&opt, + sizeof(opt)) <0) + { + dbg_perror(g,"can't set IPv6 only socket option"); + epmd_cleanup_exit(g,1); + } +#endif + /* * Note that we must not enable the SO_REUSEADDR on Windows, * because addresses will be reused even if they are still in use. @@ -329,8 +368,7 @@ void run(EpmdVars *g) dbg_perror(g,"failed to set non-blocking mode of listening socket %d", listensock[i]); - if (bind(listensock[i], (struct sockaddr*) &iserv_addr[i], - sizeof(iserv_addr[i])) < 0) + if (bind(listensock[i], (struct sockaddr*) &iserv_addr[i], salen) < 0) { if (errno == EADDRINUSE) { @@ -952,15 +990,6 @@ static int conn_open(EpmdVars *g,int fd) for (i = 0; i < g->max_conn; i++) { if (g->conn[i].open == EPMD_FALSE) { - struct sockaddr_in si; - struct sockaddr_in di; -#ifdef HAVE_SOCKLEN_T - socklen_t st; -#else - int st; -#endif - st = sizeof(si); - g->active_conn++; s = &g->conn[i]; @@ -971,20 +1000,7 @@ static int conn_open(EpmdVars *g,int fd) s->open = EPMD_TRUE; s->keep = EPMD_FALSE; - /* Determine if connection is from localhost */ - if (getpeername(s->fd,(struct sockaddr*) &si,&st) || - st < sizeof(si)) { - /* Failure to get peername is regarded as non local host */ - s->local_peer = EPMD_FALSE; - } else { - /* Only 127.x.x.x and connections from the host's IP address - allowed, no false positives */ - s->local_peer = - (((((unsigned) ntohl(si.sin_addr.s_addr)) & 0xFF000000U) == - 0x7F000000U) || - (getsockname(s->fd,(struct sockaddr*) &di,&st) ? - EPMD_FALSE : si.sin_addr.s_addr == di.sin_addr.s_addr)); - } + s->local_peer = conn_local_peer_check(g, s->fd); dbg_tty_printf(g,2,(s->local_peer) ? "Local peer connected" : "Non-local peer connected"); @@ -992,7 +1008,7 @@ static int conn_open(EpmdVars *g,int fd) s->got = 0; s->mod_time = current_time(g); /* Note activity */ - s->buf = (char *)malloc(INBUF_SIZE); + s->buf = malloc(INBUF_SIZE); if (s->buf == NULL) { dbg_printf(g,0,"epmd: Insufficient memory"); @@ -1010,6 +1026,60 @@ static int conn_open(EpmdVars *g,int fd) return EPMD_FALSE; } +static int conn_local_peer_check(EpmdVars *g, int fd) +{ + struct EPMD_SOCKADDR_IN si; + struct EPMD_SOCKADDR_IN di; + + struct sockaddr_in *si4 = (struct sockaddr_in *)&si; + struct sockaddr_in *di4 = (struct sockaddr_in *)&di; + +#if defined(HAVE_IN6) && defined(AF_INET6) + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&si; + struct sockaddr_in6 *di6 = (struct sockaddr_in6 *)&di; +#endif + +#ifdef HAVE_SOCKLEN_T + socklen_t st; +#else + int st; +#endif + + st = sizeof(si); + + /* Determine if connection is from localhost */ + if (getpeername(fd,(struct sockaddr*) &si,&st) || + st > sizeof(si)) { + /* Failure to get peername is regarded as non local host */ + return EPMD_FALSE; + } + + /* Only 127.x.x.x and connections from the host's IP address + allowed, no false positives */ +#if defined(HAVE_IN6) && defined(AF_INET6) + if (si.ss_family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&(si6->sin6_addr))) + return EPMD_TRUE; + + if (si.ss_family == AF_INET) +#endif + if ((((unsigned) ntohl(si4->sin_addr.s_addr)) & 0xFF000000U) == + 0x7F000000U) + return EPMD_TRUE; + + if (getsockname(fd,(struct sockaddr*) &di,&st)) + return EPMD_FALSE; + +#if defined(HAVE_IN6) && defined(AF_INET6) + if (si.ss_family == AF_INET6) + return IN6_ARE_ADDR_EQUAL( &(si6->sin6_addr), &(di6->sin6_addr)); + if (si.ss_family == AF_INET) +#endif + return si4->sin_addr.s_addr == di4->sin_addr.s_addr; +#if defined(HAVE_IN6) && defined(AF_INET6) + return EPMD_FALSE; +#endif +} + static int conn_close_fd(EpmdVars *g,int fd) { int i; diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl index cc24a55..ddfe5ab 100644 --- a/erts/epmd/test/epmd_SUITE.erl +++ b/erts/epmd/test/epmd_SUITE.erl @@ -42,6 +42,7 @@ -export( [ register_name/1, + register_name_ipv6/1, register_names_1/1, register_names_2/1, register_duplicate_name/1, @@ -108,7 +109,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [register_name, register_names_1, register_names_2, + [register_name, register_name_ipv6, + register_names_1, register_names_2, register_duplicate_name, unicode_name, long_unicode_name, get_port_nr, slow_get_port_nr, unregister_others_name_1, unregister_others_name_2, @@ -165,6 +167,24 @@ register_name(Config) when is_list(Config) -> ?line ok = close(Sock), % Unregister ok. +register_name_ipv6(doc) -> + ["Register a name over IPv6"]; +register_name_ipv6(suite) -> + []; +register_name_ipv6(Config) when is_list(Config) -> + % Test if the host has an IPv6 loopback address + Res = gen_tcp:listen(0, [inet6, {ip, {0,0,0,0,0,0,0,1}}]), + case Res of + {ok,LSock} -> + gen_tcp:close(LSock), + ?line ok = epmdrun(), + ?line {ok,Sock} = register_node6("foobar6"), + ?line ok = close(Sock), % Unregister + ok; + _Error -> + {skip, "Host does not have an IPv6 loopback address"} + end. + register_names_1(doc) -> ["Register and unregister two nodes"]; register_names_1(suite) -> @@ -238,13 +258,18 @@ register_node(Name) -> register_node(Name,Port) -> register_node_v2(Port,$M,0,5,5,Name,""). +register_node6(Name) -> + register_node_v2({0,0,0,0,0,0,0,1},?DUMMY_PORT,$M,0,5,5,Name,""). + register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> + register_node_v2("localhost", Port, NodeType, Prot, HVsn, LVsn, Name, Extra). +register_node_v2(Addr, Port, NodeType, Prot, HVsn, LVsn, Name, Extra) -> Utf8Name = unicode:characters_to_binary(Name), Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot, put16(HVsn), put16(LVsn), put16(size(Utf8Name)), binary_to_list(Utf8Name), size16(Extra), Extra], - case send_req(Req) of + case send_req(Req, Addr) of {ok,Sock} -> case recv(Sock,4) of {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} -> @@ -1129,7 +1154,9 @@ send_direct(Sock, Bytes) -> end. send_req(Req) -> - case connect() of + send_req(Req, "localhost"). +send_req(Req, Addr) -> + case connect(Addr) of {ok,Sock} -> case send(Sock, [size16(Req), Req]) of ok -> diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl index 91af49f..21a3dec 100644 --- a/lib/kernel/src/erl_epmd.erl +++ b/lib/kernel/src/erl_epmd.erl @@ -31,7 +31,7 @@ %% External exports -export([start/0, start_link/0, stop/0, port_please/2, port_please/3, names/0, names/1, - register_node/2, open/0, open/1, open/2]). + register_node/2, register_node/3, open/0, open/1, open/2]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -106,7 +106,9 @@ names1(HostName) -> register_node(Name, PortNo) -> - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). + register_node(Name, PortNo, inet). +register_node(Name, PortNo, Family) -> + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity). %%%---------------------------------------------------------------------- %%% Callback functions from gen_server @@ -124,10 +126,10 @@ init(_) -> -spec handle_call(calls(), term(), state()) -> {'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}. -handle_call({register, Name, PortNo}, _From, State) -> +handle_call({register, Name, PortNo, Family}, _From, State) -> case State#state.socket of P when P < 0 -> - case do_register_node(Name, PortNo) of + case do_register_node(Name, PortNo, Family) of {alive, Socket, Creation} -> S = State#state{socket = Socket, port_no = PortNo, @@ -210,8 +212,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) -> close(Socket) -> gen_tcp:close(Socket). -do_register_node(NodeName, TcpPort) -> - case open() of +do_register_node(NodeName, TcpPort, Family) -> + Localhost = case Family of + inet -> open({127,0,0,1}); + inet6 -> open({0,0,0,0,0,0,0,1}) + end, + case Localhost of {ok, Socket} -> Name = to_string(NodeName), Extra = "", diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl index 2315a56..bba4d87 100644 --- a/lib/kernel/src/inet6_tcp_dist.erl +++ b/lib/kernel/src/inet6_tcp_dist.erl @@ -71,7 +71,7 @@ listen(Name) -> {ok, Socket} -> TcpAddress = get_tcp_address(Socket), {_,Port} = TcpAddress#net_address.address, - case erl_epmd:register_node(Name, Port) of + case erl_epmd:register_node(Name, Port, inet6) of {ok, Creation} -> {ok, {Socket, TcpAddress, Creation}}; Error -> -- 1.7.9.5 From michael.santos@REDACTED Wed Feb 20 14:04:12 2013 From: michael.santos@REDACTED (Michael Santos) Date: Wed, 20 Feb 2013 08:04:12 -0500 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <5123B19F.5090907@erlang.org> References: <20130216232353.GA27511@ioctl> <512209B9.8040109@erlang.org> <5122104D.1000309@erlang.org> <5123B19F.5090907@erlang.org> Message-ID: <20130220130412.GB9962@ioctl> On Tue, Feb 19, 2013 at 06:08:47PM +0100, Patrik Nyblom wrote: > On 02/18/2013 12:28 PM, Fredrik wrote: > >This happens only on windows I should add to the context also.. > > > >BR Fredrik > >On 02/18/2013 12:00 PM, Fredrik wrote: > For unknown reasons, you need to drop support for win2k to get > IPPROTO_IPV6 from the windows headers. Either we can up the command > line -D_WIN32_WINVER to 0x0501 (Windows XP) or you can set (#define > it) in epmd_int.h before including winsock2.h. > ... > #ifdef _WIN32_WINVER > #undef _WIN32_WINVER > #endif > #define _WIN32_WINVER 0x0501 > ... That was a huge help, thanks! > But that will probably be the end of any (theoretical) windows 2000 > support. We don't support Win 2000 officially, so I think it will be > a non-issue. Others might disagree though :) For now, I've set the define. But if anyone feels strongly about this, I can change it. From aschultz@REDACTED Thu Feb 21 13:48:23 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Thu, 21 Feb 2013 13:48:23 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <1895909746.274438.1350582054364.JavaMail.root@tpip.net> Message-ID: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> Hi, I have a new version of the elliptic curve TLS support. https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch This branch includes the PSK and SRP cipher changes that are already in master-pu as it would otherwise conflict with them. EC ciphers are now optional and depend on wether EC support is compiled into OpenSSL or not. I have tested it with on Fedora (without EC support) and Ubuntu (with EC support). Andreas From fredrik@REDACTED Thu Feb 21 14:04:30 2013 From: fredrik@REDACTED (Fredrik) Date: Thu, 21 Feb 2013 14:04:30 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> Message-ID: <51261B5E.5000607@erlang.org> On 02/21/2013 01:48 PM, Andreas Schultz wrote: > Hi, > > I have a new version of the elliptic curve TLS support. > > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch > > This branch includes the PSK and SRP cipher changes that are already in master-pu > as it would otherwise conflict with them. > > EC ciphers are now optional and depend on wether EC support is compiled into > OpenSSL or not. I have tested it with on Fedora (without EC support) and Ubuntu > (with EC support). > > Andreas > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches Fetched, Dropping tls-psk-srp-suites and replacing it with this patch now, correct? -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From aschultz@REDACTED Thu Feb 21 14:05:40 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Thu, 21 Feb 2013 14:05:40 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <51261B5E.5000607@erlang.org> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> Message-ID: <1076211738.125800.1361451940234.JavaMail.root@tpip.net> ----- Original Message ----- > On 02/21/2013 01:48 PM, Andreas Schultz wrote: > > Hi, > > > > I have a new version of the elliptic curve TLS support. > > > > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC > > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch > > > > This branch includes the PSK and SRP cipher changes that are already in > > master-pu > > as it would otherwise conflict with them. > > > > EC ciphers are now optional and depend on wether EC support is compiled > > into > > OpenSSL or not. I have tested it with on Fedora (without EC support) and > > Ubuntu > > (with EC support). > > > > Andreas > > _______________________________________________ > > erlang-patches mailing list > > erlang-patches@REDACTED > > http://erlang.org/mailman/listinfo/erlang-patches > Fetched, > Dropping tls-psk-srp-suites > > and replacing it with this patch now, correct? yes, thanks Andreas > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From fredrik@REDACTED Thu Feb 21 14:31:01 2013 From: fredrik@REDACTED (Fredrik) Date: Thu, 21 Feb 2013 14:31:01 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <1076211738.125800.1361451940234.JavaMail.root@tpip.net> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> Message-ID: <51262195.2050103@erlang.org> On 02/21/2013 02:05 PM, Andreas Schultz wrote: > > ----- Original Message ----- >> On 02/21/2013 01:48 PM, Andreas Schultz wrote: >>> Hi, >>> >>> I have a new version of the elliptic curve TLS support. >>> >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch >>> >>> This branch includes the PSK and SRP cipher changes that are already in >>> master-pu >>> as it would otherwise conflict with them. >>> >>> EC ciphers are now optional and depend on wether EC support is compiled >>> into >>> OpenSSL or not. I have tested it with on Fedora (without EC support) and >>> Ubuntu >>> (with EC support). >>> >>> Andreas >>> _______________________________________________ >>> erlang-patches mailing list >>> erlang-patches@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-patches >> Fetched, >> Dropping tls-psk-srp-suites >> >> and replacing it with this patch now, correct? > yes, thanks > > Andreas > >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> Fails to build: ssl_connection.erl:1362: syntax error before: '>>' ssl_connection.erl:1230: function init_diffie_hellman/4 undefined ssl_connection.erl:1351: Warning: function handle_file_error/6 is unused ssl_connection.erl:1357: Warning: function file_error/6 is unused ssl_connection.erl:2141: Warning: variable 'Session' is unused ssl_connection.erl:2142: Warning: variable 'Role' is unused ssl_connection.erl:2142: Warning: variable 'Version' is unused ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is unused ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused -- BR Fredrik Gustafsson Erlang OTP Team From aschultz@REDACTED Thu Feb 21 16:13:25 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Thu, 21 Feb 2013 16:13:25 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <51262195.2050103@erlang.org> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> Message-ID: <417689351.131747.1361459605338.JavaMail.root@tpip.net> Hi, Sorry, messed up a merge, new version compiled, passed the SSL test suite and pushed... even with a fetch line: ;-) git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed during tests. This looks like a mistake in the common_test conversion. Andreas ----- Original Message ----- > On 02/21/2013 02:05 PM, Andreas Schultz wrote: > > > > ----- Original Message ----- > >> On 02/21/2013 01:48 PM, Andreas Schultz wrote: > >>> Hi, > >>> > >>> I have a new version of the elliptic curve TLS support. > >>> > >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC > >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch > >>> > >>> This branch includes the PSK and SRP cipher changes that are already in > >>> master-pu > >>> as it would otherwise conflict with them. > >>> > >>> EC ciphers are now optional and depend on wether EC support is compiled > >>> into > >>> OpenSSL or not. I have tested it with on Fedora (without EC support) and > >>> Ubuntu > >>> (with EC support). > >>> > >>> Andreas > >>> _______________________________________________ > >>> erlang-patches mailing list > >>> erlang-patches@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-patches > >> Fetched, > >> Dropping tls-psk-srp-suites > >> > >> and replacing it with this patch now, correct? > > yes, thanks > > > > Andreas > > > >> -- > >> > >> BR Fredrik Gustafsson > >> Erlang OTP Team > >> > >> > Fails to build: > > ssl_connection.erl:1362: syntax error before: '>>' > ssl_connection.erl:1230: function init_diffie_hellman/4 undefined > ssl_connection.erl:1351: Warning: function handle_file_error/6 is unused > ssl_connection.erl:1357: Warning: function file_error/6 is unused > ssl_connection.erl:2141: Warning: variable 'Session' is unused > ssl_connection.erl:2142: Warning: variable 'Role' is unused > ssl_connection.erl:2142: Warning: variable 'Version' is unused > ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is unused > ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused > > > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From mloftis@REDACTED Thu Feb 21 19:08:04 2013 From: mloftis@REDACTED (Michael Loftis) Date: Thu, 21 Feb 2013 10:08:04 -0800 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <417689351.131747.1361459605338.JavaMail.root@tpip.net> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> Message-ID: When I took a quick look at this I see there are static's in the function algorithms. I'm honestly not sure how erlang is using threading...and I don't remember if there are other examples of this in the code base, but, it strikes me as that is going to be inherently thread unsafe since I believe multiple threads could race to start updating those statics the first time through. You could easily end up with one thread starting an update and another thread then attempting to run. On Thu, Feb 21, 2013 at 7:13 AM, Andreas Schultz wrote: > Hi, > > Sorry, messed up a merge, new version compiled, passed the SSL test > suite and pushed... even with a fetch line: ;-) > > git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC > > BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed during > tests. This looks like a mistake in the common_test conversion. > > Andreas > > ----- Original Message ----- >> On 02/21/2013 02:05 PM, Andreas Schultz wrote: >> > >> > ----- Original Message ----- >> >> On 02/21/2013 01:48 PM, Andreas Schultz wrote: >> >>> Hi, >> >>> >> >>> I have a new version of the elliptic curve TLS support. >> >>> >> >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC >> >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch >> >>> >> >>> This branch includes the PSK and SRP cipher changes that are already in >> >>> master-pu >> >>> as it would otherwise conflict with them. >> >>> >> >>> EC ciphers are now optional and depend on wether EC support is compiled >> >>> into >> >>> OpenSSL or not. I have tested it with on Fedora (without EC support) and >> >>> Ubuntu >> >>> (with EC support). >> >>> >> >>> Andreas >> >>> _______________________________________________ >> >>> erlang-patches mailing list >> >>> erlang-patches@REDACTED >> >>> http://erlang.org/mailman/listinfo/erlang-patches >> >> Fetched, >> >> Dropping tls-psk-srp-suites >> >> >> >> and replacing it with this patch now, correct? >> > yes, thanks >> > >> > Andreas >> > >> >> -- >> >> >> >> BR Fredrik Gustafsson >> >> Erlang OTP Team >> >> >> >> >> Fails to build: >> >> ssl_connection.erl:1362: syntax error before: '>>' >> ssl_connection.erl:1230: function init_diffie_hellman/4 undefined >> ssl_connection.erl:1351: Warning: function handle_file_error/6 is unused >> ssl_connection.erl:1357: Warning: function file_error/6 is unused >> ssl_connection.erl:2141: Warning: variable 'Session' is unused >> ssl_connection.erl:2142: Warning: variable 'Role' is unused >> ssl_connection.erl:2142: Warning: variable 'Version' is unused >> ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is unused >> ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused >> >> >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> > > -- > -- > Dipl. Inform. > Andreas Schultz > > email: as@REDACTED > phone: +49-391-819099-224 > mobil: +49-170-2226073 > > ------------------ managed broadband access ------------------ > > Travelping GmbH phone: +49-391-8190990 > Roentgenstr. 13 fax: +49-391-819099299 > D-39108 Magdeburg email: info@REDACTED > GERMANY web: http://www.travelping.com > > Company Registration: HRB21276 Handelsregistergericht Chemnitz > Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 > -------------------------------------------------------------- > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches -- "Genius might be described as a supreme capacity for getting its possessors into trouble of all kinds." -- Samuel Butler From fredrik@REDACTED Fri Feb 22 10:46:25 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 22 Feb 2013 10:46:25 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <417689351.131747.1361459605338.JavaMail.root@tpip.net> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> Message-ID: <51273E71.4000609@erlang.org> On 02/21/2013 04:13 PM, Andreas Schultz wrote: > Hi, > > Sorry, messed up a merge, new version compiled, passed the SSL test > suite and pushed... even with a fetch line: ;-) > > git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC > > BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed during > tests. This looks like a mistake in the common_test conversion. > > Andreas > > ----- Original Message ----- >> On 02/21/2013 02:05 PM, Andreas Schultz wrote: >>> ----- Original Message ----- >>>> On 02/21/2013 01:48 PM, Andreas Schultz wrote: >>>>> Hi, >>>>> >>>>> I have a new version of the elliptic curve TLS support. >>>>> >>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC >>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch >>>>> >>>>> This branch includes the PSK and SRP cipher changes that are already in >>>>> master-pu >>>>> as it would otherwise conflict with them. >>>>> >>>>> EC ciphers are now optional and depend on wether EC support is compiled >>>>> into >>>>> OpenSSL or not. I have tested it with on Fedora (without EC support) and >>>>> Ubuntu >>>>> (with EC support). >>>>> >>>>> Andreas >>>>> _______________________________________________ >>>>> erlang-patches mailing list >>>>> erlang-patches@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-patches >>>> Fetched, >>>> Dropping tls-psk-srp-suites >>>> >>>> and replacing it with this patch now, correct? >>> yes, thanks >>> >>> Andreas >>> >>>> -- >>>> >>>> BR Fredrik Gustafsson >>>> Erlang OTP Team >>>> >>>> >> Fails to build: >> >> ssl_connection.erl:1362: syntax error before: '>>' >> ssl_connection.erl:1230: function init_diffie_hellman/4 undefined >> ssl_connection.erl:1351: Warning: function handle_file_error/6 is unused >> ssl_connection.erl:1357: Warning: function file_error/6 is unused >> ssl_connection.erl:2141: Warning: variable 'Session' is unused >> ssl_connection.erl:2142: Warning: variable 'Role' is unused >> ssl_connection.erl:2142: Warning: variable 'Version' is unused >> ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is unused >> ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused >> >> >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> Re-fetched. Thanks, Fetch link is always appreciated. ;) -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Fri Feb 22 11:45:21 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 22 Feb 2013 11:45:21 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <51273E71.4000609@erlang.org> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> <51273E71.4000609@erlang.org> Message-ID: <51274C41.8080506@erlang.org> On 02/22/2013 10:46 AM, Fredrik wrote: > On 02/21/2013 04:13 PM, Andreas Schultz wrote: >> Hi, >> >> Sorry, messed up a merge, new version compiled, passed the SSL test >> suite and pushed... even with a fetch line: ;-) >> >> git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC >> >> BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed during >> tests. This looks like a mistake in the common_test conversion. >> >> Andreas >> >> ----- Original Message ----- >>> On 02/21/2013 02:05 PM, Andreas Schultz wrote: >>>> ----- Original Message ----- >>>>> On 02/21/2013 01:48 PM, Andreas Schultz wrote: >>>>>> Hi, >>>>>> >>>>>> I have a new version of the elliptic curve TLS support. >>>>>> >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC >>>>>> >>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch >>>>>> >>>>>> >>>>>> This branch includes the PSK and SRP cipher changes that are >>>>>> already in >>>>>> master-pu >>>>>> as it would otherwise conflict with them. >>>>>> >>>>>> EC ciphers are now optional and depend on wether EC support is >>>>>> compiled >>>>>> into >>>>>> OpenSSL or not. I have tested it with on Fedora (without EC >>>>>> support) and >>>>>> Ubuntu >>>>>> (with EC support). >>>>>> >>>>>> Andreas >>>>>> _______________________________________________ >>>>>> erlang-patches mailing list >>>>>> erlang-patches@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-patches >>>>> Fetched, >>>>> Dropping tls-psk-srp-suites >>>>> >>>>> and replacing it with this patch now, correct? >>>> yes, thanks >>>> >>>> Andreas >>>> >>>>> -- >>>>> >>>>> BR Fredrik Gustafsson >>>>> Erlang OTP Team >>>>> >>>>> >>> Fails to build: >>> >>> ssl_connection.erl:1362: syntax error before: '>>' >>> ssl_connection.erl:1230: function init_diffie_hellman/4 undefined >>> ssl_connection.erl:1351: Warning: function handle_file_error/6 is >>> unused >>> ssl_connection.erl:1357: Warning: function file_error/6 is unused >>> ssl_connection.erl:2141: Warning: variable 'Session' is unused >>> ssl_connection.erl:2142: Warning: variable 'Role' is unused >>> ssl_connection.erl:2142: Warning: variable 'Version' is unused >>> ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is >>> unused >>> ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused >>> >>> >>> >>> -- >>> >>> BR Fredrik Gustafsson >>> Erlang OTP Team >>> >>> > Re-fetched. Thanks, > Fetch link is always appreciated. ;) > Still fails to build: crypto.c(369) : error C2059: syntax error : '.' crypto.c(370) : error C2059: syntax error : ',' crypto.c(371) : error C2059: syntax error : ',' crypto.c(372) : error C2059: syntax error : ',' crypto.c(373) : error C2059: syntax error : ',' crypto.c(374) : error C2059: syntax error : ',' crypto.c(375) : error C2059: syntax error : ',' crypto.c(377) : error C2059: syntax error : ',' crypto.c(378) : error C2059: syntax error : ',' crypto.c(379) : error C2059: syntax error : ',' crypto.c(380) : error C2059: syntax error : ',' crypto.c(381) : error C2059: syntax error : ',' crypto.c(383) : error C2059: syntax error : ',' crypto.c(384) : error C2059: syntax error : ',' crypto.c(385) : error C2059: syntax error : ',' crypto.c(387) : error C2059: syntax error : ',' crypto.c(388) : error C2059: syntax error : ',' crypto.c(389) : error C2059: syntax error : ',' crypto.c(390) : error C2059: syntax error : ',' crypto.c(391) : error C2059: syntax error : ',' crypto.c(392) : error C2059: syntax error : ',' crypto.c(393) : error C2059: syntax error : ',' crypto.c(396) : error C2059: syntax error : ',' crypto.c(397) : error C2059: syntax error : ',' crypto.c(398) : error C2059: syntax error : ',' crypto.c(399) : error C2059: syntax error : ',' crypto.c(400) : error C2059: syntax error : ',' crypto.c(401) : error C2059: syntax error : ',' crypto.c(402) : error C2059: syntax error : ',' crypto.c(403) : error C2059: syntax error : ',' crypto.c(404) : error C2059: syntax error : ',' crypto.c(405) : error C2059: syntax error : ',' crypto.c(406) : error C2059: syntax error : ',' crypto.c(407) : error C2059: syntax error : ',' crypto.c(408) : error C2059: syntax error : ',' crypto.c(409) : error C2059: syntax error : ',' crypto.c(410) : error C2059: syntax error : ',' crypto.c(411) : error C2059: syntax error : ',' crypto.c(412) : error C2059: syntax error : ',' crypto.c(413) : error C2059: syntax error : ',' crypto.c(415) : error C2059: syntax error : ',' crypto.c(416) : error C2059: syntax error : ',' crypto.c(417) : error C2059: syntax error : ',' crypto.c(418) : error C2059: syntax error : ',' crypto.c(419) : error C2059: syntax error : ',' crypto.c(420) : error C2059: syntax error : ',' crypto.c(421) : error C2059: syntax error : ',' crypto.c(422) : error C2059: syntax error : ',' crypto.c(423) : error C2059: syntax error : ',' crypto.c(424) : error C2059: syntax error : ',' crypto.c(425) : error C2059: syntax error : ',' crypto.c(426) : error C2059: syntax error : ',' crypto.c(427) : error C2059: syntax error : ',' crypto.c(428) : error C2059: syntax error : ',' crypto.c(429) : error C2059: syntax error : ',' crypto.c(430) : error C2059: syntax error : ',' crypto.c(433) : error C2059: syntax error : ',' crypto.c(434) : error C2059: syntax error : ',' crypto.c(435) : error C2059: syntax error : ',' crypto.c(436) : error C2059: syntax error : ',' crypto.c(437) : error C2059: syntax error : ',' crypto.c(438) : error C2059: syntax error : ',' crypto.c(439) : error C2059: syntax error : ',' crypto.c(440) : error C2059: syntax error : ',' crypto.c(441) : error C2059: syntax error : ',' crypto.c(442) : error C2059: syntax error : ',' crypto.c(443) : error C2059: syntax error : ',' crypto.c(445) : error C2059: syntax error : ',' crypto.c(447) : error C2059: syntax error : '}' crypto.c(611) : warning C4034: sizeof returns 0 crypto.c(2832) : warning C4034: sizeof returns 0 crypto.c(2843) : warning C4034: sizeof returns 0 -- BR Fredrik Gustafsson Erlang OTP Team From fredrik@REDACTED Fri Feb 22 11:46:48 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 22 Feb 2013 11:46:48 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <51274C41.8080506@erlang.org> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> <51273E71.4000609@erlang.org> <51274C41.8080506@erlang.org> Message-ID: <51274C98.3010908@erlang.org> On 02/22/2013 11:45 AM, Fredrik wrote: > On 02/22/2013 10:46 AM, Fredrik wrote: >> On 02/21/2013 04:13 PM, Andreas Schultz wrote: >>> Hi, >>> >>> Sorry, messed up a merge, new version compiled, passed the SSL test >>> suite and pushed... even with a fetch line: ;-) >>> >>> git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC >>> >>> BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed >>> during >>> tests. This looks like a mistake in the common_test conversion. >>> >>> Andreas >>> >>> ----- Original Message ----- >>>> On 02/21/2013 02:05 PM, Andreas Schultz wrote: >>>>> ----- Original Message ----- >>>>>> On 02/21/2013 01:48 PM, Andreas Schultz wrote: >>>>>>> Hi, >>>>>>> >>>>>>> I have a new version of the elliptic curve TLS support. >>>>>>> >>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC >>>>>>> >>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch >>>>>>> >>>>>>> >>>>>>> This branch includes the PSK and SRP cipher changes that are >>>>>>> already in >>>>>>> master-pu >>>>>>> as it would otherwise conflict with them. >>>>>>> >>>>>>> EC ciphers are now optional and depend on wether EC support is >>>>>>> compiled >>>>>>> into >>>>>>> OpenSSL or not. I have tested it with on Fedora (without EC >>>>>>> support) and >>>>>>> Ubuntu >>>>>>> (with EC support). >>>>>>> >>>>>>> Andreas >>>>>>> _______________________________________________ >>>>>>> erlang-patches mailing list >>>>>>> erlang-patches@REDACTED >>>>>>> http://erlang.org/mailman/listinfo/erlang-patches >>>>>> Fetched, >>>>>> Dropping tls-psk-srp-suites >>>>>> >>>>>> and replacing it with this patch now, correct? >>>>> yes, thanks >>>>> >>>>> Andreas >>>>> >>>>>> -- >>>>>> >>>>>> BR Fredrik Gustafsson >>>>>> Erlang OTP Team >>>>>> >>>>>> >>>> Fails to build: >>>> >>>> ssl_connection.erl:1362: syntax error before: '>>' >>>> ssl_connection.erl:1230: function init_diffie_hellman/4 undefined >>>> ssl_connection.erl:1351: Warning: function handle_file_error/6 is >>>> unused >>>> ssl_connection.erl:1357: Warning: function file_error/6 is unused >>>> ssl_connection.erl:2141: Warning: variable 'Session' is unused >>>> ssl_connection.erl:2142: Warning: variable 'Role' is unused >>>> ssl_connection.erl:2142: Warning: variable 'Version' is unused >>>> ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is >>>> unused >>>> ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused >>>> >>>> >>>> >>>> -- >>>> >>>> BR Fredrik Gustafsson >>>> Erlang OTP Team >>>> >>>> >> Re-fetched. Thanks, >> Fetch link is always appreciated. ;) >> > Still fails to build: > > crypto.c(369) : error C2059: syntax error : '.' > crypto.c(370) : error C2059: syntax error : ',' > crypto.c(371) : error C2059: syntax error : ',' > crypto.c(372) : error C2059: syntax error : ',' > crypto.c(373) : error C2059: syntax error : ',' > crypto.c(374) : error C2059: syntax error : ',' > crypto.c(375) : error C2059: syntax error : ',' > crypto.c(377) : error C2059: syntax error : ',' > crypto.c(378) : error C2059: syntax error : ',' > crypto.c(379) : error C2059: syntax error : ',' > crypto.c(380) : error C2059: syntax error : ',' > crypto.c(381) : error C2059: syntax error : ',' > crypto.c(383) : error C2059: syntax error : ',' > crypto.c(384) : error C2059: syntax error : ',' > crypto.c(385) : error C2059: syntax error : ',' > crypto.c(387) : error C2059: syntax error : ',' > crypto.c(388) : error C2059: syntax error : ',' > crypto.c(389) : error C2059: syntax error : ',' > crypto.c(390) : error C2059: syntax error : ',' > crypto.c(391) : error C2059: syntax error : ',' > crypto.c(392) : error C2059: syntax error : ',' > crypto.c(393) : error C2059: syntax error : ',' > crypto.c(396) : error C2059: syntax error : ',' > crypto.c(397) : error C2059: syntax error : ',' > crypto.c(398) : error C2059: syntax error : ',' > crypto.c(399) : error C2059: syntax error : ',' > crypto.c(400) : error C2059: syntax error : ',' > crypto.c(401) : error C2059: syntax error : ',' > crypto.c(402) : error C2059: syntax error : ',' > crypto.c(403) : error C2059: syntax error : ',' > crypto.c(404) : error C2059: syntax error : ',' > crypto.c(405) : error C2059: syntax error : ',' > crypto.c(406) : error C2059: syntax error : ',' > crypto.c(407) : error C2059: syntax error : ',' > crypto.c(408) : error C2059: syntax error : ',' > crypto.c(409) : error C2059: syntax error : ',' > crypto.c(410) : error C2059: syntax error : ',' > crypto.c(411) : error C2059: syntax error : ',' > crypto.c(412) : error C2059: syntax error : ',' > crypto.c(413) : error C2059: syntax error : ',' > crypto.c(415) : error C2059: syntax error : ',' > crypto.c(416) : error C2059: syntax error : ',' > crypto.c(417) : error C2059: syntax error : ',' > crypto.c(418) : error C2059: syntax error : ',' > crypto.c(419) : error C2059: syntax error : ',' > crypto.c(420) : error C2059: syntax error : ',' > crypto.c(421) : error C2059: syntax error : ',' > crypto.c(422) : error C2059: syntax error : ',' > crypto.c(423) : error C2059: syntax error : ',' > crypto.c(424) : error C2059: syntax error : ',' > crypto.c(425) : error C2059: syntax error : ',' > crypto.c(426) : error C2059: syntax error : ',' > crypto.c(427) : error C2059: syntax error : ',' > crypto.c(428) : error C2059: syntax error : ',' > crypto.c(429) : error C2059: syntax error : ',' > crypto.c(430) : error C2059: syntax error : ',' > crypto.c(433) : error C2059: syntax error : ',' > crypto.c(434) : error C2059: syntax error : ',' > crypto.c(435) : error C2059: syntax error : ',' > crypto.c(436) : error C2059: syntax error : ',' > crypto.c(437) : error C2059: syntax error : ',' > crypto.c(438) : error C2059: syntax error : ',' > crypto.c(439) : error C2059: syntax error : ',' > crypto.c(440) : error C2059: syntax error : ',' > crypto.c(441) : error C2059: syntax error : ',' > crypto.c(442) : error C2059: syntax error : ',' > crypto.c(443) : error C2059: syntax error : ',' > crypto.c(445) : error C2059: syntax error : ',' > crypto.c(447) : error C2059: syntax error : '}' > crypto.c(611) : warning C4034: sizeof returns 0 > crypto.c(2832) : warning C4034: sizeof returns 0 > crypto.c(2843) : warning C4034: sizeof returns 0 > > > This is only on windows I should add also! -- BR Fredrik Gustafsson Erlang OTP Team From aschultz@REDACTED Fri Feb 22 13:22:39 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Fri, 22 Feb 2013 13:22:39 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> Message-ID: <548341553.151156.1361535759099.JavaMail.root@tpip.net> Hi Michael, The static in crypto:algorithms/0 is used to perform the initialization of the list of supported algos only once. Looking it again if have to admit that there is a small windows for a race that would overrun the static array if two process called it at the time when cnt is zero. I'll move the initialization to the init function... Andreas ----- Original Message ----- > When I took a quick look at this I see there are static's in the > function algorithms. I'm honestly not sure how erlang is using > threading...and I don't remember if there are other examples of this > in the code base, but, it strikes me as that is going to be inherently > thread unsafe since I believe multiple threads could race to start > updating those statics the first time through. You could easily end > up with one thread starting an update and another thread then > attempting to run. > > On Thu, Feb 21, 2013 at 7:13 AM, Andreas Schultz wrote: > > Hi, > > > > Sorry, messed up a merge, new version compiled, passed the SSL test > > suite and pushed... even with a fetch line: ;-) > > > > git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC > > > > BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed during > > tests. This looks like a mistake in the common_test conversion. > > > > Andreas > > > > ----- Original Message ----- > >> On 02/21/2013 02:05 PM, Andreas Schultz wrote: > >> > > >> > ----- Original Message ----- > >> >> On 02/21/2013 01:48 PM, Andreas Schultz wrote: > >> >>> Hi, > >> >>> > >> >>> I have a new version of the elliptic curve TLS support. > >> >>> > >> >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC > >> >>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch > >> >>> > >> >>> This branch includes the PSK and SRP cipher changes that are already > >> >>> in > >> >>> master-pu > >> >>> as it would otherwise conflict with them. > >> >>> > >> >>> EC ciphers are now optional and depend on wether EC support is > >> >>> compiled > >> >>> into > >> >>> OpenSSL or not. I have tested it with on Fedora (without EC support) > >> >>> and > >> >>> Ubuntu > >> >>> (with EC support). > >> >>> > >> >>> Andreas > >> >>> _______________________________________________ > >> >>> erlang-patches mailing list > >> >>> erlang-patches@REDACTED > >> >>> http://erlang.org/mailman/listinfo/erlang-patches > >> >> Fetched, > >> >> Dropping tls-psk-srp-suites > >> >> > >> >> and replacing it with this patch now, correct? > >> > yes, thanks > >> > > >> > Andreas > >> > > >> >> -- > >> >> > >> >> BR Fredrik Gustafsson > >> >> Erlang OTP Team > >> >> > >> >> > >> Fails to build: > >> > >> ssl_connection.erl:1362: syntax error before: '>>' > >> ssl_connection.erl:1230: function init_diffie_hellman/4 undefined > >> ssl_connection.erl:1351: Warning: function handle_file_error/6 is unused > >> ssl_connection.erl:1357: Warning: function file_error/6 is unused > >> ssl_connection.erl:2141: Warning: variable 'Session' is unused > >> ssl_connection.erl:2142: Warning: variable 'Role' is unused > >> ssl_connection.erl:2142: Warning: variable 'Version' is unused > >> ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is unused > >> ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused > >> > >> > >> > >> -- > >> > >> BR Fredrik Gustafsson > >> Erlang OTP Team > >> > >> > > > > -- > > -- > > Dipl. Inform. > > Andreas Schultz > > > > email: as@REDACTED > > phone: +49-391-819099-224 > > mobil: +49-170-2226073 > > > > ------------------ managed broadband access ------------------ > > > > Travelping GmbH phone: +49-391-8190990 > > Roentgenstr. 13 fax: +49-391-819099299 > > D-39108 Magdeburg email: info@REDACTED > > GERMANY web: http://www.travelping.com > > > > Company Registration: HRB21276 Handelsregistergericht Chemnitz > > Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 > > -------------------------------------------------------------- > > _______________________________________________ > > erlang-patches mailing list > > erlang-patches@REDACTED > > http://erlang.org/mailman/listinfo/erlang-patches > > > > -- > > "Genius might be described as a supreme capacity for getting its possessors > into trouble of all kinds." > -- Samuel Butler > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From aschultz@REDACTED Fri Feb 22 15:01:57 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Fri, 22 Feb 2013 15:01:57 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <51274C98.3010908@erlang.org> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> <51273E71.4000609@erlang.org> <51274C41.8080506@erlang.org> <51274C98.3010908@erlang.org> Message-ID: <722666550.156203.1361541717114.JavaMail.root@tpip.net> Hi, Updated version pushed, I don't have windows around, so I couldn't test the change. Static initialization in crypto.c and unused symbols are changed as well. git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch Andreas ----- Original Message ----- > On 02/22/2013 11:45 AM, Fredrik wrote: > > On 02/22/2013 10:46 AM, Fredrik wrote: > >> On 02/21/2013 04:13 PM, Andreas Schultz wrote: > >>> Hi, > >>> > >>> Sorry, messed up a merge, new version compiled, passed the SSL test > >>> suite and pushed... even with a fetch line: ;-) > >>> > >>> git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC > >>> > >>> BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed > >>> during > >>> tests. This looks like a mistake in the common_test conversion. > >>> > >>> Andreas > >>> > >>> ----- Original Message ----- > >>>> On 02/21/2013 02:05 PM, Andreas Schultz wrote: > >>>>> ----- Original Message ----- > >>>>>> On 02/21/2013 01:48 PM, Andreas Schultz wrote: > >>>>>>> Hi, > >>>>>>> > >>>>>>> I have a new version of the elliptic curve TLS support. > >>>>>>> > >>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC > >>>>>>> > >>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch > >>>>>>> > >>>>>>> > >>>>>>> This branch includes the PSK and SRP cipher changes that are > >>>>>>> already in > >>>>>>> master-pu > >>>>>>> as it would otherwise conflict with them. > >>>>>>> > >>>>>>> EC ciphers are now optional and depend on wether EC support is > >>>>>>> compiled > >>>>>>> into > >>>>>>> OpenSSL or not. I have tested it with on Fedora (without EC > >>>>>>> support) and > >>>>>>> Ubuntu > >>>>>>> (with EC support). > >>>>>>> > >>>>>>> Andreas > >>>>>>> _______________________________________________ > >>>>>>> erlang-patches mailing list > >>>>>>> erlang-patches@REDACTED > >>>>>>> http://erlang.org/mailman/listinfo/erlang-patches > >>>>>> Fetched, > >>>>>> Dropping tls-psk-srp-suites > >>>>>> > >>>>>> and replacing it with this patch now, correct? > >>>>> yes, thanks > >>>>> > >>>>> Andreas > >>>>> > >>>>>> -- > >>>>>> > >>>>>> BR Fredrik Gustafsson > >>>>>> Erlang OTP Team > >>>>>> > >>>>>> > >>>> Fails to build: > >>>> > >>>> ssl_connection.erl:1362: syntax error before: '>>' > >>>> ssl_connection.erl:1230: function init_diffie_hellman/4 undefined > >>>> ssl_connection.erl:1351: Warning: function handle_file_error/6 is > >>>> unused > >>>> ssl_connection.erl:1357: Warning: function file_error/6 is unused > >>>> ssl_connection.erl:2141: Warning: variable 'Session' is unused > >>>> ssl_connection.erl:2142: Warning: variable 'Role' is unused > >>>> ssl_connection.erl:2142: Warning: variable 'Version' is unused > >>>> ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is > >>>> unused > >>>> ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused > >>>> > >>>> > >>>> > >>>> -- > >>>> > >>>> BR Fredrik Gustafsson > >>>> Erlang OTP Team > >>>> > >>>> > >> Re-fetched. Thanks, > >> Fetch link is always appreciated. ;) > >> > > Still fails to build: > > > > crypto.c(369) : error C2059: syntax error : '.' > > crypto.c(370) : error C2059: syntax error : ',' > > crypto.c(371) : error C2059: syntax error : ',' > > crypto.c(372) : error C2059: syntax error : ',' > > crypto.c(373) : error C2059: syntax error : ',' > > crypto.c(374) : error C2059: syntax error : ',' > > crypto.c(375) : error C2059: syntax error : ',' > > crypto.c(377) : error C2059: syntax error : ',' > > crypto.c(378) : error C2059: syntax error : ',' > > crypto.c(379) : error C2059: syntax error : ',' > > crypto.c(380) : error C2059: syntax error : ',' > > crypto.c(381) : error C2059: syntax error : ',' > > crypto.c(383) : error C2059: syntax error : ',' > > crypto.c(384) : error C2059: syntax error : ',' > > crypto.c(385) : error C2059: syntax error : ',' > > crypto.c(387) : error C2059: syntax error : ',' > > crypto.c(388) : error C2059: syntax error : ',' > > crypto.c(389) : error C2059: syntax error : ',' > > crypto.c(390) : error C2059: syntax error : ',' > > crypto.c(391) : error C2059: syntax error : ',' > > crypto.c(392) : error C2059: syntax error : ',' > > crypto.c(393) : error C2059: syntax error : ',' > > crypto.c(396) : error C2059: syntax error : ',' > > crypto.c(397) : error C2059: syntax error : ',' > > crypto.c(398) : error C2059: syntax error : ',' > > crypto.c(399) : error C2059: syntax error : ',' > > crypto.c(400) : error C2059: syntax error : ',' > > crypto.c(401) : error C2059: syntax error : ',' > > crypto.c(402) : error C2059: syntax error : ',' > > crypto.c(403) : error C2059: syntax error : ',' > > crypto.c(404) : error C2059: syntax error : ',' > > crypto.c(405) : error C2059: syntax error : ',' > > crypto.c(406) : error C2059: syntax error : ',' > > crypto.c(407) : error C2059: syntax error : ',' > > crypto.c(408) : error C2059: syntax error : ',' > > crypto.c(409) : error C2059: syntax error : ',' > > crypto.c(410) : error C2059: syntax error : ',' > > crypto.c(411) : error C2059: syntax error : ',' > > crypto.c(412) : error C2059: syntax error : ',' > > crypto.c(413) : error C2059: syntax error : ',' > > crypto.c(415) : error C2059: syntax error : ',' > > crypto.c(416) : error C2059: syntax error : ',' > > crypto.c(417) : error C2059: syntax error : ',' > > crypto.c(418) : error C2059: syntax error : ',' > > crypto.c(419) : error C2059: syntax error : ',' > > crypto.c(420) : error C2059: syntax error : ',' > > crypto.c(421) : error C2059: syntax error : ',' > > crypto.c(422) : error C2059: syntax error : ',' > > crypto.c(423) : error C2059: syntax error : ',' > > crypto.c(424) : error C2059: syntax error : ',' > > crypto.c(425) : error C2059: syntax error : ',' > > crypto.c(426) : error C2059: syntax error : ',' > > crypto.c(427) : error C2059: syntax error : ',' > > crypto.c(428) : error C2059: syntax error : ',' > > crypto.c(429) : error C2059: syntax error : ',' > > crypto.c(430) : error C2059: syntax error : ',' > > crypto.c(433) : error C2059: syntax error : ',' > > crypto.c(434) : error C2059: syntax error : ',' > > crypto.c(435) : error C2059: syntax error : ',' > > crypto.c(436) : error C2059: syntax error : ',' > > crypto.c(437) : error C2059: syntax error : ',' > > crypto.c(438) : error C2059: syntax error : ',' > > crypto.c(439) : error C2059: syntax error : ',' > > crypto.c(440) : error C2059: syntax error : ',' > > crypto.c(441) : error C2059: syntax error : ',' > > crypto.c(442) : error C2059: syntax error : ',' > > crypto.c(443) : error C2059: syntax error : ',' > > crypto.c(445) : error C2059: syntax error : ',' > > crypto.c(447) : error C2059: syntax error : '}' > > crypto.c(611) : warning C4034: sizeof returns 0 > > crypto.c(2832) : warning C4034: sizeof returns 0 > > crypto.c(2843) : warning C4034: sizeof returns 0 > > > > > > > This is only on windows I should add also! > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From sverker.eriksson@REDACTED Fri Feb 22 16:04:04 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Fri, 22 Feb 2013 16:04:04 +0100 Subject: [erlang-patches] Win64 memory corruption fix In-Reply-To: <87a9r7c2vw.fsf@pingviini.dyndns.org> References: <511A898D.2000206@erix.ericsson.se> <87a9r7c2vw.fsf@pingviini.dyndns.org> Message-ID: <512788E4.8080104@erix.ericsson.se> Jani Hakala wrote: > Blaine Whittle writes: > > >> Code wise, I looked at all uses of the type long regardless of the >> code section. I agree that the majority of the patch is just >> formatting code with bad casts which should only result in incorrect >> memory reads and not writes (however I believe the issue could result >> in erl_misc_utils.c a write) >> >> > I looked at the patch and these original lines looked the most > suspicious to me: > > in erts/lib_src/common/erl_printf_format.c > > 825: unsigned long eterm; > 836: eterm = va_arg(ap, unsigned long); > 840: res = (*erts_printf_eterm_func)(noop_fn, NULL, eterm, prec, eterm_base); > > erts_printf_eterm_func is assigned as erts_printf_term, which calls > print_term. print_term probably uses eterm as a pointer at some point > which causes invalid memory access with top-down memory allocation. > > Jani Hakala > > Yes, thank you for that observation Jani. I have now done a revised version of Blaine's patch that will be included in R16B. /Sverker, Erlang/OTP From pan@REDACTED Fri Feb 22 16:56:26 2013 From: pan@REDACTED (Patrik Nyblom) Date: Fri, 22 Feb 2013 16:56:26 +0100 Subject: [erlang-patches] [PATCH] epmd: support IPv6 node registration In-Reply-To: <20130220130412.GB9962@ioctl> References: <20130216232353.GA27511@ioctl> <512209B9.8040109@erlang.org> <5122104D.1000309@erlang.org> <5123B19F.5090907@erlang.org> <20130220130412.GB9962@ioctl> Message-ID: <5127952A.8030202@erlang.org> Hi! On 02/20/2013 02:04 PM, Michael Santos wrote: > On Tue, Feb 19, 2013 at 06:08:47PM +0100, Patrik Nyblom wrote: >> On 02/18/2013 12:28 PM, Fredrik wrote: >>> This happens only on windows I should add to the context also.. >>> >>> BR Fredrik >>> On 02/18/2013 12:00 PM, Fredrik wrote: >> For unknown reasons, you need to drop support for win2k to get >> IPPROTO_IPV6 from the windows headers. Either we can up the command >> line -D_WIN32_WINVER to 0x0501 (Windows XP) or you can set (#define >> it) in epmd_int.h before including winsock2.h. >> ... >> #ifdef _WIN32_WINVER >> #undef _WIN32_WINVER >> #endif >> #define _WIN32_WINVER 0x0501 >> ... > That was a huge help, thanks! > >> But that will probably be the end of any (theoretical) windows 2000 >> support. We don't support Win 2000 officially, so I think it will be >> a non-issue. Others might disagree though :) > For now, I've set the define. But if anyone feels strongly about this, > I can change it. I've asked around, and we are pretty sure we should change the global define anyway. Win 2000 cannot build Erlang and it will probably not work there even if built elsewhere. (not that anyone have tried for the last couple of years...) The flag was added to explicitly force away NT4 to be able to use proper threading API's back in the days :) I think we can safely set the windows version to 0x0501 already in the forthcoming maint (after the release). So then we can remove the #define. Thanks for the patch! > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches /Patrik From pan@REDACTED Fri Feb 22 17:03:09 2013 From: pan@REDACTED (Patrik Nyblom) Date: Fri, 22 Feb 2013 17:03:09 +0100 Subject: [erlang-patches] Win64 memory corruption fix In-Reply-To: <512788E4.8080104@erix.ericsson.se> References: <511A898D.2000206@erix.ericsson.se> <87a9r7c2vw.fsf@pingviini.dyndns.org> <512788E4.8080104@erix.ericsson.se> Message-ID: <512796BD.9000904@erlang.org> On 02/22/2013 04:04 PM, Sverker Eriksson wrote: > Jani Hakala wrote: >> Blaine Whittle writes: >> >>> Code wise, I looked at all uses of the type long regardless of the >>> code section. I agree that the majority of the patch is just >>> formatting code with bad casts which should only result in incorrect >>> memory reads and not writes (however I believe the issue could result >>> in erl_misc_utils.c a write) >>> >> I looked at the patch and these original lines looked the most >> suspicious to me: >> in erts/lib_src/common/erl_printf_format.c >> >> 825: unsigned long eterm; >> 836: eterm = va_arg(ap, unsigned long); >> 840: res = (*erts_printf_eterm_func)(noop_fn, NULL, eterm, prec, >> eterm_base); >> >> erts_printf_eterm_func is assigned as erts_printf_term, which calls >> print_term. print_term probably uses eterm as a pointer at some point >> which causes invalid memory access with top-down memory allocation. >> >> Jani Hakala >> > Yes, thank you for that observation Jani. > > I have now done a revised version of Blaine's patch that will be > included in R16B. > Also visible in master on github now. > > /Sverker, Erlang/OTP > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches From fredrik@REDACTED Mon Feb 25 14:56:56 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 25 Feb 2013 14:56:56 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <722666550.156203.1361541717114.JavaMail.root@tpip.net> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51261B5E.5000607@erlang.org> <1076211738.125800.1361451940234.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> <51273E71.4000609@erlang.org> <51274C41.8080506@erlang.org> <51274C98.3010908@erlang.org> <722666550.156203.1361541717114.JavaMail.root@tpip.net> Message-ID: <512B6DA8.1020704@erlang.org> On 02/22/2013 03:01 PM, Andreas Schultz wrote: > Hi, > > Updated version pushed, I don't have windows around, so I couldn't test the change. > Static initialization in crypto.c and unused symbols are changed as well. > > git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC > > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch > > Andreas > > ----- Original Message ----- >> On 02/22/2013 11:45 AM, Fredrik wrote: >>> On 02/22/2013 10:46 AM, Fredrik wrote: >>>> On 02/21/2013 04:13 PM, Andreas Schultz wrote: >>>>> Hi, >>>>> >>>>> Sorry, messed up a merge, new version compiled, passed the SSL test >>>>> suite and pushed... even with a fetch line: ;-) >>>>> >>>>> git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC >>>>> >>>>> BTW: @Ingela: I noticec that the ssl_packet_SUITE is not executed >>>>> during >>>>> tests. This looks like a mistake in the common_test conversion. >>>>> >>>>> Andreas >>>>> >>>>> ----- Original Message ----- >>>>>> On 02/21/2013 02:05 PM, Andreas Schultz wrote: >>>>>>> ----- Original Message ----- >>>>>>>> On 02/21/2013 01:48 PM, Andreas Schultz wrote: >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I have a new version of the elliptic curve TLS support. >>>>>>>>> >>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC >>>>>>>>> >>>>>>>>> https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch >>>>>>>>> >>>>>>>>> >>>>>>>>> This branch includes the PSK and SRP cipher changes that are >>>>>>>>> already in >>>>>>>>> master-pu >>>>>>>>> as it would otherwise conflict with them. >>>>>>>>> >>>>>>>>> EC ciphers are now optional and depend on wether EC support is >>>>>>>>> compiled >>>>>>>>> into >>>>>>>>> OpenSSL or not. I have tested it with on Fedora (without EC >>>>>>>>> support) and >>>>>>>>> Ubuntu >>>>>>>>> (with EC support). >>>>>>>>> >>>>>>>>> Andreas >>>>>>>>> _______________________________________________ >>>>>>>>> erlang-patches mailing list >>>>>>>>> erlang-patches@REDACTED >>>>>>>>> http://erlang.org/mailman/listinfo/erlang-patches >>>>>>>> Fetched, >>>>>>>> Dropping tls-psk-srp-suites >>>>>>>> >>>>>>>> and replacing it with this patch now, correct? >>>>>>> yes, thanks >>>>>>> >>>>>>> Andreas >>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> BR Fredrik Gustafsson >>>>>>>> Erlang OTP Team >>>>>>>> >>>>>>>> >>>>>> Fails to build: >>>>>> >>>>>> ssl_connection.erl:1362: syntax error before: '>>' >>>>>> ssl_connection.erl:1230: function init_diffie_hellman/4 undefined >>>>>> ssl_connection.erl:1351: Warning: function handle_file_error/6 is >>>>>> unused >>>>>> ssl_connection.erl:1357: Warning: function file_error/6 is unused >>>>>> ssl_connection.erl:2141: Warning: variable 'Session' is unused >>>>>> ssl_connection.erl:2142: Warning: variable 'Role' is unused >>>>>> ssl_connection.erl:2142: Warning: variable 'Version' is unused >>>>>> ssl_connection.erl:2143: Warning: variable 'ConnectionStates0' is >>>>>> unused >>>>>> ssl_connection.erl:2148: Warning: variable 'PSKIdentity' is unused >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> BR Fredrik Gustafsson >>>>>> Erlang OTP Team >>>>>> >>>>>> >>>> Re-fetched. Thanks, >>>> Fetch link is always appreciated. ;) >>>> >>> Still fails to build: >>> >>> crypto.c(369) : error C2059: syntax error : '.' >>> crypto.c(370) : error C2059: syntax error : ',' >>> crypto.c(371) : error C2059: syntax error : ',' >>> crypto.c(372) : error C2059: syntax error : ',' >>> crypto.c(373) : error C2059: syntax error : ',' >>> crypto.c(374) : error C2059: syntax error : ',' >>> crypto.c(375) : error C2059: syntax error : ',' >>> crypto.c(377) : error C2059: syntax error : ',' >>> crypto.c(378) : error C2059: syntax error : ',' >>> crypto.c(379) : error C2059: syntax error : ',' >>> crypto.c(380) : error C2059: syntax error : ',' >>> crypto.c(381) : error C2059: syntax error : ',' >>> crypto.c(383) : error C2059: syntax error : ',' >>> crypto.c(384) : error C2059: syntax error : ',' >>> crypto.c(385) : error C2059: syntax error : ',' >>> crypto.c(387) : error C2059: syntax error : ',' >>> crypto.c(388) : error C2059: syntax error : ',' >>> crypto.c(389) : error C2059: syntax error : ',' >>> crypto.c(390) : error C2059: syntax error : ',' >>> crypto.c(391) : error C2059: syntax error : ',' >>> crypto.c(392) : error C2059: syntax error : ',' >>> crypto.c(393) : error C2059: syntax error : ',' >>> crypto.c(396) : error C2059: syntax error : ',' >>> crypto.c(397) : error C2059: syntax error : ',' >>> crypto.c(398) : error C2059: syntax error : ',' >>> crypto.c(399) : error C2059: syntax error : ',' >>> crypto.c(400) : error C2059: syntax error : ',' >>> crypto.c(401) : error C2059: syntax error : ',' >>> crypto.c(402) : error C2059: syntax error : ',' >>> crypto.c(403) : error C2059: syntax error : ',' >>> crypto.c(404) : error C2059: syntax error : ',' >>> crypto.c(405) : error C2059: syntax error : ',' >>> crypto.c(406) : error C2059: syntax error : ',' >>> crypto.c(407) : error C2059: syntax error : ',' >>> crypto.c(408) : error C2059: syntax error : ',' >>> crypto.c(409) : error C2059: syntax error : ',' >>> crypto.c(410) : error C2059: syntax error : ',' >>> crypto.c(411) : error C2059: syntax error : ',' >>> crypto.c(412) : error C2059: syntax error : ',' >>> crypto.c(413) : error C2059: syntax error : ',' >>> crypto.c(415) : error C2059: syntax error : ',' >>> crypto.c(416) : error C2059: syntax error : ',' >>> crypto.c(417) : error C2059: syntax error : ',' >>> crypto.c(418) : error C2059: syntax error : ',' >>> crypto.c(419) : error C2059: syntax error : ',' >>> crypto.c(420) : error C2059: syntax error : ',' >>> crypto.c(421) : error C2059: syntax error : ',' >>> crypto.c(422) : error C2059: syntax error : ',' >>> crypto.c(423) : error C2059: syntax error : ',' >>> crypto.c(424) : error C2059: syntax error : ',' >>> crypto.c(425) : error C2059: syntax error : ',' >>> crypto.c(426) : error C2059: syntax error : ',' >>> crypto.c(427) : error C2059: syntax error : ',' >>> crypto.c(428) : error C2059: syntax error : ',' >>> crypto.c(429) : error C2059: syntax error : ',' >>> crypto.c(430) : error C2059: syntax error : ',' >>> crypto.c(433) : error C2059: syntax error : ',' >>> crypto.c(434) : error C2059: syntax error : ',' >>> crypto.c(435) : error C2059: syntax error : ',' >>> crypto.c(436) : error C2059: syntax error : ',' >>> crypto.c(437) : error C2059: syntax error : ',' >>> crypto.c(438) : error C2059: syntax error : ',' >>> crypto.c(439) : error C2059: syntax error : ',' >>> crypto.c(440) : error C2059: syntax error : ',' >>> crypto.c(441) : error C2059: syntax error : ',' >>> crypto.c(442) : error C2059: syntax error : ',' >>> crypto.c(443) : error C2059: syntax error : ',' >>> crypto.c(445) : error C2059: syntax error : ',' >>> crypto.c(447) : error C2059: syntax error : '}' >>> crypto.c(611) : warning C4034: sizeof returns 0 >>> crypto.c(2832) : warning C4034: sizeof returns 0 >>> crypto.c(2843) : warning C4034: sizeof returns 0 >>> >>> >>> >> This is only on windows I should add also! >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> Hello, Your patch is failing several testcases: In crypto: Suite: crypto_SUITE, Testcase: ec Reason: crypto:ecdsa_sign failed on line 1153 Reason: badkey In ssl: ssl_to_openssl_SUITE, basic_erlang_server_openssl_client, Reason: ssl_to_openssl_SUITE:basic_erlang_server_openssl_client failed on line 249 Reason: {test_case_failed,{{expected,{<0.11346.0>,ok}}, {got,{'EXIT',#Port<0.11738>,normal}}}} ssl_to_openssl_SUITE, erlang_server_openssl_client Reason: ssl_to_openssl_SUITE:erlang_server_openssl_client failed on line 322 Reason: {test_case_failed,{{expected,{<0.11609.0>,ok}}, {got,{'EXIT',#Port<0.11893>,normal}}}} ssl_to_openssl_SUITE, erlang_server_openssl_client_client_cert Reason: ssl_to_openssl_SUITE:erlang_server_openssl_client_client_cert failed on line 699 Reason: {test_case_failed,{{expected,{<0.11661.0>,ok}}, {got,{'EXIT',#Port<0.11939>,normal}}}} ssl_to_openssl_SUITE, erlang_server_openssl_client_dsa_cert Reason: **** User 2013-02-25 11:28:12.865 ****ssl_to_openssl_SUITE:erlang_server_openssl_client_dsa_cert failed on line 404 Reason: {test_case_failed,{{expected,{<0.11622.0>,ok}}, {got,{'EXIT',#Port<0.11908>,normal}}}} ssl_to_openssl_SUITE, erlang_server_openssl_client_reuse_session Reason: ssl_to_openssl_SUITE:erlang_server_openssl_client_reuse_session failed on line 440 Reason: {test_case_failed,{{expected,{<0.11628.0>,ok}}, {got,{'EXIT',#Port<0.11915>,normal}}}} ssl_to_openssl_SUITE, ciphers_rsa_signed_certs Reason: Error detected: testcase_aborted_or_killed -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Mon Feb 25 17:10:57 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 25 Feb 2013 17:10:57 +0100 Subject: [erlang-patches] [erlang-bugs] bug (HiPE) In-Reply-To: <6ADF2CCA-360B-4A26-81E0-5566351D0453@entelios.com> References: <6ADF2CCA-360B-4A26-81E0-5566351D0453@entelios.com> Message-ID: <512B8D11.8040904@cs.ntua.gr> On 02/25/2013 01:48 PM, Sebastian Egner wrote: > Hello, > > Consider the following module: > > ---- a.erl ---- > -module(a). > -export([foo/1]). > > foo(X) when is_number(X) -> > is_integer(X). > ---- > > Then a:foo(0) evaluates to 'false' when compiled with HiPE: > > 1> c(a). > 2> a:foo(0). > true > 3> hipe:c(a, []). > 4> a:foo(0). > false % *** WRONG *** > > The bug seems to be related to HiPE's icode type analysis: > > 5> hipe:c(a, [no_icode_type]). > 6> a:foo(0). > true > > For what it is worth, we have reproduced the problem on R14B04, R15B02, R15B03, > R16A and OTP_R16A_RELEASE_CANDIDATE-434-gc8651ed on Debian GNU/Linux > and for MacOSX (10.8.2). Thanks for bringing the bug into our attention. The two line fix for it can be seen here: https://github.com/kostis/otp/commit/6907ed77452dcf409e0e3540cf7bd876e87b54b9 Although it's probably after the code freeze date, I sincerely hope that this makes it into R16B because it fixes a real bug in the integer range analysis of the native code compiler (and I cannot see how it breaks anything else). Here is the command for adding this: git fetch git://github.com/kostis/otp.git hipe-icode-range-bug Kostis From egil@REDACTED Mon Feb 25 17:21:43 2013 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Mon, 25 Feb 2013 17:21:43 +0100 Subject: [erlang-patches] [erlang-bugs] bug (HiPE) In-Reply-To: <512B8D11.8040904@cs.ntua.gr> References: <6ADF2CCA-360B-4A26-81E0-5566351D0453@entelios.com> <512B8D11.8040904@cs.ntua.gr> Message-ID: <512B8F97.30702@erlang.org> On 2013-02-25 17:10, Kostis Sagonas wrote: > On 02/25/2013 01:48 PM, Sebastian Egner wrote: >> Hello, >> >> Consider the following module: >> >> ---- a.erl ---- >> -module(a). >> -export([foo/1]). >> >> foo(X) when is_number(X) -> >> is_integer(X). >> ---- >> >> Then a:foo(0) evaluates to 'false' when compiled with HiPE: >> >> 1> c(a). >> 2> a:foo(0). >> true >> 3> hipe:c(a, []). >> 4> a:foo(0). >> false % *** WRONG *** >> >> The bug seems to be related to HiPE's icode type analysis: >> >> 5> hipe:c(a, [no_icode_type]). >> 6> a:foo(0). >> true >> >> For what it is worth, we have reproduced the problem on R14B04, >> R15B02, R15B03, >> R16A and OTP_R16A_RELEASE_CANDIDATE-434-gc8651ed on Debian GNU/Linux >> and for MacOSX (10.8.2). > > Thanks for bringing the bug into our attention. The two line fix for > it can be seen here: > > > https://github.com/kostis/otp/commit/6907ed77452dcf409e0e3540cf7bd876e87b54b9 > > > > Although it's probably after the code freeze date, I sincerely hope > that this makes it into R16B because it fixes a real bug in the > integer range analysis of the native code compiler (and I cannot see > how it breaks anything else). We will most probably include this patch. I've put Sverker on it. =) // Bj?rn-Egil > > Here is the command for adding this: > > git fetch git://github.com/kostis/otp.git hipe-icode-range-bug > > Kostis > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > From aschultz@REDACTED Mon Feb 25 17:52:36 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Mon, 25 Feb 2013 17:52:36 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <512B6DA8.1020704@erlang.org> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> <51273E71.4000609@erlang.org> <51274C41.8080506@erlang.org> <51274C98.3010908@erlang.org> <722666550.156203.1361541717114.JavaMail.root@tpip.net> <512B6DA8.1020704@erlang.org> Message-ID: <845848298.208535.1361811156579.JavaMail.root@tpip.net> ----- Original Message ----- [...] > Hello, > Your patch is failing several testcases: I've rerun the test suite on my system and all of them pass. Do you have any additional information about the test system (e.g. OS, OS Version, OpenSSL Version, Compiler), so that I can try to recreate the failures? Thanks Andreas > > In crypto: > Suite: crypto_SUITE, Testcase: ec > Reason: > crypto:ecdsa_sign failed on line 1153 Reason: badkey > > In ssl: > ssl_to_openssl_SUITE, basic_erlang_server_openssl_client, > Reason: > ssl_to_openssl_SUITE:basic_erlang_server_openssl_client failed on line > 249 Reason: {test_case_failed,{{expected,{<0.11346.0>,ok}}, > {got,{'EXIT',#Port<0.11738>,normal}}}} > > ssl_to_openssl_SUITE, erlang_server_openssl_client > Reason: > ssl_to_openssl_SUITE:erlang_server_openssl_client failed on line 322 > Reason: {test_case_failed,{{expected,{<0.11609.0>,ok}}, > {got,{'EXIT',#Port<0.11893>,normal}}}} > ssl_to_openssl_SUITE, erlang_server_openssl_client_client_cert > Reason: > ssl_to_openssl_SUITE:erlang_server_openssl_client_client_cert failed on > line 699 Reason: {test_case_failed,{{expected,{<0.11661.0>,ok}}, > {got,{'EXIT',#Port<0.11939>,normal}}}} > ssl_to_openssl_SUITE, erlang_server_openssl_client_dsa_cert > Reason: > **** User 2013-02-25 11:28:12.865 > ****ssl_to_openssl_SUITE:erlang_server_openssl_client_dsa_cert failed on > line 404 Reason: {test_case_failed,{{expected,{<0.11622.0>,ok}}, > {got,{'EXIT',#Port<0.11908>,normal}}}} > ssl_to_openssl_SUITE, erlang_server_openssl_client_reuse_session > Reason: > ssl_to_openssl_SUITE:erlang_server_openssl_client_reuse_session failed > on line 440 Reason: {test_case_failed,{{expected,{<0.11628.0>,ok}}, > {got,{'EXIT',#Port<0.11915>,normal}}}} > ssl_to_openssl_SUITE, ciphers_rsa_signed_certs > Reason: > Error detected: testcase_aborted_or_killed > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > -- -- Dipl. Inform. Andreas Schultz From fredrik@REDACTED Mon Feb 25 18:00:10 2013 From: fredrik@REDACTED (Fredrik) Date: Mon, 25 Feb 2013 18:00:10 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <845848298.208535.1361811156579.JavaMail.root@tpip.net> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51262195.2050103@erlang.org> <417689351.131747.1361459605338.JavaMail.root@tpip.net> <51273E71.4000609@erlang.org> <51274C41.8080506@erlang.org> <51274C98.3010908@erlang.org> <722666550.156203.1361541717114.JavaMail.root@tpip.net> <512B6DA8.1020704@erlang.org> <845848298.208535.1361811156579.JavaMail.root@tpip.net> Message-ID: <512B989A.7090306@erlang.org> On 02/25/2013 05:52 PM, Andreas Schultz wrote: > ----- Original Message ----- > > [...] > >> Hello, >> Your patch is failing several testcases: > I've rerun the test suite on my system and all of them pass. Do you have > any additional information about the test system (e.g. OS, OS Version, > OpenSSL Version, Compiler), so that I can try to recreate the failures? > > Thanks > Andreas > >> In crypto: >> Suite: crypto_SUITE, Testcase: ec >> Reason: >> crypto:ecdsa_sign failed on line 1153 Reason: badkey >> >> In ssl: >> ssl_to_openssl_SUITE, basic_erlang_server_openssl_client, >> Reason: >> ssl_to_openssl_SUITE:basic_erlang_server_openssl_client failed on line >> 249 Reason: {test_case_failed,{{expected,{<0.11346.0>,ok}}, >> {got,{'EXIT',#Port<0.11738>,normal}}}} >> >> ssl_to_openssl_SUITE, erlang_server_openssl_client >> Reason: >> ssl_to_openssl_SUITE:erlang_server_openssl_client failed on line 322 >> Reason: {test_case_failed,{{expected,{<0.11609.0>,ok}}, >> {got,{'EXIT',#Port<0.11893>,normal}}}} >> ssl_to_openssl_SUITE, erlang_server_openssl_client_client_cert >> Reason: >> ssl_to_openssl_SUITE:erlang_server_openssl_client_client_cert failed on >> line 699 Reason: {test_case_failed,{{expected,{<0.11661.0>,ok}}, >> {got,{'EXIT',#Port<0.11939>,normal}}}} >> ssl_to_openssl_SUITE, erlang_server_openssl_client_dsa_cert >> Reason: >> **** User 2013-02-25 11:28:12.865 >> ****ssl_to_openssl_SUITE:erlang_server_openssl_client_dsa_cert failed on >> line 404 Reason: {test_case_failed,{{expected,{<0.11622.0>,ok}}, >> {got,{'EXIT',#Port<0.11908>,normal}}}} >> ssl_to_openssl_SUITE, erlang_server_openssl_client_reuse_session >> Reason: >> ssl_to_openssl_SUITE:erlang_server_openssl_client_reuse_session failed >> on line 440 Reason: {test_case_failed,{{expected,{<0.11628.0>,ok}}, >> {got,{'EXIT',#Port<0.11915>,normal}}}} >> ssl_to_openssl_SUITE, ciphers_rsa_signed_certs >> Reason: >> Error detected: testcase_aborted_or_killed >> >> -- >> >> BR Fredrik Gustafsson >> Erlang OTP Team >> >> Hello, Linux and architecture x86. -- BR Fredrik Gustafsson Erlang OTP Team From aschultz@REDACTED Tue Feb 26 09:53:46 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Tue, 26 Feb 2013 09:53:46 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <512BA1E5.1020702@erlang.org> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <51274C98.3010908@erlang.org> <722666550.156203.1361541717114.JavaMail.root@tpip.net> <512B6DA8.1020704@erlang.org> <845848298.208535.1361811156579.JavaMail.root@tpip.net> <512B989A.7090306@erlang.org> <1821337653.210106.1361811964008.JavaMail.root@tpip.net> <512BA1E5.1020702@erlang.org> Message-ID: <147553970.218032.1361868826091.JavaMail.root@tpip.net> Hi Frederik, I have run the test on a natty i386 system, without updates and with updates installed, but I still can't get the test to fail. Do you use any special configure flags on this build or special hardware? Also, for reference, would it be possible to get the output of: dpkg -l uname -a cat /proc/cpuinfo Andreas ----- Original Message ----- > On 02/25/2013 06:06 PM, Andreas Schultz wrote: > > ----- Original Message ----- > > [...] > > > >> Hello, > >> Linux and architecture x86. > > Any particular distribution, or version? > > OpenSSL version would also be great to know. > > > > Thanks > > Andreas > >> -- > >> > >> BR Fredrik Gustafsson > >> Erlang OTP Team > >> > >> > Hello, > OpenSSL 0.9.8o 01 Jun 2010 > > DISTRIB_ID=Ubuntu > DISTRIB_RELEASE=11.04 > DISTRIB_CODENAME=natty > DISTRIB_DESCRIPTION="Ubuntu 11.04" > > > -- > > BR Fredrik Gustafsson > Erlang OTP Team > > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From aschultz@REDACTED Tue Feb 26 14:02:52 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Tue, 26 Feb 2013 14:02:52 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <512C8318.3090102@erix.ericsson.se> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <512B6DA8.1020704@erlang.org> <845848298.208535.1361811156579.JavaMail.root@tpip.net> <512B989A.7090306@erlang.org> <1821337653.210106.1361811964008.JavaMail.root@tpip.net> <512BA1E5.1020702@erlang.org> <147553970.218032.1361868826091.JavaMail.root@tpip.net> <512C8318.3090102@erix.ericsson.se> Message-ID: <892672285.231026.1361883772253.JavaMail.root@tpip.net> ----- Original Message ----- > Hi! > > I took a look at the failing test cases and found that whit openssl > 0.9.8k, openssl > > will crash with errors like the following: > > openssl 25966:error:14092073:SSL routines:SSL3_GET_SERVER_HELLO:bad packet > length:s3_clnt.c:879: > CONNECTED(00000003) > > > **** User 2013-02-25 11:01:47.291 **** > ssl_to_openssl_SUITE:basic_erlang_server_openssl_client failed on line > 249 Reason: {test_case_failed,{{expected,{<0.11346.0>,ok}}, > {got,{'EXIT',#Port<0.11738>,normal}}}} > > > That is why the the test case gets {EXIT',#Port<0.11738>,normal} > > for the test cases erlang_server_openssl_client, > erlang_server_openssl_client_client_cert, > erlang_server_openssl_client_dsa_cert, > erlang_server_openssl_client_reuse_session > > > and with openssl openssl 0.9.8k and 0.9.8.o there is a hanshake failure > in the ciphers_rsa_signed_certs test case > Got that too. Will investigate. Yet this still doesn't explain why the i386 build is showing a failure in the crypto EC tests (this also cause a lot of the ssl failures later on). Andreas > > > === Started at 2013-02-26 05:04:58 > [...] > > openssl Using default temp DH parameters > > > **** User 2013-02-26 05:04:59.753 **** =ERROR REPORT==== > 26-Feb-2013::06:04:59 === SSL: hello: ssl_connection.erl:2308:Fatal > error: handshake failure > **** User 2013-02-26 05:07:08.747 **** Error detected: > testcase_aborted_or_killed > > **** User 2013-02-26 05:07:08.747 **** =ERROR REPORT==== > 26-Feb-2013::06:07:08 === Testcase process <0.11491.0> not responding to > timetrap timeout: > {timetrap_timeout,120000,[{ssl_to_openssl_SUITE,ciphers_rsa_signed_certs}]}. > Killing testcase... > > === Ended at 2013-02-26 05:07:08 > === location unknown > === reason = testcase_aborted_or_killed > > If it is possible to confirm that the problem is in openssl the testcases > can be skipped for those ancient versions. > > Regards Ingela Erlang/OTP team - Ericsson AB > > > Andreas Schultz wrote: > > Hi Frederik, > > > > I have run the test on a natty i386 system, without > > updates and with updates installed, but I still can't > > get the test to fail. > > > > Do you use any special configure flags on this > > build or special hardware? > > > > Also, for reference, would it be possible to get > > the output of: > > > > dpkg -l > > uname -a > > cat /proc/cpuinfo > > > > Andreas > > > > ----- Original Message ----- > > > >> On 02/25/2013 06:06 PM, Andreas Schultz wrote: > >> > >>> ----- Original Message ----- > >>> [...] > >>> > >>> > >>>> Hello, > >>>> Linux and architecture x86. > >>>> > >>> Any particular distribution, or version? > >>> OpenSSL version would also be great to know. > >>> > >>> Thanks > >>> Andreas > >>> > >>>> -- > >>>> > >>>> BR Fredrik Gustafsson > >>>> Erlang OTP Team > >>>> > >>>> > >>>> > >> Hello, > >> OpenSSL 0.9.8o 01 Jun 2010 > >> > >> DISTRIB_ID=Ubuntu > >> DISTRIB_RELEASE=11.04 > >> DISTRIB_CODENAME=natty > >> DISTRIB_DESCRIPTION="Ubuntu 11.04" > >> > >> > >> -- > >> > >> BR Fredrik Gustafsson > >> Erlang OTP Team > >> > >> > >> > > > > > > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From aschultz@REDACTED Tue Feb 26 15:43:35 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Tue, 26 Feb 2013 15:43:35 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <512CC728.4020803@ericsson.com> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <512B989A.7090306@erlang.org> <1821337653.210106.1361811964008.JavaMail.root@tpip.net> <512BA1E5.1020702@erlang.org> <147553970.218032.1361868826091.JavaMail.root@tpip.net> <512C8318.3090102@erix.ericsson.se> <892672285.231026.1361883772253.JavaMail.root@tpip.net> <512CC728.4020803@ericsson.com> Message-ID: <1394676632.235085.1361889815146.JavaMail.root@tpip.net> Hi! ----- Original Message ----- > Hi! [...] > Looking at the crypto testruns it fails on openssl 0.9.8k. There has to be more to this than just the version. I tried to reproduce the test failure Frederik gave me on a Natty i386 system, packages seem to be same, openssl seem to be same, but I still don't get the crypto failure. Do you use any special configure options on those systems? e.g. 32bit build on 64bit userland or halfword emulator? Andreas > > Regards Ingela Erlang/OTP team - Ericsson AB > > [...] > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From aschultz@REDACTED Wed Feb 27 19:33:25 2013 From: aschultz@REDACTED (Andreas Schultz) Date: Wed, 27 Feb 2013 19:33:25 +0100 (CET) Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <512CC728.4020803@ericsson.com> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <512B989A.7090306@erlang.org> <1821337653.210106.1361811964008.JavaMail.root@tpip.net> <512BA1E5.1020702@erlang.org> <147553970.218032.1361868826091.JavaMail.root@tpip.net> <512C8318.3090102@erix.ericsson.se> <892672285.231026.1361883772253.JavaMail.root@tpip.net> <512CC728.4020803@ericsson.com> Message-ID: <1398393108.279224.1361990005766.JavaMail.root@tpip.net> Hi, I have fixed the ssl_to_openssl_SUITE failure. The test suite tried to use an EC cipher on an openssl version that has no support for that cipher. I have also tried to reproduced the failing crypto ec test on Ubuntu natty 32bit and 64bit with halfword and m32-build, but it does pass the test on all those variants. Is there anything special or non-standard in your test setup (e.g. configuration switches, manually installed libraries, ...)??? New version with fixed ssl_to_openssl_SUITE here: git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch Andreas ----- Original Message ----- > Hi! > > Andreas Schultz wrote: > > ----- Original Message ----- > >> Hi! > >> > >> I took a look at the failing test cases and found that whit openssl > >> 0.9.8k, openssl > >> > >> will crash with errors like the following: > >> > >> openssl 25966:error:14092073:SSL routines:SSL3_GET_SERVER_HELLO:bad packet > >> length:s3_clnt.c:879: > >> CONNECTED(00000003) > >> > >> > >> **** User 2013-02-25 11:01:47.291 **** > >> ssl_to_openssl_SUITE:basic_erlang_server_openssl_client failed on line > >> 249 Reason: {test_case_failed,{{expected,{<0.11346.0>,ok}}, > >> {got,{'EXIT',#Port<0.11738>,normal}}}} > >> > >> > >> That is why the the test case gets {EXIT',#Port<0.11738>,normal} > >> > >> for the test cases erlang_server_openssl_client, > >> erlang_server_openssl_client_client_cert, > >> erlang_server_openssl_client_dsa_cert, > >> erlang_server_openssl_client_reuse_session > >> > >> > >> and with openssl openssl 0.9.8k and 0.9.8.o there is a hanshake failure > >> in the ciphers_rsa_signed_certs test case > >> > > > > Got that too. Will investigate. > > > > Yet this still doesn't explain why the i386 build is showing > > a failure in the crypto EC tests (this also cause a lot of > > the ssl failures later on). > > Yes it could be good to investigate that first. > Looking at the crypto testruns it fails on openssl 0.9.8k. > > Regards Ingela Erlang/OTP team - Ericsson AB > > [...] > -- -- Dipl. Inform. Andreas Schultz From fredrik@REDACTED Thu Feb 28 09:43:11 2013 From: fredrik@REDACTED (Fredrik) Date: Thu, 28 Feb 2013 09:43:11 +0100 Subject: [erlang-patches] new veriosn elliptic curve support In-Reply-To: <1398393108.279224.1361990005766.JavaMail.root@tpip.net> References: <1039035650.125721.1361450903354.JavaMail.root@tpip.net> <512B989A.7090306@erlang.org> <1821337653.210106.1361811964008.JavaMail.root@tpip.net> <512BA1E5.1020702@erlang.org> <147553970.218032.1361868826091.JavaMail.root@tpip.net> <512C8318.3090102@erix.ericsson.se> <892672285.231026.1361883772253.JavaMail.root@tpip.net> <512CC728.4020803@ericsson.com> <1398393108.279224.1361990005766.JavaMail.root@tpip.net> Message-ID: <512F189F.5010704@erlang.org> On 02/27/2013 07:33 PM, Andreas Schultz wrote: > Hi, > > I have fixed the ssl_to_openssl_SUITE failure. The test suite tried to > use an EC cipher on an openssl version that has no support for that > cipher. > > I have also tried to reproduced the failing crypto ec test on Ubuntu > natty 32bit and 64bit with halfword and m32-build, but it does pass > the test on all those variants. > > Is there anything special or non-standard in your test setup > (e.g. configuration switches, manually installed libraries, ...)??? > > New version with fixed ssl_to_openssl_SUITE here: > > git fetch git://github.com/RoadRunnr/otp.git tls-psk-srp-suites-ECC > > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC > https://github.com/RoadRunnr/otp/compare/master...tls-psk-srp-suites-ECC.patch > > Andreas > > ----- Original Message ----- >> Hi! >> >> Andreas Schultz wrote: >>> ----- Original Message ----- >>>> Hi! >>>> >>>> I took a look at the failing test cases and found that whit openssl >>>> 0.9.8k, openssl >>>> >>>> will crash with errors like the following: >>>> >>>> openssl 25966:error:14092073:SSL routines:SSL3_GET_SERVER_HELLO:bad packet >>>> length:s3_clnt.c:879: >>>> CONNECTED(00000003) >>>> >>>> >>>> **** User 2013-02-25 11:01:47.291 **** >>>> ssl_to_openssl_SUITE:basic_erlang_server_openssl_client failed on line >>>> 249 Reason: {test_case_failed,{{expected,{<0.11346.0>,ok}}, >>>> {got,{'EXIT',#Port<0.11738>,normal}}}} >>>> >>>> >>>> That is why the the test case gets {EXIT',#Port<0.11738>,normal} >>>> >>>> for the test cases erlang_server_openssl_client, >>>> erlang_server_openssl_client_client_cert, >>>> erlang_server_openssl_client_dsa_cert, >>>> erlang_server_openssl_client_reuse_session >>>> >>>> >>>> and with openssl openssl 0.9.8k and 0.9.8.o there is a hanshake failure >>>> in the ciphers_rsa_signed_certs test case >>>> >>> Got that too. Will investigate. >>> >>> Yet this still doesn't explain why the i386 build is showing >>> a failure in the crypto EC tests (this also cause a lot of >>> the ssl failures later on). >> Yes it could be good to investigate that first. >> Looking at the crypto testruns it fails on openssl 0.9.8k. >> >> Regards Ingela Erlang/OTP team - Ericsson AB >> >> [...] >> Hello, Re-fetched. Let's see how the testing go now! There should be no special configurations as far as I know.. -- BR Fredrik Gustafsson Erlang OTP Team From siri.couchbase@REDACTED Thu Feb 28 17:15:09 2013 From: siri.couchbase@REDACTED (Sriram Melkote) Date: Thu, 28 Feb 2013 21:45:09 +0530 Subject: [erlang-patches] Fix disksup:get_disk_data on OS X Message-ID: Hi, This patch fixes disksup:get_disk_data for SUSv3, specifically OS X Mountain Lion. On OS X Mountain Lion, the default output of df command includes iNode used and iNodes free, which apparent what SUSv3 specifies. This breaks the current parse logic and reports incorrect results. This patch adds support for the new format and ensures older versions of OS X produce this format by adding the -i switch (which is the default in latest version). Adding support for this new format rather than changing df output to older one, as we'll presumably see this on other platforms eventually. https://github.com/melkote/otp/compare/fix-disksup-susv3.patch https://github.com/melkote/otp/compare/fix-disksup-susv3 git fetch git://github.com/melkote/otp.git fix-disksup-susv3 Thanks, Sriram -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Thu Feb 28 17:32:20 2013 From: fredrik@REDACTED (Fredrik) Date: Thu, 28 Feb 2013 17:32:20 +0100 Subject: [erlang-patches] Fix disksup:get_disk_data on OS X In-Reply-To: References: Message-ID: <512F8694.8010900@erlang.org> On 02/28/2013 05:15 PM, Sriram Melkote wrote: > https://github.com/melkote/otp/compare/fix-disksup-susv3.patch > https://github.com/melkote/otp/compare/fix-disksup-susv3 > > git fetch git://github.com/melkote/otp.git > fix-disksup-susv3 Hello, I have included your patch in the 'pu' branch. -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: