Skip to content

Commit b1b4d48

Browse files
authored
Merge pull request #2 from insa-unyte/development
Development
2 parents 6426065 + ee249aa commit b1b4d48

30 files changed

+1303
-64
lines changed

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ dkms.conf
5353

5454
client_sample
5555
client_continuous
56+
client_socket
57+
client_ebpf_user
58+
vmlinux.h
5659
libunyte-https-notif.so
5760
unyte-https-notif.pc
5861
.vscode
@@ -62,3 +65,52 @@ unyte-https-notif.pc
6265

6366
**/*.log
6467
src/vmlinux.h
68+
Makefile.in
69+
build-aux
70+
71+
# http://www.gnu.org/software/autoconf
72+
73+
autom4te.cache
74+
/autoscan.log
75+
/autoscan-*.log
76+
/aclocal.m4
77+
/compile
78+
/config.cache
79+
/config.guess
80+
/config.h.in
81+
/config.log
82+
/config.status
83+
/config.sub
84+
/configure
85+
/configure.scan
86+
/depcomp
87+
/install-sh
88+
/missing
89+
/stamp-h1
90+
91+
# https://www.gnu.org/software/libtool/
92+
93+
/ltmain.sh
94+
95+
# http://www.gnu.org/software/texinfo
96+
97+
/texinfo.tex
98+
99+
# http://www.gnu.org/software/m4/
100+
101+
m4/libtool.m4
102+
m4/ltoptions.m4
103+
m4/ltsugar.m4
104+
m4/ltversion.m4
105+
m4/lt~obsolete.m4
106+
107+
*.lo
108+
Makefile
109+
src/libunyte-https-notif.la
110+
examples/**/.deps
111+
examples/**/.libs
112+
src/.deps
113+
src/.libs
114+
config.h
115+
libtool
116+
**/obj/*.h

CONTRIBUTING

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Contributing
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.
5+
6+
Please note we have a code of conduct, please follow it in all your interactions with the project.
7+
8+
## Pull Request Process
9+
10+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11+
build.
12+
2. Update the README.md with details of changes to the interface, this includes new environment
13+
variables, exposed ports, useful file locations and container parameters.
14+
3. Increase the version numbers in any examples files and the README.md to the new version that this
15+
Pull Request would represent if a bump version is required.
16+
17+
## Code of Conduct
18+
19+
### Our Pledge
20+
21+
In the interest of fostering an open and welcoming environment, we as
22+
contributors and maintainers pledge to making participation in our project and
23+
our community a harassment-free experience for everyone, regardless of age, body
24+
size, disability, ethnicity, gender identity and expression, level of experience,
25+
nationality, personal appearance, race, religion, or sexual identity and
26+
orientation.
27+
28+
### Our Standards
29+
30+
Examples of behavior that contributes to creating a positive environment
31+
include:
32+
33+
* Using welcoming and inclusive language
34+
* Being respectful of differing viewpoints and experiences
35+
* Gracefully accepting constructive criticism
36+
* Focusing on what is best for the community
37+
* Showing empathy towards other community members
38+
39+
Examples of unacceptable behavior by participants include:
40+
41+
* The use of sexualized language or imagery and unwelcome sexual attention or
42+
advances
43+
* Trolling, insulting/derogatory comments, and personal or political attacks
44+
* Public or private harassment
45+
* Publishing others' private information, such as a physical or electronic
46+
address, without explicit permission
47+
* Other conduct which could reasonably be considered inappropriate in a
48+
professional setting
49+
50+
### Our Responsibilities
51+
52+
Project maintainers are responsible for clarifying the standards of acceptable
53+
behavior and are expected to take appropriate and fair corrective action in
54+
response to any instances of unacceptable behavior.
55+
56+
Project maintainers have the right and responsibility to remove, edit, or
57+
reject comments, commits, code, wiki edits, issues, and other contributions
58+
that are not aligned to this Code of Conduct, or to ban temporarily or
59+
permanently any contributor for other behaviors that they deem inappropriate,
60+
threatening, offensive, or harmful.
61+
62+
### Scope
63+
64+
This Code of Conduct applies both within project spaces and in public spaces
65+
when an individual is representing the project or its community. Examples of
66+
representing a project or community include using an official project e-mail
67+
address, posting via an official social media account, or acting as an appointed
68+
representative at an online or offline event. Representation of a project may be
69+
further defined and clarified by project maintainers.
70+
71+
### Enforcement
72+
73+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
74+
reported by contacting the project team at alex.huang-feng@insa-lyon.fr. All
75+
complaints will be reviewed and investigated and will result in a response that
76+
is deemed necessary and appropriate to the circumstances. The project team is
77+
obligated to maintain confidentiality with regard to the reporter of an incident.
78+
Further details of specific enforcement policies may be posted separately.
79+
80+
Project maintainers who do not follow or enforce the Code of Conduct in good
81+
faith may face temporary or permanent repercussions as determined by other
82+
members of the project's leadership.
83+
84+
### Attribution
85+
86+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
87+
available at [http://contributor-covenant.org/version/1/4][version]
88+
89+
[homepage]: http://contributor-covenant.org
90+
[version]: http://contributor-covenant.org/version/1/4/

INSTALL.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Building project
2+
3+
## Dependencies
4+
This project uses autotools to build the library and `libmicrohttpd` for the HTTPS server. **The libmicrohttpd library should be compiled and installed including TLS support.**
5+
6+
On Ubuntu:
7+
```shell
8+
$ sudo apt-get update
9+
$ sudo apt-get install autoconf libtool make automake gcc pkg-config # autotools and gcc
10+
$ sudo apt-get install libgnutls28-dev libgcrypt20 # libgnutls for microhttpd
11+
$ mkdir microhttpd && cd microhttpd # Use a tmp directory
12+
$ wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.73.tar.gz
13+
$ tar -xf libmicrohttpd-0.9.73.tar.gz
14+
$ cd libmicrohttpd-0.9.73
15+
$ ./configure # Check HTTPS support is activated
16+
$ make
17+
$ sudo make install
18+
```
19+
20+
On Centos (tested on `Centos 8`):
21+
```shell
22+
$ sudo yum install gcc autoconf libtool make automake pkgconf # autotools and gcc
23+
$ sudo yum install gnutls-devel
24+
$ mkdir microhttpd && cd microhttpd # Use a tmp directory
25+
$ wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.73.tar.gz
26+
$ tar -xf libmicrohttpd-0.9.73.tar.gz
27+
$ cd libmicrohttpd-0.9.73
28+
$ ./configure # Check HTTPS support is activated at this step
29+
$ make
30+
$ sudo make install
31+
$ sudo cp /usr/local/lib/pkgconfig/libmicrohttpd.pc /usr/lib64/pkgconfig/libmicrohttpd.pc # Centos installs pkgconfig files in /usr/lib64 instead.
32+
```
33+
34+
### Optional Dependencies
35+
#### Using tcmalloc (Optional)
36+
This project can use tcmalloc for memory management allowing better performance.
37+
38+
On Ubuntu:
39+
```shell
40+
$ sudo apt-get install libgoogle-perftools-dev
41+
```
42+
43+
On Centos (tested on `Centos 8`):
44+
```shell
45+
$ sudo yum install gperftools gperftools-devel
46+
```
47+
48+
#### Using eBPF loadbalancer based on IP only
49+
To use eBPF loadbalancing `Python3` is needed for eBPF compilation.
50+
51+
On Ubuntu:
52+
```shell
53+
$ sudo apt install linux-headers-$(uname -r) clang libbpf-dev linux-tools-$(uname -r)
54+
```
55+
56+
On Centos (tested on `Centos 8`):
57+
```shell
58+
$ sudo yum install kernel-headers clang
59+
$ sudo dnf --enablerepo=powertools install libbpf-devel
60+
$ sudo dnf install bpftool
61+
```
62+
63+
## Compiling project
64+
This project uses autotools to compile and install the library.
65+
66+
### Installing
67+
To install the library on a linux machine.
68+
```shell
69+
$ ./bootstrap
70+
$ ./configure # See "./configure --help" for options
71+
$ make
72+
$ make install # Usually needs sudo permissions
73+
$ ./export.sh # Optional: export LD_LIBRARY_PATH with /usr/local/lib in global variable to allow linking process
74+
```
75+
76+
#### Configure options
77+
There are some custom `./configure` options :
78+
- `--with-examples`: compile examples directory. Not compiled by default.
79+
- `--with-ebpf-example`: compile eBPF example. Not compiled by default. Allows to launch multiple instances of the collector on the same port and use IP loadbalancing for the reuseport socket pool instead of IP/port (default by the kernel).
80+
- `--with-pkgconfigdir=[/own_path/pkgconfig]`: overwrite pkgconfig directory to install .pc file [default: ${PREFIX}/lib/pkgconfig].
81+
- `--enable-tcmalloc`: enable compilation with tcmalloc instead of native malloc. tcmalloc should be installed first.
82+
- `--with-linux=[/own_path/linux/src]`: linux source code necesary for eBPF compilation [default: /usr/src/linux]. (On Ubuntu use /usr/src/<linux>-generic version)
83+
84+
### Uninstalling
85+
```shell
86+
$ sudo make uninstall
87+
```
88+
You should remove the export of the lib in your `.bashrc` manually yourself to fully remove the lib.

Makefile.am

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
AM_LDFLAGS = $(EXTRA_LDFLAGS)
2+
3+
SUBDIRS = src
4+
5+
if EXAMPLES
6+
SUBDIRS += examples
7+
endif
8+
9+
ACLOCAL_AMFLAGS = -I m4
10+
11+
# PKGCONFIG_USER comes from configure.ac
12+
pkgconfigdir = $(PKGCONFIG_USER)
13+
pkgconfig_DATA = \
14+
unyte-https-notif.pc \
15+
$(NULL)

README.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,8 @@
11
# C-Collector for HTTPS-notif protocol
22
Library for collecting HTTPS-notif protocol messages defined on the IETF draft [draft-ietf-netconf-https-notif-08](https://datatracker.ietf.org/doc/html/draft-ietf-netconf-https-notif-08).
33

4-
## Dependencies
5-
The library uses `libmicrohttpd` as a HTTPS server. **The library should be compiled and installed including TLS support.**
6-
7-
- [libmicrohttpd](https://www.gnu.org/software/libmicrohttpd/): https library
8-
- `libgnutls28-dev libgcrypt20`: dependencies for libmicrohttpd TLS module (tested on `Ubuntu`)
9-
- `gnutls-devel`: dependencies for libmicrohttpd TLS module (tested on `CentOS 7`)
10-
11-
## Build & install
12-
To build the project and test example clients, just `make` on root folder. Il will compile with gcc all dependencies and the clients.
13-
14-
### Installing
15-
To install the library on a machine, run `make install` with sudo and `export.sh` without sudo. Export script will export the LD_LIBRARY_PATH on user space.
16-
```
17-
$ make
18-
$ sudo make install
19-
$ ./export.sh
20-
```
21-
22-
### Uninstalling
23-
```
24-
$ sudo make uninstall
25-
```
26-
You should remove the export of the lib in your `.bashrc` manually yourself to fully remove the lib.
4+
## Compiling and building the project
5+
See [INSTALL](INSTALL.md)
276

287
## Usage
298
The collector allows to read HTTPS-notif protocol messages from a ip/port specified on the parameters. It allows to get directly the buffer and the metadata of the message in a struct.
@@ -34,7 +13,9 @@ The api is in `unyte_https_collector.h` :
3413
- `int unyte_https_free_msg(unyte_https_msg_met_t * msg)` from `unyte_https_collector.h`: free all struct used on a message received.
3514

3615
Simple example of usage of a client [client_sample.c](examples/client_sample.c):
37-
```
16+
17+
/!\ To run the samples, a TLS private key and certificate should be generated first. See [TLS layer](#TLS-layer).
18+
```c
3819
#include <stdio.h>
3920
#include <stdlib.h>
4021

@@ -104,7 +85,7 @@ int main()
10485

10586
### Message data
10687
To process the message data, all the headers, meta-data and payload are found on the struct unyte_https_msg_met_t defined on unyte_https_utils.h:
107-
```
88+
```c
10889
typedef struct unyte_msg_with_metadata
10990
{
11091
uint16_t src_port; // source port
@@ -123,7 +104,7 @@ typedef struct unyte_msg_with_metadata
123104

124105
### TLS layer
125106
To use/test TLS layer, you should generate the certificate first :
126-
```
107+
```shell
127108
$ openssl genrsa -out private.key 2048
128109
$ openssl req -days 365 -out certificate.pem -new -x509 -key private.key
129110
```

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.1-git

bootstrap

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
# create m4 directory if does not exist
4+
[ -d m4 ] || mkdir m4
5+
6+
AUTORECONF=${AUTORECONF:-autoreconf}
7+
8+
# Check we have all tools installed
9+
check_command() {
10+
command -v "${1}" > /dev/null 2>&1 || {
11+
>&2 echo "./bootstrap: could not find \`$1'. \`$1' is required to run bootstrap."
12+
exit 1
13+
}
14+
}
15+
16+
check_command "$AUTORECONF"
17+
18+
autoreconf --install

0 commit comments

Comments
 (0)