Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Apr 2011 11:28:07 -0700
From:      YongHyeon PYUN <pyunyh@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   Re: collisions on tun interfaces ...
Message-ID:  <20110429182807.GA21084@michelle.cdnetworks.com>
In-Reply-To: <20110429095231.GA17786@relay.ibs.dn.ua>
References:  <201104290001.p3T01EvQ082443@artema.vpn.ibs> <20110429095231.GA17786@relay.ibs.dn.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Apr 29, 2011 at 12:52:31PM +0300, Zeus V Panchenko wrote:
> Hi,
> 
> may somebody epxplain it for me, what can cause collisions on tun
> interfaces created by ppp(8) and openvpn?
> 
> > uname -a
> FreeBSD 8.2-STABLE #0 i386
> 
> > netstat -i
> Name    Mtu Network       Address              Ipkts Ierrs Idrop    Opkts Oerrs  Coll
> tun0   1492 <Link#7>                        18940349     0     0 15737760     0 45668
> tun0   1492 A.B.C.D A-B-C-D.domain          15623965     -     - 12429351     -     -
> tun1   1500 <Link#8>                        12721670     0     0  9957662     0 11161
> tun1   1500 E.F.G.H E-F-G-H.vpn     	        6454     -     -   445751     -     -
> 
> 
> rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
>      options=3808<VLAN_MTU,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
>      ether 00:30:4f:67:cf:81
>      media: Ethernet autoselect (100baseTX <full-duplex>)
>      status: active
> tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1492
>       options=80000<LINKSTATE>
>       inet A.B.C.D --> A1.B1.C1.D1 netmask 0xffffffff 
>       Opened by PID 3943
> tun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500
>       options=80000<LINKSTATE>
>       inet E.F.G.H --> E1.F1.G1.H1 netmask 0xffffffff 
>       Opened by PID 1387
> 
> tun0 is created by ppp(8)
> 
> in /etc/ppp.conf is:
> default:
>  set log Phase Chat LCP IPCP CCP tun command
>  set server /var/run/ppp/internet "" 0177
>  set device PPPoE:rl0
>  set speed sync
>  enable lqr echo
>  set lqrperiod 30
>  set login
>  set ctsrts off
>  add default HISADDR
>  set timeout 0
>  set redial 0 0
>  set cd 5
> 
> tun1 is created by OpenVPN with configuration:
> client
> dev tun1
> proto udp
> ...
> 
> so, what can cause the collisions and can i fix them?
> 

It seems tun(4) just increments collision counter whenever it
can't enqueue packet. Because it's not collision at all I think
it's a bug that had been there from day 1. Just nuking updating the
counter will address the issue. You still can get the previous
collision counter of tun(4) with d option of netstat which shows
number of packets dropped due to send queue full.

--fUYQa+Pmc3FrFX/N
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="tun.diff"

Index: sys/net/if_tun.c
===================================================================
--- sys/net/if_tun.c	(revision 221175)
+++ sys/net/if_tun.c	(working copy)
@@ -661,10 +661,8 @@
 	}
 
 	error = (ifp->if_transmit)(ifp, m0);
-	if (error) {
-		ifp->if_collisions++;
+	if (error)
 		return (ENOBUFS);
-	}
 	ifp->if_opackets++;
 	return (0);
 }

--fUYQa+Pmc3FrFX/N--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110429182807.GA21084>