Bryan Guy <[EMAIL PROTECTED]> writes:
> I'm receiving the following errors when I issue the command "vblade 0 0 nfe0
> /storage/blade.1"
>
> ioctl returned -1
> 4294968320 bytes
> BIOSETF 1: Invalid argument
> pid 15099: e0.0, 8388610 sectors O_RDWR
> putpkt aoe id: Bad file descriptor
> read: Bad file descriptor
>
> I am running FreeBSD 7.0-RELEASE
Sam Hopkins <[EMAIL PROTECTED]> writes:
> It appears freebsd doesn't care for the filter vblade is trying to
> install to capture aoe packets. I believe the filter code was touched
> last in vblade 16, so if you're using the latest, try version 15 and
> see if it works.
Hi. I'm afraid this a bug I introduced with the refactoring of the bpf code
into bpf.c so it could be used on both Linux and FreeBSD. The type of
bpf_insn.k is incorrectly declared as long (32-bit on Linux, 64-bit on
FreeBSD) rather than u_int32_t.
The attached patch against stock vblade-18 should fix this regression. I
also correct the type of bpf_program.bf_len, having checked what size type
setsockopt SOL_SOCKET, SO_ATTACH_FILTER and ioctl BIOCSETF are expecting.
Cheers,
Chris.
# HG changeset patch
# User Chris Webb <[EMAIL PROTECTED]>
# Date 1223382205 -3600
# Node ID 33eab92360b9f1b0fb36fda650250219c9b5b6e4
# Parent ec6d8df48aa00f7cb43d6eb0737f7eed53f70199
Fix BPF regression on FreeBSD where sizeof(long) is 8
Signed-off-by: Chris Webb <[EMAIL PROTECTED]>
diff --git a/bpf.c b/bpf.c
--- a/bpf.c
+++ b/bpf.c
@@ -12,11 +12,11 @@
ushort code;
uchar jt;
uchar jf;
- long k;
+ u_int32_t k;
};
struct bpf_program {
- ulong bf_len;
+ uint bf_len;
struct bpf_insn *bf_insns;
};
@@ -95,22 +95,22 @@
/* Load the shelf number into register */
BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 16),
/* Does it match shelf number? No, goto CHECKBROADCAST */
- BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, (ulong) shelf, 0, 2),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, shelf, 0, 2),
/* Load the slot number into register */
BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 18),
/* Does it match shelf number? Yes, goto VALID */
- BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, (ulong) slot, 4, 0),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, slot, 4, 0),
/* CHECKBROADCAST: is (shelf, slot) == (0xffff, 0xff)? */
/* Load the shelf number into register */
BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 16),
/* Is it 0xffff? No, goto INVALID */
- BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, (ulong) 0xffff, 0, 3),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0xffff, 0, 3),
/* Load the slot number into register */
BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 18),
/* Is it 0xff? No, goto INVALID */
- BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, (ulong) 0xff, 0, 1),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0xff, 0, 1),
/* VALID: return -1 (allow the packet to be read) */
- BPF_STMT(BPF_RET+BPF_K, (ulong) -1),
+ BPF_STMT(BPF_RET+BPF_K, -1),
/* INVALID: return 0 (ignore the packet) */
BPF_STMT(BPF_RET+BPF_K, 0),
};
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Aoetools-discuss mailing list
Aoetools-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/aoetools-discuss