Subject: bin/2623: pppd active filter doesn't grok VJ compression; idle time can be used instead
To: None <gnats-bugs@NetBSD.ORG>
From: John Kohl <jtk@kolvir.arlington.ma.us>
List: netbsd-bugs
Date: 07/13/1996 13:13:43
>Number:         2623
>Category:       bin
>Synopsis:       pppd active filter doesn't grok VJ compression; idle time can be used instead
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 13 19:05:06 1996
>Last-Modified:
>Originator:     John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release:        1.2_ALPHA
>Environment:
	
System: NetBSD pattern 1.2_ALPHA NetBSD 1.2_ALPHA (PATTERN) #86: Thu Jun 20 23:43:36 EDT 1996 jtk@pattern:/u4/sandbox/src/sys/arch/i386/compile/PATTERN i386


>Description:
	The pppd active filter stuff for demand-dialing PPP links does
not work right with VJ compression in use.
The kernel applies the active filter via bpf_filter() before the TCP
segment is compressed with VJ compression, but pppd does not get the
packet until after compression on an idle link (when it's looping the
packets to a pseudo-terminal), so its active filter may not always work
properly.

This can be seen if you examine the PPP_PROTOCOL() of the frames
received in demand.c:loop_frame().  Segment transmissions come up first
as PPP_VJC_COMP and then as PPP_VJC_UNCOMP protocols, and the bpf_filter
doesn't grok them.

>How-To-Repeat:
set up an active filter of the sort:
active-filter 'udp port kerberos or udp port kerberos4 or (tcp and not tcp port smtp)'

and note that sending new bytes over established TCP connections does
NOT bring up the line, even after a retransmit.

>Fix:
The kernel maintains a transmit idle time which can be used to determine
whether the active filter as applied in the kernel has been triggered
since the last idle timeout period.

If so, then regardless of whether the packet at hand is deeemed an
activating packet, the link should be reactivated.

Index: sys-bsd.c
===================================================================
RCS file: /u4/cvsroot/src/usr.sbin/pppd/sys-bsd.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -c -r1.1.1.2 -r1.2
*** sys-bsd.c	1996/03/30 19:53:28	1.1.1.2
--- sys-bsd.c	1996/07/13 17:04:59	1.2
***************
*** 643,648 ****
--- 643,649 ----
  {
      int rv = 0;
      int n;
+     struct ppp_idle idle;
  
      while ((n = read(loop_master, inbuf, sizeof(inbuf))) >= 0) {
  	if (loop_chars(inbuf, n))
***************
*** 656,662 ****
  	syslog(LOG_ERR, "read from loopback: %m");
  	die(1);
      }
! 
      return rv;
  }
  
--- 657,672 ----
  	syslog(LOG_ERR, "read from loopback: %m");
  	die(1);
      }
!     if (get_idle_time(0, &idle)) {
! 	/* somebody sent a packet which poked the active filter. */
! 	/* VJ compression may result in get_loop_output() never
! 	   matching the idle filter since it's applied here in user space
! 	   after the kernel has compressed the packet.
! 	   The kernel applies the active filter before the VJ compression. */
! 	if (idle.xmit_idle < idle_time_limit)
! 	    rv = 1;
! 	SYSDEBUG((LOG_DEBUG, "xmit idle %d", idle.xmit_idle));
!     }
      return rv;
  }
  

>Audit-Trail:
>Unformatted: