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

Update our fork to the latest libpnet version #1

Open
wants to merge 168 commits into
base: icmpv6-echo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
2fba9de
module path should be pnet::datalink
hsmtkk May 24, 2021
df15cfd
Merge pull request #1 from hsmtkk/fix-module-path
hsmtkk May 24, 2021
1c1b01f
Update import path and remove deprecated api
magbone Sep 4, 2021
294541a
add icmpv6 echo_request and echo_reply
yuyuyureka Oct 19, 2021
ac0a666
Mark pnet_datalink::Channel non-exhaustive; remove workaround
Oct 27, 2021
12824f9
Add NetworkInterface::is_running()
Disasm Nov 30, 2021
1c2e840
Remove a few usages of uninitialized
5225225 Jan 11, 2022
90b0b67
Merge pull request #541 from 5225225/banish-uninitialized
mrmonday Jan 13, 2022
4384f81
Merge pull request #529 from cole-miller/non-exhaustive
mrmonday Jan 13, 2022
f77938c
Fix pnet_macros tests
mrmonday Jan 13, 2022
c5512e0
Merge pull request #527 from nyantec/feature/v6-ping
mrmonday Jan 13, 2022
b1bf0c2
Merge pull request #523 from magbone/master
mrmonday Jan 13, 2022
5b5a31d
Merge pull request #542 from mrmonday/fix-macro-tests
mrmonday Jan 13, 2022
551ae3d
Merge pull request #500 from hsmtkk/master
mrmonday Jan 13, 2022
5258783
Update time dependency to 0.3
mrmonday Jan 13, 2022
9932cd0
Merge pull request #543 from mrmonday/update-time
mrmonday Jan 13, 2022
ddc95d2
Merge pull request #534 from Disasm/add-is_running
mrmonday Jan 13, 2022
22e6b47
Upgrade pnet to Rust 2018
mrmonday Jan 13, 2022
1dfa2df
Upgrade pnet_datalink to Rust 2018
mrmonday Jan 13, 2022
33605c2
Upgrade pnet_base to Rust 2018
mrmonday Jan 13, 2022
ac57522
Upgrade pnet_macros_support to Rust 2018
mrmonday Jan 13, 2022
d666275
Upgrade pnet_packet to Rust 2018
mrmonday Jan 13, 2022
eb791ee
Upgrade pnet_sys to Rust 2018
mrmonday Jan 13, 2022
4a6336b
Upgrade pnet_transport to Rust 2018
mrmonday Jan 13, 2022
e87954b
Upgrade pnet_base to Rust 2021
mrmonday Jan 13, 2022
231db31
Upgrade pnet_sys to Rust 2021
mrmonday Jan 13, 2022
d3e1743
Upgrade pnet_macros_support to Rust 2021
mrmonday Jan 13, 2022
610d1cf
Upgrade pnet_macros to Rust 2021
mrmonday Jan 13, 2022
254987f
Upgrade pnet_datalink to Rust 2021
mrmonday Jan 13, 2022
5d70cc0
Upgrade pnet_transport to Rust 2021
mrmonday Jan 13, 2022
b5c1e56
Upgrade pnet to Rust 2021
mrmonday Jan 13, 2022
8a2194c
Merge pull request #544 from mrmonday/edition-upgrade
mrmonday Jan 13, 2022
bddca52
Added support for querying kernel driver flags
fennewald Jan 11, 2022
4a49d96
Fixups for interface flags
mrmonday Jan 13, 2022
a848bf9
Merge pull request #545 from mrmonday/interface-flags
mrmonday Jan 13, 2022
0abf526
Release v0.29.0
mrmonday Jan 13, 2022
c0d3c78
fix num_bytes calculation
yuyuyureka Apr 4, 2022
b9a1176
add test for operations(6, 6)
yuyuyureka Apr 4, 2022
3daa033
add new run-pass test weird_field_pos
yuyuyureka Apr 8, 2022
c10134b
Merge pull request #547 from nyantec/feature-fix-num-bytes
mrmonday Apr 8, 2022
1dc1227
Fix documentation links
mrmonday Apr 8, 2022
6031469
Fix build lifetime issue on macOS
mrmonday Apr 8, 2022
c888bfa
Ensure warnings cause build failures in CI
mrmonday Apr 8, 2022
5c3d09d
Fix fanout example build warnings on macOS
mrmonday Apr 8, 2022
8f37c4b
Merge pull request #548 from mrmonday/assorted-cleanup
mrmonday Apr 8, 2022
4dc53c8
support Vec with construct_with
kloenk Apr 5, 2022
720953f
working construct_with on vec
yuyuyureka Apr 11, 2022
9651626
Misc fixes
mrmonday Apr 11, 2022
a0b056f
Merge pull request #550 from nyantec/vec_construct
mrmonday Apr 11, 2022
a91a205
Merge pull request #551 from mrmonday/expect-build
mrmonday Apr 11, 2022
f7aa541
Add illumos+solaris support
teutat3s Apr 10, 2022
854efcd
Fix error[E0308]: mismatched types on illumos +
teutat3s Apr 10, 2022
e175359
Fix build lifetime issue on freebsd, netbsd,
teutat3s Apr 10, 2022
48d2834
Update ipnetwork requirement from 0.18.0 to 0.19.0
dependabot[bot] Apr 18, 2022
da0124d
Merge pull request #552 from libpnet/dependabot/cargo/ipnetwork-0.19.0
mrmonday Apr 18, 2022
9ab461b
moved benches from inside pnet_packet/src/ethernet.rs to pnet_packet/…
Apr 19, 2022
7b2ddc9
changed benches to criterion so to stay on stable toolchain
Apr 19, 2022
ce180d3
Fix build on architectures with unsigned char
pkubaj Apr 25, 2022
ce67226
Merge pull request #561 from pkubaj/patch-1
mrmonday Apr 25, 2022
a8cb175
Merge pull request #555 from infosechoudini/benches
mrmonday Apr 25, 2022
44f17c8
Merge pull request #549 from greenbaum/illumos
mrmonday Apr 25, 2022
a1ba846
std feature to enable #[no_std] use
Felix-El Apr 28, 2022
9e06711
Merge pull request #562 from Felix-El/no_std
mrmonday May 12, 2022
0d7f305
Release v0.30.0
mrmonday May 12, 2022
cf1535f
Fix feature deps in top-level Cargo.toml blocking #[no_std] use
Felix-El May 12, 2022
79e7969
bump version for ipnetwork in pnet_datalink
May 13, 2022
7091932
Update libc dependency to 0.2.117
morn-0 May 21, 2022
1423378
Merge pull request #568 from cc-morning/master
mrmonday May 23, 2022
98e3fe1
Merge pull request #566 from Felix-El/no_std
mrmonday Jun 1, 2022
c24329e
Merge pull request #567 from matteyeux/master
mrmonday Jun 1, 2022
a802148
Fix doc test when publishing crates
mrmonday Jun 1, 2022
5e620ce
Upgrade dependencies
mrmonday Jun 1, 2022
49768c4
Merge pull request #570 from mrmonday/dep-upgrade
mrmonday Jun 1, 2022
c9bb42f
Fix build warnings on Windows
mrmonday Jun 1, 2022
05db0f1
Release v0.31.0
mrmonday Jun 1, 2022
ebd0edb
apply dependabot on all subfolders
matteyeux Jul 14, 2022
e93465c
dhcp: initial support
Martichou Aug 31, 2022
db655b4
dhcp: change struct layout to match RFC 2131
Martichou Aug 31, 2022
71bdd35
sort mod alphabetically
Martichou Sep 1, 2022
56baf65
Fix examples/arp_packet.rs
palindrom615 Oct 1, 2022
6ac2ce6
Fix handle_vec_primitive for multi byte primitives
Jan 11, 2023
84d6cb6
Merge pull request #596 from jefftt/fix-vec-primitive
mrmonday Jan 27, 2023
2cb8acd
Add blanket impls of Packet for Box<T> and &T.
landhb Feb 1, 2023
54c3f13
Fix typo on payload method.
landhb Feb 1, 2023
b13dad4
Add missing repr(C) attributes
mrmonday Feb 3, 2023
29d0080
Include std features by default
mrmonday Feb 3, 2023
05e3c62
Release v0.32.0
mrmonday Feb 3, 2023
bfe4048
Merge pull request #578 from matteyeux/master
mrmonday Feb 3, 2023
8a74b3b
Merge pull request #581 from Martichou/dhcp
mrmonday Feb 3, 2023
e8ba14b
Upgrade dependencies
mrmonday Feb 3, 2023
c9d7c1c
Merge pull request #586 from palindrom615/patch-1
mrmonday Feb 3, 2023
9a3a0ba
Merge pull request #599 from landhb/blanket_impls
mrmonday Feb 3, 2023
60cab23
Revert "Add blanket impls of Packet for Box<T> and &T."
mrmonday Feb 3, 2023
4e9993c
Merge pull request #605 from libpnet/revert-599-blanket_impls
mrmonday Feb 3, 2023
0ae7e8e
Fix datalink pcap backend
mrmonday Feb 3, 2023
e3d6c11
Remove pnet dev dependency from pnet_datalink
mrmonday Feb 3, 2023
77305b2
Fix cargo doc warning
mrmonday Feb 3, 2023
b206925
Release v0.33.0
mrmonday Feb 3, 2023
7e18271
Explictly deref to avoid recursion.
landhb Feb 3, 2023
55bb2f3
GitHub actions updates
mrmonday Feb 3, 2023
14ea58a
Merge pull request #606 from landhb/blanket_impls
mrmonday Feb 3, 2023
b82d042
Merge pull request #608 from mrmonday/github-actions-update
mrmonday Feb 3, 2023
3189dc4
Fix typos
darxriggs Feb 5, 2023
f5ab216
Merge pull request #609 from darxriggs/fix-typos
mrmonday Mar 21, 2023
8f447e1
fix: link sll
reticulis May 13, 2023
b776fb0
feature: add LINUX_SLL2
reticulis May 13, 2023
b60ad54
fix: typo
reticulis May 13, 2023
4e30186
fix: add missing field
reticulis May 13, 2023
15bc024
chore: modify to public fields
reticulis May 13, 2023
b58f711
Spell check with `typos`. Add `spell-check` CI job
vvv Jul 2, 2023
6bdcf95
Update `length_expr_parentheses.stderr`
vvv Jul 2, 2023
6f31c07
Fix "irrefutable `while let` pattern" warning
vvv Jul 2, 2023
0e6ddaf
ECN-nonce never gained widespread use and the RFC was moved to Histor…
rikonaka Jul 10, 2023
324c569
update pnet_macros to use syn 2.x
Jul 14, 2023
b46f7f3
Update compile fail test error messages
Jul 14, 2023
431ced2
add more compilation error tests for #[construct_with]
Jul 14, 2023
08622c5
Fix compile test stderr for correct rustc version
Jul 14, 2023
d29848e
Merge pull request #627 from james-jra/syn-2
mrmonday Jul 19, 2023
12636de
Merge pull request #621 from vvv/spell-check
mrmonday Jul 19, 2023
391b133
Merge pull request #619 from reticulis/sll2
mrmonday Jul 19, 2023
c32d9db
Merge pull request #625 from rikonaka/master
mrmonday Jul 19, 2023
47ae47d
Assorted cleanup
mrmonday Jul 19, 2023
b8bd8e0
Merge pull request #630 from mrmonday/fix-build-warnings
mrmonday Jul 19, 2023
9bd20d8
Release v0.34.0
mrmonday Jul 19, 2023
8ed68b5
Update license field following SPDX 2.1 license expression standard
frisoft Jul 20, 2023
87f362d
Merge pull request #633 from frisoft/main
mrmonday Jul 27, 2023
50c2bad
Expose the various values in the TcpOption structure for external pro…
rikonaka Aug 18, 2023
eeaddc6
Update ARP example to also support IPv6 via NDP
tgross35 Aug 26, 2023
12ca962
Definition for ethernet flow control packets.
AJMansfield Sep 21, 2023
73f82dd
Add apple tvos support
lcruz99 Jul 13, 2023
4052801
Adding vxlan to pnet_packet
stevedoyle Oct 18, 2023
6c8d959
Fixing existing typo in pnet_packet Cargo.toml
stevedoyle Oct 18, 2023
386afc4
Ensure BPF read buffer is 4-byte aligned
frankplow Oct 21, 2023
4a20e3d
Fix typo: `offseting` -> `offsetting`
frankplow Oct 21, 2023
6a2269c
Use `align_of` and `next_multiple_of`
frankplow Oct 21, 2023
30f22c3
Add ICMP Destination unreachable Next-hop MTU
fabi321 Nov 20, 2023
f792699
remove the repetitive word
cuishuang Jan 9, 2024
87806e1
..Fix failing tests..
Paul-weqe Mar 2, 2024
eedbeab
Fix spelling error for passing Github Checks
Paul-weqe Mar 2, 2024
48f2109
linux: use poll api instead of select inorder to support fd > 1024
nemosupremo Apr 19, 2024
3447354
transport: Add option to set ECN on the TransportSender socket.
hawkinsw May 6, 2024
04a0724
Merge pull request #685 from hawkinsw/set_ecn
mrmonday May 30, 2024
9b4050e
Merge pull request #676 from Paul-weqe/main
mrmonday May 30, 2024
004d192
Merge pull request #672 from rustaceanclub/main
mrmonday May 30, 2024
a686cda
Merge pull request #652 from NordSecurity/add_appletvos_support
mrmonday May 30, 2024
896559e
Merge pull request #654 from stevedoyle/vxlan
mrmonday May 30, 2024
7d56e28
Merge pull request #662 from fabi321/icmp-next-hop-mtu
mrmonday May 30, 2024
263679d
Merge pull request #642 from tgross35/update-mac-example
mrmonday May 30, 2024
2d32460
Merge pull request #655 from frankplow/fix-bpf-alignment
mrmonday May 30, 2024
667cb46
Merge pull request #640 from rikonaka/master
mrmonday May 30, 2024
053e508
Merge pull request #649 from AJMansfield/ethernet_flow_control
mrmonday May 30, 2024
01eee25
Expose set_ecn on unix only.
mrmonday May 30, 2024
28e9de4
Merge pull request #689 from mrmonday/ecn-unix-only
mrmonday May 30, 2024
bd4c8b0
datalink(linux): add feature to pass the fd (socket) to ::channel()
Martichou Sep 12, 2022
14a01ff
Merge pull request #584 from Martichou/raw_socket
mrmonday May 30, 2024
7086ed2
dns layer in pnet
tomDev5 Mar 30, 2024
a3a46e6
removed BooleanField for u1
tomDev5 Mar 30, 2024
b319ca2
fixed dns code
tomDev5 Mar 30, 2024
07526a7
Merge pull request #678 from tomDev5/dns
mrmonday May 30, 2024
49c8c68
Merge pull request #681 from ionosnetworks/feat/linux-poll-api
mrmonday May 30, 2024
97ece70
Release v0.35.0
mrmonday May 30, 2024
097a995
Merge tag 'v0.29.0' into icmpv6-echo
Dec 2, 2024
8796593
Merge tag 'v0.30.0' into icmpv6-echo
Dec 2, 2024
bae0357
Merge tag 'v0.31.0' into icmpv6-echo
Dec 2, 2024
c9a7ea8
Merge tag 'v0.32.0' into icmpv6-echo
Dec 2, 2024
28fa86e
Merge tag 'v0.33.0' into icmpv6-echo
Dec 2, 2024
4a067e1
Merge tag 'v0.34.0' into icmpv6-echo
Dec 2, 2024
32c478b
Merge tag 'v0.35.0' into icmpv6-echo
Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,28 @@ updates:
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: cargo
directory: "/pnet_base"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: cargo
directory: "/pnet_sys"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: cargo
directory: "/pnet_datalink"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: cargo
directory: "/pnet_transport"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: cargo
directory: "/pnet_packet"
schedule:
interval: weekly
open-pull-requests-limit: 10
24 changes: 15 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@ name: Rust

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

