From owner-freebsd-bugs Thu Jan 8 14:31:56 1998 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA09570 for bugs-outgoing; Thu, 8 Jan 1998 14:31:56 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA09531; Thu, 8 Jan 1998 14:31:46 -0800 (PST) (envelope-from gnats) Resent-Date: Thu, 8 Jan 1998 14:31:46 -0800 (PST) Resent-Message-Id: <199801082231.OAA09531@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, amagai@nue.org Received: from celis.nue.org ([192.5.216.128]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA04050 for ; Mon, 5 Jan 1998 21:50:59 -0800 (PST) (envelope-from amagai@nue.org) Received: by celis.nue.org (8.8.8/nue.mxn1) with TCP; Tue, 6 Jan 1998 14:50:37 +0900 (JST) Message-Id: <199801060550.OAA03574@celis.nue.org> Date: Tue, 6 Jan 1998 14:50:37 +0900 (JST) From: amagai@nue.org Reply-To: amagai@nue.org To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: docs/5443: Man page bpf(4), buggy example program Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 5443 >Category: docs >Synopsis: Man page bpf(4), buggy example program >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 8 14:31:32 PST 1998 >Last-Modified: >Originator: AMAGAI Yoshiji >Organization: New Unified Environment Project >Release: FreeBSD 2.2.5-RELEASE i386 >Environment: Pentium II 300MHz, ASUS P2L97-S, 128MByte MM >Description: Example program in man page bpf(4) contain problems. this statement load two bytes of data, BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 26), and compare it to four bytes constant. BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 2), This filter accepts only IP packets between host 128.3.112.15 and 128.3.112.35. struct bpf_insn insns[] = { BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 8), BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 26), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 2), BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 30), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 3, 4), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 0, 3), BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 30), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 1), BPF_STMT(BPF_RET+BPF_K, (u_int)-1), BPF_STMT(BPF_RET+BPF_K, 0), }; >How-To-Repeat: >Fix: This filter accepts only IP packets between host 128.3.112.15 and 128.3.112.35. struct bpf_insn insns[] = { BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 8), BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 26), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 2), BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 30), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 3, 4), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 0, 3), BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 30), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 1), BPF_STMT(BPF_RET+BPF_K, (u_int)-1), BPF_STMT(BPF_RET+BPF_K, 0), }; >Audit-Trail: >Unformatted: