Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpcap The only two data link types that support the "i...



details:   https://anonhg.NetBSD.org/src/rev/23e876310619
branches:  trunk
changeset: 472989:23e876310619
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat May 15 17:39:07 1999 +0000

description:
The only two data link types that support the "inbound" and "outbound"
qualifiers are DLT_SLIP and DLT_PPP (i.e. old-style serial encap PPP).
If an attempt to use these qualifiers is used for any other link type,
cause a BPF program compilation error.

diffstat:

 lib/libpcap/gencode.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 61bc465ad7c3 -r 23e876310619 lib/libpcap/gencode.c
--- a/lib/libpcap/gencode.c     Sat May 15 16:42:48 1999 +0000
+++ b/lib/libpcap/gencode.c     Sat May 15 17:39:07 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gencode.c,v 1.11 1999/05/11 06:36:26 thorpej Exp $     */
+/*     $NetBSD: gencode.c,v 1.12 1999/05/15 17:39:07 thorpej Exp $     */
 
 /*
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -26,7 +26,7 @@
 static const char rcsid[] =
     "@(#) Header: gencode.c,v 1.93 97/06/12 14:22:47 leres Exp  (LBL)";
 #else
-__RCSID("$NetBSD: gencode.c,v 1.11 1999/05/11 06:36:26 thorpej Exp $");
+__RCSID("$NetBSD: gencode.c,v 1.12 1999/05/15 17:39:07 thorpej Exp $");
 #endif
 #endif
 
@@ -1962,6 +1962,22 @@
 {
        register struct block *b0;
 
+       /*
+        * Only SLIP and old-style PPP data link types support
+        * inbound/outbound qualifiers.
+        */
+       switch (linktype) {
+       case DLT_SLIP:
+       case DLT_PPP:
+               /* These are okay. */
+               break;
+
+       default:
+               bpf_error("inbound/outbound not supported on linktype 0x%x\n",
+                   linktype);
+               /* NOTREACHED */
+       }
+
        b0 = gen_relation(BPF_JEQ,
                          gen_load(Q_LINK, gen_loadi(0), 1),
                          gen_loadi(0),



Home | Main Index | Thread Index | Old Index