forked from r-caamano/zfw
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from netfoundry/v0.4.4_release_candidate
Added Makefile anf install.sh to src/ to give support for make based …
- Loading branch information
Showing
7 changed files
with
129 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
SHELL=/bin/bash | ||
IDIR = /usr/include/aarch64-linux-gnu/ | ||
CFLAGS=-I$(IDIR) | ||
CC=clang | ||
uname_m := $(shell uname -m) | ||
all: zfw zfw_tc_ingress.o zfw_tc_ingress.o zfw_xdp_tun_ingress.o zfw_tc_outbound_track.o zfw_tunnwrapper | ||
zfw: zfw.c | ||
ifeq ($(uname_m),aarch64) | ||
$(CC) -D BPF_MAX_ENTRIES=100000 -O1 -lbpf -o zfw zfw.c $(CFLAGS) | ||
else | ||
$(CC) -D BPF_MAX_ENTRIES=100000 -O1 -lbpf -o zfw zfw.c | ||
endif | ||
zfw_tc_ingress.o: zfw_tc_ingress.c | ||
ifeq ($(uname_m),aarch64) | ||
$(CC) -D BPF_MAX_ENTRIES=100000 -g -O2 -Wall -Wextra -target bpf -c zfw_tc_ingress.c -o zfw_tc_ingress.o $(CFLAGS) | ||
else | ||
$(CC) -D BPF_MAX_ENTRIES=100000 -g -O2 -Wall -Wextra -target bpf -c zfw_tc_ingress.c -o zfw_tc_ingress.o | ||
endif | ||
zfw_xdp_tun_ingress.o: zfw_xdp_tun_ingress.c | ||
ifeq ($(uname_m),aarch64) | ||
$(CC) -O2 -g -Wall -target bpf -c zfw_xdp_tun_ingress.c -o zfw_xdp_tun_ingress.o $(CFLAGS) | ||
else | ||
$(CC) -O2 -g -Wall -target bpf -c zfw_xdp_tun_ingress.c -o zfw_xdp_tun_ingress.o | ||
endif | ||
zfw_tc_outbound_track.o: zfw_tc_outbound_track.c | ||
ifeq ($(uname_m),aarch64) | ||
$(CC) -g -O2 -Wall -Wextra -target bpf -c -o zfw_tc_outbound_track.o zfw_tc_outbound_track.c $(CFLAGS) | ||
else | ||
$(CC) -g -O2 -Wall -Wextra -target bpf -c -o zfw_tc_outbound_track.o zfw_tc_outbound_track.c | ||
endif | ||
zfw_tunnwrapper: zfw_tunnel_wrapper.c | ||
$(CC) -o zfw_tunnwrapper zfw_tunnel_wrapper.c -l json-c | ||
clean: | ||
rm -fr zfw zfw_tc_ingress.o zfw_tunnwrapper zfw_tc_ingress.o zfw_xdp_tun_ingress.o zfw_tc_outbound_track.o | ||
install: | ||
./install.sh $(ARGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
if [ $# -lt 1 ]; then | ||
echo "" | ||
echo "Usage:" | ||
echo " $0 <router|tunnel>" | ||
exit | ||
fi | ||
if [ $1 == "router" ] | ||
then | ||
if [ ! -d "/opt/openziti/bin" ] | ||
then | ||
mkdir -p /opt/openziti/bin/user | ||
fi | ||
if [ ! -d "/opt/openziti/etc" ] | ||
then | ||
mkdir -p /opt/openziti/etc | ||
fi | ||
cp -p zfw /opt/openziti/bin | ||
cp -p zfw_tc_ingress.o /opt/openziti/bin | ||
cp -p zfw_tc_outbound_track.o /opt/openziti/bin | ||
cp -p ../files/scripts/start_ebpf_router.py /opt/openziti/bin | ||
cp -p ../files/scripts/revert_ebpf_router.py /opt/openziti/bin | ||
cp -p ../files/scripts/revert_ebpf_router.py /opt/openziti/bin | ||
cp -p ../files/scripts/user_rules.sh.sample /opt/openziti/bin/user | ||
cp -p ../files/json/ebpf_config.json.sample /opt/openziti/etc | ||
chmod 744 /opt/openziti/bin/start_ebpf_router.py | ||
chmod 744 /opt/openziti/bin/revert_ebpf_router.py | ||
chmod 744 /opt/openziti/bin/user/user_rules.sh.sample | ||
chmod 744 /opt/openziti/bin/zfw | ||
if [ ! -L "/usr/sbin/zfw" ] | ||
then | ||
ln -s /opt/openziti/bin/zfw /usr/sbin/zfw | ||
fi | ||
elif [ $1 == "tunnel" ] | ||
then | ||
if [ -d "/opt/openziti/bin" ] && [ -d "/opt/openziti/etc" ] | ||
then | ||
if [ ! -d "/opt/openziti/bin/user" ] | ||
then | ||
mkdir -p /opt/openziti/bin/user | ||
fi | ||
cp -p zfw /opt/openziti/bin | ||
cp -p zfw_tc_ingress.o /opt/openziti/bin | ||
cp -p zfw_tc_outbound_track.o /opt/openziti/bin | ||
cp -p zfw_xdp_tun_ingress.o /opt/openziti/bin | ||
cp -p zfw_tunnwrapper /opt/openziti/bin | ||
cp -p ../files/scripts/start_ebpf_tunnel.py /opt/openziti/bin | ||
cp -p ../files/scripts/set_xdp_redirect.py /opt/openziti/bin | ||
cp -p ../files/scripts/user_rules.sh.sample /opt/openziti/bin/user | ||
cp -p ../files/json/ebpf_config.json.sample /opt/openziti/etc | ||
cp -p ../files/services/ziti-wrapper.service /etc/systemd/system | ||
cp -p ../files/services/ziti-fw-init.service /etc/systemd/system | ||
chmod 744 /opt/openziti/bin/start_ebpf_tunnel.py | ||
chmod 744 /opt/openziti/bin/set_xdp_redirect.py | ||
chmod 744 /opt/openziti/bin/user/user_rules.sh.sample | ||
chmod 744 /opt/openziti/bin/zfw_tunnwrapper | ||
chmod 744 /opt/openziti/bin/zfw | ||
|
||
if [ ! -L "/usr/sbin/zfw" ] | ||
then | ||
ln -s /opt/openziti/bin/zfw /usr/sbin/zfw | ||
fi | ||
else | ||
echo "ziti-edge-tunnel not installed!" | ||
exit 1 | ||
fi | ||
fi | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters