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

error occur when compile #1

Open
hcyGo opened this issue Mar 18, 2019 · 1 comment
Open

error occur when compile #1

hcyGo opened this issue Mar 18, 2019 · 1 comment

Comments

@hcyGo
Copy link

hcyGo commented Mar 18, 2019

rust-pfring-sys$ cargo +nightly build
Compiling pfring-sys v0.0.1 (/home/ababaabb/works/rust-pfring-sys)
error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:114:1
|
114 | / pub struct kcompact_ipv6_hdr {
115 | | pub bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>,
116 | | pub payload_len: uint16_t,
117 | | pub nexthdr: uint8_t,
... |
120 | | pub daddr: in6_addr,
121 | | }
| |
^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:214:1
|
214 | / pub struct tunnel_info {
215 | | pub tunnel_id: uint32_t,
216 | | pub tunneled_ip_version: uint8_t,
217 | | pub tunneled_proto: uint8_t,
... |
221 | | pub tunneled_l4_dst_port: uint16_t,
222 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:251:1
|
251 | / pub struct pkt_parsing_info {
252 | | pub dmac: [uint8_t; 6usize],
253 | | pub smac: [uint8_t; 6usize],
254 | | pub eth_type: uint16_t,
... |
269 | | pub offset: pkt_offset,
270 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:300:1
|
300 | / pub struct pfring_extended_pkthdr {
301 | | pub timestamp_ns: uint64_t,
302 | | pub flags: uint32_t,
303 | | pub rx_direction: uint8_t,
... |
307 | | pub parsed_pkt: pkt_parsing_info,
308 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:317:1
|
317 | / pub struct pfring_pkthdr {
318 | | pub ts: timeval,
319 | | pub caplen: uint32_t,
320 | | pub len: uint32_t,
321 | | pub extended_hdr: pfring_extended_pkthdr,
322 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:335:1
|
335 | / pub struct filtering_rule_core_fields {
336 | | pub if_index: i32,
337 | | pub smac: [uint8_t; 6usize],
338 | | pub dmac: [uint8_t; 6usize],
... |
350 | | pub tcp: filtering_rule_core_fields__bindgen_ty_1,
351 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:359:1
|
359 | / pub struct filtering_rule_extended_fields {
360 | | pub optional_fields: uint16_t,
361 | | pub tunnel: filtering_rule_extended_fields__bindgen_ty_1,
362 | | pub payload_pattern: [libc::c_char; 32usize],
363 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:402:1
|
402 | / pub struct filtering_rule {
403 | | pub rule_id: uint16_t,
404 | | pub rule_action: rule_action_behaviour,
405 | | pub balance_id: uint8_t,
... |
412 | | pub internals: filtering_internals,
413 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:441:1
|
441 | / pub struct silicom_redirector_hw_rule {
442 | | pub rule_type: silicom_redirector_rule_type,
443 | | pub rule_port: uint8_t,
444 | | pub rule_target_port: uint8_t,
... |
455 | | pub dst_port_high: uint16_t,
456 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:462:1
|
462 | / pub struct accolade_hw_rule {
463 | | pub action: accolade_rule_action_type,
464 | | pub port_mask: uint32_t,
465 | | pub ip_version: uint8_t,
... |
477 | | pub l4_port_not: uint8_t,
478 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:491:1
|
491 | / pub struct generic_flow_tuple_hw_rule {
492 | | pub action: generic_flow_rule_action_type,
493 | | pub src_ip: ip_addr,
494 | | pub dst_ip: ip_addr,
... |
499 | | pub interface: uint8_t,
500 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:511:1
|
511 | / pub struct hw_filtering_rule {
512 | | pub rule_family_type: hw_filtering_rule_type,
513 | | pub rule_id: uint16_t,
514 | | pub rule_family: hw_filtering_rule__bindgen_ty_1,
515 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:538:1
|
538 | / pub struct generic_flow_update {
539 | | pub flow_id: uint32_t,
540 | | pub ip_version: uint8_t,
541 | | pub l4_protocol: uint8_t,
... |
555 | | pub rev_ts_last: pfring_timespec,
556 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:595:1
|
595 | / pub struct hash_filtering_rule {
596 | | pub rule_id: uint16_t,
597 | | pub vlan_id: uint16_t,
598 | | pub ip_version: uint8_t,
... |
606 | | pub internals: filtering_internals,
607 | | }
| |_^

error[E0588]: packed type cannot transitively contain a [repr(align)] type
--> src/linux/pf_ring.rs:618:1
|
618 | / pub struct sw_filtering_hash_bucket {
619 | | pub rule: hash_filtering_rule,
620 | | pub match
: uint64_t,
621 | | pub filtered: uint64_t,
622 | | pub match_forward: uint64_t,
623 | | pub next: *mut sw_filtering_hash_bucket,
624 | | }
| |
^

error: aborting due to 15 previous errors

For more information about this error, try rustc --explain E0588.
error: Could not compile pfring-sys.

To learn more, run the command again with --verbose

@LuoZijun
Copy link
Owner

@hcyGo

这个问题相关的讨论看起来在这里: rust-lang/rust-bindgen#537

C 代码: https://github.com/LuoZijun/rust-pfring-sys/blob/master/include/linux/pf_ring.h#L732-L739

Rust 转译代码: https://github.com/LuoZijun/rust-pfring-sys/blob/master/src/linux/pf_ring.rs#L616-L624

我不是很熟悉 C, 所以我目前不太清楚这个需要怎么翻译。

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

No branches or pull requests

2 participants