Subject: [dtn-users] dtnd segfault

From: [email-masked]
Date: Tue, 11 Dec 2012 11:37:16 +0000

Hi,

For some reason EthConvergenceLayer::init_link() is missing, which
causes segmentation fault when trying to add ethernet link. The
following patch fixes this issue. Tested against the latest mercurial
tree.

diff -r 52e2b403edd4 servlib/conv_layers/EthConvergenceLayer.cc
--- a/servlib/conv_layers/EthConvergenceLayer.cc    Mon Nov 19 11:58:18 2012 +0000
+++ b/servlib/conv_layers/EthConvergenceLayer.cc    Tue Dec 11 11:04:28 2012 +0000
@@ -218,6 +218,30 @@
 }
 
 //----------------------------------------------------------------------
+bool
+EthConvergenceLayer::init_link(const LinkRef& link, int argc, const char* argv[])
+{
+    ASSERT(link != NULL);
+    ASSERT(!link->isdeleted());
+    ASSERT(link->cl_info() == NULL);
+
+    log_debug("adding %s link %s", link->type_str(), link->nexthop());
+
+    Params* params = new Params(defaults_);
+
+    const char* invalid;
+    if(!parse_params(params, argc, argv, &invalid)) {
+        log_err("error parsing link options: invalid option '%s'", invalid);
+        delete params;
+        return false;
+    }
+
+    link->set_cl_info(params);
+
+    return true;
+}
+
+//----------------------------------------------------------------------
 void
 EthConvergenceLayer::delete_link(const LinkRef& link)
 {
diff -r 52e2b403edd4 servlib/conv_layers/EthConvergenceLayer.h
--- a/servlib/conv_layers/EthConvergenceLayer.h Mon Nov 19 11:58:18 2012 +0000
+++ b/servlib/conv_layers/EthConvergenceLayer.h Tue Dec 11 11:04:28 2012 +0000
@@ -131,6 +131,11 @@
     bool close_contact(const ContactRef& contact);
 
     /**
+     * Create any CL-specific components of the Link.
+     */
+    bool init_link(const LinkRef& link, int argc, const char* argv[]);
+
+    /**
      * Delete any CL-specific components of the Link.
      */
     void delete_link(const LinkRef& link);