env:
CARGO_TERM_COLOR: always
PNET_FEATURES: travis pcap serde
PNET_MACROS_FEATURES: travis
VERBOSE: 1

jobs:
spell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crate-ci/typos@master

build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand All @@ -33,9 +40,8 @@ jobs:
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand All @@ -51,9 +57,9 @@ jobs:
env:
RUST_TEST_THREADS: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down
51 changes: 41 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,63 @@
[package]
name = "pnet"
version = "0.28.0"
version = "0.35.0"
authors = [ "Robert Clipsham <[email protected]>" ]
license = "MIT/Apache-2.0"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/libpnet/libpnet"
repository = "https://github.com/libpnet/libpnet"
description = "Cross-platform, low level networking using the Rust programming language."
readme = "README.md"
keywords = ["networking", "transport", "datalink", "packet", "protocol"]
categories = ["network-programming", "parser-implementations"]
build = "build.rs"
edition = "2021"

[features]
benchmark = []
netmap = ["pnet_datalink/netmap_sys", "pnet_datalink/netmap"]
pcap = ["pnet_datalink/pcap"]
appveyor = []
travis = []
serde = ["pnet_base/serde", "pnet_datalink/serde"]
serde = ["pnet_base/serde", "pnet_datalink?/serde"]
std = ["pnet_base/std", "pnet_sys", "pnet_datalink", "pnet_transport", "ipnetwork"]
default = ["std"]

