Skip to content

Commit

Permalink
Fixed potential race condition for filter application in case dhcp no…
Browse files Browse the repository at this point in the history
…t available at boot
  • Loading branch information
r-caamano committed Aug 14, 2023
1 parent 0b725b3 commit 153cad3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

---
# [0.4.6] - 2023-08-13

###

- Fixed potential race condition if upstream DHCP server is not functioning when FW inits ebpf.
Changed address family match to ethernet when applying TC Filters/Diag settings.

# [0.4.5] - 2023-08-03

###
Expand Down
10 changes: 7 additions & 3 deletions src/zfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ char *monitor_interface;
char *tc_interface;
char *object_file;
char *direction_string;
const char *argp_program_version = "0.4.5";
const char *argp_program_version = "0.4.6";
struct ring_buffer *ring_buffer;

__u8 if_list[MAX_IF_LIST_ENTRIES];
Expand Down Expand Up @@ -1017,7 +1017,9 @@ void interface_tc()
*/
while (address)
{
if (address->ifa_addr && (address->ifa_addr->sa_family == AF_INET))
if(address->ifa_addr && ((!strncmp(address->ifa_name, "ziti0", 4) && (address->ifa_addr->sa_family == AF_INET))
|| (!strncmp(address->ifa_name, "tun", 3) && (address->ifa_addr->sa_family == AF_INET))
|| (address->ifa_addr->sa_family == AF_PACKET)))
{
idx = if_nametoindex(address->ifa_name);
if(!idx){
Expand Down Expand Up @@ -1117,7 +1119,9 @@ void interface_diag()
*/
while (address)
{
if (address->ifa_addr && (address->ifa_addr->sa_family == AF_INET))
if (address->ifa_addr && ((!strncmp(address->ifa_name, "ziti0", 4) && (address->ifa_addr->sa_family == AF_INET))
|| (!strncmp(address->ifa_name, "tun", 3) && (address->ifa_addr->sa_family == AF_INET))
|| (address->ifa_addr->sa_family == AF_PACKET)))
{
idx = if_nametoindex(address->ifa_name);
if(!idx){
Expand Down

0 comments on commit 153cad3

Please sign in to comment.