title: What is the "destination address" for a TAP/TUN device?
body: <p>What is the purpose of the "destination address" for a TAP/TUN device?</p>
  
  <p><a href="https://github.com/montag451/pytun" rel="noreferrer">Pytun</a> lets you easily set parameters of a tap/tun device:</p>
  
  <pre><code>tun = TapTunDevice(name='mytun')
  tun.addr = '10.66.66.1'
  tun.dstaddr = '10.66.66.2'
  tun.netmask = '255.255.255.0'
  tun.up()
  </code></pre>
  
  <p>Doing this will result in a device configured as such:</p>
  
  <pre><code>$ ifconfig mytun
  mytun: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt;  mtu 1500
          inet 10.66.66.1  netmask 255.255.255.0  destination 10.66.66.2
          unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
          RX packets 0  bytes 0 (0.0 B)
          RX errors 0  dropped 0  overruns 0  frame 0
          TX packets 0  bytes 0 (0.0 B)
          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  </code></pre>
  
  <p>I understand that the system now has a virtual interface with IP 10.66.66.1. And it's presumable that in this scenario, the TUN device would be "connected" to a (e.g. VPN gateway) device whose IP address is 10.66.66.2.</p>
  
  <p>But what purpose specifically, does it serve for the kernel to know that this is a "point-to-point" interface, and the IP address of the destination? Does it impact routing in some way that simply configuring the route table would not achieve? </p>
  
  <hr>
  
  <p>Setting the <code>dstaddr</code> property results in a <code>SIOCSIFDSTADDR</code> ioctl.</p>
  
  <p>The <a href="http://man7.org/linux/man-pages/man7/netdevice.7.html" rel="noreferrer"><code>netdevice(7)</code></a> man page simply says:</p>
  
  <blockquote>
  <pre><code>  SIOCGIFDSTADDR, SIOCSIFDSTADDR
            Get or set the destination address of a point-to-point  device
            using  ifr_dstaddr.  For compatibility, only AF_INET addresses
            are accepted or returned.  Setting the destination address  is
            a privileged operation.
  </code></pre>
  </blockquote>