<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="FR-CA">Hi everyone,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA"><o:p> </o:p></span></p>
<p class="MsoNormal">We have been using version 65 of Dropbear to maintain an ssh connection to a central server. It usually works fine, but when there is a network failure the Dropbear client waits until there is a tcp timeout before declaring that there was
a keepalive timeout. So in practice even though we set the keepalive timeout as 30 seconds, dbclient doesn’t exit before ~15 minutes which is when the tcp timeout is triggered.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">By digging in dropbear’s code I noticed that when running in client mode, the connection to the server is blocking whereas that connection is non blocking when running in server mode. I thus changed the connection to non blocking in client
mode. To do this I changed <span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#484848">
the call to connect_remote line 75-76 of cli-main.c from<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#484848"><o:p> </o:p></span></p>
<div style="mso-element:para-border-div;border:solid #E2E2E2 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt;background:#FAFAFA;margin-left:19.2pt;margin-right:12.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:#FAFAFA;border:none;padding:0in">
<span style="font-size:9.0pt;font-family:"Courier New";color:#484848">int sock = connect_remote(cli_opts.remotehost, cli_opts.remoteport, 0, &error);<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#484848"><br>
<span style="background:white">to</span><br>
<br>
</span><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><o:p></o:p></span></p>
<div style="mso-element:para-border-div;border:solid #E2E2E2 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt;background:#FAFAFA;margin-left:19.2pt;margin-right:12.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:#FAFAFA;border:none;padding:0in">
<span style="font-size:9.0pt;font-family:"Courier New";color:#484848">int sock = connect_remote(cli_opts.remotehost, cli_opts.remoteport, 1, &error);<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Initial tests are good so far and it addresses our issue, but I wanted to run this through you to get your insights on potential problems with this change. As far as you know, is there any side effect that we should be aware of? Was there
a reason why the connection was blocking in client mode?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks a lot for your inputs!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span lang="FR-CA" style="font-family:"Arial",sans-serif;color:#00749B">David Chapdelaine<o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="FR-CA" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958">D�veloppeur logiciel | Software Developer<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958">T|P</span></b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958">:<b> </b>+1-514-332-4000 p.6595 |
</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif"><a href="mailto:dchapdelaine@genetec.com"><span style="color:#0563C1">dchapdelaine@genetec.com</span></a><span style="color:#575958"><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#575958"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#575958"><img border="0" width="158" height="30" id="Picture_x0020_47" src="cid:image001.png@01D1C091.EF4E1DC0" alt="cid:image001.png@01D0F159.91250450"></span><span lang="FR-CA" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#575958"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#575958"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958">Con�u pour �voluer</span></b><b><u><span style="color:#575958">
</span></u></b><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958">| Built to evolve</span></b><b><u><span style="color:#575958">
</span></u></b><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958">|
</span></b><a href="http://www.genetec.com/dna"><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:blue">www.genetec.com/dna</span></b></a><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958"><o:p></o:p></span></b></p>
<p class="MsoNormal"><a href="http://www.facebook.com/Genetec"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958;text-decoration:none"><img border="0" width="24" height="24" id="Picture_x0020_2" src="cid:image002.png@01D1C091.EF4E1DC0" alt="cid:image003.png@01CBEA2D.0B393EC0"></span></a><a href="http://www.linkedin.com/company/genetec/"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958;text-decoration:none"><img border="0" width="24" height="24" id="Picture_x0020_3" src="cid:image003.png@01D1C091.EF4E1DC0" alt="cid:image004.png@01CBEA2D.0B393EC0"></span></a><span lang="FR-CA" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958"> </span><a href="http://www.twitter.com/_Genetec_"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958;text-decoration:none"><img border="0" width="24" height="24" id="Picture_x0020_4" src="cid:image004.png@01D1C091.EF4E1DC0" alt="cid:image005.png@01CBEA2D.0B393EC0"></span></a><span lang="FR-CA" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958"> </span><a href="http://www.youtube.com/Genetec"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#575958;text-decoration:none"><img border="0" width="24" height="24" id="Picture_x0020_5" src="cid:image005.png@01D1C091.EF4E1DC0" alt="cid:image006.png@01CBEA2D.0B393EC0"></span></a><span lang="FR-CA" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#575958"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>