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

Removed unused variable in zfw.c and refactored start_ebpf_controller.py #83

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format
---
###

# [0.9.3] - 2024-11-12

- Removed unused variables from zfw.c
- refactored start_ebpf_controller.py to enable/modify external ddos protection services
###

# [0.9.2] - 2024-10-01

- adding environmental path option for the ```sudo zfw -H, --init-tc <ifname|all>```. if ZFW_OBJECT_PATH=<PATH> is populated then this command will
Expand Down
4 changes: 3 additions & 1 deletion files/scripts/start_ebpf_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,15 @@ def set_local_rules(ip):
test1 = os.system("sed -i '/ExecStart=/i ExecStartPre\=\-\/opt\/openziti\/bin\/start_ebpf_controller.py --lanIf " + lanIf + "' /etc/systemd/system/zfw-logging.service")
test1 = os.system("sed -i 's/ziti-router/ziti-controller/g' /etc/systemd/system/zfw-logging.service")
test1 = os.system("sed -i 's/_router.py/_controller.py --lanIf " + lanIf + "/g' /etc/systemd/system/fw-init.service")

test1 = os.system("sed -i 's/ddos-monitor enp0s5/ddos-monitor " + lanIf + "/g' /etc/systemd/system/ddos-monitor.service")
if(not test1):
test1 = os.system("systemctl daemon-reload")
if(not test1):
print("Successfully converted zfw-logging.service. Restarting!")
os.system('systemctl enable zfw-logging.service')
os.system('systemctl enable fw-init.service')
os.system('systemctl enable ddos-monitor.service')
os.system('systemctl enable api-session-monitor.service')
os.system('systemctl restart ziti-controller.service')
if(not os.system('systemctl is-active --quiet ziti-controller.service')):
print("ziti-controller.service successfully restarted!")
Expand Down
6 changes: 1 addition & 5 deletions src/zfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ char *direction_string;
char *masq_interface;
char check_alt[IF_NAMESIZE];

const char *argp_program_version = "0.9.2";
const char *argp_program_version = "0.9.3";
struct ring_buffer *ring_buffer;

__u32 if_list[MAX_IF_LIST_ENTRIES];
Expand Down Expand Up @@ -624,7 +624,6 @@ void bind_prefix(struct in_addr *address, unsigned short mask)
void bind6_prefix(struct in6_addr *address, unsigned short mask)
{
char prefix[INET6_ADDRSTRLEN];
struct in6_addr addr_6 = {0};
inet_ntop(AF_INET6, address, prefix, INET6_ADDRSTRLEN);
char cidr_block[44];
sprintf(cidr_block, "%s/%u", prefix, mask);
Expand All @@ -646,7 +645,6 @@ void bind6_prefix(struct in6_addr *address, unsigned short mask)
void unbind6_prefix(struct in6_addr *address, unsigned short mask)
{
char prefix[INET6_ADDRSTRLEN];
struct in6_addr addr_6 = {0};
inet_ntop(AF_INET6, address, prefix, INET6_ADDRSTRLEN);
char cidr_block[44];
sprintf(cidr_block, "%s/%u", prefix, mask);
Expand Down Expand Up @@ -1593,7 +1591,6 @@ void update_bind_saddr_map(struct bind_key *key)
{
open_bind_saddr_map();
}
struct in_addr cidr;
__u32 count = 0;
bind_saddr_map.key = (uint64_t)key;
bind_saddr_map.value = (uint64_t)&count;
Expand Down Expand Up @@ -1643,7 +1640,6 @@ void delete_bind_saddr_map(struct bind_key *key)
{
open_bind_saddr_map();
}
struct in_addr cidr;
__u32 count = 0;
bind_saddr_map.key = (uint64_t)key;
bind_saddr_map.value = (uint64_t)&count;
Expand Down
2 changes: 1 addition & 1 deletion src/zfw_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ char check_alt[IF_NAMESIZE];
char doc[] = "zfw_monitor -- ebpf firewall monitor tool";
const char *rb_map_path = "/sys/fs/bpf/tc/globals/rb_map";
const char *tproxy_map_path = "/sys/fs/bpf/tc/globals/zt_tproxy_map";
const char *argp_program_version = "0.9.2";
const char *argp_program_version = "0.9.3";
union bpf_attr rb_map;
int rb_fd = -1;

Expand Down