Project

General

Profile

Actions

Bug #4174

closed

NAC causes NFD-Android to crash when runs on Android

Added by Haitao Zhang almost 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
jni
Start date:
07/09/2017
Due date:
% Done:

0%

Estimated time:

Description

NAC can serve DKEY correctly on MAC, but not on Android. (for Linux, I have tested) For example, the following code works correctly on MAC: when a consumer sends an Interest for the DKEY, the code can serve it correctly.

            GroupManager gm = new GroupManager(new Name("/prefix"), new Name("type"),
                    new Sqlite3GroupManagerDb("/tmp/gm.db"), 2048, 24 * 365, keyChain);
            RepetitiveInterval interval = new RepetitiveInterval(
                    Schedule.fromIsoString("20170701T000000"),
                    Schedule.fromIsoString("20170730T000000"),
                    0, 24, 1,
                    RepetitiveInterval.RepeatUnit.DAY);
            Schedule schedule = new Schedule();
            schedule.addWhiteInterval(interval);
            String scheduleName = "schedule1";
            gm.addSchedule(scheduleName, schedule);
            gm.addMember(scheduleName, keyChain.getCertificate(keyChain.getDefaultCertificateName()));
            List groupKeys = gm.getGroupKey(Schedule.fromIsoString("20170710T000000"), false);
            for (int i = 1; i < groupKeys.size(); i++) {
                final Data oneKey = (Data) (groupKeys.get(i));
                System.out.println(oneKey.getName());
                face.registerPrefix(oneKey.getName(), new OnInterestCallback() {
                    @Override
                    public void onInterest(Name name, Interest intrst, Face face, long l, InterestFilter i) {
                        try {
                            face.putData(oneKey);
                        } catch (IOException ex) {
                            Logger.getLogger(TestRSA.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    }

                }, new OnRegisterFailed() {
                    @Override
                    public void onRegisterFailed(Name name) {
                        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                    }

                });
                break;
            }

When the same code runs on Android (need to modify the db parameter to be new AndroidSqlite3GroupManagerDb(getApplicationContext().getFilesDir().getAbsolutePath() + "/tmp.db"), it doesn't work correctly: when a consumer sends an Interest for the DKEY, and NFD-Android crashes when it tries to forward the DKEY. Following is the error reported by NFD-Android, it seems that the MetaInfo cannot be decoded correctly by NFD-Android.

07-08 18:02:30.930 137-137/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-08 18:02:30.931 137-137/? I/DEBUG: Build fingerprint: 'google/yakju/maguro:4.3/JWR66Y/776638:user/release-keys'
07-08 18:02:30.931 137-137/? I/DEBUG: Revision: '9'
07-08 18:02:30.931 137-137/? I/DEBUG: ABI: 'arm'
07-08 18:02:30.931 137-137/? I/DEBUG: pid: 18957, tid: 18989, name: vice.NfdService  >>> net.named_data.nfd.service.NfdService <<<
07-08 18:02:30.931 137-137/? I/DEBUG: signal 7 (SIGBUS), code 128 (SI_KERNEL), fault addr 0x0
07-08 18:02:30.970 137-137/? I/DEBUG:     r0 00000007  r1 53eb341c  r2 00000008  r3 4869c142
07-08 18:02:30.970 137-137/? I/DEBUG:     r4 40137de4  r5 53eb341c  r6 53c10664  r7 40137de4
07-08 18:02:30.970 137-137/? I/DEBUG:     r8 485d127c  r9 485d1378  sl 485d13a4  fp 53eb37f0
07-08 18:02:30.970 137-137/? I/DEBUG:     ip 00000001  sp 53eb33e0  lr 53acdc37  pc 53acdb58  cpsr 200f0030
07-08 18:02:30.970 137-137/? I/DEBUG: backtrace:
07-08 18:02:30.971 137-137/? I/DEBUG:     #00 pc 00160b58  /data/app/net.named_data.nfd-1/lib/arm/libndn-cxx.so (unsigned long long ndn::tlv::readNonNegativeInteger<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > >(unsigned int, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >&, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > > const&)+303)
07-08 18:02:30.971 137-137/? I/DEBUG:     #01 pc 00160c33  /data/app/net.named_data.nfd-1/lib/arm/libndn-cxx.so (ndn::encoding::readNonNegativeInteger(ndn::Block const&)+34)
07-08 18:02:30.971 137-137/? I/DEBUG:     #02 pc 0017b171  /data/app/net.named_data.nfd-1/lib/arm/libndn-cxx.so (ndn::MetaInfo::wireDecode(ndn::Block const&)+100)
07-08 18:02:30.971 137-137/? I/DEBUG:     #03 pc 0015fa9b  /data/app/net.named_data.nfd-1/lib/arm/libndn-cxx.so (ndn::Data::wireDecode(ndn::Block const&)+64)
07-08 18:02:30.971 137-137/? I/DEBUG:     #04 pc 0015fba7  /data/app/net.named_data.nfd-1/lib/arm/libndn-cxx.so (ndn::Data::Data(ndn::Block const&)+82)
07-08 18:02:30.971 137-137/? I/DEBUG:     #05 pc 00102299  /data/app/net.named_data.nfd-1/lib/arm/libnfd-daemon.so (nfd::face::GenericLinkService::decodeData(ndn::Block const&, ndn::lp::Packet const&)+72)
07-08 18:02:30.972 137-137/? I/DEBUG:     #06 pc 00102653  /data/app/net.named_data.nfd-1/lib/arm/libnfd-daemon.so (nfd::face::GenericLinkService::decodeNetPacket(ndn::Block const&, ndn::lp::Packet const&)+62)
07-08 18:02:30.972 137-137/? I/DEBUG:     #07 pc 00102a61  /data/app/net.named_data.nfd-1/lib/arm/libnfd-daemon.so (nfd::face::GenericLinkService::doReceivePacket(nfd::face::Transport::Packet&&)+656)
07-08 18:02:30.972 137-137/? I/DEBUG:     #08 pc 0010eb59  /data/app/net.named_data.nfd-1/lib/arm/libnfd-daemon.so (nfd::face::StreamTransport<boost::asio::ip::tcp>::handleReceive(boost::system::error_code const&, unsigned int)+348)
07-08 18:02:30.972 137-137/? I/DEBUG:     #09 pc 0010f107  /data/app/net.named_data.nfd-1/lib/arm/libnfd-daemon.so (boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::_bi::bind_t<void, boost::_mfi::mf2<void, nfd::face::StreamTransport<boost::asio::ip::tcp>, boost::system::error_code const&, unsigned int>, boost::_bi::list3<boost::_bi::value<nfd::face::StreamTransport<boost::asio::ip::tcp>*>, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::ta
07-08 18:02:30.973 137-137/? I/DEBUG:     #10 pc 00010f47  /data/app/net.named_data.nfd-1/lib/arm/libnfd-wrapper.so (boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex>&, boost::asio::detail::task_io_service_thread_info&, boost::system::error_code const&)+198)
07-08 18:02:30.973 137-137/? I/DEBUG:     #11 pc 0001101b  /data/app/net.named_data.nfd-1/lib/arm/libnfd-wrapper.so (boost::asio::detail::task_io_service::run(boost::system::error_code&)+122)
07-08 18:02:30.974 137-137/? I/DEBUG:     #12 pc 0001536b  /data/app/net.named_data.nfd-1/lib/arm/libnfd-wrapper.so
07-08 18:02:30.974 137-137/? I/DEBUG:     #13 pc 0000de60  /data/app/net.named_data.nfd-1/lib/arm/libboost_thread.so
07-08 18:02:30.974 137-137/? I/DEBUG:     #14 pc 000135a3  /system/lib/libc.so (__pthread_start(void*)+30)
07-08 18:02:30.974 137-137/? I/DEBUG:     #15 pc 000114cf  /system/lib/libc.so (__start_thread+6)
Actions

Also available in: Atom PDF