Project

General

Profile

Actions

Bug #1356

closed

Face::setInterestFilter likely to fail if setController has been called

Added by Junxiao Shi about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
03/14/2014
Due date:
% Done:

100%

Estimated time:

Description

Environment: Ubuntu 12.04

ndn-cpp-dev commit c145d492e98ffc7949a80c551bc7188afd074635

NFD commit eee71fd6bca6e49115989a64ac75bfc71b324e5d

Steps to reproduce:

  1. in NFD configuration file, grant fib privilege to default identity
  2. start NFD, and wait about 5 seconds
  3. run program NFD=1 ./a.out

    // g++ set-controller.cpp -lndn-cpp-dev -pthread -lboost_system -lboost_filesystem -lcrypto -lcryptopp -lsqlite3 -lrt
    
    #include <ndn-cpp-dev/face.hpp>
    #include <ndn-cpp-dev/management/nfd-controller.hpp>
    
    using ndn::Name;
    using ndn::Interest;
    using ndn::Face;
    
    void
    onInterest(const Name& name, const Interest& interest)
    {
      std::cout << "interest " << interest.getName() << std::endl;
    }
    
    void
    onRegisterFailed(const Name& prefix, const std::string& reason)
    {
      std::cout << prefix << " fail " << reason << std::endl;
    }
    
    int
    main()
    {
      Face face;
      face.setController(boost::make_shared<ndn::nfd::Controller>(boost::ref(face)));
      face.setInterestFilter("/localhost/set-controller", &onInterest, &onRegisterFailed);
    
      face.processEvents();
    
      return 0;
    }
    
  4. if "/localhost/set-controller fail Unauthorized command" appears, terminate and run the program again

Expected: no error message

Actual: "Unauthorized command" occurs about 4~7 times

Note: if face.setController line is commented out, "Unauthorized command" occurs 2~3 times

Note: if "Unauthorized command" stops appearing, subsequent execution of the program won't have this error message


Related issues 1 (0 open1 closed)

Blocked by NFD - Bug #1365: NFD doesn't build with ndn-cpp-dev aa0e7dadClosedAlex Afanasyev03/18/2014

Actions
Actions #1

Updated by Alex Afanasyev about 10 years ago

I do not confirm this on OSX 10.9. The behavior is as expected, though there is a problem running the example: it doesn't work without "export NFD=1", regardless setController call (this is related to the default Transport creation, which also uses NFD variable to select "correct" unix socket).

Are you running the test code with or without NFD=1 ?

Actions #2

Updated by Junxiao Shi about 10 years ago

  • Description updated (diff)
Actions #3

Updated by Alex Afanasyev about 10 years ago

Do not confirm this on Ubuntu 12.04.

Again, the test code must be run NFD=1 ./a.out Otherwise, commands will be directed to ndnx (which shouldn't be running on your machines...)

Actions #4

Updated by Junxiao Shi about 10 years ago

As shown in step 3, program is executed with NFD=1 ./a.out.

Actions #5

Updated by Junxiao Shi about 10 years ago

  • Tracker changed from Task to Bug

@Yi is experiencing a similar issue:

ltr120@traffic-gen-vm2:~$ NFD=1 nfdc create udp4://10.0.0.1
ERROR: Face creation failed: Unauthorized command

I suspect it has something to do with the concurrent access to the SQLite-based KeyChain.

The other possible cause is CommandInterestGenerator/CommandInterestValidator's improper use of monotonic clock.
Monotonic clock observed by two processes are not guaranteed to have the same epoch.

CommandInterestGenerator/CommandInterestValidator should use wall clock.
This is fixed in I122799e45bdcf200e42d4a9b751b1db43f0957bb with #1152.

Actions #6

Updated by Alex Afanasyev about 10 years ago

  • Status changed from New to Resolved

This should be fixed after #1152 submitted

Actions #7

Updated by Junxiao Shi about 10 years ago

The resolution of this bug cannot be tested until #1365 is fixed.

Actions #8

Updated by Junxiao Shi about 10 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF