To simplicity, I made the following test program about this situation. I found that getaddrinfo() return -2 ( EAI_NONAME ) when I set AF_INET6 as hints.ai_family. This is strange.
#include <stdio.h>
#include <sys/types.h> #include <sys/socket.h> #include <netdb.h>
int main(int argc, char *argv[]) { struct addrinfo hints, *res; memset(&hints, 0, sizeof hints);
hints.ai_family = AF_INET6; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE;
char *address = 0; char *service = "4551";
int ret = getaddrinfo(address, service, &hints, &res);
printf("ret=%d\n", ret);
freeaddrinfo(res);
return 0; }
-----Original Message----- From: ibr-dtn-bounces@ibr.cs.tu-bs.de [mailto:ibr-dtn-bounces@ibr.cs.tu-bs.de] On Behalf Of 고석갑 Sent: Friday, November 02, 2012 12:09 PM To: Johannes Morgenroth Cc: ibr-dtn@ibr.cs.tu-bs.de Subject: Re: [ibr-dtn] terminate called after throwing an instance of 'ibrcommon::socket_exception'
Hello. I'm Softgear Ko.
Thank you for your comment. But It is still error. I did " svn co http://www.ibr.cs.tu-bs.de/svn/ibr-dtn/trunk/ibrdtn ibrdtn-svn " again. And I built them. I got the same error. Please check out.
softgear@softgear-cube02:~/dtn/ibrdtn-svn$ cp daemon/etc/ibrdtnd.conf . softgear@softgear-cube02:~/dtn/ibrdtn-svn$ dtnd -c ibrdtnd.conf -d 1000 Fri Nov 2 12:06:00 2012 INFO: Configuration: ibrdtnd.conf Fri Nov 2 12:06:00 2012 INFO: IBR-DTN daemon 0.8.0 (build 59616) Fri Nov 2 12:06:00 2012 INFO: debug level set to 1000 Fri Nov 2 12:06:00 2012 INFO: use logfile for output: /var/log/ibrdtn/ibrdtn.log Fri Nov 2 12:06:00 2012 INFO: Local node name: dtn://softgear-cube02 Fri Nov 2 12:06:01 2012 INFO: using bundle storage in memory-only mode Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: DOWN -> SAFE_DOWN Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: SAFE_DOWN -> DOWN Fri Nov 2 12:06:01 2012 INFO: DiscoveryAgent: listen to [224.0.0.1]:4551 Fri Nov 2 12:06:01 2012 INFO: StandByManager: IPNDAgent adopted Fri Nov 2 12:06:01 2012 INFO: Using default routing extensions Fri Nov 2 12:06:01 2012 INFO: Forwarding of bundles enabled. Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: DOWN -> SAFE_DOWN Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: SAFE_DOWN -> DOWN Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: DOWN -> SAFE_DOWN Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: SAFE_DOWN -> DOWN Fri Nov 2 12:06:01 2012 INFO: API initialized using tcp socket: lo:4550 Fri Nov 2 12:06:01 2012 DEBUG.20: Initialize component StandByManager Fri Nov 2 12:06:01 2012 DEBUG.20: Initialize component MemoryBundleStorage Fri Nov 2 12:06:01 2012 DEBUG.20: Initialize component IPNDAgent Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: DOWN -> PENDING_UP Fri Nov 2 12:06:01 2012 DEBUG.66: SocketState transition: PENDING_UP -> DOWN terminate called after throwing an instance of 'ibrcommon::socket_exception' what(): failed to getaddrinfo with address: <any>:4551 Aborted softgear@softgear-cube02:~/dtn/ibrdtn-svn$ svn update
Fetching external item into 'ibrcommon' External at revision 59616.
At revision 59616. softgear@softgear-cube02:~/dtn/ibrdtn-svn$ softgear@softgear-cube02:~/dtn/ibrdtn-svn$ svn info Path: . URL: http://www.ibr.cs.tu-bs.de/svn/ibr-dtn/trunk/ibrdtn Repository Root: http://www.ibr.cs.tu-bs.de/svn Repository UUID: 1cffb75b-d306-6187-5d55-5a277715007a Revision: 59616 Node Kind: directory Schedule: normal Last Changed Author: morgenro Last Changed Rev: 59603 Last Changed Date: 2012-11-02 01:56:55 +0900 (Fri, 02 Nov 2012)
softgear@softgear-cube02:~/dtn/ibrdtn-svn$
-----Original Message----- From: Johannes Morgenroth [mailto:morgenroth@ibr.cs.tu-bs.de] Sent: Thursday, November 01, 2012 11:52 PM To: 고석갑 Cc: ibr-dtn@ibr.cs.tu-bs.de Subject: Re: [ibr-dtn] terminate called after throwing an instance of 'ibrcommon::socket_exception'
Hi.
It looks like you grabbed a bad state of the source. Please checkout a fresh version and try again.
Johannes
Am Donnerstag, den 01.11.2012, 14:36 +0000 schrieb 고석갑:
Hello.
I downloaded ibrdtn source code using SVN. I am using Ubuntu-10.04.4 64bit. Because of compile error, I added ‘#include “Configuration.h”’ into BundleCore.cpp. Afterthat, I got successful compile. However, When I run ibrdtn with default configuration (no touched ibrdtnd.conf from SVN), I get 'ibrcommon::socket_exception’ error.
softgear@softgear-cube02:~/dtn/ibrdtn-svn$ dtnd -c ibrdtnd.conf -d 1000 Thu Nov 1 23:07:32 2012 INFO: Configuration: ibrdtnd.conf Thu Nov 1 23:07:32 2012 INFO: IBR-DTN daemon 0.8.0 (build 59560) Thu Nov 1 23:07:32 2012 INFO: debug level set to 1000 Thu Nov 1 23:07:32 2012 INFO: use logfile for output: /var/log/ibrdtn/ibrdtn.log Thu Nov 1 23:07:32 2012 INFO: Local node name: dtn://softgear-cube02 Thu Nov 1 23:07:32 2012 INFO: using bundle storage in memory-only mode Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: DOWN -> SAFE_DOWN Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: SAFE_DOWN -> DOWN Thu Nov 1 23:07:32 2012 INFO: DiscoveryAgent: listen to [224.0.0.1]:4551 Thu Nov 1 23:07:32 2012 INFO: StandByManager: IPNDAgent adopted Thu Nov 1 23:07:32 2012 INFO: Using default routing extensions Thu Nov 1 23:07:32 2012 INFO: Forwarding of bundles enabled. Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: DOWN -> SAFE_DOWN Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: SAFE_DOWN -> DOWN Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: DOWN -> SAFE_DOWN Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: SAFE_DOWN -> DOWN Thu Nov 1 23:07:32 2012 INFO: API initialized using tcp socket: lo:4550 Thu Nov 1 23:07:32 2012 DEBUG.20: Initialize component StandByManager Thu Nov 1 23:07:32 2012 DEBUG.20: Initialize component MemoryBundleStorage Thu Nov 1 23:07:32 2012 DEBUG.20: Initialize component IPNDAgent Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: DOWN -> PENDING_UP Thu Nov 1 23:07:32 2012 DEBUG.66: SocketState transition: PENDING_UP -> DOWN terminate called after throwing an instance of 'ibrcommon::socket_exception' what(): failed to getaddrinfo with address: <any>:4551 Aborted softgear@softgear-cube02:~/dtn/ibrdtn-svn$
So, I tried to debug this as the following. softgear@softgear-cube02:~/dtn/ibrdtn-svn$ gdb daemon/src/.libs/dtnd
Reading symbols from /home/softgear/dtn/ibrdtn-svn/daemon/src/.libs/dtnd...done. (gdb) r -c ibrdtnd.conf -d 1000
terminate called after throwing an instance of 'ibrcommon::socket_exception' what(): failed to getaddrinfo with address: <any>:4551
Program received signal SIGABRT, Aborted. 0x00007ffff69e0a75 in raise () from /lib/libc.so.6 (gdb) bt #0 0x00007ffff69e0a75 in raise () from /lib/libc.so.6 #1 0x00007ffff69e45c0 in abort () from /lib/libc.so.6 #2 0x00007ffff72998c5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6 #3 0x00007ffff7297cf6 in ?? () from /usr/lib/libstdc++.so.6 #4 0x00007ffff7297d23 in std::terminate() () from /usr/lib/libstdc++.so.6 #5 0x00007ffff7297d36 in ?? () from /usr/lib/libstdc++.so.6 #6 0x00007ffff7297373 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.6 #7 0x000000000046e5f2 in dtn::net::IPNDAgent::componentUp (this=<value optimized out>) at IPNDAgent.cpp:255 #8 0x000000000041e766 in __daemon_run (conf=<value optimized out>) at Main.cpp:892 #9 0x00007ffff69cbc4d in __libc_start_main () from /lib/libc.so.6 #10 0x000000000041b749 in _start () (gdb)
So, After I traced the source code, I found that getaddrinfo(address, service, &hints, &res) returned -2 in udpsocket::bind(const vaddress &addr) throw (socket_exception) in ibrcommon/ibrcommon/net/socket.cpp . At that time, address was NULL.
Could you help me?
Thanks in advance.
- Softgear Ko.
-- Johannes Morgenroth Institut fuer Betriebssysteme und Rechnerverbund Tel.: +49-531-391-3249 Muehlenpfordtstrasse 23 Fax.: +49-531-391-5936 TU Braunschweig D-38106 Braunschweig
-- !! This message is brought to you via the `ibr-dtn' mailing list. !! Please do not reply to this message to unsubscribe. To unsubscribe or adjust !! your settings, send a mail message to ibr-dtn-request@ibr.cs.tu-bs.de !! or look at https://www.ibr.cs.tu-bs.de/mailman/listinfo/ibr-dtn.