<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=utf-8">
<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:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
p.MailQuote, li.MailQuote, div.MailQuote
        {mso-style-name:"Mail Quote";
        mso-style-priority:99;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">I chose the code change I made simply because I don’t use pcap. I also don’t like layers for layers sake.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> owner-hecnet@Update.UU.SE [mailto:owner-hecnet@Update.UU.SE]
<b>On Behalf Of </b>David Moylan<br>
<b>Sent:</b> 10 March 2020 21:19<br>
<b>To:</b> hecnet@Update.UU.SE<br>
<b>Subject:</b> RE: [HECnet] Intermittent Connection with PyDECnet?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I’m all for backwards compatibility, however the /dev/net/tun interface has been in linux since the 2.6 days. A quick google shows that people back
 in 2010 have been using it, and browsing on kernel.org for the oldest archived kernel entry of 2.6.11 shows code examples for /dev/net/tun dated 2005.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><a href="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/networking/tuntap.txt?h=linux-2.6.11.y">https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/networking/tuntap.txt?h=linux-2.6.11.y</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I think the starting date for support of /dev/net/tun is earlier than that of the discontinuation of support for /dev/tapx.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Given that the whole goal of pyDECnet is to permit usage of decnet on more modern environments, I think having code that supports back to 2005 is
 a pretty solid move.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Cheers, Wiz!!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma",sans-serif">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma",sans-serif">
<a href="mailto:owner-hecnet@Update.UU.SE">owner-hecnet@Update.UU.SE</a> [<a href="mailto:owner-hecnet@Update.UU.SE">mailto:owner-hecnet@Update.UU.SE</a>]
<b>On Behalf Of </b>Thomas DeBellis<br>
<b>Sent:</b> Wednesday, 11 March 2020 2:08 AM<br>
<b>To:</b> <a href="mailto:hecnet@Update.UU.SE">hecnet@Update.UU.SE</a><br>
<b>Subject:</b> Re: [HECnet] Intermittent Connection with PyDECnet?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p><span lang="EN-US">Since you may be running both on newer and older kernels, does it make sense to test for which tunnel type interface exists and simply use that?<o:p></o:p></span></p>
<p><span lang="EN-US">You don't even need to test versions, but rather try /dev/net/tun and if it works, use that or if it fails, use /dev/tapx.<o:p></o:p></span></p>
<p><span lang="EN-US">I'm a big fan of dynamic configuration, also known in the trade as 'auto magic' or 'automatic nice things'.<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US">
<hr size="2" width="100%" align="center">
</span></div>
<pre><span lang="EN-US">On 3/10/20 9:40 AM, Paul Koning wrote:<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">Thanks, sorry for leaving that dangling.  I'll test that and merge it into my code.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"> paul<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US">
<hr size="2" width="100%" align="center">
</span></div>
<pre><span lang="EN-US">On Mar 10, 2020, at 4:28 AM, Keith Halewood <a href="mailto:Keith.Halewood@pitbulluk.org"><Keith.Halewood@pitbulluk.org></a> wrote:<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">Hi,<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">These are the changes:<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">In  Ethernet.py:<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">   class _TapEth (_Ethernet):<o:p></o:p></span></pre>
<pre><span lang="EN-US">       def open (self):<o:p></o:p></span></pre>
<pre><span lang="EN-US">           fd = os.open('/dev/net/tun', os.O_RDWR | os.O_NONBLOCK)<o:p></o:p></span></pre>
<pre><span lang="EN-US">           ifr = struct.pack('16sH', self.dev.encode('utf-8'), IFF_TAP | IFF_NO_PI)<o:p></o:p></span></pre>
<pre><span lang="EN-US">           ioctl(fd, TUNSETIFF, ifr)<o:p></o:p></span></pre>
<pre><span lang="EN-US">           self.tap = fd<o:p></o:p></span></pre>
<pre><span lang="EN-US">           self.sellist = ( fd, )<o:p></o:p></span></pre>
<pre><span lang="EN-US">           # Turn the interface on -- needed only on Mac OS<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">With the definitions of those constants up near the top:<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">TUNSETIFF = 0x400454ca<o:p></o:p></span></pre>
<pre><span lang="EN-US">TUNSETOWNER = TUNSETIFF + 2<o:p></o:p></span></pre>
<pre><span lang="EN-US">IFF_TUN = 0x0001<o:p></o:p></span></pre>
<pre><span lang="EN-US">IFF_TAP = 0x0002<o:p></o:p></span></pre>
<pre><span lang="EN-US">IFF_NO_PI = 0x1000<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">Keith<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<div class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US">
<hr size="2" width="100%" align="center">
</span></div>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">From: <a href="mailto:owner-hecnet@Update.UU.SE">owner-hecnet@Update.UU.SE</a> [<a href="mailto:owner-hecnet@Update.UU.SE">mailto:owner-hecnet@Update.UU.SE</a>] On Behalf Of David Moylan<o:p></o:p></span></pre>
<pre><span lang="EN-US">Sent: 10 March 2020 07:46<o:p></o:p></span></pre>
<pre><span lang="EN-US">To: <a href="mailto:hecnet@Update.UU.SE">hecnet@Update.UU.SE</a><o:p></o:p></span></pre>
<pre><span lang="EN-US">Subject: RE: [HECnet] Intermittent Connection with PyDECnet?<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">Robert Armstrong said on Tuesday, 10 March 2020 4:17 AM<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US"> FWIW, the "tap:" option in pyDECnet never worked for me.  I use pcap<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US">to<o:p></o:p></span></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span lang="EN-US">access tap devices -<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">    circuit TAP-0 Ethernet pcap:tap0 --single-address --cost=2<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">works for me with Ubuntu 18.04...<o:p></o:p></span></pre>
</blockquote>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">When I first went to play with pyDECnet under Ubuntu 18, I also discovered issues with the tap adapter. Fundamentally the issue comes down to newer kernels (such as in Ubuntu 18) that use a /dev/net/tun interface to communicate instead of /dev/tapx<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I heard on the list that Keith Halewood had modified Paul's code to work with the newer interface standard, so I reached out to him and he provided me with the changes. It's only a few lines of code that need modification.<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">I believe Keith has provided Paul with the changes. I'd love to see them become mainstream in pyDECnet, as at the moment if I pull down a new build, I have to make the modifications by hand again. <o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">With the code changes, tap works a dream for me. <o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">circuit tap-1022 Ethernet tap:tap1022 --random-address<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
<pre><span lang="EN-US">cheers, Wiz!!<o:p></o:p></span></pre>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
</blockquote>
<pre><span lang="EN-US"><o:p> </o:p></span></pre>
</blockquote>
</div>
</div>
</body>
</html>