Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2012 18:44:53 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236251 - head/sys/net
Message-ID:  <201205291844.q4TIirOp095944@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Tue May 29 18:44:53 2012
New Revision: 236251
URL: http://svn.freebsd.org/changeset/base/236251

Log:
  Fix 32-bit shim for BIOCSETF to drop all packets buffered on the descriptor
  and reset statistics as it should.
  
  MFC after:	3 days

Modified:
  head/sys/net/bpf.c

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c	Tue May 29 18:11:45 2012	(r236250)
+++ head/sys/net/bpf.c	Tue May 29 18:44:53 2012	(r236251)
@@ -1718,13 +1718,23 @@ bpf_setf(struct bpf_d *d, struct bpf_pro
 	struct bpf_program32 *fp32;
 	struct bpf_program fp_swab;
 
-	if (cmd == BIOCSETWF32 || cmd == BIOCSETF32 || cmd == BIOCSETFNR32) {
+	switch (cmd) {
+	case BIOCSETF32:
+	case BIOCSETWF32:
+	case BIOCSETFNR32:
 		fp32 = (struct bpf_program32 *)fp;
 		fp_swab.bf_len = fp32->bf_len;
 		fp_swab.bf_insns = (struct bpf_insn *)(uintptr_t)fp32->bf_insns;
 		fp = &fp_swab;
-		if (cmd == BIOCSETWF32)
+		switch (cmd) {
+		case BIOCSETF32:
+			cmd = BIOCSETF;
+			break;
+		case BIOCSETWF32:
 			cmd = BIOCSETWF;
+			break;
+		}
+		break;
 	}
 #endif
 	/*



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