File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed
Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format
55---
66###
77
8+ # [ 0.9.56 - 2024-12-09
9+
10+ - Updated zfw.c to redirect system call output to /dev/null for set_tc_filter()
11+
12+ ###
13+
814# [ 0.9.5] - 2024-11-29
915
1016- updated the release workflow to upload zfw-router deb package to jfrog repo
Original file line number Diff line number Diff line change 4141#include <time.h>
4242#include <signal.h>
4343#include <limits.h>
44+ #include <fcntl.h>
4445
4546#ifndef BPF_MAX_ENTRIES
4647#define BPF_MAX_ENTRIES 100 // MAX # PREFIXES
@@ -262,7 +263,7 @@ char *direction_string;
262263char * masq_interface ;
263264char check_alt [IF_NAMESIZE ];
264265
265- const char * argp_program_version = "0.9.5 " ;
266+ const char * argp_program_version = "0.9.6 " ;
266267struct ring_buffer * ring_buffer ;
267268
268269__u32 if_list [MAX_IF_LIST_ENTRIES ];
@@ -727,6 +728,15 @@ void set_tc_filter(char *action)
727728 close_maps (1 );
728729 }
729730 pid_t pid ;
731+ int o_std_out = dup (STDOUT_FILENO );
732+ int o_std_err = dup (STDERR_FILENO );
733+ int fd = open ("/dev/null" , O_WRONLY );
734+ if (fd == -1 ){
735+ return ;
736+ }
737+ dup2 (fd , STDOUT_FILENO );
738+ dup2 (fd , STDERR_FILENO );
739+ close (fd );
730740 if (!strcmp (action , "add" ) && check_filter (if_nametoindex (tc_interface ),direction_string ))
731741 {
732742 if (check_qdisc (tc_interface )){
@@ -782,6 +792,10 @@ void set_tc_filter(char *action)
782792 printf ("execv error: unknown error removing filter" );
783793 }
784794 }
795+ dup2 (o_std_out , STDOUT_FILENO );
796+ dup2 (o_std_err , STDERR_FILENO );
797+ close (o_std_out );
798+ close (o_std_err );
785799}
786800
787801void disable_ebpf ()
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ char check_alt[IF_NAMESIZE];
8787char doc [] = "zfw_monitor -- ebpf firewall monitor tool" ;
8888const char * rb_map_path = "/sys/fs/bpf/tc/globals/rb_map" ;
8989const char * tproxy_map_path = "/sys/fs/bpf/tc/globals/zt_tproxy_map" ;
90- const char * argp_program_version = "0.9.5 " ;
90+ const char * argp_program_version = "0.9.6 " ;
9191union bpf_attr rb_map ;
9292int rb_fd = -1 ;
9393
You can’t perform that action at this time.
0 commit comments