Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ioctl() constants for BPF #1448

Merged
merged 2 commits into from
Aug 17, 2019
Merged

Add ioctl() constants for BPF #1448

merged 2 commits into from
Aug 17, 2019

Conversation

equal-l2
Copy link
Contributor

No description provided.

@rust-highfive
Copy link

r? @gnzlbg

(rust_highfive has picked a reviewer for you, use r? to override)

@equal-l2
Copy link
Contributor Author

@bors: try

@bors
Copy link
Contributor

bors commented Aug 10, 2019

@equal-l2: 🔑 Insufficient privileges: not in try users

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 10, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 10, 2019

📌 Commit 1cf0811 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Aug 10, 2019

⌛ Testing commit 1cf0811 with merge ebbb10e...

bors added a commit that referenced this pull request Aug 10, 2019
Add ioctl() constants for BPF
@bors
Copy link
Contributor

bors commented Aug 10, 2019

💔 Test failed - status-azure

@equal-l2
Copy link
Contributor Author

@gnzlbg Will you try again please?

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 12, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 12, 2019

📌 Commit d2bf673 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Aug 12, 2019

⌛ Testing commit d2bf673 with merge 1a9f1e9...

bors added a commit that referenced this pull request Aug 12, 2019
Add ioctl() constants for BPF
@bors
Copy link
Contributor

bors commented Aug 12, 2019

💔 Test failed - status-azure

@gnzlbg gnzlbg closed this Aug 12, 2019
@gnzlbg gnzlbg reopened this Aug 12, 2019
@equal-l2
Copy link
Contributor Author

bad BIOCSETF value at byte 2: rust: 16 (0x10) != c 8 (0x8)
bad BIOCSRTIMEOUT value at byte 2: rust: 16 (0x10) != c 8 (0x8)
bad BIOCGRTIMEOUT value at byte 2: rust: 16 (0x10) != c 8 (0x8)
bad BIOCSETFNR value at byte 2: rust: 16 (0x10) != c 8 (0x8)

I'll fix this soon.

@equal-l2
Copy link
Contributor Author

equal-l2 commented Aug 12, 2019

For future reference:

These constants are defined as below:

#define BIOCSETF        _IOW('B',103, struct bpf_program)
#define BIOCSRTIMEOUT   _IOW('B',109, struct timeval)
#define BIOCGRTIMEOUT   _IOR('B',110, struct timeval)
#define BIOCSETFNR      _IOW('B', 126, struct bpf_program)

struct bpf_program is this:

struct bpf_program {
	u_int bf_len;
	struct bpf_insn *bf_insns;
};

And struct timeval:

_STRUCT_TIMEVAL
{
	__darwin_time_t         tv_sec;         /* seconds */
	__darwin_suseconds_t    tv_usec;        /* and microseconds */
};

(__darwin_time_t is long, __darwin_suseconds_t is __int32_t)

The problem is that size of pointer and long differs between 32-bit and 64-bit.

EDIT: The size of bpf_program is 16 (including 4 bytes padding) on 64-bit and 8 on 32-bit system.
The same is timeval.

@gnzlbg gnzlbg closed this Aug 13, 2019
@gnzlbg gnzlbg reopened this Aug 13, 2019
@gnzlbg gnzlbg closed this Aug 16, 2019
@gnzlbg gnzlbg reopened this Aug 16, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 17, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 17, 2019

📌 Commit cf1a3e1 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Aug 17, 2019

⌛ Testing commit cf1a3e1 with merge ec3f080...

bors added a commit that referenced this pull request Aug 17, 2019
Add ioctl() constants for BPF
@bors
Copy link
Contributor

bors commented Aug 17, 2019

💔 Test failed - status-azure

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 17, 2019

@bors: retry

@bors
Copy link
Contributor

bors commented Aug 17, 2019

⌛ Testing commit cf1a3e1 with merge abd5a3c...

bors added a commit that referenced this pull request Aug 17, 2019
Add ioctl() constants for BPF
@bors
Copy link
Contributor

bors commented Aug 17, 2019

☀️ Test successful - checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, status-azure
Approved by: gnzlbg
Pushing abd5a3c to master...

@bors bors merged commit cf1a3e1 into rust-lang:master Aug 17, 2019
@semarie
Copy link
Contributor

semarie commented Aug 18, 2019

it broke OpenBSD. several of them are not defined on it

bors added a commit that referenced this pull request Aug 18, 2019
several const ioctl() BPF aren't defined on OpenBSD

unbreak OpenBSD after #1448
bors added a commit that referenced this pull request Aug 18, 2019
several const ioctl() BPF aren't defined on OpenBSD

unbreak OpenBSD after #1448
@equal-l2 equal-l2 deleted the bpf-consts branch December 14, 2019 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants