Git Product home page Git Product logo

rust-pfring-sys's Introduction

rust pfring-sys

Date: 2018/12/04

安装预编译的 PF_RING 内核模块以及用户态的 API:

# Debian
wget http://apt.ntop.org/stretch/all/apt-ntop.deb
dpkg -i apt-ntop.deb
apt install pfring pfring-dkms pfring-drivers-zc-dkms

从源码开始编译 PF_RING 内核模块 以及用户态 API:

# Debian
sudo apt install bison flex

git clone https://github.com/ntop/PF_RING.git

cd  PF_RING/driver
make

cd  PF_RING/kernel
make

cd PF_RING/userland
make libpfring pcap build_examples

构建对 Rust 的绑定:

cargo build

Rust 语言样例:

cargo build --example dump
sudo ./target/debug/dump

C 语言样例:

cc examples/dump.c -Wall -g -lpfring -lpcap -o dump
sudo ./dump

rust-pfring-sys's People

Contributors

luozijun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

stachdude

rust-pfring-sys's Issues

error occur when compile

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.