Skip to content

Commit

Permalink
fix: rename Cargo.toml -> Cargo.toml.hidden to fix cargo behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjoDeundiak committed Dec 3, 2024
1 parent 21e4dc2 commit 9ec0ea2
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ vendor
# nix build
/result*
.home
/ockam_ebpf_impl/Cargo.toml
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,63 @@
# ockam-ebpf
# ockam_ebpf

[![crate][crate-image]][crate-link]
[![docs][docs-image]][docs-link]
[![license][license-image]][license-link]
[![discuss][discuss-image]][discuss-link]

Ockam is a library for building devices that communicate securely, privately
and trustfully with cloud services and other devices.

This crate contains the eBPF part of Ockam Reliable TCP Portals.

### Build

This crate exposes eBPF binary through the `EBPF_BINARY` static constant in the root of the crate. That binary can be
used to attach Ockam eBPF to network devices.

### Features

By default, this crate ships a prebuilt eBPF binary downloaded from the corresponding GitHub release artifacts. This
allows to build Ockam without all the dependencies that are required to build eBPF.

* build - build the eBPF locally instead of downloading the prebuilt binary. This might be useful during development and debugging.
* logging - this will enable logs for eBPF. Note that eBPF sends logs to the user space using `AsyncPerfEventArray`, therefore it implies performance penalty.

```bash
cargo build
```

### Requirements to build eBPF

Please refer to [ockam_ebpf_impl/README.md](ockam_ebpf_impl/README.md)

### Requirements to use eBPF

Using ockam with eBPFs requires:
- Linux
- root (CAP_BPF, CAP_NET_RAW, CAP_NET_ADMIN, CAP_SYS_ADMIN)

## Usage

Add this to your `Cargo.toml`:

```
[dependencies]
ockam_ebpf = "0.5.0"
```

## License

This code is licensed under the terms of the [Apache License 2.0][license-link].

[crate-image]: https://img.shields.io/crates/v/ockam_ebpf.svg
[crate-link]: https://crates.io/crates/ockam_ebpf

[docs-image]: https://docs.rs/ockam_ebpf/badge.svg
[docs-link]: https://docs.rs/ockam_ebpf

[license-image]: https://img.shields.io/badge/License-Apache%202.0-green.svg
[license-link]: https://github.com/build-trust/ockam/blob/HEAD/LICENSE

[discuss-image]: https://img.shields.io/badge/Discuss-Github%20Discussions-ff70b4.svg
[discuss-link]: https://github.com/build-trust/ockam/discussions
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ edition = "2021"
homepage = "https://github.com/build-trust/ockam"
keywords = ["ockam", "crypto", "p2p", "cryptography", "encryption"]
license = "Apache-2.0"
publish = true
publish = false
readme = "README.md"
repository = "https://github.com/build-trust/ockam/implementations/rust/ockam/ockam_ebpf"
repository = "https://github.com/build-trust/ockam-ebpf/ockam_ebpf_impl"
rust-version = "1.70.0"
description = """
eBPF program used by Ockam Privileged Portals
Expand Down
65 changes: 13 additions & 52 deletions ockam_ebpf_impl/README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,25 @@
# ockam_ebpf
# ockam_ebpf_impl

[![crate][crate-image]][crate-link]
[![docs][docs-image]][docs-link]
[![license][license-image]][license-link]
[![discuss][discuss-image]][discuss-link]

Ockam is a library for building devices that communicate securely, privately
and trustfully with cloud services and other devices.

This crate contains the eBPF part of Ockam Reliable TCP Portals.
This crate is shipped as a part of `ockam_ebpf` crate rather than a stand-alone crate. Please refer to the ../README.md
for more information.

### Build

In order to build the crate it's required to copy `Cargo.toml.hidden` file and rename it to `Cargo.toml`. Note, that
`Cargo.toml` file is added to `.gitignore` and shouldn't be commited, instead all changes should be inside
`Cargo.toml.hidden` file. The reason for that is special cargo behaviour that doesn't allow including other crates as
part of a crate. Therefore, if `ockam_ebpf_impl` subdirectory has `Cargo.toml` file, that directory will be completely
ignored during `ockam_ebpf` crate release even if it's added to `include` field of root `Cargo.toml`.

```bash
cargo build-ebpf
cargo build
```
### Requirements

Building eBPFs have roughly following requirements:
- Linux
- Rust nightly
- Some dependencies to be installed

Because of that crate with the eBPF code is kept out of the workspace.
Example of a virtual machine to build it can be found in `ubuntu_x86.yaml`.

Using ockam with eBPFs requires:
- Linux
- root (CAP_BPF, CAP_NET_RAW, CAP_NET_ADMIN, CAP_SYS_ADMIN)

Example of a virtual machine to run ockam with eBPF can be found in `ubuntu_arm.yaml`.

eBPF is a small architecture-independent object file that is small enough,
to include it in the repo.

The built eBPF object should be copied to `/implementations/rust/ockam/ockam_ebpf/ockam_ebpf`,
from where it will be grabbed by `ockam_transport_tcp` crate.

## Usage

Add this to your `Cargo.toml`:

```
[dependencies]
ockam_ebpf = "0.1.0"
```

## License

This code is licensed under the terms of the [Apache License 2.0][license-link].

[main-ockam-crate-link]: https://crates.io/crates/ockam

[crate-image]: https://img.shields.io/crates/v/ockam_ebpf.svg
[crate-link]: https://crates.io/crates/ockam_ebpf

[docs-image]: https://docs.rs/ockam_ebpf/badge.svg
[docs-link]: https://docs.rs/ockam_ebpf

[license-image]: https://img.shields.io/badge/License-Apache%202.0-green.svg
[license-link]: https://github.com/build-trust/ockam/blob/HEAD/LICENSE

[discuss-image]: https://img.shields.io/badge/Discuss-Github%20Discussions-ff70b4.svg
[discuss-link]: https://github.com/build-trust/ockam/discussions
Because of that, crate with the eBPF code is kept out of the workspace.
Example of a virtual machine to build and run eBPF can be found in [ubuntu_arm.yaml](../vm/ubuntu_arm.yaml)

0 comments on commit 9ec0ea2

Please sign in to comment.