Merge branch 'bmk/megaco/flex_buffer_overrun_while_scanning_prop_parms/OTP-10998/r15' into maint-r15

* bmk/megaco/flex_buffer_overrun_while_scanning_prop_parms/OTP-10998/r15:
  [megaco] Used wrong downgrade tag for (flex) handler
  [megaco] Fixrd appup sub-test suite
  [megaco] Debug printouts in megaco test server
  [megaco] Internal test server not handling failing cases
  [megaco] Fix merge
  [megaco] Misc codec tickets test case fixes
  [megaco] Misc fixes of the (internal) megaco test server
  Changed name of test case functions (from seq12263 to otp10998)
  Assign correct version and updated release notes accordingly.
  Removed comments
  Ensure of incorrect number of terms when scanning property groups
  Uncommented test cases
  Add new messages
  Calculation of term_spec size (initial and next) changed
  Minor test case rework
  Test case cleanup
  Add rule for test beam'es
  Preliminary test case updates
Make ssh_cli.erl handle <CTRL>+C

Dear all,

I've found that ssh_cli.erl does not scan the input received from the
remote for occurrences of <CTRL>+C to signal the user's interrupt
requests to the group_leader of the CLI session. The patch attached to
this e-mail fixes the issue.

Kind regards,

--
Dr. Stefan Zegenhagen

arcutronix GmbH
Garbsener Landstr. 10
30419 Hannover
Germany

Tel:   +49 511 277-2734
Fax:   +49 511 277-2709
Email: stefan.zegenhagen@arcutronix.com
Web:   www.arcutronix.com

*Synchronize the Ethernet*

General Managers: Dipl. Ing. Juergen Schroeder, Dr. Josef Gfrerer -
Legal Form: GmbH, Registered office: Hannover, HRB 202442, Amtsgericht
Hannover; Ust-Id: DE257551767.

Please consider the environment before printing this message.

>From f1d056ed1bf419677098cdc57bc7ce8a327e6b43 Mon Sep 17 00:00:00 2001
From: Stefan Zegenhagen <stefan.zegenhagen@arcutronix.com>
Date: Mon, 6 May 2013 14:29:45 +0200
Subject: [PATCH] [SSH-CLI] properly handle <CTRL>+C as shell interrupt

In ssh_cli.erl, check for the presence of <CTRL>+C in data received from
the remote. If detected, use the established mechanism (send an
'interrupt' exit signal to the group_leader) to signal an interrupt to
the shell.
Make term_to_binary yield (trap).
Make all steps ofterm_to_binary work in chunks and yield

Rewrite and extend of Happi's initial work

Extra_root to process structure to enable GC of state - Changed the
process structure to point to a separate struct, the struct also
contains a destructor function to allow for proper cleanup.

Rewrote encode_size_struct and enc_term to have internal versions with
reduction counters which will result in interrupt for later restart
when the counter reaches zero - removed the EWA_STACK from Happis
version and directly save the ESTACK's and WSTACK's in the above
mentioned struct (or array thereof) that are pointed out from the
process structure. The destructor will take care of the deallocation
in case of process death.

Added ESTACK and WSTACK macros to save and restore stack and to change
allocator, which makes the previously mentioned stack-save work.

Rewrote enc_term to not store pointers on the stack, and use one WSTACK
for commands etc and another ESTACK for Eterms - Slightly different than
Happis version to make halfword code simpler.

Rewrote encode_size_struct2 so that it does not store pointers on the
stack, also switched to ESTACK instead of WSTACK, this also handles
halfword correctly.

Added interfaces for chunkwise compression, that are
used from term_to_binary/2 when the compressed option is given.
Forbid unsized fields in patterns of binary generators

It makes no sense to be able to do `<<...,Rest/binary>> <= ...` in a
comprehension. The related Dialyzer test is removed.
Simplify v3_core's translation of bit string generators

Now that unsized binary segments are forbidden in patterns of bit string
generators, v3_core:append_tail_segment/2 does not need to check for an
existing unsized tail segment and can thus be changed to a simple '++'/2
call.
Bootstrap added
Teach external.c to handle reallocs before compression
Teach erl_gc:offset_rootset about extra_root
Silence a misleading warning with some comprehensions

When compiling comprehensions with generators which are foldable to
'true', a misleading warning is emitted by sys_core_fold because a
clause resulting from the compilation of the comprehension to Core
Erlang is not marked as generated by the compiler.

An example of such a comprehension is [ true || true ].
Bootstrap
handle_info Info type possible typo

