-
Notifications
You must be signed in to change notification settings - Fork 16
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
Rc add zfw calls 1.3.x #1054
Rc add zfw calls 1.3.x #1054
Conversation
61119a2
to
5b99de0
Compare
@@ -78,6 +79,28 @@ static bool is_host_only(); | |||
static void run_tunneler_loop(uv_loop_t* ziti_loop); | |||
static tunneler_context initialize_tunneler(netif_driver tun, uv_loop_t* ziti_loop); | |||
|
|||
#if __linux__ | |||
static void diverter_quit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should make these into diverter interface
char *diverter_env_path = getenv("ZFW_OBJECT_PATH"); | ||
if(diverter_env_path && strlen(diverter_env_path)){ | ||
diverter_path = diverter_env_path; | ||
sprintf(zfw_path, "%s/%s", diverter_env_path, "zfw"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use snprintf
static void diverter_update(const char *ip, uint8_t prefix_len, uint16_t lowport, uint16_t highport, const char *protocol, const char *service_id, const char *action) { | ||
int rndm; | ||
uv_random(NULL, NULL, &rndm, sizeof(rndm), 0, NULL); | ||
unsigned short random_port = 1024 + rndm % (65535 - 1023); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if port is in use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for zfw in tunnel mode it just cant be set to 0. A setting of 0 indicates that a matching packet should be passed to the OS and not to directly forwarded to the ziti0 interface. As long as it between 1 and 65535 it does not matter if it is in use. We could make it any static value between 1 and 65535 and remove the uv_random call. On ziti-router in tproxy mode it would matter that it was specific to the tproxy port configured for the service.
fea9b96
to
df94a2a
Compare
df94a2a
to
d363b83
Compare
} | ||
} | ||
} | ||
else if(svc->Permissions.Bind){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be else
? Both permissions could be set
changes from #1000 applied to main instead of release-1.x