cn-uofbasel / ccn-lite

CCN-lite, a lightweight implementation of the CCNx protocol and its variations
ISC License
74 stars 63 forks source link

Bug in ccnl_interest_new #365

Closed marvsz closed 3 years ago

marvsz commented 4 years ago

Description

In ccnl-interest.c there was a function ccnl_interest_new added which eventually checks, if it pitcount is bigger than the max_pit_entries. By default max_pit_entries is set to -1 which signals unlimite pits. This leads to the interest getting destroyed and NULL is returned which should not happend. If the code block is wrapped in a if(ccnl->max_pit_entries != -1) everything works. Sorry for the formatting, this is maybe the second issue I have created on github.

Steps to reproduce the issue

Try to run the tutorial and after running the ccnl-peek command you get a segmentation fault

Expected results

Not getting a segmentation fault

Actual results

You get a segmentation fault

Versions

Master Branch Operating system: Ubuntu 18.04 Build environment: GCC

mfrey commented 4 years ago

I'll look into it and get back to you

MahdiBaghbani commented 3 years ago

I can verify the error @marvsz !

Scenario is like tutorial, 3 nodes each in different docker container communicating through docker network ip address. node C (client) sends interest to node A with ccn-lite-peek command and the relay on node A immediately crashes.

This might be also the cause of re-sending interest syndrome that has been around for a while.

Here is the debug messages of node A relay for anyone interested:

`[I] 0.0002: This is ccn-lite-relay, starting at Mar 9 19:12:30 2021 [I] 0.0003: ccnl-core: 2015-07-07 [I] 0.0003: compile time: Mar 9 2021 17:57:28 [I] 0.0003: compile options: CCNxDIGEST, DEBUG, DEBUG_MALLOC, ETHERNET, HMAC256, HTTP_STATUS, LOGGING, MGMT, SUITE_CCNB, SUITE_CCNTLV, SUITE_LOCALRPC, SUITE_NDNTLV, UNIXSOCKET, [I] 0.0003: seed: 3856889078 [I] 0.0004: configuring relay [I] 0.0004: configuring relay2 [I] 0.0004: UDP interface (0.0.0.0/9998) configured [I] 0.0004: configuring relay3 [I] 0.0005: could not bind socket for http server [I] 0.0007: UNIX interface (/tmp/mgmt-relay-a.sock) configured [I] 0.0007: starting main event and IO loop [I] 1.0020: local time is Tue Mar 9 19:12:31 2021

[D] 551.3000: ccnl_core_RX ifndx=0, 32 bytes [T] 551.3000: ccnl_get_face_or_create src=200.200.0.13/44787 [V] 551.3000: found suitable interface 0 for 200.200.0.13/44787 [<] 551.3000: ccnl_get_face_or_create() in /var/ccn-lite/src/ccnl-core/src/ccnl-relay.c:122 [D] 551.3000: face 6, peer=200.200.0.13/44787 [T] 551.3000: pkt2suite 5 30 [D] 551.3000: ccnl_ndntlv_forwarder (32 bytes left) [D] 551.3000: ccnl_ndntlv_bytes2pkt len=30 [D] 551.3000: check interest type [I] 551.3000: [T] 551.3000: result: 1, buf: /, avail size: 2048, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2047, buflen: 2048 [T] 551.3000: result: 1, buf: d, avail size: 2046, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2045, buflen: 2048 [T] 551.3000: result: 1, buf: /, avail size: 2044, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2043, buflen: 2048 [T] 551.3000: result: 1, buf: e, avail size: 2042, buflen: 2048 [T] 551.3000: result: 1, buf: s, avail size: 2041, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2040, buflen: 2048 [T] 551.3000: result: 1, buf: /, avail size: 2039, buflen: 2048 [T] 551.3000: result: 1, buf: m, avail size: 2038, buflen: 2048 [T] 551.3000: result: 1, buf: y, avail size: 2037, buflen: 2048 [T] 551.3000: result: 1, buf: c, avail size: 2036, buflen: 2048 [T] 551.3000: result: 1, buf: o, avail size: 2035, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2034, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2033, buflen: 2048 [T] 551.3000: result: 1, buf: e, avail size: 2032, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2031, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2030, buflen: 2048 incoming interest=</ndn/test/mycontent>ndn2013 nonce=227252056 from=200.200.0.13/44787 [T] 551.3000: ccnl_nonce_find_or_append [D] 551.3000: searching in CS [T] 551.3000: [T] 551.3000: result: 1, buf: /, avail size: 2048, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2047, buflen: 2048 [T] 551.3000: result: 1, buf: d, avail size: 2046, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2045, buflen: 2048 [T] 551.3000: result: 1, buf: /, avail size: 2044, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2043, buflen: 2048 [T] 551.3000: result: 1, buf: e, avail size: 2042, buflen: 2048 [T] 551.3000: result: 1, buf: s, avail size: 2041, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2040, buflen: 2048 [T] 551.3000: result: 1, buf: /, avail size: 2039, buflen: 2048 [T] 551.3000: result: 1, buf: m, avail size: 2038, buflen: 2048 [T] 551.3000: result: 1, buf: y, avail size: 2037, buflen: 2048 [T] 551.3000: result: 1, buf: c, avail size: 2036, buflen: 2048 [T] 551.3000: result: 1, buf: o, avail size: 2035, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2034, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2033, buflen: 2048 [T] 551.3000: result: 1, buf: e, avail size: 2032, buflen: 2048 [T] 551.3000: result: 1, buf: n, avail size: 2031, buflen: 2048 [T] 551.3000: result: 1, buf: t, avail size: 2030, buflen: 2048 ccnl_new_interest(prefix=/ndn/test/mycontent, suite=ndn2013) [D] 551.3000: Segmentation fault (core dumped)`