<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>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?</p>
    <p>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.<br>
    </p>
    <p>I'm a big fan of dynamic configuration, also known in the trade
      as 'auto magic' or 'automatic nice things'.<br>
    </p>
    <blockquote type="cite"
      cite="mid:9D02987C-A297-4484-9A83-2DDB69756814@comcast.net">
      <hr width="100%" size="2">
      <pre class="moz-quote-pre" wrap="">On 3/10/20 9:40 AM, Paul Koning wrote:

Thanks, sorry for leaving that dangling.  I'll test that and merge it into my code.

        paul

</pre>
      <blockquote type="cite">
        <hr width="100%" size="2">
        <pre class="moz-quote-pre" wrap="">On Mar 10, 2020, at 4:28 AM, Keith Halewood <a class="moz-txt-link-rfc2396E" href="mailto:Keith.Halewood@pitbulluk.org"><Keith.Halewood@pitbulluk.org></a> wrote:

Hi,

These are the changes:

In  Ethernet.py:

   class _TapEth (_Ethernet):
       def open (self):
           fd = os.open('/dev/net/tun', os.O_RDWR | os.O_NONBLOCK)
           ifr = struct.pack('16sH', self.dev.encode('utf-8'), IFF_TAP | IFF_NO_PI)
           ioctl(fd, TUNSETIFF, ifr)
           self.tap = fd
           self.sellist = ( fd, )
           # Turn the interface on -- needed only on Mac OS

With the definitions of those constants up near the top:

TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2
IFF_TUN = 0x0001
IFF_TAP = 0x0002
IFF_NO_PI = 0x1000




Keith

</pre>
        <hr width="100%" size="2">
        <pre class="moz-quote-pre" wrap="">
From: <a class="moz-txt-link-abbreviated" href="mailto:owner-hecnet@Update.UU.SE">owner-hecnet@Update.UU.SE</a> [<a class="moz-txt-link-freetext" href="mailto:owner-hecnet@Update.UU.SE">mailto:owner-hecnet@Update.UU.SE</a>] On Behalf Of David Moylan
Sent: 10 March 2020 07:46
To: <a class="moz-txt-link-abbreviated" href="mailto:hecnet@Update.UU.SE">hecnet@Update.UU.SE</a>
Subject: RE: [HECnet] Intermittent Connection with PyDECnet?

Robert Armstrong said on Tuesday, 10 March 2020 4:17 AM
</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">
 FWIW, the "tap:" option in pyDECnet never worked for me.  I use pcap
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">to
</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">access tap devices -

        circuit TAP-0 Ethernet pcap:tap0 --single-address --cost=2

works for me with Ubuntu 18.04...
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">
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

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.

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. 

With the code changes, tap works a dream for me. 

circuit tap-1022 Ethernet tap:tap1022 --random-address

cheers, Wiz!!

</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
    </blockquote>
  </body>
</html>