[dependencies]
ipnetwork = "0.18.0"
ipnetwork = { version = "0.20.0", optional = true }

pnet_base = { path = "pnet_base", version = "0.28.0" }
pnet_sys = { path = "pnet_sys", version = "0.28.0" }
pnet_datalink = { path = "pnet_datalink", version = "0.28.0" }
pnet_transport = { path = "pnet_transport", version = "0.28.0" }
pnet_packet = { path = "pnet_packet", version = "0.28.0" }
pnet_base = { path = "pnet_base", version = "0.35.0", default-features = false }
pnet_sys = { path = "pnet_sys", version = "0.35.0", optional = true, default-features = false }
pnet_datalink = { path = "pnet_datalink", version = "0.35.0", optional = true, default-features = false }
pnet_transport = { path = "pnet_transport", version = "0.35.0", optional = true, default-features = false }
pnet_packet = { path = "pnet_packet", version = "0.35.0", default-features = false }

[dev-dependencies]
time = "0.2.26"
time = "0.3.23"

[[example]]
name = "ip_to_mac"
required-features = ["std"]

[[example]]
name = "fanout"
required-features = ["std"]

[[example]]
name = "list_interfaces"
required-features = ["std"]

[[example]]
name = "packetdump"
required-features = ["std"]

[[example]]
name = "transport_echo_server"
required-features = ["std"]

