Skip to content

Commit

Permalink
Merge pull request #50 from netfoundry/v0.7.7-release-candidate
Browse files Browse the repository at this point in the history
Fixed fw-init.service, code cleanup in zfw_tunnel_wrapper.c
  • Loading branch information
r-caamano authored Jun 11, 2024
2 parents cd1af31 + 501f6ce commit c821ffd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
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.7] - 2024-06-11

###

- Fixed fw-init.service changed after= to After=
- Cleanup in zfw_tunnel_wrapper.c removed various unused variables
-
# [0.7.6] - 2024-06-04

###
Expand Down
2 changes: 1 addition & 1 deletion files/services/fw-init.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Ziti-FW-Init
Requires=network.target
after=network.target
After=network.target

[Service]
User=root
Expand Down
2 changes: 1 addition & 1 deletion src/zfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ char *log_file_name;
char *object_file;
char *direction_string;

const char *argp_program_version = "0.7.6";
const char *argp_program_version = "0.7.7";
struct ring_buffer *ring_buffer;

__u32 if_list[MAX_IF_LIST_ENTRIES];
Expand Down
11 changes: 3 additions & 8 deletions src/zfw_tunnel_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ int process_routes(char *service_id){
transp_map.map_fd = transp_fd;
transp_map.flags = BPF_ANY;
int lookup = syscall(__NR_bpf, BPF_MAP_LOOKUP_ELEM, &transp_map, sizeof(transp_map));
bool changed = false;
if (!lookup)
{
for(int x = 0; x <= o_routes.count; x++){
Expand Down Expand Up @@ -1042,8 +1041,6 @@ int process_bind(json_object *jobj, char *action)
struct json_object *addresses_obj = json_object_object_get(jobj, "Addresses");
if(addresses_obj && !strcmp(action,"-I"))
{
int addresses_obj_len = json_object_array_length(addresses_obj);
// enum json_type type;
struct json_object *allowedSourceAddresses = json_object_object_get(jobj, "AllowedSourceAddresses");
if (allowedSourceAddresses)
{
Expand All @@ -1058,7 +1055,6 @@ int process_bind(json_object *jobj, char *action)
struct json_object *host_obj = json_object_object_get(address_obj, "IsHost");
if(host_obj){
bool is_host = json_object_get_boolean(host_obj);
char ip[16];
char mask[10];
if(is_host)
{
Expand All @@ -1073,7 +1069,7 @@ int process_bind(json_object *jobj, char *action)
if(prefix_obj){
char ip[strlen(json_object_get_string(ip_obj) + 1)];
sprintf(ip,"%s", json_object_get_string(ip_obj));
int smask = sprintf(mask, "%d", json_object_get_int(prefix_obj));
sprintf(mask, "%d", json_object_get_int(prefix_obj));
printf("Service_IP=%s\n", ip);
struct in_addr tuncidr;
if (inet_aton(ip, &tuncidr)){
Expand All @@ -1088,7 +1084,6 @@ int process_bind(json_object *jobj, char *action)
transp_map.map_fd = transp_fd;
transp_map.flags = BPF_ANY;
int lookup = syscall(__NR_bpf, BPF_MAP_LOOKUP_ELEM, &transp_map, sizeof(transp_map));
bool changed = false;
if (lookup)
{
o_routes.tentry[j].saddr = tuncidr;
Expand Down Expand Up @@ -1380,7 +1375,7 @@ int process_dial(json_object *jobj, char *action){
struct json_object *prefix_obj = json_object_object_get(address_obj, "Prefix");
char ip[strlen(json_object_get_string(ip_obj) + 1)];
sprintf(ip,"%s", json_object_get_string(ip_obj));
int smask = sprintf(mask, "%d", json_object_get_int(prefix_obj));
sprintf(mask, "%d", json_object_get_int(prefix_obj));
printf("Service_IP=%s\n", ip);
printf("Protocol=%s\n", protocol);
printf("Low=%s\n", lowport);
Expand Down Expand Up @@ -1597,7 +1592,7 @@ int run(){
return 0;
}

int main(int argc, char *argv[]) {
int main() {
signal(SIGINT, INThandler);
signal(SIGTERM, INThandler);
//system("clear");
Expand Down

0 comments on commit c821ffd

Please sign in to comment.