Should it be 'timeout' instead of timeout(), as in doc: http://www.erlang.org/doc/man/gen_server.html#Module:handle_info-2?
SNMP/VACM: bugfix for vacmViewTreeFamilyMask

Dear all,

it's almost a year since I sent the patch attached to this e-mail, and I
just found out that I have not yet gotten a response to it.

I would consider this patch important because it fixes an issue with the
interpretation of data that might be critical for SNMPv3 operation. I
confirmed at that time that erlangs interpretation of
vacmViewTreeFamilyMask is indeed not interoperable with other SNMP
stacks.

Kind regards,

> > > the implementation of SNMP-VIEW-BASED-ACM.mib assumes that the input for
> > > vacmViewTreeFamilyMask is an OID consisting of 1's and 0's only to form
> > > the mask. However, the MIB states that the input should be a bitstring.
> > >
> > > The OID representation of the mask is useful in the code as it speeds up
> > > time-critical code paths when checking access permissions for EACH SNMP
> > > access. Reading/writing the view mask objects is less time-critical.
> > >
> > > Therefore, to fix the issue, convert between OID representation and
> > > bitstring when the vacmViewTreeFamilyMask objects are accessed. This is
> > > done by the patch attached to this e-mail.
>
>
> I'm very sorry for the troubles that I am causing but it seems that the
> previous version of the patch did more than it should: the OID-bitstring
> conversion was also applied to other tables in the same MIB on
> get/get-next requests.
>
> The version of the patch that is attached to this e-mail restricts the
> OID-bitstring conversion to vacmViewTreeFamilyMask alone.

--
Dr. Stefan Zegenhagen

arcutronix GmbH
Garbsener Landstr. 10
30419 Hannover
Germany

Tel:   +49 511 277-2734
Fax:   +49 511 277-2709
Email: stefan.zegenhagen@arcutronix.com
Web:   www.arcutronix.com

*Synchronize the Ethernet*

General Managers: Dipl. Ing. Juergen Schroeder, Dr. Josef Gfrerer -
Legal Form: GmbH, Registered office: Hannover, HRB 202442, Amtsgericht
Hannover; Ust-Id: DE257551767.

Please consider the environment before printing this message.

>From aa2acfb8a0b5ae05fc5ba982d78ee5607384a2be Mon Sep 17 00:00:00 2001
From: Stefan Zegenhagen <stefan.zegenhagen@arcutronix.com>
Date: Wed, 1 Aug 2012 09:56:15 +0200
Subject: [PATCH] bugfix for vacmViewTreeFamilyMask

The vacmViewTreeFamilyMask is defined to be a bit string in the MIB, not
an OID. However, the MIB implementation assumed the latter, effectively
rendering all attempts to read/set masks via SNMP unsuccessful.

Since the mask is used in hot paths (e.g. access permission checks for
each SNMP operation, the OID representation of the mask has benefits
(e.g. faster processing). Therefore, convert the bitstring to/from its
OID representation when reading/setting any mask object.
Wrap eunit macros into begin ... end blocks

This makes typos such as missing commas between two assertions
(e.g. ?assert(true) ?assert(true)) syntax errors instead of silently
compiling and failing with a badfun error at runtime.

This won't break any existing code as parenthesed expressions and blocks
have the same precedence and none of these macros can be used as patterns.
term_to_binary: Remove debug code and set production trap levels
Add testcase to stress extra_root
Merge branch 'pan/happi/yield_in_term_to_binary' into maint

* pan/happi/yield_in_term_to_binary:
  Add testcase to stress extra_root
  term_to_binary: Remove debug code and set production trap levels
  Teach erl_gc:offset_rootset about extra_root
  Teach external.c to handle reallocs before compression
  Make all steps ofterm_to_binary work in chunks and yield
  Make term_to_binary yield (trap).

OTP-11163
crypto: Fix bug with takover of EC resource type

enif_open_resource_type() must be called even during repeated loading
of same library. Otherwise the resource type will be deallocated
when the old module instance is purged.
erts: Add the +sfwi system flag

+sfwi Interval
    Set scheduler forced wakeup interval. All run queues will be scanned
    each Interval milliseconds. While there are sleeping schedulers in
    the system, one scheduler will be woken for each non-empty run queue
    found. An Interval of zero disables this feature, which also is the
    default.

    This feature has been introduced as a temporary workaround for lengthy
    executing native code, and native code that do not bump reductions
    properly in OTP. When these bugs have be fixed the +sfwi flag will
    be removed.
Merge branch 'sverk/crypto-upgrade-resource-bug' into maint

* sverk/crypto-upgrade-resource-bug:
  crypto: Fix bug with takover of EC resource type