Re: [dtn-users] A problem with dtntunnel

"ssireskin@gmail.com" <ssireskin@gmail.com> Mon, 17 December 2012 12:39 UTC

Return-Path: <ssireskin@gmail.com>
X-Original-To: dtn-users@ietfa.amsl.com
Delivered-To: dtn-users@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 88DE721F8A61 for <dtn-users@ietfa.amsl.com>; Mon, 17 Dec 2012 04:39:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.033
X-Spam-Level:
X-Spam-Status: No, score=-3.033 tagged_above=-999 required=5 tests=[AWL=-0.035, BAYES_00=-2.599, HTML_MESSAGE=0.001, J_CHICKENPOX_92=0.6, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VQ8Q7xXBsUOR for <dtn-users@ietfa.amsl.com>; Mon, 17 Dec 2012 04:39:56 -0800 (PST)
Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by ietfa.amsl.com (Postfix) with ESMTP id A006521F89E2 for <dtn-users@irtf.org>; Mon, 17 Dec 2012 04:39:56 -0800 (PST)
Received: by mail-vc0-f182.google.com with SMTP id fy27so4850393vcb.13 for <dtn-users@irtf.org>; Mon, 17 Dec 2012 04:39:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=P2A7LO1xPYVc3yWbJPcB04NNxLCtp8LzPuzzsep9YQ4=; b=rnjJ0DhXnTMPMXgASH+Jgpo2QuOsfuvrzgOmxWbhSuu1f4S+vfVt+fjWvDOfdYUjk1 /QEzn9BkFGo1KER7E2Stlp/7HPNX6xy0q+CalY9po7FlJnYPqHJ2Wo9zBKIZeqHVPV0E UheQo6YF1Yn22LgnWPwdZnLVjDir1Hc7ZwCB8j/ZbWt+2Sw8YZHiULXN3W3VUdrPChjS JiGqaUpYU2ROLMaRpx4aTg7VDunJV6a7plUKlgRIX4Zz9pn/vaz6mB73JucFx3crdbGn z8lzj14B6n8AnOkt8WEEyb6NKpbKorZvvbxqF9iHR3DQID4PoW7LhOptKFFC1Qpo7Kt7 m1Ww==
MIME-Version: 1.0
Received: by 10.52.18.147 with SMTP id w19mr19951634vdd.94.1355747995908; Mon, 17 Dec 2012 04:39:55 -0800 (PST)
Received: by 10.58.219.65 with HTTP; Mon, 17 Dec 2012 04:39:54 -0800 (PST)
In-Reply-To: <CA+X1Codj6FoKWPDj+giFK-6oa-pbCZ8LF2x9cZyW1OzBJNTAYw@mail.gmail.com>
References: <CA+X1Codj6FoKWPDj+giFK-6oa-pbCZ8LF2x9cZyW1OzBJNTAYw@mail.gmail.com>
Date: Mon, 17 Dec 2012 15:39:54 +0300
Message-ID: <CAJR8z99v9XUDZyCzy6uhg7zYHrig8B4E6SPW+i-FfSU2LJT6zA@mail.gmail.com>
From: "ssireskin@gmail.com" <ssireskin@gmail.com>
To: David Zoller <zollerd@gmail.com>
Content-Type: multipart/alternative; boundary="bcaec50406eab37a9504d10bad70"
Cc: dtn-users@irtf.org
Subject: Re: [dtn-users] A problem with dtntunnel
X-BeenThere: dtn-users@irtf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "The Delay-Tolerant Networking Research Group \(DTNRG\) - Users." <dtn-users.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/dtn-users>, <mailto:dtn-users-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/dtn-users>
List-Post: <mailto:dtn-users@irtf.org>
List-Help: <mailto:dtn-users-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/dtn-users>, <mailto:dtn-users-request@irtf.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Dec 2012 12:39:57 -0000

Hi David,

Thanks for your patch, it works! :) Connection is cleanly terminated now.

However, there still seems to be a problem. I run dtntunnel over a link
with high latency and about 30% packet loss. The receiving nc sometimes
gets FIN packet before it receives all the data. If I understand it right,
on a lossy link bundles may come out of order. In this case the EOF bundle
may come too early. I think that the reordering procedure in dtntunnel
should be reviewed. Just for information, pure TCP performs better that DTN
over this link.

2012/12/14 David Zoller <zollerd@gmail.com>

> Hi Sergey,
> I can't stay away from a problem that is nagging at me so I made some time
> this morning. Going back to the original TCPTunnel.cc code, when a bundle
> is received that has the EOF indication, an empty bundle with the same EOF
> flag set needs to be returned to close the loop (the second FIN). There may
> still be some loose ends or clean up needed but try the code below at the
> end of the while loop.
>
> I did not do a packet capture but I saw that if the receiving nc is not
> running when you start the sender nc then the receiving dtntunnel logs an
> error on the failed connect and returns an EOF bundle which closes the
> sender nc. The EOF bundle could possibly be enhanced to include an error
> message.
>
> I agree that some applications could benefit from a "pretend to be a
> receiver" option with the default working as a bidirectional end-to-end TCP
> connection.
>
> Thanks for dragging me along kicking and screaming on this lesson in DTN
> and TCP tunneling. I've only been using dtntunnel as a one way UDP
> transmitter. I see a good fit for the TCP tunnel in an upcoming project and
> I'll try to make the pitch to use it. This is a pretty cool little app.
> Best regards,
> DZ
>
>
>
>
>
> 484             delete b_recv;
> 485
> 486             if (recv_hdr->eof_) {
> 487                 log_info("bundle had eof bit set... closing
> connection");
> 488
> 489                 if ( !sock_eof ) {
> 490                     sock_eof = true;
> 491                     // send an empty bundle back since we did not
> initiate the close
> 492                     dtn::APIBundle* b = new dtn::APIBundle();
> 493                     hdr.eof_ = 1;
> 494                     hdr.seqno_ = ntohl(send_seqno++);
> 495                     memcpy(b->payload_.buf(sizeof(hdr)), &hdr,
> sizeof(hdr));
> 496                     b->payload_.set_len(sizeof(hdr));
> 497                     int err;
> 498                     if ((err = tunnel->send_bundle(b, &dest_eid_)) !=
> DTN_SUCCESS) {
> 499                         log_err("error sending final socket closed
> packet bundle: %s",
> 500                                 dtn_strerror(err));
> 501                         tcptun_->kill_connection(this);
> 502                         exit(1);
> 503                     }
> 504                     delete b;
> 505                 }
> 506                 sock_.close();
> 507                 goto done;
> 508             }
> 509         }
> 510     }
> 511
> 512  done:
>
>


-- 
Best regards,
Sergey Sireskin