Send kea-dev mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.isc.org/mailman/listinfo/kea-dev
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of kea-dev digest..."
Today's Topics:
1. Accidentally found infinite recursion in Kea 1.3 Option...
(Dave Cole)
2. Re: Accidentally found infinite recursion in Kea 1.3
Option... (Francis Dupont)
----------------------------------------------------------------------
Message: 1
Date: Sun, 4 Feb 2018 22:06:53 +0000
From: Dave Cole <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [kea-dev] Accidentally found infinite recursion in Kea 1.3
Option...
Message-ID:
<syxpr01mb1727bd3a58a7ea4adbb42c9ff2...@syxpr01mb1727.ausprd01.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"
While adding more tests for my code I stumbled on a problem in Kea. It is a
small thing in the scheme of things, but it might be of interest.
(keapython) djc@dave:~/work/keapython/keamodule$ gdb python
GNU gdb (Ubuntu 7.12.50.20170314-0ubuntu1.1) 7.12.50.20170314-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/djc/env/keapython/bin/python
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Python 2.7.13 (default, Nov 23 2017, 15:37:09)
[GCC 6.3.0 20170406] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from kea import *
>>> p = Pkt4(DHCPDISCOVER, 0)
>>> o = Option(1)
>>> o.addOption(o)
>>> p.addOption(o)
>>> p.pack()
Program received signal SIGSEGV, Segmentation fault.
isc::dhcp::Option::len (this=0x555555ba3140) at option.cc:176
176 size_t length = getHeaderLen() + data_.size();
(gdb) where
#0 isc::dhcp::Option::len (this=0x555555ba3140) at option.cc:176
#1 0x00007ffff5cc4d42 in isc::dhcp::Option::len (this=0x555555ba3140) at
option.cc:182
#2 0x00007ffff5cc4d42 in isc::dhcp::Option::len (this=0x555555ba3140) at
option.cc:182
#3 0x00007ffff5cc4d42 in isc::dhcp::Option::len (this=0x555555ba3140) at
option.cc:182
#4 0x00007ffff5cc4d42 in isc::dhcp::Option::len (this=0x555555ba3140) at
option.cc:182
#5 0x00007ffff5cc4d42 in isc::dhcp::Option::len (this=0x555555ba3140) at
option.cc:182
#6 0x00007ffff5cc4d42 in isc::dhcp::Option::len (this=0x555555ba3140) at
option.cc:182
#7 0x00007ffff5cc4d42 in isc::dhcp::Option::len (this=0x555555ba3140) at
option.cc:182
And so on...
------------------------------
Message: 2
Date: Mon, 05 Feb 2018 10:34:59 +0000
From: Francis Dupont <[email protected]>
To: Dave Cole <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: [kea-dev] Accidentally found infinite recursion in Kea
1.3 Option...
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
Dave Cole writes:
> While adding more tests for my code I stumbled on a problem in Kea. It is a
> small thing in the scheme of things, but it might be of interest.
=> IMHO the problem is in your code and is not prevented by Kea.
> >>> from kea import *
> >>> p = Pkt4(DHCPDISCOVER, 0)
> >>> o = Option(1)
> >>> o.addOption(o)
> >>> p.addOption(o)
> >>> p.pack()
=> if I understand well you created a loop with an option including
itself as a sub-option.
> Program received signal SIGSEGV, Segmentation fault.
=> even if the method is tail recursive its call consumes some stack
until the stack underflows...
> isc::dhcp::Option::len (this=0x555555ba3140) at option.cc:176
> 176 size_t length = getHeaderLen() + data_.size();
=> for documentation what is the source of the problem is:
// ... and sum of lengths of all suboptions
for (OptionCollection::const_iterator it = options_.begin();
it != options_.end();
++it) {
length += (*it).second->len();
^^^ recursive call
}
Thanks
Francis Dupont <[email protected]>
------------------------------
Subject: Digest Footer
_______________________________________________
kea-dev mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-dev
------------------------------
End of kea-dev Digest, Vol 47, Issue 2
**************************************