diff --git a/CHANGELOG.md b/CHANGELOG.md index 379c197..ae596cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.7.6] - 2024-06-04 + +### + +- Fixed issues in zfw_tunnel_wrapper where incorrect reference was made to zet ctrl socket where needed to check status of event socket. Removed all + references to unused zet ctrl socket. + # [0.7.5] - 2024-06-04 ### diff --git a/src/zfw.c b/src/zfw.c index c9bc79d..6f0f60d 100644 --- a/src/zfw.c +++ b/src/zfw.c @@ -182,7 +182,7 @@ char *log_file_name; char *object_file; char *direction_string; -const char *argp_program_version = "0.7.5"; +const char *argp_program_version = "0.7.6"; struct ring_buffer *ring_buffer; __u32 if_list[MAX_IF_LIST_ENTRIES]; diff --git a/src/zfw_tunnel_wrapper.c b/src/zfw_tunnel_wrapper.c index 5807d5f..56d4dc9 100644 --- a/src/zfw_tunnel_wrapper.c +++ b/src/zfw_tunnel_wrapper.c @@ -86,7 +86,7 @@ const char *range_map_path = "/sys/fs/bpf/tc/globals/range_map"; const char *if_list_ext_map_path = "/sys/fs/bpf/tc/globals/if_list_extension_map"; const char *count_map_path = "/sys/fs/bpf/tc/globals/tuple_count_map"; const char *wildcard_port_map_path = "/sys/fs/bpf/tc/globals/wildcard_port_map"; -int ctrl_socket, event_socket; +int event_socket; char tunip_string[16]=""; char tunip_mask_string[10]=""; uint32_t tun_resolver_ip = 0; @@ -212,9 +212,6 @@ void close_maps(int code){ if(event_socket != -1){ close(event_socket); } - if(event_socket != -1){ - close(ctrl_socket); - } if(transp_fd != -1){ close(transp_fd); } @@ -1465,44 +1462,24 @@ void get_string(char source[4096], char dest[2048]){ int run(){ signal(SIGINT, INThandler); system("clear"); - setpath("/tmp/", "ziti-edge-tunnel.sock",SOCK_NAME); setpath("/tmp/", "ziti-edge-tunnel-event.sock",EVENT_SOCK_NAME); - struct sockaddr_un ctrl_addr; struct sockaddr_un event_addr; - int new_count = 0; - int old_count =0; - char* command = "{\"Command\":\"ZitiDump\",\"Data\":{\"DumpPath\": \"/tmp/.ziti\"}}"; - int command_len = strlen(command); - byte cmdbytes[command_len]; - string2Byte(command, cmdbytes); - char *val_type_str, *str; - int val_type; int ret; char event_buffer[EVENT_BUFFER_SIZE]; - //open Unix client ctrl socket + //open Unix client event socket event_socket = socket(AF_UNIX, SOCK_STREAM, 0); - if (ctrl_socket == -1) { - perror("socket"); - printf("%s\n", strerror(errno)); - return 1; - } - //open Unix client ctrl socket - ctrl_socket = socket(AF_UNIX, SOCK_STREAM, 0); - if (ctrl_socket == -1) { - perror("socket"); + if (event_socket == -1) { + perror("event_socket"); printf("%s\n", strerror(errno)); return 1; } //zero sockaddr_un for compatibility memset(&event_addr, 0, sizeof(struct sockaddr_un)); - memset(&ctrl_addr, 0, sizeof(struct sockaddr_un)); - ctrl_addr.sun_family = AF_UNIX; event_addr.sun_family = AF_UNIX; - //copy string path of symbolic link to Sun Paths + //copy string path of symbolic link to Sun Path strncpy(event_addr.sun_path, EVENT_SOCK_NAME, sizeof(event_addr.sun_path) - 1); - strncpy(ctrl_addr.sun_path, SOCK_NAME, sizeof(ctrl_addr.sun_path) - 1); //connect to ziti-edge-tunnel unix sockets ret = connect(event_socket, (const struct sockaddr *) &event_addr,sizeof(struct sockaddr_un)); if (ret == -1) { @@ -1510,12 +1487,6 @@ int run(){ printf("%s\n", strerror(errno)); return -1; } - ret = connect (ctrl_socket, (const struct sockaddr *) &ctrl_addr,sizeof(struct sockaddr_un)); - if (ret == -1) { - fprintf(stderr, "The ziti-edge-tunnel sock is down.\n"); - printf("%s\n", strerror(errno)); - return -1; - } while(true) { if(tun_fd == -1){ @@ -1643,9 +1614,6 @@ int main(int argc, char *argv[]) { if(event_socket != -1){ close(event_socket); } - if(event_socket != -1){ - close(ctrl_socket); - } sleep(1); } return 0;