[[bench]]
name = "rs_sender"
required-features = ["std"]

[[bench]]
name = "rs_receiver"
required-features = ["std"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ To use `libpnet` in your project, add the following to your Cargo.toml:

```
[dependencies.pnet]
version = "0.28.0"
version = "0.35.0"
```

`libpnet` should work with the latest stable version of Rust.
Expand Down
7 changes: 4 additions & 3 deletions benches/rs_receiver.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2014, 2015 Robert Clipsham <[email protected]>
// Copyright (c) 2014, 2015, 2022 Robert Clipsham <[email protected]>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand All @@ -10,6 +10,7 @@ extern crate pnet_datalink;
extern crate time;

use std::env;
use time::OffsetDateTime;

fn main() {
use pnet_datalink::Channel::Ethernet;
Expand All @@ -33,14 +34,14 @@ fn main() {

let mut i = 0usize;
let mut timestamps = Vec::with_capacity(201);
timestamps.push(time::precise_time_ns() / 1_000);
timestamps.push(OffsetDateTime::now_utc().unix_timestamp());

loop {
match rx.next() {
Ok(_) => {
i += 1;
if i == 1_000_000 {
timestamps.push(time::precise_time_ns() / 1_000);
timestamps.push(OffsetDateTime::now_utc().unix_timestamp());
if timestamps.len() == 201 {
break;
}
Expand Down
6 changes: 3 additions & 3 deletions benches/rs_sender.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2014, 2015 Robert Clipsham <[email protected]>
// Copyright (c) 2014, 2015, 2022 Robert Clipsham <[email protected]>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand Down Expand Up @@ -44,7 +44,7 @@ pub fn build_ipv4_header(packet: &mut [u8]) -> MutableIpv4Packet {
pub fn build_udp_header(packet: &mut [u8]) -> MutableUdpPacket {
let mut udp_header = MutableUdpPacket::new(packet).unwrap();

udp_header.set_source(1234); // Arbitary port number
udp_header.set_source(1234); // Arbitrary port number
udp_header.set_destination(1234);
udp_header.set_length((UDP_HEADER_LEN + TEST_DATA_LEN) as u16);

Expand Down Expand Up @@ -95,7 +95,7 @@ fn main() {
{
let mut mut_ethernet_header = MutableEthernetPacket::new(&mut buffer[..]).unwrap();
mut_ethernet_header.set_destination(destination);
mut_ethernet_header.set_source(interface.mac_address());
mut_ethernet_header.set_source(interface.mac.unwrap());
mut_ethernet_header.set_ethertype(EtherTypes::Ipv4);
build_udp4_packet(mut_ethernet_header.payload_mut(), "rmesg");
}
Expand Down
25 changes: 15 additions & 10 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ MACROS_WITH_SYNTEX=0
if [[ -n "$PNET_FEATURES" ]]; then
PNET_CARGO_FLAGS="--no-default-features --features \"$PNET_FEATURES\""
else
PNET_CARGO_FLAGS=
PNET_CARGO_FLAGS=""
fi

if [[ -n "$PNET_MACROS_FEATURES" ]]; then
PNET_MACROS_CARGO_FLAGS="--no-default-features --features \"$PNET_MACROS_FEATURES\""
else
PNET_MACROS_CARGO_FLAGS=
PNET_MACROS_CARGO_FLAGS=""
fi

# FIXME Need to get interface differently on Windows
Expand All @@ -38,6 +38,8 @@ IPROUTE2=$(which ip)

echo $PNET_MACROS_FEATURES | grep -q with-syntex && MACROS_WITH_SYNTEX=1

PNET_TEST_IFACE=""

if [[ -x "$IFCONFIG" ]]; then
PNET_TEST_IFACE=$($IFCONFIG | egrep 'UP| active' | \
perl -pe '/^[A-z0-9]+:([^\n]|\n\t)*status: active/' | \
Expand All @@ -60,6 +62,8 @@ if [[ -z "$PNET_TEST_IFACE" && "$SYSTEM" = "Linux" ]]; then
done
fi

set -euo pipefail

# FIXME Need to link libraries properly on Windows
build() {
if [[ -x "$CARGO" ]]; then
Expand Down Expand Up @@ -104,17 +108,17 @@ run_test() {
export RUST_TEST_THREADS=1 &&
case "$SYSTEM" in
Linux)
"$SUDO" -E LD_LIBRARY_PATH=$LD_LIBRARY_PATH sh -c "$CARGO build $PNET_CARGO_FLAGS --release && \
$CARGO test $PNET_CARGO_FLAGS && \
$CARGO bench --no-run $PNET_CARGO_FLAGS && \
$CARGO doc $PNET_CARGO_FLAGS"
"$SUDO" -E sh -c "$CARGO build $PNET_CARGO_FLAGS --release && \
$CARGO test $PNET_CARGO_FLAGS && \
$CARGO bench --no-run $PNET_CARGO_FLAGS && \
$CARGO doc $PNET_CARGO_FLAGS"
;;
FreeBSD|Darwin)
export PNET_TEST_IFACE
"$SUDO" -E DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH bash -c "$CARGO build $PNET_CARGO_FLAGS && \
$CARGO test $PNET_CARGO_FLAGS && \
$CARGO bench --no-run $PNET_CARGO_FLAGS && \
$CARGO doc $PNET_CARGO_FLAGS"
"$SUDO" -E bash -c "$CARGO build $PNET_CARGO_FLAGS && \
$CARGO test $PNET_CARGO_FLAGS && \
$CARGO bench --no-run $PNET_CARGO_FLAGS && \
$CARGO doc $PNET_CARGO_FLAGS"
;;
MINGW*|MSYS*)
PNET_TEST_IFACE=$PNET_TEST_IFACE RUST_TEST_THREADS=1 $TESTER
Expand Down Expand Up @@ -153,6 +157,7 @@ travis_script() {
;;
*)
echo "Unsupported travis platform"
exit 1
;;
esac

Expand Down
Loading